Advertisement
Guest User

HELP NTG9 PLZ

a guest
May 29th, 2013
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 208.89 KB | None | 0 0
  1. /*1369343972,173199923*/
  2.  
  3. if (self.CavalryLogger) { CavalryLogger.start_js(["WCh3r"]); }
  4.  
  5. __d("BlackbirdUpsellConstants",[],function(a,b,c,d,e,f){e.exports={ACTION_UPSELL:"upsell",CLICK_TYPE_DISMISS_PROMO:"dismiss_promo",ACTION_EDUCATE:"educate",CLICK_TYPE_ENABLE_CHAT:"enable_chat",CLICK_TYPE_OPEN_SETTINGS:"open_settings"};});
  6. __d("GenderConst",[],function(a,b,c,d,e,f){var g={UNKNOWN:0,FEMALE_SINGULAR:1,MALE_SINGULAR:2,FEMALE_SINGULAR_GUESS:3,MALE_SINGULAR_GUESS:4,MIXED_SINGULAR:5,MIXED_PLURAL:5,NEUTER_SINGULAR:6,UNKNOWN_SINGULAR:7,FEMALE_PLURAL:8,MALE_PLURAL:9,NEUTER_PLURAL:10,UNKNOWN_PLURAL:11};e.exports=g;});
  7. __d("AsyncLoader",["copyProperties","AsyncRequest","BaseAsyncLoader"],function(a,b,c,d,e,f){var g=b('copyProperties'),h=b('AsyncRequest'),i=b('BaseAsyncLoader');function j(k,l){this._endpoint=k;this._type=l;}g(j.prototype,i.prototype);j.prototype.send=function(k,l,m,n,o){new h(k).setData({ids:l}).setHandler(n).setErrorHandler(o).setAllowCrossPageTransition(true).setMethod('GET').setReadOnly(true).send();};e.exports=j;});
  8. __d("ChatContexts",[],function(a,b,c,d,e,f){var g={};function h(k){var l=k?k.subtext:'';return l;}function i(k,l){g[k]=l;}var j={get:function(k){if(k in g){return g[k];}else return null;},update:function(k){for(var l in k)i(l,k[l]);},getShortDisplay:function(k){return h(j.get(k));}};e.exports=j;});
  9. __d("ChatFavoriteList",["AsyncRequest","arrayContains","emptyFunction"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('arrayContains'),i=b('emptyFunction'),j=false,k=[],l=[],m=false;function n(){var r=k.join(',');new g('/ajax/chat/favorite_list.php').setData({favorite_list:r}).setHandler(i).setErrorHandler(i).send();}function o(r){return r.toString();}function p(r){if(k.length!=r.length)return true;for(var s=0;s<r.length;s++)if(k[s]!==r[s].toString())return true;return false;}var q={isEditMode:function(){var r=null;d(['ChatSidebar'],function(s){r=s;});return j&&r&&r.isEnabled();},toggleEditMode:function(){j=!j;if(j)l=k.slice();},get:function(){if(j){return l.slice();}else return k.slice();},isFavored:function(r){return h(l,r.toString());},init:function(r){k=r.slice().map(o);l=k.slice();},toggleID:function(r){if(!j)return;r=r.toString();var s=l.indexOf(r);if(s>=0){l.splice(s,1);}else l.push(r);m=true;},hasChanged:function(){if(m){m=false;return true;}return false;},updateList:function(r){if(!j)return;l=r.map(o);},save:function(){if(p(l)){k=l;n();}}};e.exports=q;});
  10. __d("PresencePrivacy",["hasArrayNature","Arbiter","AsyncRequest","ChannelConstants","copyProperties","Env","JSLogger","PresenceUtil","PresencePrivacyInitialData"],function(a,b,c,d,e,f){var g=b('hasArrayNature'),h=b('Arbiter'),i=b('AsyncRequest'),j=b('ChannelConstants'),k=b('copyProperties'),l=b('Env'),m=b('JSLogger'),n=b('PresenceUtil'),o=b('PresencePrivacyInitialData'),p='/ajax/chat/privacy/settings.php',q='/ajax/chat/privacy/online_policy.php',r='/ajax/chat/privacy/visibility.php',s='friend_visibility',t='visibility',u='online_policy',v=k({},o.privacyData),w=o.visibility,x=k({},o.privacyData),y=w,z=o.onlinePolicy,aa=z,ba=[],ca=false;function da(){return m.create('blackbird');}var ea=k(new h(),{WHITELISTED:1,BLACKLISTED:-1,UNLISTED:0,ONLINE:1,OFFLINE:0,ONLINE_TO_WHITELIST:0,ONLINE_TO_BLACKLIST:1});function fa(ra){var sa;for(sa in ra){var ta=ra[sa];if(sa==l.user){da().error('set_viewer_visibility');throw new Error("Invalid to set current user's visibility");}switch(ta){case ea.WHITELISTED:case ea.BLACKLISTED:case ea.UNLISTED:break;default:da().error('set_invalid_friend_visibility',{id:sa,value:ta});throw new Error("Invalid state: "+ta);}}for(sa in ra)v[sa]=ra[sa];ea.inform('privacy-changed');}function ga(ra,sa){var ta={};ta[ra]=sa;fa(ta);}function ha(ra){switch(ra){case ea.ONLINE:case ea.OFFLINE:break;default:da().error('set_invalid_visibility',{value:ra});throw new Error("Invalid visibility: "+ra);}w=ra;ea.inform('privacy-changed');ea.inform('privacy-user-presence-changed');h.inform('chat/visibility-changed',{sender:this});}function ia(ra){switch(ra){case ea.ONLINE_TO_WHITELIST:case ea.ONLINE_TO_BLACKLIST:break;default:throw new Error("Invalid default online policy: "+ra);}z=ra;ea.inform('privacy-user-presence-changed');ea.inform('privacy-changed');}function ja(ra,sa){ca=true;ra.send();}function ka(ra,sa){ba.push({request:ra,data:sa});if(!ca){var ta=ba.shift();ja(ta.request,ta.data);}}function la(ra,sa){var ta=ra.type;if(ta===s){var ua=sa.payload.user_availabilities;if(!g(ua)){ea.inform('privacy-availability-changed',{user_availabilities:ua});for(var va in ra.settings)x[va]=ra.settings[va];}}else{if(ta===t){y=ra.visibility;}else if(ta===u)aa=ra.online_policy;ea.inform('privacy-user-presence-response');}da().log('set_update_response',{data:ra,response:sa});}function ma(ra,sa){if(w!==y)ha(y);if(z!==aa)ia(aa);k(v,x);ea.inform('privacy-changed');ba=[];da().log('set_error_response',{data:ra,response:sa});}function na(ra){ca=false;if(ba.length>0){var sa=ba.shift();ja(sa.request,sa.data);}}function oa(ra,sa){if(n!=null){var ta=ra.getData();ta.window_id=n.getSessionID();ra.setData(ta);}ra.setHandler(la.bind(this,sa)).setErrorHandler(ma.bind(this,sa)).setTransportErrorHandler(ma.bind(this,sa)).setFinallyHandler(na.bind(this)).setAllowCrossPageTransition(true);return ra;}function pa(ra,sa,ta){return oa(new i(ra).setData(sa),ta);}function qa(ra,sa){var ta=sa.obj;if(ta.viewer_id!=l.user){da().error('invalid_viewer_for_channel_message',{type:ra,data:sa});throw new Error("Viewer got from the channel is not the real viewer");}if(ta.window_id===n.getSessionID())return;var ua=ta.data;if(ta.event=='access_control_entry'){ua.target_ids.forEach(function(wa){ga(wa,ua.setting);x[wa]=ua.setting;});}else{if(ta.event=='visibility_update'){var va=!!ua.visibility?ea.ONLINE:ea.OFFLINE;ha(va);y=va;}else if(ta.event=='online_policy_update'){ia(ua.online_policy);aa=ua.online_policy;}ea.inform('privacy-user-presence-response');}da().log('channel_message_received',{data:sa.obj});}k(ea,{WHITELISTED:1,BLACKLISTED:-1,UNLISTED:0,ONLINE:1,OFFLINE:0,ONLINE_TO_WHITELIST:0,ONLINE_TO_BLACKLIST:1,init:function(ra,sa,ta){},setVisibility:function(ra){y=w;ha(ra);var sa={visibility:ra},ta={type:t,visibility:ra},ua=pa(r,sa,ta);ka(ua,ta);da().log('set_visibility',{data:sa});return ra;},getVisibility:function(){return w;},setOnlinePolicy:function(ra){aa=z;ia(ra);var sa={online_policy:ra},ta={type:u,online_policy:ra},ua=pa(q,sa,ta);ka(ua,ta);da().log('set_online_policy',{data:sa});return ra;},getOnlinePolicy:function(){return z;},getFriendVisibility:function(ra){return v[ra]||ea.UNLISTED;},allows:function(ra){if(this.getVisibility()===ea.OFFLINE)return false;var sa=this.getOnlinePolicy();return sa===ea.ONLINE_TO_WHITELIST?v[ra]==ea.WHITELISTED:v[ra]!=ea.BLACKLISTED;},setFriendsVisibility:function(ra,sa){if(ra.length>0){var ta={};for(var ua=0;ua<ra.length;ua++){var va=ra[ua];x[va]=v[va];ta[va]=sa;}fa(ta);var wa=sa;if(wa==ea.UNLISTED)wa=x[ra[0]];var xa={users:ra,setting:sa,setting_type:wa},ya={type:s,settings:ta},za=pa(p,xa,ya);ka(za,ya);da().log('set_friend_visibility',{data:xa});}return sa;},setFriendVisibilityMap:function(ra,sa){for(var ta in ra)x[ta]=v[ta];fa(ra);var ua={type:s,settings:ra};ka(oa(sa,ua),ua);da().log('set_friend_visibility_from_map',{data:ra});},allow:function(ra){if(this.allows(ra)){da().error('allow_already_allowed');throw new Error("allow() should only be called for users that "+"are not already allowed");}if(this.getVisibility()===ea.OFFLINE){da().error('allow_called_while_offline');throw new Error("allow() should only be called when the user is already online");}var sa=this.getOnlinePolicy()===ea.ONLINE_TO_WHITELIST?ea.WHITELISTED:ea.UNLISTED;return this.setFriendsVisibility([ra],sa);},disallow:function(ra){if(!this.allows(ra)){da().error('disallow_already_disallowed');throw new Error("disallow() should only be called for users that "+"are not already disallowed");}if(this.getVisibility()===ea.OFFLINE){da().error('disallow_called_while_offline');throw new Error("disallow() should only be called when the user is already online");}var sa=this.getOnlinePolicy()===ea.ONLINE_TO_BLACKLIST?ea.BLACKLISTED:ea.UNLISTED;return this.setFriendsVisibility([ra],sa);},getBlacklist:function(){var ra=[];for(var sa in v)if(v[sa]===ea.BLACKLISTED)ra.push(sa);return ra;},getWhitelist:function(){var ra=[];for(var sa in v)if(v[sa]===ea.WHITELISTED)ra.push(sa);return ra;},getMapForTest:function(){return v;},setMapForTest:function(ra){v=ra;}});ea.inform('privacy-changed');ea.inform('privacy-user-presence-changed');da().log('initialized',{visibility:w,policy:z});h.subscribe(j.getArbiterType('privacy_changed'),qa.bind(this));h.subscribe(j.ON_CONFIG,function(ra,sa){var ta=sa.getConfig('visibility',null);if(ta!==null&&typeof(ta)!=='undefined'){var ua=ta?ea.ONLINE:ea.OFFLINE;ha(ua);da().log('config_visibility',{vis:ua});}}.bind(this));a.PresencePrivacy=e.exports=ea;},3);
  11. __d("ChatVisibility",["Arbiter","JSLogger","PresencePrivacy"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('JSLogger'),i=b('PresencePrivacy'),j={isOnline:function(){return i.getVisibility()===i.ONLINE;},hasBlackbirdEnabled:function(){return this.isVisibleToMostFriends()||this.isVisibleToSomeFriends();},isVisibleToMostFriends:function(){return i.getOnlinePolicy()===i.ONLINE_TO_BLACKLIST&&i.getBlacklist().length>0;},isVisibleToSomeFriends:function(){return i.getOnlinePolicy()===i.ONLINE_TO_WHITELIST&&i.getWhitelist().length>0;},goOnline:function(k){if(i.getVisibility()===i.OFFLINE){h.create('blackbird').log('chat_go_online');i.setVisibility(i.ONLINE);g.inform('chat-visibility/go-online');}k&&k();},goOffline:function(k){if(i.getVisibility()===i.ONLINE){h.create('blackbird').log('chat_go_offline');i.setVisibility(i.OFFLINE);g.inform('chat-visibility/go-offline');}k&&k();},toggleVisibility:function(){if(j.isOnline()){j.goOffline();}else j.goOnline();}};a.ChatVisibility=e.exports=j;},3);
  12. __d("LastMobileActiveTimes",["tx"],function(a,b,c,d,e,f){var g=b('tx'),h=0,i={};function j(n){if(!h||!n)return '';var o=h-n,p=Math.floor(o/60),q=Math.floor(p/60),r=Math.floor(q/24);if(p<=1){return g._("{count}m",{count:1});}else if(p<60){return g._("{count}m",{count:p});}else if(q<24){return g._("{count}h",{count:q});}else if(r<3){return g._("{count}d",{count:r});}else return '';}function k(n,o){i[n]=o;}function l(n){if(n in i){return i[n];}else return 0;}var m={update:function(n,o){h=o/1000;for(var p in n)k(p,n[p]);},getShortDisplay:function(n){return j(l(n));}};e.exports=m;});
  13. __d("ServerTime",["PresenceInitialData"],function(a,b,c,d,e,f){var g=b('PresenceInitialData'),h;function i(k){h=Date.now()-k;}i(g.serverTime);var j={get:function(){return Date.now()-h;},getSkew:function(){return h;},update:function(k){i(k);}};e.exports=j;});
  14. __d("PresenceStatus",["AvailableListConstants","ChatConfig","ChatVisibility","Env","PresencePrivacy","ServerTime","createObjectFrom"],function(a,b,c,d,e,f){var g=b('AvailableListConstants'),h=b('ChatConfig'),i=b('ChatVisibility'),j=b('Env'),k=b('PresencePrivacy'),l=b('ServerTime'),m=b('createObjectFrom'),n={},o={},p={},q={},r={resetPresenceData:function(){n={};q={};p={};},reset:function(){r.resetPresenceData();o={};},get:function(s){if(s==j.user)return i.isOnline()?g.ACTIVE:g.OFFLINE;var t=g.OFFLINE;if(s in n)t=n[s];if(!k.allows(s))t=g.OFFLINE;if(t==g.OFFLINE)if(o[s])t=g.MOBILE;return t;},getGroup:function(s){if(!h.get('chat_group_presence',0))return g.OFFLINE;return s.some(function(t){if(t==j.user)return false;return (r.get(t)===g.ACTIVE);})?g.ACTIVE:g.OFFLINE;},set:function(s,t,u,v){if(s==j.user)return false;switch(t){case g.OFFLINE:case g.IDLE:case g.ACTIVE:case g.MOBILE:break;default:return false;}var w=r.get(s)!=t;if(u){p[s]=l.get();q[s]=v;}n[s]=t;return w;},setMobileFriends:function(s){o=m(s);},getOnlineIDs:function(){var s,t=[];for(s in n)if(r.get(s)===g.ACTIVE)t.push(s);return t;},getAvailableIDs:function(){var s=r.getOnlineIDs(),t;for(t in o){if(n[t])continue;s.push(t);}return s;},getOnlineCount:function(){return r.getOnlineIDs().length;},getDebugInfo:function(s){return {id:s,presence:n[s],overlaySource:q[s],overlayTime:p[s],mobile:o[s]};}};e.exports=r;});
  15. __d("AvailableList",["function-extensions","Arbiter","ArbiterMixin","AsyncRequest","AvailableListConstants","ChannelConstants","ChatConfig","ChatContexts","ChatFavoriteList","ChatVisibility","Env","JSLogger","LastMobileActiveTimes","Poller","PresencePrivacy","PresenceStatus","PresenceUtil","ServerTime","ShortProfiles","UserActivity","copyProperties","debounceAcrossTransitions","emptyFunction","ChannelImplementation","AvailableListInitialData"],function(a,b,c,d,e,f){b('function-extensions');var g=b('Arbiter'),h=b('ArbiterMixin'),i=b('AsyncRequest'),j=b('AvailableListConstants'),k=b('ChannelConstants'),l=b('ChatConfig'),m=b('ChatContexts'),n=b('ChatFavoriteList'),o=b('ChatVisibility'),p=b('Env'),q=b('JSLogger'),r=b('LastMobileActiveTimes'),s=b('Poller'),t=b('PresencePrivacy'),u=b('PresenceStatus'),v=b('PresenceUtil'),w=b('ServerTime'),x=b('ShortProfiles'),y=b('UserActivity'),z=b('copyProperties'),aa=b('debounceAcrossTransitions'),ba=b('emptyFunction'),ca=c('ChannelImplementation').instance,da=c('AvailableListInitialData'),ea=5,fa='/ajax/chat/buddy_list.php',ga=5000,ha=1800000,ia=0,ja=0,ka=false,la=da.pollInterval,ma=da.lazyPollInterval,na=da.lazyThreshold,oa=0,pa=Date.now(),qa=0,ra=false,sa=false,ta=null,ua=l.get('buddy_list_double_fetch',0),va=q.create('available_list'),wa=z({},j,h);wa.subscribe([j.ON_AVAILABILITY_CHANGED,j.ON_UPDATE_ERROR,j.ON_UPDATED],function(pb,qb){g.inform(pb,qb);});function xa(pb){var qb=pb||y.isActive(na);return o.isOnline()?(qb?la:ma):null;}function ya(){wa.inform(j.ON_AVAILABILITY_CHANGED);}var za=aa(ya,0);function ab(pb,qb,rb,sb){var tb=u.set(pb,qb,rb,sb);if(tb){ia++;za();}}function bb(pb){qa=Date.now();u.setMobileFriends(pb);ia++;za();}function cb(){if(ra)wa.inform(j.ON_UPDATED,wa);}function db(pb){if(v.checkMaintenanceError(pb))return;ja++;ka=false;if(ja>=ea)wa.inform(j.ON_UPDATE_ERROR);}function eb(pb){var qb=pb.getPayload(),rb=qb.buddy_list;if(!rb){db(pb);return;}w.update(qb.time);oa=w.get();ja=0;ka=false;if(rb.mobile_friends!=null)bb(rb.mobile_friends);var sb=rb.userInfos;if(sb)x.setMulti(sb);kb();sa=rb.userIsIdle;var tb=rb.nowAvailableList;tb&&ib(tb);var ub=rb.last_active_times;ub&&r.update(ub,qb.time);var vb=rb.chatContexts;vb&&m.update(vb);if(rb.chatNotif!==undefined){ta=rb.chatNotif;wa.inform(j.ON_CHAT_NOTIFICATION_CHANGED,ta);}jb();cb();za();}function fb(pb){if(ca.isShutdown()||!o.isOnline()){wa._poller.stop();return;}pa=Date.now();var qb=false;if(Date.now()-qa>ha)qb=true;ka=true;var rb=x.getCachedProfileIDs().join(",");pb.setHandler(eb).setErrorHandler(db).setOption('suppressErrorAlerts',true).setOption('retries',1).setData({user:p.user,cached_user_info_ids:rb,fetch_mobile:qb}).setURI(fa).setAllowCrossPageTransition(true);}function gb(pb){var qb=pb.payload.availability||{};for(var rb in qb)ab(rb,qb[rb],true,'mercury_tabs');}function hb(pb){var qb=wa.getDebugInfo(pb),rb=(qb.presence==j.ACTIVE),sb=new i('/ajax/mercury/tabs_presence.php').setData({target_id:pb,to_online:rb,presence_source:qb.overlaySource,presence_time:qb.overlayTime}).setHandler(gb).setErrorHandler(ba).setAllowCrossPageTransition(true).send();}function ib(pb){for(var qb in pb)ab(qb,pb[qb].a,false,null);ra=true;}function jb(pb){var qb=xa(pb);va.debug('update_poller',qb);var rb=wa._poller;if(rb)if(!ua||(rb.getInterval()!=qb))rb.setInterval(qb);}function kb(){ra=false;u.resetPresenceData();ia++;}function lb(){u.reset();pa=0;qa=0;sa=false;ta=null;ya();}function mb(){jb();if(ca.disconnected()){lb();}else if(!ra)wa.update();}function nb(pb,qb){qb.chat_config=l.getDebugInfo();qb.available_list_debug_info={};wa.getAvailableIDs().forEach(function(rb){qb.available_list_debug_info[rb]=wa.getDebugInfo(rb);});qb.available_list_poll_interval=wa._poller&&wa._poller.getInterval();}z(wa,{get:function(pb){return u.get(pb);},updateForID:function(pb){hb(pb);},getWebChatNotification:function(){return ta;},isUserIdle:function(){return sa;},isReady:function(){return ra;},set:function(pb,qb,rb){ab(pb,qb,true,rb);},update:function(){if(Date.now()-pa<ga){!ka&&cb.defer();return;}var pb=wa._poller;if(pb)if(!ua||!pb.isPolling())pb.request();},getRev:function(){return ia;},isIdle:function(pb){return wa.get(pb)==j.IDLE;},getOnlineIDs:function(){return u.getOnlineIDs();},getAvailableIDs:function(){return u.getAvailableIDs();},getOnlineCount:function(){return u.getOnlineCount();},getDebugInfo:function(pb){var qb=u.getDebugInfo(pb),rb=x.getNow(pb);if(rb)qb.name=rb.name;return qb;}});oa=da.updateTime;ib(da.availableList);if(da.mobileFriends)bb(da.mobileFriends);if(da.lastActiveTimes)r.update(da.lastActiveTimes,oa);if(da.favoriteList)n.init(da.favoriteList);ta=da.chatNotif;var ob=ua?true:false;wa._poller=new s({interval:xa(ob),setupRequest:fb,clearOnQuicklingEvents:false,dontStart:true});wa._poller.start.bind(wa._poller).defer();if(!ua)jb(true);g.subscribe(q.DUMP_EVENT,nb);g.subscribe(k.getArbiterType('favorite_list'),function(pb,qb){var rb=qb.obj,sb=rb.value?rb.value.split(','):[];n.init(sb);za();});y.subscribe(function(pb,qb){if(qb.idleness>la){va.debug('update_activity');wa.update();}});t.subscribe('privacy-changed',ya);t.subscribe('privacy-availability-changed',function(pb,qb){for(var rb in qb.user_availabilities)this.set(rb,qb.user_availabilities[rb]);}.bind(wa));t.subscribe('privacy-user-presence-response',wa.update);ca.subscribe([ca.CONNECTED,ca.RECONNECTING,ca.SHUTDOWN,ca.MUTE_WARNING,ca.UNMUTE_WARNING],mb);g.subscribe(k.getArbiterType('buddylist_overlay'),function(pb,qb){var rb=qb.obj.overlay;for(var sb in rb)wa.set(sb,rb[sb].a,rb[sb].s||'channel');});a.AvailableList=e.exports=wa;});
  16. __d("BlackbirdUpsell",["Event","Arbiter","AsyncRequest","LegacyContextualDialog","DOM","LayerDestroyOnHide","LayerHideOnTransition","PresencePrivacy","copyProperties","BlackbirdUpsellConfig","BlackbirdUpsellConstants","BlackbirdUpsellTemplates"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('AsyncRequest'),j=b('LegacyContextualDialog'),k=b('DOM'),l=b('LayerDestroyOnHide'),m=b('LayerHideOnTransition'),n=b('PresencePrivacy'),o=b('copyProperties'),p=b('BlackbirdUpsellConfig'),q=b('BlackbirdUpsellConstants'),r=b('BlackbirdUpsellTemplates'),s='/ajax/chat/blackbird/update_clicks.php',t='/ajax/chat/blackbird/update_impressions.php',u='/ajax/chat/blackbird/dismiss.php',v=235,w=null,x=null,y=false,z=false;function aa(){}o(aa,{shouldShow:function(){if(this._dialogDismissed)return false;if(this.isEducation()){return !!p.EducationGK&&!p.EducationDismissed&&p.EducationImpressions<p.EducationImpressionLimit;}else return !!p.UpsellGK&&!p.UpsellDismissed&&p.UpsellImpressions<p.UpsellImpressionLimit&&p.FriendCount>=p.UpsellMinFriendCount;},isEducation:function(){return p.TimeOffline<=p.EducationTimeOfflineThresdhold;},getOfflineContent:function(){if(this.isEducation()){return this._getEducationContent();}else return this._getUpsellContent();},_getEducationContent:function(){ga();var ka=r[':fb:chat:blackbird:offline-educate'].build(),la=ka.getNode('chatSettingsButton');g.listen(la,'click',function(){h.inform('chat/advanced-settings-dialog-opened');ja(q.CLICK_TYPE_OPEN_SETTINGS);da();});return ka.getRoot();},_getUpsellContent:function(){fa();var ka=r[':fb:chat:blackbird:upsell'].build(),la=ka.getNode('chatSettingsButton');g.listen(la,'click',function(){h.inform('chat/advanced-settings-dialog-opened');ia(q.CLICK_TYPE_OPEN_SETTINGS);ca();});var ma=ka.getNode('enableChatButton');g.listen(ma,'click',function(){ia(q.CLICK_TYPE_ENABLE_CHAT);ca();});return ka.getRoot();},getBlackbirdContent:function(ka){ga();switch(ka){case n.ONLINE:return r[':fb:chat:blackbird:most-friends-educate'].build().getRoot();case n.OFFLINE:return r[':fb:chat:blackbird:some-friends-educate'].build().getRoot();}},showOfflineDialog:function(ka){this.showDialog(ka,this.getOfflineContent.bind(this));},showBlackbirdDialog:function(ka,la){this.showDialog(ka,this.getBlackbirdContent.curry(la));},showDialog:function(ka,la){!w&&this._constructDialog();k.setContent(x,la());w.setContext(ka);w.show();},hide:function(){if(w&&w.isShown())w.hide();},dismiss:function(){this.hide();if(this.isEducation()){da();}else ca();},registerDismissClick:function(){if(this.isEducation()){ja(q.CLICK_TYPE_DISMISS_PROMO);}else ia(q.CLICK_TYPE_DISMISS_PROMO);},isVisible:function(){return z&&!y;},_constructDialog:function(){var ka=r[':fb:chat:blackbird:dialog-frame'].build();x=ka.getNode('dialogContent');w=new j();w.init(ka.getRoot());w.setPosition('above').setWidth(v).setFixed(true).disableBehavior(l).disableBehavior(m);g.listen(ka.getNode('dialogCloseButton'),'click',this.dismiss.bind(this));g.listen(ka.getNode('dialogCloseButton'),'click',this.registerDismissClick.bind(this));}});function ba(ka,la){if(!y&&z){y=true;n.inform('privacy-user-presence-changed');var ma=new i(u);ma.setData({source:ka,impressions:la,time_offline:p.TimeOffline});ma.setErrorHandler(function(){y=false;});ma.send();}}function ca(){ba(q.ACTION_UPSELL,p.UpsellImpressions);}function da(){ba(q.ACTION_EDUCATE,p.EducationImpressions);}function ea(ka,la){if(!z){z=true;var ma=new i(t);ma.setData({action:ka,impressions:la,time_offline:p.TimeOffline});ma.setErrorHandler(function(){z=false;});ma.send();}}function fa(){ea(q.ACTION_UPSELL,p.UpsellImpressions);}function ga(){ea(q.ACTION_EDUCATE,p.EducationImpressions);}function ha(ka,la,ma,na){var oa=new i(s);oa.setData({action:ka,impressions:ma,source:la,time_offline:na});oa.send();}function ia(ka){ha(ka,q.ACTION_UPSELL,p.UpsellImpressions,p.TimeOffline);}function ja(ka){ha(ka,q.ACTION_EDUCATE,p.EducateImpressions,p.TimeOffline);}h.subscribe('chat/advanced-settings-dialog-opened',aa.dismiss.bind(aa));h.subscribe('chat-visibility/go-online',aa.dismiss.bind(aa));h.subscribe('chat-visibility/go-offline',aa.dismiss.bind(aa));e.exports=aa;});
  17. __d("ChatImpressionLogger",["AvailableList","AsyncSignal","ChatConfig","ChatVisibility","Poller"],function(a,b,c,d,e,f){var g=b('AvailableList'),h=b('AsyncSignal'),i=b('ChatConfig'),j=b('ChatVisibility'),k=b('Poller'),l=null,m=null,n={init:function(o){l=o;var p=i.get('chat_impression_logging_periodical',0);if(p){var q=i.get('periodical_impression_logging_config.interval');m=new k({interval:q,setupRequest:this.logImps.bind(this),clearOnQuicklingEvents:false});}this.init=function(){};},logImps:function(o){if(!j.isOnline())return;var p={source:'periodical_imps'},q=l.getCachedSortedList(),r=[];for(var s=0;s<q.length;s++)r[s]=g.get(q[s]);p.sorted_list=q.toString();p.list_availability=r.toString();o.setURI('/ajax/chat/imps_logging.php').setData(p);},getOrderedList:function(){return l;},logImpressions:function(o){var p=[],q=[];if(i.get('chat_impression_logging_with_click')){p=l.getCachedSortedList();for(var r=0;r<p.length;r++)q[r]=g.get(p[r]);}o.sorted_list=p.toString();o.list_availability=q.toString();new h('/ajax/chat/ct.php',o).send();}};e.exports=n;});
  18. __d("ChatTypeaheadConstants",[],function(a,b,c,d,e,f){var g={USER_TYPE:'user',THREAD_TYPE:'thread',FRIEND_TYPE:'friend',NON_FRIEND_TYPE:'non_friend',HEADER_TYPE:'header'};e.exports=g;});
  19. __d("Chat",["Arbiter","AvailableList","ChatImpressionLogger","ChatTypeaheadConstants","MercuryParticipantTypes"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('AvailableList'),i=b('ChatImpressionLogger'),j=b('ChatTypeaheadConstants'),k=b('MercuryParticipantTypes');function l(q,r){var s=r&&r.source;if(s&&s==='ordered_list'||s==='more_online_friends'||s==='online_friends'||s==='recent_threads_in_divebar_new'||s==='recent_threads_in_divebar'||s==='presence'||s==='typeahead'){r.viewport_width=document.body.clientWidth;r.target=q;r.target_presence=h.get(q);i.logImpressions(r);}}var m={buddyListNub:'buddylist-nub/initialized',sidebar:'sidebar/initialized'};function n(q,r){g.subscribe(m[q],function(event,s){r(s);});}function o(){return (Math.random()*2147483648|0).toString(16);}var p={openTab:function(q,r,s){if(window.External&&window.External.Chat&&window.External.Chat.openWindow)window.External.Chat.openWindow(q);l.curry(q,s).defer();d(['MercuryThreads'],function(t){if(!r||r===k.FRIEND||r===j.FRIEND_TYPE||r===j.USER_TYPE){var u=t.get().getCanonicalThreadToUser(q),v=o();g.inform('chat/open-tab',{thread_id:u.thread_id,signature_id:v});return;}if(r===j.THREAD_TYPE)d(['ChatOpenTab'],function(w){if(q){w.openThread(q);}else w.openEmptyTab();});});},openBuddyList:function(){n('buddyListNub',function(q){q.show();n('sidebar',function(r){r.enable();});});},closeBuddyList:function(){n('buddyListNub',function(q){q.hide();});},toggleSidebar:function(){n('sidebar',function(q){q.toggle();});},goOnline:function(q){d(['ChatVisibility'],function(r){r.goOnline(q);});},isOnline:function(){var q=null;d(['ChatVisibility'],function(r){q=r;});return q&&q.isOnline();}};a.Chat=e.exports=p;},3);
  20. __d("ChatFavoriteNux",["AsyncRequest"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=null,i=false,j={tryShow:function(k){if(h&&!i){h.setContext(k);h.show();i=true;}},tryHide:function(){if(h&&i){h.hide();h=null;}},registerDialog:function(k){h=k;if(k)k.subscribe('confirm',this.dismissDialog);},dismissDialog:function(){if(h){new g('/ajax/chat/dismiss_favorite_nux.php').send();h.hide();h=null;}}};e.exports=j;});
  21. __d("ChatGroupThreadsController",["ArbiterMixin","ChatConfig","InitialMultichatList","MercuryServerRequests","copyProperties"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('ChatConfig'),i=b('InitialMultichatList'),j=b('MercuryServerRequests').get(),k=b('copyProperties'),l=[],m=h.get('max_sidebar_multichats'),n=i.payload;if(n){j.handleUpdate(n);var o=n.threads||[];l=o.map(function(q){return q.thread_id;});}var p={};k(p,g,{getThreadIDs:function(){return l.filter(function(q,r){return q&&r<m;});}});e.exports=p;});
  22. __d("ChatHovercard",["Arbiter","AsyncLoader","Hovercard","JSLogger","debounce"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('AsyncLoader'),i=b('Hovercard'),j=b('JSLogger'),k=b('debounce'),l=5,m=new h('/ajax/chat/hovercard/sidebar.php','hover'),n=j.create('chat_hovercard');g.subscribe('Hovercard/dirty',m.reset.bind(m));function o(s,t){m.get(s,function(u){(function(){if(!u){n.error('fetch_failure',{id:s});return;}var v=i.getDialog(u);if(!v){n.error('no_hovercard',{id:s,endpoint:u});return;}if(s==t.getActiveID())t.showHovercard(s,v);}).defer();});}function p(s,t){var u=[];function v(y){if(y>=0&&y<s.length)u.push(s[y]);}var w=s.indexOf(t);if(w>-1){v(w);for(var x=1;x<l;x++){v(w+x);v(w-x);}}return u.filter(function(y){return y;});}function q(s,t){var u=t.getActiveID();if(u){var v=s.getShowingUsers(),w=p(v,u);m.get(w,function(){});}}function r(s){var t=s.getHoverController();t.registerDefault(o);t.subscribe('hover',k(q.curry(s,t),100));}e.exports=r;});
  23. __d("ChatOpenTab",["Arbiter","Bootloader","Event","MercuryIDs","MercuryMessages","MercuryServerRequests","MercuryThreads"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Bootloader'),i=b('Event'),j=b('MercuryIDs'),k=b('MercuryMessages').get(),l=b('MercuryServerRequests').get(),m=b('MercuryThreads').get();function n(q){m.getThreadMeta(q,function(){g.inform('chat/open-tab',{thread_id:q});});}function o(q,r,s){i.listen(q,'click',function(t){if(s(r))return;return t.kill();});}var p={openEmptyTab:function(){if(!window.Chat)return true;h.loadModules(['ChatTabModel'],function(q){var r=q.getEmptyTab();if(!r){r='root:'+k.generateNewClientMessageID(Date.now());m.createNewLocalThread(r,[]);}n(r);});},listenOpenEmptyTab:function(q){o(q,null,p.openEmptyTab);},openThread:function(q){if(j.isValid(q)){n(q);}else l.getClientThreadID(q,n);},listenOpenThread:function(q,r){o(q,r,p.openThread);},openUserTab:function(q){var r=m.getCanonicalThreadToUser(q);n(r.thread_id);},listenOpenUserTab:function(q,r){o(q,r,p.openUserTab);}};e.exports=p;});
  24. __d("ChatOptions",["Arbiter","ChannelConstants","JSLogger","PresenceUtil","copyProperties","ChatOptionsInitialData"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('ChannelConstants'),i=b('JSLogger'),j=b('PresenceUtil'),k=b('copyProperties'),l=i.create('chat_options'),m={};(function(){var o=b('ChatOptionsInitialData');for(var p in o){var q=o[p];m[p]=!!q;}})();var n=k(new g(),{getSetting:function(o){return m[o];},setSetting:function(o,p,q){if(this.getSetting(o)==p)return;if(q){q='from_'+q;l.log(q,{name:o,new_value:p,old_value:this.getSetting(o)});}m[o]=!!p;g.inform('chat/option-changed',{name:o,value:p});}});g.subscribe(h.getArbiterType('setting'),function(o,p){var q=p.obj;if(q.window_id===j.getSessionID())return;n.setSetting(q.setting,!!q.value,'channel');});g.subscribe(i.DUMP_EVENT,function(o,p){p.chat_options=m;});e.exports=n;});
  25. __d("ChatOrderedListHover",["function-extensions","ArbiterMixin","ChatFavoriteList","CSS","ErrorUtils","Event","LayerFadeOnHide","LayerHideOnBlur","Parent","copyProperties","cx","setTimeoutAcrossTransitions","shield"],function(a,b,c,d,e,f){b('function-extensions');var g=b('ArbiterMixin'),h=b('ChatFavoriteList'),i=b('CSS'),j=b('ErrorUtils'),k=b('Event'),l=b('LayerFadeOnHide'),m=b('LayerHideOnBlur'),n=b('Parent'),o=b('copyProperties'),p=b('cx'),q=b('setTimeoutAcrossTransitions'),r=b('shield');function s(v){i.addClass(v,'fetching');}function t(v){i.removeClass(v,'fetching');}function u(v){this._orderedList=v;this._root=v.getRoot();k.listen(this._root,'mouseover',this._mouseOver.bind(this));k.listen(this._root,'mouseleave',this._mouseLeave.bind(this));v.subscribe('click',r(this._hide,this));}o(u.prototype,g,{_root:null,_activeItem:null,_hideTimeout:null,_showTimeout:null,_showingDialog:null,_showingID:null,_alreadyShowing:false,_handlers:{},_defaultHandler:null,_mouseOver:function(event){if(this._paused)return;var v=event.getTarget(),w=n.byClass(v,"_42fz");w&&this._setActiveItem(w);},_mouseLeave:function(event){this._setActiveItem(null);},_clearTimeouts:function(){this._showTimeout&&clearTimeout(this._showTimeout);this._showTimeout=null;this._hideTimeout&&clearTimeout(this._hideTimeout);this._hideTimeout=null;},_checkAlreadyShowing:function(){var v=this.getActiveID();if(!v&&!this._showingID)this._alreadyShowing=false;},_hide:function(){if(this._showingDialog){this._showingDialog.enableBehavior(l);this._showingDialog.hide();this._showingDialog=null;this._showingID=null;}this._checkAlreadyShowing();},_show:function(){this._alreadyShowing=true;var v=this.getActiveID(),w=false;if(this._handlers[v]){w=true;j.applyWithGuard(this._handlers[v],{},[v,this]);}else if(this._defaultHandler){w=true;j.applyWithGuard(this._defaultHandler,{},[v,this]);}if(w&&this._showingID!=this.getActiveID())s(this._activeItem);},_setActiveItem:function(v){if(h.isEditMode()){this._clearTimeouts();this._hide();return;}if(v!=this._activeItem){this._clearTimeouts();this._activeItem&&t(this._activeItem);this._activeItem=null;var w=v?0:100;this._hideTimeout=q(function(){if(this.getActiveID()!=this._showingID)this._hide();}.bind(this),w);if(v){var x=this._orderedList.getUserForNode(v);this._activeItem=v;var y=w+(this._alreadyShowing?75:500);this._showTimeout=q(function(){this._show();}.bind(this),y);this.inform('hover',x);}else this.inform('leave');this._checkAlreadyShowing();}},register:function(v,w){if(!this._handlers[v]){this._handlers[v]=w;return {unregister:function(){if(v==this._showingID)this._hide();delete this._handlers[v];var x=this._orderedList.getAllNodes(),y=x[v];y&&t(y);}.bind(this)};}},registerDefault:function(v){this._defaultHandler=v;},getActiveID:function(){var v=this._activeItem&&this._orderedList.getUserForNode(this._activeItem);return v||null;},showHovercard:function(v,w){if(v==this.getActiveID()&&v!=this._showingID){this._clearTimeouts();t(this._activeItem);this._hide();this._showingDialog=w;this._showingID=v;var x=w.subscribe('mouseenter',this._setActiveItem.bind(this,this._activeItem)),y=w.subscribe('mouseleave',function(){x.unsubscribe();this._setActiveItem(null);}.bind(this)),z=w.subscribe('hide',function(){this.inform('hovercard_hide');x.unsubscribe();y.unsubscribe();z.unsubscribe();}.bind(this));w.enableBehavior(m).setContext(this._activeItem).setPosition('left').show();this.inform('hovercard_show');}},setPaused:function(v){this._paused=v;}});e.exports=u;});
  26. __d("ChatQuietLinks",["Event","DOM","UserAgent","DataStore","Parent"],function(a,b,c,d,e,f){var g=b('Event'),h=b('DOM'),i=b('UserAgent'),j=b('DataStore'),k=b('Parent'),l={},m={silenceLinks:function(q){n(q,this.removeEmptyHrefs.bind(this));},nukeLinks:function(q){n(q,this.removeAllHrefs.bind(this));},removeEmptyHrefs:function(q){o(q,function(r){return !r||r==='#';});},removeAllHrefs:function(q){o(q);},removeMessagesHrefs:function(q){o(q,function(r){return !r||r==='#'||r.indexOf('/messages/')!=-1;});}};function n(q,r){var s=!!i.chrome(),t=!!i.chrome()||i.ie()>=9||i.firefox()>=4;if(l[h.getID(q)])return;l[h.getID(q)]=true;if(!t)return;if(!s){r&&r(q);return;}g.listen(q,'mouseover',function u(v){var w=k.byTag(v.getTarget(),'a');if(w){var x=w.getAttribute('href');if(p(x)){j.set(w,'stashedHref',w.getAttribute('href'));w.removeAttribute('href');}}});g.listen(q,'mouseout',function u(v){var w=k.byTag(v.getTarget(),'a'),x=w&&j.remove(w,'stashedHref');if(p(x))w.setAttribute('href',x);});g.listen(q,'mousedown',function(u){if(!u.isDefaultRequested())return true;var v=k.byTag(u.getTarget(),'a'),w=v&&j.get(v,'stashedHref');if(p(w))v.setAttribute('href',w);});}function o(q,r){var s=h.scry(q,'a');if(r)s=s.filter(function(t){return r(t.getAttribute('href'));});s.forEach(function(t){t.removeAttribute('href');t.setAttribute('tabindex',0);});}function p(q){return q&&q!=='#';}e.exports=m;});
  27. __d("ChatSidebarConstants",[],function(a,b,c,d,e,f){var g={LITESTAND_IMAGE_SIZE:24,IMAGE_SIZE:28};e.exports=g;});
  28. __d("ChatSidebarItem.react",["ReactDOM","AvailableListConstants","ChatConfig","ChatFavoriteList","ChatSidebarConstants","Image.react","Link.react","React","SplitImage.react","cx","ix"],function(a,b,c,d,e,f){var g=b('ReactDOM'),h=b('AvailableListConstants'),i=b('ChatConfig'),j=b('ChatFavoriteList'),k=b('ChatSidebarConstants'),l=b('Image.react'),m=b('Link.react'),n=b('React'),o=b('SplitImage.react'),p=b('cx'),q=b('ix'),r=n.createClass({displayName:'ChatSidebarItem',render:function(){var s=(("_55ln")+(this.props.context?' '+"_55lo":''));return (m({className:s,href:this.props.href,onClick:this.props.onClick,rel:"ignore"},g.div({className:"_55lp"},[this.renderFavorite(),g.div({className:"_56p9"},[this.renderImage(),g.div({className:"_568w"},null)]),this.renderStatus(),g.div({className:"_55lr"},this.props.name),g.div({className:"_55ls"},this.props.context)])));},renderFavorite:function(){if(this.props.isAdded===undefined)return null;var s=null;if(this.props.litestandSidebar){s=this.props.isAdded?q('/images/litestand/bookmarks/sidebar/remove.png'):q('/images/litestand/bookmarks/sidebar/add.png');}else s=this.props.isAdded?q('/images/chat/delete.png'):q('/images/chat/add.png');var t=(("_568x")+(!this.props.showEditButton?' '+"hidden_elem":''));return (g.div({className:t,onClick:this.props.onEditClick},l({className:"_568y",src:s},null)));},renderImage:function(){var s=this.props.imageSize||k.IMAGE_SIZE;return o({size:s,srcs:this.props.images},null);},renderStatus:function(){var s=this.getStatusSrc();if(!s)return null;var t=i.get('divebar_favorite_list',0)&&j.isEditMode(),u=(("_568z")+(t?' '+"hidden_elem":''));return (g.div({className:u},[g.div({className:"_568-"},this.props.statusTime),l({className:"_568_",src:s},null)]));},getStatusSrc:function(){switch(this.props.status){case h.ACTIVE:case h.IDLE:return this.props.litestandSidebar?q('/images/litestand/sidebar/online.png'):q('/images/chat/status/online.png');case h.MOBILE:return this.props.litestandSidebar?q('/images/litestand/sidebar/pushable.png'):q('/images/chat/status/mobile.png');}return null;}});e.exports=r;});
  29. __d("ChatSidebarThread.react",["ReactDOM","ChatSidebarItem.react","WebMessengerPermalinkConstants","React","MercuryThreadMetadataRawRenderer"],function(a,b,c,d,e,f){var g=b('ChatSidebarItem.react'),h=b('WebMessengerPermalinkConstants'),i=b('React'),j=b('MercuryThreadMetadataRawRenderer'),k=i.createClass({displayName:'ChatSidebarThread',render:function(){var n=this.props.name,o=l(this.props.threadID,this.props.participants),p=n?o:undefined,q=h.getURIPathForThreadID(this.props.threadID),r=m(this.props.image,this.props.participants),s=n?n:o;return (g({context:p,href:{url:q},imageSize:this.props.imageSize,images:r,litestandSidebar:this.props.litestandSidebar,name:s,status:this.props.status},null));}});function l(n,o){return j.renderRawParticipantList(n,o,o.length,{names_renderer:j.renderShortNames});}function m(n,o){if(n)return n;return o.map(function(p){return p.image_src;});}e.exports=k;});
  30. __d("ChatSidebarThreadlist.react",["ReactDOM","ChatConfig","ChatGroupThreadsController","ChatSidebarConstants","ChatSidebarItem.react","ChatSidebarThread.react","MercuryThreads","MercuryParticipants","PresenceStatus","React","copyProperties","cx","fbt","ix"],function(a,b,c,d,e,f){var g=b('ReactDOM'),h=b('ChatConfig'),i=b('ChatGroupThreadsController'),j=b('ChatSidebarConstants'),k=b('ChatSidebarItem.react'),l=b('ChatSidebarThread.react'),m=b('MercuryThreads').get(),n=b('MercuryParticipants'),o=b('PresenceStatus'),p=b('React'),q=b('copyProperties'),r=b('cx'),s=b('fbt'),t=b('ix'),u=p.createClass({displayName:'ChatSidebarThreadlist',render:function(){var v=this.state.threadData,w=this.state.participantData,x=this.props.litestandSidebar?j.LITESTAND_IMAGE_SIZE:j.IMAGE_SIZE,y=this.props.litestandSidebar?t('/images/chat/sidebar/newGroupChatLitestand.png'):t('/images/chat/sidebar/newGroupChat.png'),z="New Group Chat...";z=h.get('divebar_group_new_button_name',z);var aa=[];if(this.props.showNewGroupsButton)aa.push(g.li({className:(("_56yg")+(' '+"_56yj")+(this.props.offlineItems?' '+"_570-":''))},k({images:y,name:z,imageSize:x},null)));for(var ba in v){var ca=v[ba],da=ca.participants.map(function(fa){return (w||{})[fa];}).filter(function(fa){return fa;}),ea=ca.participants.map(function(fa){return n.getUserID(fa);});if(da.length)aa.push(g.li({className:(("_56yg")+(this.props.offlineItems?' '+"_570-":'')),'data-threadid':ba},l({image:ca.image_src,imageSize:x,litestandSidebar:this.props.litestandSidebar,name:ca.name,participants:da,status:o.getGroup(ea),threadID:ba},null)));}return g.ul(null,aa);},getInitialState:function(){return {};},componentWillMount:function(){var v=function(){this.setState(this._calculateState());}.bind(this);this.token=i.subscribe('update',v);v();},componentWillUnmount:function(){this.token&&this.token.unsubscribe();this.token=null;},_calculateState:function(){var v=false,w={},x={},y=i.getThreadIDs(),z=y.length;y.forEach(function(ba){m.getThreadMeta(ba,function(ca){x[ba]=ca;n.getMulti(ca.participants,function(da){delete da[n.user];if(v){this.setState(this._calculateState());}else q(w,da);z--;}.bind(this));}.bind(this));}.bind(this));if(z===0){return {threadData:x,participantData:w};}else{v=true;var aa=this.state||{};return {threadData:q(aa.threadData,x),participantData:q(aa.participantData,w)};}}});e.exports=u;});
  31. __d("OrderedFriendsList",["AvailableList","ChatConfig","createArrayFrom","ShortProfiles","AsyncRequest","InitialChatFriendsList"],function(a,b,c,d,e,f){var g=b('AvailableList'),h=b('ChatConfig'),i=b('createArrayFrom'),j=b('ShortProfiles'),k=b('AsyncRequest'),l=[],m={},n=[],o={contains:function(p){return p in m;},compare:function(p,q){var r=o.getRank(p),s=o.getRank(q);if(r!==s)return r-s;var t=j.getNowUnsafe(p),u=j.getNowUnsafe(q),v=((t||{}).name||'~').toLowerCase(),w=((u||{}).name||'~').toLowerCase();if(v!==w)return v<w?-1:1;return 0;},getList:function(){if(h.get('chat_web_ranking_with_presence'))o.reRank();var p=i(l);p=p.filter(function(q){var r=j.getNowUnsafe(q);return !r||r.type=="friend";});return p;},getRank:function(p){return p in m?m[p]:l.length;},reload:function(){new k().setURI('/chat/ranking/web_divebar.php').setHandler(function(p){l=p.list.length?p.list:[];l.forEach(function(q,r){m[q]=r;});}).send();},reRank:function(){var p={},q={};n.forEach(function(s,t){var u=s.substr(0,s.length-2),v=s.substring(s.length-1);if(typeof(q.uid)=='undefined'){if(typeof(p.uid)=='undefined')p[u]=g.get(u);var w=p[u];if(w==v)q[t]=u;}});l=[];for(var r in q)l.push(q[r]);l.forEach(function(s,t){m[s]=t;});}};(function(){var p=b('InitialChatFriendsList');l=p.list.length?p.list:[];if(h.get('chat_web_ranking_with_presence')){n=l.slice();o.reRank();}l.forEach(function(q,r){m[q]=r;});})();e.exports=a.OrderedFriendsList||o;});
  32. __d("runAfterScrollingStops",["Arbiter","Event","Run","debounceAcrossTransitions","emptyFunction","throttle"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('Event'),i=b('Run'),j=b('debounceAcrossTransitions'),k=b('emptyFunction'),l=b('throttle');function m(x,y,z){if(y&&p[y])return;if(!o){g.subscribe('page_transition',w);o=true;}if(!n){x();return;}y&&(p[y]=1);q.push(x);if(!z){if(s){i.onLeave(w);s=false;}r.push(q.length-1);}}var n,o,p={},q=[],r=[],s=true,t=500,u=j(function(){n=false;var x=q;q=[];r=[];p={};for(var y=0,z=x.length;y<z;++y)x[y]();},t);function v(){n=true;u();}function w(){var x=r;r=[];s=true;for(var y=0,z=x.length;y<z;++y)q[x[y]]=k;}h.listen(window,'scroll',l.acrossTransitions(v,250));e.exports=m;});
  33. __d("ChatOrderedList",["JSXDOM","Animation","Arbiter","ArbiterMixin","AsyncDialog","AsyncRequest","AvailableList","AvailableListConstants","Bootloader","Chat","ChatConfig","ChatContexts","ChatFavoriteList","ChatFavoriteNux","ChatGroupThreadsController","ChatOrderedListHover","ChatQuietLinks","ChatSidebarThreadlist.react","ChatTypeaheadConstants","ChatVisibility","CSS","DataStore","DOM","Ease","Event","ImageSourceRequest","ImageSourceType","JSLogger","LastMobileActiveTimes","MercuryParticipantTypes","MercuryThreadInformer","MercuryThreads","OrderedFriendsList","Parent","PhotoResizeModeConst","PresencePrivacy","React","Rect","ShortProfiles","Style","Tooltip","TypeaheadUtil","URI","Vector","XHPTemplate","copyProperties","createObjectFrom","csx","cx","debounceAcrossTransitions","guid","requestAnimationFrame","runAfterScrollingStops","shield","throttle","tx","ChannelImplementation"],function(a,b,c,d,e,f){var g=b('JSXDOM'),h=b('Animation'),i=b('Arbiter'),j=b('ArbiterMixin'),k=b('AsyncDialog'),l=b('AsyncRequest'),m=b('AvailableList'),n=b('AvailableListConstants'),o=b('Bootloader'),p=b('Chat'),q=b('ChatConfig'),r=b('ChatContexts'),s=b('ChatFavoriteList'),t=b('ChatFavoriteNux'),u=b('ChatGroupThreadsController'),v=b('ChatOrderedListHover'),w=b('ChatQuietLinks'),x=b('ChatSidebarThreadlist.react'),y=b('ChatTypeaheadConstants'),z=b('ChatVisibility'),aa=b('CSS'),ba=b('DataStore'),ca=b('DOM'),da=b('Ease'),ea=b('Event'),fa=b('ImageSourceRequest'),ga=b('ImageSourceType'),ha=b('JSLogger'),ia=b('LastMobileActiveTimes'),ja=b('MercuryParticipantTypes'),ka=b('MercuryThreadInformer').get(),la=b('MercuryThreads').get(),ma=b('OrderedFriendsList'),na=b('Parent'),oa=b('PhotoResizeModeConst'),pa=b('PresencePrivacy'),qa=b('React'),ra=b('Rect'),sa=b('ShortProfiles'),ta=b('Style'),ua=b('Tooltip'),va=b('TypeaheadUtil'),wa=b('URI'),xa=b('Vector'),ya=b('XHPTemplate'),za=b('copyProperties'),ab=b('createObjectFrom'),bb=b('csx'),cb=b('cx'),db=b('debounceAcrossTransitions'),eb=b('guid'),fb=b('requestAnimationFrame'),gb=b('runAfterScrollingStops'),hb=b('shield'),ib=b('throttle'),jb=b('tx'),kb=c('ChannelImplementation').instance,lb=q.get('chat_ranked_by_coefficient',0),mb=null,nb,ob=9;function pb(yb,zb,ac,bc,cc,dc){this._isSidebar=yb;this._isLitestand=q.get('litestand',0)||q.get('test_litestand_sidebar',0);this._hasNonHoverSidebar=this._isSidebar&&q.get('litestand_sidebar_flyout',0);this._hasChatFlyout=this._isSidebar&&q.get('litestand_sidebar_chat_flyout',0);this._isSidebarFlyout=!!na.byClass(zb,"_57dj");this._root=zb;this._itemsMap={};this._isVisible=false;this._excludedIds={};this._numTopFriends=5;this._hasRendered=false;this._preventRendering=false;this._hoverController=null;this._template=ac;this._messageTemplate=bc;this._favoriteMode=q.get('divebar_favorite_list',0);this._contextualDialog=cc;this._cachedItemHeight=null;this._cachedItemPadding=null;if(dc&&ca.scry(dc,"._54y_").length)this._pymk=dc;this._usePlaceholder=this._isLitestand&&this._isSidebar;if(q.get('groups_in_divebar')){this._groupThreadsNode=g.li({className:"_56yf"},null);this._updateGroupThreads();this._groupsList=this._favoriteMode&&ca.find(this._root,"._56yh");}if(this._favoriteMode){this._favoriteSidebar=ca.find(this._root,"._42g5");this._editButton=ca.scry(this._root,"._57m9 ._54sl")[0];this._favoriteList=ca.find(this._root,"._54sm");this._activeNowList=ca.find(this._root,"._54sn");this._activeNowLabel=ca.scry(this._root,"._42g9")[0];if(this._activeNowLabel)this._activeNowArea=na.byClass(this._activeNowLabel,"_57yh");}if(this._hasChatFlyout)this._sidebarFlyoutItemContainer=ca.find(this._root,"._57yi");this._orderedList=ca.find(this._root,'.fbChatOrderedList');this._scrollableOrderedList=na.byClass(this._root,'scrollableOrderedList');this._chatSidebar=na.byClass(this._root,'fbChatSidebar');this._scrollableArea=na.byClass(this._root,'scrollable');ea.listen(this._root,'click',this._onClick.bind(this));ea.listen(this._root,'mouseenter',this._mouseEnter.bind(this));ea.listen(this._root,'mouseleave',this._mouseLeave.bind(this));if(this._editButton){ea.listen(this._editButton,'click',this.toggleEditMode.bind(this));i.subscribe(['LitestandSidebarBookmarks/close','LitestandSidebar/collapse','LitestandSidebar/closeFromHover'],this._onEditEnd.bind(this));}i.subscribe(['LitestandSidebar/collapse','LitestandSidebar/expand'],function(event){if(this._hasChatFlyout)this.getHoverController().setPaused(event==='LitestandSidebar/collapse');this.render();}.bind(this));m.subscribe(n.ON_AVAILABILITY_CHANGED,hb(this.update,this));pa.subscribe('privacy-changed',hb(this.update,this));kb.subscribe([kb.CONNECTED,kb.RECONNECTING,kb.SHUTDOWN,kb.MUTE_WARNING,kb.UNMUTE_WARNING],hb(this.update,this));this.inform('initialized',this,i.BEHAVIOR_PERSISTENT);this.render();i.subscribe(ha.DUMP_EVENT,function(ec,fc){fc.chat_lists=fc.chat_lists||{sorted_list:this.getCachedSortedList(),ordered_list:ma.getList(),available_list:pb.getAvailableList(this._excludedIds),excluded_list:this._excludedIds};}.bind(this));i.subscribe('ChatOrderedList/itemHeightChange',function(){this._cachedItemHeight=null;this._cachedItemPadding=null;}.bind(this));this._renderUnreadCount=q.get('divebar_message_count');if(this._renderUnreadCount)ka.subscribe('threads-updated',function(ec,fc){for(var gc in fc){var hc=la.getCanonicalUserInThread(gc);if(!this._renderedTopUsers||!(hc in this._renderedTopUsers)||!this._itemsMap[hc])continue;la.getThreadMeta(gc,function(ic){var jc=ic&&ic.unread_count;this._updateUnreadCount(hc,jc);}.bind(this));}}.bind(this));this._useEgo=q.get('divebar_www_use_ego',0);if(this._useEgo)setInterval(ma.reload,q.get('divebar_www_rerank_interval',300000));}function qb(yb,zb){var ac=rb(yb,zb);if(ac!==0)return ac;if(!lb){var bc=ub(yb,zb);if(bc!==0)return bc;}return ma.compare(yb,zb);}function rb(yb,zb){var ac=pa.allows(yb),bc=pa.allows(zb);if(ac!==bc)return ac?-1:1;return 0;}var sb={};function tb(yb){return sb[yb]||(sb[yb]=va.flatten(yb));}function ub(yb,zb){var ac=sa.getNowUnsafe(yb),bc=sa.getNowUnsafe(zb),cc=tb((ac||{}).name||'~'),dc=tb((bc||{}).name||'~');if(cc!==dc)return cc<dc?-1:1;return 0;}function vb(yb,zb){var ac=m.get(yb)===n.MOBILE,bc=m.get(zb)===n.MOBILE;if(ac!==bc)return bc?-1:1;return ub(yb,zb);}var wb;function xb(){if(wb)return !wb.isExpanded();o.loadModules(['LitestandSidebar'],function(yb){wb=yb;});return aa.hasClass(document.documentElement,"_4kdq");}za(pb,{CONTEXT_CLASSES:{nearby:"_56xw",visiting:"_56xx",neighbourhood:"_56xy",listening:"_56xz"},getSortedList:function(yb,zb){if(this._useEgo)return this.getEgoSortedList(yb,zb);var ac=ma.getList().filter(function(dc){return !(dc in yb)&&pa.getFriendVisibility(dc)!==pa.BLACKLISTED;}),bc=[];if(!z.isOnline()){Array.prototype.push.apply(bc,ac);}else{if(pa.getOnlinePolicy()===pa.ONLINE_TO_WHITELIST)ac=this._filterByWhitelist(ac);if(q.get('chat_web_ranking_with_presence')){Array.prototype.push.apply(bc,ac);}else bc=this._splitOutTopFriends(ac,zb);}bc=bc.slice(0,zb);if(bc.length===zb){var cc=pb.getAvailableList(bc.concat(yb)).length;cc&&bc.splice(-1);}if(!q.get('chat_web_ranking_with_presence'))bc.sort(qb);mb=bc.slice();return bc;},_filterByWhitelist:function(yb){var zb=yb,ac={},bc,cc;yb=[];for(bc=0;bc<zb.length;++bc){cc=zb[bc];if(pa.allows(cc)){ac[cc]=true;yb.push(cc);}}var dc=pa.getWhitelist();for(bc=0;bc<dc.length;++bc){cc=dc[bc];if(!(cc in ac))yb.push(cc);}for(bc=0;bc<zb.length;++bc){cc=zb[bc];if(!pa.allows(cc))yb.push(cc);}return yb;},_splitOutTopFriends:function(yb,zb){var ac=[],bc=[],cc=q.get('ordered_list.top_friends',0),dc=q.get('ordered_list.top_mobile',0),ec=q.get('ordered_list.available_target',1),fc=Math.floor(zb*ec),gc=yb.length;for(var hc=0;hc<gc&&fc>0;hc++){var ic=yb[hc],jc=m.get(ic),kc=jc===n.ACTIVE;if(kc||(jc===n.MOBILE&&hc<dc)||hc<cc){ac.push(ic);kc&&fc--;}else bc.push(ic);}if(hc<gc)Array.prototype.push.apply(bc,yb.slice(hc));if(ac.length<zb)Array.prototype.push.apply(ac,bc);return ac;},getEgoSortedList:function(yb,zb){var ac=ma.getList().filter(function(dc){return !(dc in yb);}),bc=ac.slice(0,zb);if(bc.length===zb){var cc=pb.getAvailableList(bc.concat(yb));cc.length&&bc.splice(-1);}return bc;},getAvailableList:function(yb){var zb;if(q.get('divebar_show_mobile_more_friends')||q.get('divebar_show_mobile_more_friends_alphabetical'))zb=m.getAvailableIDs();if(!zb)zb=m.getOnlineIDs();return zb.filter(function(ac){return !(ac in yb);});},_pause:function(){nb=true;},_unpause:function(){nb=false;},_registerToggleRenderItem:function(yb){ea.listen(yb,'click',function(){nb=!nb;aa.conditionClass(yb,'checked',nb);});}});za(pb.prototype,j,{getAllNodes:function(){var yb={},zb=ca.scry(this._root,"li._42fz");for(var ac=0;ac<zb.length;ac++){var bc=ba.get(zb[ac],'id');if(bc)yb[bc]=zb[ac];}return yb;},getShowingUsers:function(){return ca.scry(this._root,"li._42fz").map(function(yb){return ba.get(yb,'id');});},getUserForNode:function(yb){return ba.get(yb,'id');},getHoverController:function(){if(!this._hoverController){this._hoverController=new v(this,this._contextualDialog);if(this._hasChatFlyout&&xb())this._hoverController.setPaused(true);}return this._hoverController;},getPaddingOffset:function(){return this._favoriteMode?24:8;},_calculateItemMeasurements:function(){var yb=this._orderedList,zb=this._template.build(),ac=zb.getRoot();ca.setContent(zb.getNode('name'),'test');if(this._favoriteSidebar){yb=this._favoriteList;aa.addClass(this._favoriteSidebar,"_4zmr");}ac.style.visibility='hidden';ca.appendContent(yb,ac);this._cachedItemHeight=xa.getElementDimensions(ac).y;this._cachedItemPadding=ta.getFloat(zb.getNode('anchor'),'padding')||0;ca.remove(ac);if(this._favoriteSidebar)aa.removeClass(this._favoriteSidebar,"_4zmr");},getItemHeight:function(){if(this._cachedItemHeight===null)this._calculateItemMeasurements();return this._cachedItemHeight;},getItemPadding:function(){if(this._cachedItemPadding===null)this._calculateItemMeasurements();return this._cachedItemPadding;},_updateGroupThreads:function(){var yb=pa.getVisibility(),zb=x({offlineItems:kb.disconnected()||!yb,litestandSidebar:(this._isSidebar&&this._isLitestand)||this._isSidebarFlyout,showNewGroupsButton:q.get('divebar_has_new_groups_button',false)});qa.renderComponent(zb,this._groupThreadsNode);},_placeholderUpdate:function(){if(!this._usePlaceholder||!this._scrollContainer)return;var yb=this._root.offsetTop-this._scrollContainer.scrollTop;this._scrollContainerHeight=this._scrollContainerHeight||this._scrollContainer.offsetHeight;var zb=this.getItemHeight(),ac=Math.ceil(this._scrollContainerHeight/zb),bc=yb<0?Math.max(Math.floor(-yb/zb)-ac,0):0,cc=bc+ac+ac;this._cachedItems=this._cachedItems||ca.scry(this._root,"li._42fz");for(var dc=0,ec=this._cachedItems.length;dc<ec;dc++)aa.conditionClass(this._cachedItems[dc],"_50zv",dc<bc||dc>cc);},_getListItem:function(yb,zb){var ac=this._itemsMap[yb];if(!ac)return;var bc=m.get(yb),cc=pa.allows(yb)&&!kb.disconnected();if(ac.buttonNode===undefined){ac.buttonNode=ca.scry(ac.node,"._54sk")[0];ac.contextNode=ca.find(ac.node,"._52zk");ac.timeNode=ca.scry(ac.node,'.active_time')[0];ac.statusNodes=ca.scry(ac.node,'img.status');}aa.conditionClass(ac.node,"_42f-",zb);aa.conditionClass(ac.node,"_54sj",zb);aa.conditionClass(ac.node,"_52s3",this._isLitestand&&zb);if(ac.buttonNode)if(!this._isLitestand){aa.conditionClass(ac.buttonNode,"_42f_",zb);aa.conditionClass(ac.buttonNode,"_42g0",!zb);}var dc={active:false,mobile:false};dc.active=bc===n.ACTIVE;dc.mobile=bc===n.MOBILE;if(dc.mobile){var ec=ia.getShortDisplay(yb);if(ac.timeNode&&ac.lastActiveTime!==ec){ac.lastActiveTime=ec;ca.setContent(ac.timeNode,ec);}}else if(ac.lastActiveTime){ac.lastActiveTime=null;ca.empty(ac.timeNode);}for(var fc in dc)aa.conditionClass(ac.node,fc,dc[fc]&&cc);aa.conditionClass(ac.node,'invis',!cc);ac.statusNodes.forEach(function(gc){if(bc===n.ACTIVE&&cc){gc.alt="Online";}else if(bc===n.MOBILE&&cc){gc.alt="Mobile";}else gc.alt='';});this._applyContext(yb,ac);return ac.node;},getRoot:function(){return this._root;},getSortedList:function(yb){return pb.getSortedList(yb||this._excludedIds,this._numTopFriends);},getCachedSortedList:function(yb){if(mb==null)mb=this.getSortedList(yb);return mb;},toggleFavoriteSidebar:function(yb,zb){function ac(dc,ec){aa.conditionShow(ec,dc);var fc=na.byClass(ec,'uiContextualLayerPositioner');fc&&aa.conditionShow(fc,dc);}aa.conditionShow(this._orderedList,!yb);if(this._favoriteSidebar)aa.conditionShow(this._favoriteSidebar,yb);var bc=ca.scry(this._scrollableOrderedList||this._root,"._42i3");bc.forEach(ac.curry(yb));var cc=ca.scry(this._scrollableOrderedList||this._root,"._56yi");cc.length&&ac(zb,cc[0]);},hide:function(){if(!this._isVisible)return;this._isVisible=false;t.tryHide();aa.hide(this._scrollableOrderedList||this._root);this.inform('hide');},_onFavoriteOrderChange:function(){var yb=this.sortableGroup.getOrder();s.updateList(yb);s.save();},_getFavoriteItems:function(){var yb=[],zb=s.get();for(var ac=0;ac<zb.length;ac++){var bc=this._itemsMap[zb[ac]];if(bc)yb.push(bc.node);}return yb;},_getChatTabOpenLogData:function(yb){var zb=aa.hasClass(document.documentElement,'sidebarMode'),ac={mode:zb?'sidebar':'chatNub',typehead:false};if(this._scrollableArea&&this._scrollContainer){var bc=xa.getElementPosition(this._scrollableArea,'viewport').y,cc=xa.getElementPosition(yb,'viewport').y,dc=this._scrollContainer.scrollTop;if(cc>bc){ac.visible_slot=Math.round((cc-bc)/32);var ec=Math.round(dc/32);ac.global_slot=ac.visible_slot+ec;}}if(zb){ac.sidebar_height=this._chatSidebar&&this._chatSidebar.clientHeight;if(this._scrollContainer)ac.buddylist_height=this._scrollContainer.clientHeight;}return ac;},_resetFavoriteBounds:function(){var yb=s.get(),zb=yb.length;if(zb){var ac=yb[0],bc=yb[zb-1],cc=this._itemsMap[ac],dc=this._itemsMap[bc],ec=new ra(xa.getElementPosition(cc.node).y,0,xa.getElementPosition(dc.node).y+xa.getElementDimensions(dc.node).y,0);this.sortableGroup.setBoundingBox(ec);}},_createSortableGroup:function(){if(this.sortableGroup)this.sortableGroup.destroy();o.loadModules(['SortableGroup'],function(yb){this.sortableGroup=new yb().setBeforeGrabCallback(this._resetFavoriteBounds.bind(this)).setOrderChangeHandler(this._onFavoriteOrderChange.bind(this));if(this._isLitestand)this.sortableGroup.gutter=1;var zb=this._getFavoriteItems();for(var ac=0;ac<zb.length;ac++){var bc=zb[ac];this.sortableGroup.addSortable(ba.get(bc,'id'),bc);}}.bind(this));},toggleEditMode:function(){t.dismissDialog();s.toggleEditMode();if(s.isEditMode()){this._createSortableGroup();ca.setContent(this._editButton,"DONE");aa.addClass(this._favoriteSidebar,"_4-d6");this.inform('editStart');}else this._onEditEnd();},_onEditEnd:function(){if(s.isEditMode())s.toggleEditMode();ca.setContent(this._editButton,"EDIT");aa.removeClass(this._favoriteSidebar,"_4-d6");this.inform('editEnd');},_onClick:function(event){var yb=event.getTarget(),zb=na.byTag(yb,'li');if(s.isEditMode()){var ac=na.byClass(yb,"_54sk");if(ac&&zb){var bc=ba.get(zb,'id');if(bc){s.toggleID(bc);s.save();}this.update();}event.prevent();return false;}if(zb){if(aa.hasClass(zb,'blackbirdWhitelist')){var cc=new wa('/ajax/chat/privacy/settings_dialog.php').addQueryData({ref:'whitelist_separator'});k.send(new l(cc));event.prevent();return false;}var dc=ba.get(zb,'id'),ec=aa.hasClass(zb,"_56yg");if(dc||ec){var fc=this._getChatTabOpenLogData(zb),gc=aa.hasClass(document.documentElement,'sidebarMode'),hc=pa.getOnlinePolicy()===pa.ONLINE_TO_WHITELIST,ic=hc?'white_list':'ordered_list';if(ec){dc=zb.getAttribute('data-threadid');ic=dc?'recent_threads_in_divebar':'recent_threads_in_divebar_new';}else if(gc&&this._favoriteMode&&!hc){while(zb.parentNode){zb=zb.parentNode;if(aa.hasClass(zb,"_42g8")){ic='more_online_friends';break;}if(aa.hasClass(zb,"_42g7"))break;}}else while(zb.previousSibling){zb=zb.previousSibling;if(aa.hasClass(zb,"_554m")){if(aa.hasClass(zb,'moreOnlineFriends')){ic='more_online_friends';break;}if(aa.hasClass(zb,'blackbirdWhitelist')){ic='blackbird_offline_section';break;}}}fc.source=ic;var jc=ec?y.THREAD_TYPE:ja.FRIEND;p.openTab(dc,jc,fc);this.inform('click',{id:dc});}else if(aa.hasClass(zb,"_554m")&&na.byClass(yb,"_554n")){this.scrollTo(zb);}else if(aa.hasClass(zb,"_55nf"))return;return false;}},_mouseEnter:function(){this._preventRendering=true;},_mouseLeave:function(){this._preventRendering=false;},setExcludedIds:function(yb){this._excludedIds=ab(yb||[]);},setNumTopFriends:function(yb){if(yb!==this._numTopFriends){this._numTopFriends=yb;this.render();}},_getOfflineToSectionItems:function(){var yb='subheader-text-'+eb(),zb=ca.create('a',{href:'#','aria-describedby':yb},ca.tx._("Edit")),ac=[],bc=ca.tx._("MORE FRIENDS");ac.push(g.li({className:"_554m"},g.div({className:"_554o"},g.div({className:"_554n"},[g.span({className:"_554p"},bc),g.div({className:"_554q"},g.span({className:"_554r"},null))]))));ac.push(g.li({className:"_554m blackbirdWhitelist"},g.div({className:"_554o"},g.div({className:"fbChatOrderedList/separatorInner"},g.div({className:"fbChatOrderedList/separatorSubheader"},g.span({id:yb,className:"_554t"},jb._("These friends can't see you on chat. {=link}",{'=link':zb})))))));return ac;},_renderOrderedList:function(){if(!this._isVisible||(this._preventRendering&&this._hasRendered)||nb)return;this._hasRendered=true;this._cachedItems=null;var yb=[],zb,ac,bc=false,cc=false,dc=q.get('divebar_has_new_groups_button',false),ec=aa.hasClass(document.documentElement,'sidebarMode'),fc=pa.getVisibility(),gc=pa.getOnlinePolicy()===pa.ONLINE_TO_WHITELIST,hc=this._hasNonHoverSidebar&&xb(),ic=q.get('groups_in_divebar');ic&&this._updateGroupThreads();var jc=ic&&u.getThreadIDs().length,kc=ec&&this._favoriteMode&&fc&&!gc;if(kc&&ic&&jc&&this._groupThreadsNode){ca.setContent(this._groupsList,this._groupThreadsNode);w.nukeLinks(this._groupThreadsNode);w.nukeLinks(this._favoriteList);this.inform('render');}var lc=kc&&this._groupThreadsNode&&this._groupsList,mc=lc&&jc,nc=this._isLitestand&&!na.byClass(this._root,"_4w59");if(lc&&(jc||nc&&dc)){ca.setContent(this._groupsList,this._groupThreadsNode);aa.show(this._groupsList);w.nukeLinks(this._favoriteList);this.inform('render');}else this._groupsList&&aa.hide(this._groupsList);var oc=jc||0;if(dc&&(mc||!kc))oc++;if(this._hasChatFlyout&&xb())oc++;var pc=[],qc,rc;if(kc){this._chatSidebar&&aa.addClass(this._chatSidebar,'fbSidebarFavoriteList');pc=s.get();if(hc)pc=pc.slice(0,Math.max(0,this._numTopFriends-oc));for(qc=0,rc=pc.length;qc<rc;qc++){zb=pc[qc];ac=this._getListItem(zb,true);if(ac){yb.push(ac);}else{cc=true;this._renderListItem(zb,this.update.bind(this));}}}this.toggleFavoriteSidebar(kc,mc);var sc=hc?1:0,tc=pb.getSortedList(ab(pc),Math.max(0,this._numTopFriends-pc.length-oc+sc));if(kc){if(pc.length&&tc.length){var uc=ca.create('li',{className:"_42g3"});yb.push(uc);}}else if(jc||dc)this._groupThreadsNode&&yb.push(this._groupThreadsNode);var vc=pa.getVisibility()&&pa.getOnlinePolicy()==pa.ONLINE_TO_WHITELIST;for(var wc=0,xc=tc.length;wc<xc;wc++){zb=tc[wc];if(vc)if(!pa.allows(zb)){if(wc+2>=tc.length)break;vc=false;var yc=this._getOfflineToSectionItems();yb.push(yc[0]);yb.push(yc[1]);xc-=2;}ac=this._getListItem(zb);if(ac){yb.push(ac);}else this._renderListItem(zb,this.render.bind(this));}if(kc){ca.setContent(this._favoriteList,yb);if(yb.length)w.nukeLinks(this._favoriteList);this.inform('render');}var zc;if(hc){zc=[];}else zc=pb.getAvailableList(this._excludedIds);var ad=pc.concat(tc),bd=ab(ad);zc=zc.filter(function(kd){return !(kd in bd);});if(this._renderUnreadCount){var cd=[];if(this._renderedTopUsers){var dd=Object.keys(this._renderedTopUsers).filter(function(kd){return !(kd in bd);});dd.forEach(function(kd){this._updateUnreadCount(kd,0);}.bind(this));ad.forEach(function(kd){if(!(kd in this._renderedTopUsers))cd.push(kd);}.bind(this));}else cd=ad;cd.forEach(function(kd){la.getThreadMeta(la.getThreadIdForUser(kd),function(ld){this._updateUnreadCount(kd,ld&&ld.unread_count);}.bind(this));}.bind(this));this._renderedTopUsers=bd;}if(q.get('divebar_show_mobile_more_friends_alphabetical')){zc.sort(ub);}else zc.sort(vb);var ed="MORE FRIENDS";if(kc){yb=[];}else if(zc.length&&yb.length){var fd;if(this._isLitestand){fd=g.span(null,[g.span({className:"_554u"},[ed," · ",zc.length]),g.span({className:"_554v"},[" +",zc.length])]);}else fd=jb._("{MORE ONLINE FRIENDS} ({=count})",{'MORE ONLINE FRIENDS':ed,'=count':zc.length});if(this._pymk){bc=true;yb.push(this._pymk);}yb.push(g.li({className:"_554m moreOnlineFriends"},g.div({className:"_554o"},g.div({className:"_554n"},[g.span({className:"_554p"},fd),g.div({className:"_554q"},g.span({className:"_554r"},null))]))));}for(qc=0,rc=zc.length;qc<rc;qc++){zb=zc[qc];ac=this._getListItem(zb);if(ac){yb.push(ac);}else this._renderListItem(zb,this.render.bind(this));}if(!tc.length&&!zc.length&&!oc){var gd=this._messageTemplate.render(),hd=ya.getNode(gd,'message');ca.setContent(hd,"No one is available to chat.");yb.push(gd);}if(this._hasChatFlyout){var id=xb()?this._getSidebarFlyoutItem():null;ca.setContent(this._sidebarFlyoutItemContainer,id);}if(yb.length){if(kc){aa.show(this._activeNowList);if(this._activeNowLabel){var jd;aa.show(this._activeNowArea);if(this._isLitestand){jd=g.span(null,[g.span({className:"_554u"},[ed," · ",zc.length]),g.span({className:"_554v"},[" +",zc.length])]);}else jd=jb._("{MORE ONLINE FRIENDS} ({=count})",{'MORE ONLINE FRIENDS':"ACTIVE NOW",'=count':zc.length});ca.setContent(this._activeNowLabel,jd);}ca.setContent(this._activeNowList,yb);w.nukeLinks(this._activeNowList);}else{if(this._pymk&&!bc)yb.push(this._pymk);ca.setContent(this._orderedList,yb);if(this._pymk){w.removeMessagesHrefs(this.getRoot());}else w.nukeLinks(this.getRoot());}this.inform('render');this._placeholderUpdate();if(!this._renderingAfterScroll){this._renderingAfterScroll=true;this.render=db(gb.curry(this._renderOrderedList.bind(this),'ChatOrderedList/render',true),300);}}else if(kc){aa.hide(this._activeNowList);if(this._activeNowArea)aa.hide(this._activeNowArea);}if(kc){this._editButton&&t.tryShow(this._editButton);}else t.tryHide();if(kc&&!cc)if(s.isEditMode()&&s.hasChanged())this._createSortableGroup();},render:function(){this.render=db(this._renderOrderedList.bind(this),300);this.render();},_renderListItem:function(yb,zb){sa.get(yb,function(ac){var bc=this._template.render(),cc=ya.getNode(bc,'profile-photo');if(q.get('chat_use_client_side_image_requests',0)){var dc=this._isLitestand?24:28;new fa().setFBID(ac.id).setType(ga.PROFILE_PICTURE).setDimensions(dc,dc).setResizeMode(oa.COVER).setCallback(function(hc){cc.setAttribute('src',hc.uri);}).send();}else cc.setAttribute('src',ac.thumbSrc);var ec=ya.getNode(bc,'name');ca.setContent(ec,ac.name);var fc=ya.getNode(bc,'anchor');fc.setAttribute('href','/messages/'+yb);var gc=ya.getNode(bc,'tooltip');gc&&ua.set(gc,ac.name,'right');ba.set(bc,'id',yb);this._itemsMap[yb]={node:bc};zb&&zb(bc);}.bind(this));},_updateUnreadCount:function(yb,zb){var ac=this._itemsMap[yb];if(!ac)return;if(this._isSidebar){this._unreadMessages=this._unreadMessages||{};if(!!zb){this._unreadMessages[yb]=true;}else delete this._unreadMessages[yb];i.inform('buddylist-nub/updateCount',{count:Object.keys(this._unreadMessages).length});}ac.unreadCount=ac.unreadCount||ca.find(ac.node,"._550_");zb=zb?zb:0;ca.setContent(ac.unreadCount,zb>ob?ob+'+':zb);aa.conditionClass(ac.unreadCount,"_550z",zb>ob);aa.conditionClass(ac.node,"_550-",zb);},_getSidebarFlyoutItem:function(){if(this._flyoutItem)return this._flyoutItem;this._flyoutItem=(g.li({className:"_57dk"},g.div({className:"_57dl"},null)));ea.listen(this._flyoutItem,'mouseenter',function(){var zb=g.span(null,["Chat"," · ",m.getOnlineCount()]);if(this._flyoutInstance&&this._flyoutInstance.isShown()){ua.remove(this._flyoutItem);}else ua.set(this._flyoutItem,zb,'right');}.bind(this));var yb=this._showLitestandChatFlyout.bind(this);i.subscribe('ChatBeeper/clicked',yb);ea.listen(this._flyoutItem,'click',yb);return this._flyoutItem;},_showLitestandChatFlyout:function(){if(this._loadingFlyout)return;if(this._flyoutInstance){this._flyoutInstance.toggle();return;}this._loadingFlyout=true;new l('/ajax/chat/litestand_flyout').setData({contextID:ca.getID(this._flyoutItem)}).setAllowCrossPageTransition(true).send();var yb=i.subscribe('LitestandChatSidebarFlyout/init',function(zb,ac){this._flyoutInstance=ac;this._loadingFlyout=false;yb.unsubscribe();this.subscribe('render',ac.contextPositionInvalidated.bind(ac));}.bind(this));},show:function(){if(this._isVisible)return;this._isVisible=true;aa.show(this._scrollableOrderedList||this._root);this.render();this.inform('show');},isVisible:function(){return this._isVisible;},update:function(){this._hasRendered=false;if(!this._renderRequest)this._renderRequest=fb(function(){this.render();this._renderRequest=null;}.bind(this));},setScrollContainer:function(yb){if(ca.contains(yb,this._root)){this._scrollContainer=yb;if(this._usePlaceholder){ea.listen(yb,'scroll',ib.acrossTransitions(this._placeholderUpdate.bind(this)));ea.listen(window,'resize',ib.acrossTransitions(function(){this._scrollContainerHeight=null;this._placeholderUpdate();}.bind(this),250));}}},scrollTo:function(yb){if(!this._scrollContainer)return;var zb=this._scrollContainer.scrollHeight,ac=this._scrollContainer.clientHeight,bc=this._scrollContainer.scrollTop,cc=Math.min(yb.offsetTop,zb-ac);if(bc!==cc){var dc=this._isLitestand?600:Math.abs(cc-bc)/this._scrollContainer.clientHeight*500,ec=this._isLitestand?da.easeOutExpo:h.ease.end;new h(this._scrollContainer).to('scrollTop',cc).ease(ec).duration(dc).go();}},_applyContext:function(yb,zb){var ac=r.getShortDisplay(yb)||'';if(zb.contextNode){ca.setContent(zb.contextNode,ac);aa.conditionClass(zb.node,"_52zj",ac);var bc=r.get(yb),cc=bc?bc.type:null;for(var dc in pb.CONTEXT_CLASSES){var ec=(dc===cc),fc=pb.CONTEXT_CLASSES[dc]||"_56x-";aa.conditionClass(zb.contextNode,fc,ec);}}}});e.exports=pb;});
  34. __d("TypingDetectorController",["AsyncRequest","AvailableList","AvailableListConstants","ChannelConnection","ChatVisibility","Keys","PresencePrivacy","ShortProfiles","TypingDetector","copyProperties","emptyFunction","shield"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('AvailableList'),i=b('AvailableListConstants'),j=b('ChannelConnection'),k=b('ChatVisibility'),l=b('Keys'),m=b('PresencePrivacy'),n=b('ShortProfiles'),o=b('TypingDetector'),p=b('copyProperties'),q=b('emptyFunction'),r=b('shield');function s(u){if(!k.isOnline())return false;if(u){var v=n.getNow(u);return v&&v.type=="friend"&&m.allows(u);}return true;}function t(u,v,w,x,y){this.userID=u;this.input=v;this.source=w;this.threadID=y;this.remoteState=o.INACTIVE;this.notifyTimer=null;x=x||{};this.notifyDelay=x.notifyDelay||this.notifyDelay;this._typingDetector=new o(v);this._typingDetector.init(x);this._typingDetector.subscribe('change',this._stateChange.bind(this));}p(t.prototype,{notifyDelay:1000,setUserAndThread:function(u,v){if(this.userID!==u||this.threadID!==v){this.resetState();this.userID=u;this.threadID=v;}},setIgnoreEnter:function(u){var v=u?[l.RETURN]:[];this._typingDetector.setIgnoreKeys(v);},resetState:function(){this.remoteState=t.INACTIVE;this._typingDetector.reset();clearTimeout(this.notifyTimer);this.notifyTimer=null;},_stateChange:function(u,v){if(v!=o.QUITTING){clearTimeout(this.notifyTimer);this.notifyTimer=r(this._notifyState,this,v).defer(this.notifyDelay,false);}else this._notifyState(v,true);},_notifyState:function(u,v){if(!this.userID&&!this.threadID)return;var w=this.userID,x=s(w);if(x&&u!=this.remoteState){this.remoteState=u;if(j.disconnected())return;var y={typ:u,to:w,source:this.source,thread:this.threadID};new g().setHandler(this._onTypResponse.bind(this,w)).setErrorHandler(q).setData(y).setURI('/ajax/messaging/typ.php').setAllowCrossPageTransition(true).setOption('asynchronous',!v).send();}},_onTypResponse:function(u,v){var w=v.getPayload()||{};if(w.offline)h.set(u,i.OFFLINE,'typing_response');}});e.exports=t;});
  35. __d("ChatTypeaheadBehavior",["Chat","ChatConfig","ChatFavoriteList","CSS","DOM","Rect","copyProperties","tx"],function(a,b,c,d,e,f){var g=b('Chat'),h=b('ChatConfig'),i=b('ChatFavoriteList'),j=b('CSS'),k=b('DOM'),l=b('Rect'),m=b('copyProperties'),n=b('tx');function o(p){this._typeahead=p;}m(o.prototype,{_subscriptions:null,enable:function(){var p=this._typeahead;this._subscriptions=[p.subscribe('focus',function(){p.getData().refreshData();}),p.subscribe('blur',function(q){p.getCore().reset();}),p.subscribe('respond',function(q,r){if(r.value&&r.value===p.getCore().getValue()){if(!r.results.length){var s=h.get('divebar_typeahead_group_fof',0);if(s&&!r.isAsync)return;var t=k.create('div',{className:'noResults'},"Friend not found.");k.setContent(p.getView().getElement(),t);}j.addClass(p.getElement(),'hasValue');}}),p.subscribe('reset',function(){j.removeClass(p.getElement(),'hasValue');}),p.subscribe('select',function(q,r){if(i.isEditMode()){i.toggleID(r.selected.uid);i.save();}else{var s=j.hasClass(document.documentElement,'sidebarMode'),t={mode:s?'sidebar':'chatNub',source:'typeahead',type:r.selected.type,typeahead:true};g.openTab(r.selected.uid,r.selected.type,t);}}),p.subscribe('highlight',function(q,r){if(r.index>=0){var s=p.getView().getItems()[r.index];if(s){var t=new l(s),u=s.offsetParent,v=t.boundWithin(new l(u)).getPositionVector();t.getPositionVector().sub(v).scrollElementBy(u);}}})];},disable:function(){this._subscriptions.forEach(function(p){this._typeahead.unsubscribe(p);}.bind(this));this._subscriptions=null;}});e.exports=o;});
  36. __d("ChatTypeaheadCore",["function-extensions","Class","Event","Keys","TypeaheadCore","copyProperties","emptyFunction","shield"],function(a,b,c,d,e,f){b('function-extensions');var g=b('Class'),h=b('Event'),i=b('Keys'),j=b('TypeaheadCore'),k=b('copyProperties'),l=b('emptyFunction'),m=b('shield');function n(o){this.parent.construct(this,o);}g.extend(n,j);k(n.prototype,{init:function(o,p,q){this.parent.init(o,p,q);this.informBeginActive=false;this.informEndActive=false;this.data.subscribe('respond',function(){if(this.informBeginActive){this.informBeginActive=false;this.inform('sidebar/typeahead/active',true);}else if(this.informEndActive){this.informEndActive=false;this.inform('sidebar/typeahead/active',false);}}.bind(this));},handleTab:l,keydown:function(event){var o=h.getKeyCode(event);if(o===i.ESC){m(this.reset,this).defer();return event.kill();}return this.parent.keydown(event);},checkValue:function(){var o=this.getValue(),p=this.value;if(o==p)return;if(p&&!o){this.typeaheadActive=false;this.informEndActive=true;}else if(!p&&o){this.typeaheadActive=true;this.informBeginActive=true;this.inform('sidebar/typeahead/preActive');}this.parent.checkValue();}});e.exports=n;});
  37. __d("ChatTypeaheadDataSource",["Class","DataSource","Env","JSLogger","MercuryParticipantTypes","OrderedFriendsList","Run","ShortProfiles","copyProperties"],function(a,b,c,d,e,f){var g=b('Class'),h=b('DataSource'),i=b('Env'),j=b('JSLogger'),k=b('MercuryParticipantTypes'),l=b('OrderedFriendsList'),m=b('Run'),n=b('ShortProfiles'),o=b('copyProperties');function p(q){q=q||{};q.kanaNormalization=true;this.parent.construct(this,q);this.persistOnRefresh=q.persistOnRefresh!==false;this.showOfflineUsers=!!q.showOfflineUsers;this._jslog=j.create('chat_typeahead');this._jslog.log('created');}g.extend(p,h);o(p.prototype,{init:function(){this._jslog.log('init');this.parent.init();this._update();},bootstrap:function(){this._jslog.log('bootstrap');this.parent.bootstrap();if(this.showOfflineUsers){this._jslog.log('show_offline_users');this._jslog.log('ensured_short_profiles');if(n.hasAll()){this._update();}else{this._jslog.log('fetch_all_short_profiles');n.fetchAll();this.inform('activity',{activity:true});var q=n.subscribe('updated',function(){this.inform('activity',{activity:false});this._update();}.bind(this));if(!this.persistOnRefresh)m.onLeave(function(){n.unsubscribe(q);});}}},_update:function(){d(['AvailableList'],function(q){var r=this.value;this.dirty();var s=n.getCachedProfileIDs(),t=s.filter(function(v){var w=n.getNow(v);return w.type===k.FRIEND;});t.sort(l.compare);var u=[];t.forEach(function(v){if(v==i.user)return;var w=q.get(v);if(!this.showOfflineUsers&&w!==q.ACTIVE)return;var x=n.getNow(v),y=x.additionalName;if(x.hasOwnProperty('searchTokens'))y=y!==null?y+" "+x.searchTokens.join(" "):x.searchTokens.join(" ");u.push({uid:v,text:x.name,tokens:y,localized_text:x.name,additional_text:x.additionalName,photo:x.thumbSrc,type:x.type});}.bind(this));if(u.length)this.addEntries(u);this.value=r;if(r)this.query(r);}.bind(this));},refreshData:function(){d(['AvailableList'],function(q){q.update();}.bind(this));}});e.exports=p;});
  38. __d("ChatSidebarHeader.react",["ReactDOM","React","cx"],function(a,b,c,d,e,f){var g=b('ReactDOM'),h=b('React'),i=b('cx'),j=h.createClass({displayName:'ReactChatSidebarHeader',render:function(){return (g.div({className:"_55ob"},g.div({className:"_55oc"},this.props.name)));}});e.exports=j;});
  39. __d("ChatSidebarUser.react",["ReactDOM","ChatFavoriteList","WebMessengerPermalinkConstants","ChatConfig","React","ChatSidebarItem.react"],function(a,b,c,d,e,f){var g=b('ChatFavoriteList'),h=b('WebMessengerPermalinkConstants'),i=b('ChatConfig'),j=b('React'),k=b('ChatSidebarItem.react'),l=j.createClass({displayName:'ChatSidebarUser',render:function(){var m=h.getURIPathForIDOrVanity(this.props.userID),n=g.isFavored(this.props.userID),o=function(){g.toggleID(this.props.userID);}.bind(this),p=i.get('divebar_favorite_list',0)?n:undefined;return (k({href:{url:m},imageSize:this.props.imageSize,images:this.props.image,litestandSidebar:this.props.litestandSidebar,isAdded:p,showEditButton:g.isEditMode(),name:this.props.name,onEditClick:o,status:this.props.status,statusTime:this.props.statusTime},null));}});e.exports=l;});
  40. __d("ChatTypeaheadRenderer",["ReactDOM","AvailableListConstants","ChatConfig","ChatSidebarConstants","ChatSidebarHeader.react","ChatSidebarThread.react","ChatSidebarUser.react","ChatTypeaheadConstants","DOM","LastMobileActiveTimes","MercuryParticipants","PresenceStatus","React"],function(a,b,c,d,e,f){var g=b('AvailableListConstants'),h=b('ChatConfig'),i=b('ChatSidebarConstants'),j=b('ChatSidebarHeader.react'),k=b('ChatSidebarThread.react'),l=b('ChatSidebarUser.react'),m=b('ChatTypeaheadConstants'),n=b('DOM'),o=b('LastMobileActiveTimes'),p=b('MercuryParticipants'),q=b('PresenceStatus'),r=b('React'),s={};function t(y,z){if(!(y in s))s[y]=n.create('li');r.renderComponent(z,s[y]);return s[y];}function u(y){return t(y.text,j({name:y.text},null));}function v(y){var z=y.mercury_thread.participants.map(function(ba){return p.getUserID(ba);}),aa=h.get('litestand',0)?i.LITESTAND_IMAGE_SIZE:i.IMAGE_SIZE;return t(y.uid,k({image:y.mercury_thread.image_src,imageSize:aa,litestandSidebar:h.get('litestand',0),name:y.mercury_thread.name,participants:y.participants_to_render,status:q.getGroup(z),threadID:y.uid},null));}function w(y){var z=q.get(y.uid),aa=(z===g.MOBILE)?o.getShortDisplay(y.uid):null,ba=h.get('litestand',0)?i.LITESTAND_IMAGE_SIZE:i.IMAGE_SIZE;return t(y.uid,l({image:y.photo,imageSize:ba,litestandSidebar:h.get('litestand',0),name:y.text,status:z,statusTime:aa,userID:y.uid},null));}function x(y,z){if(y.type===m.HEADER_TYPE)return u(y);if(y.type==m.THREAD_TYPE)return v(y);return w(y);}e.exports=x;});
  41. __d("ChatTypeaheadView",["BucketedTypeaheadView","ChatConfig","Class","ChatTypeaheadConstants","copyProperties","tx"],function(a,b,c,d,e,f){var g=b('BucketedTypeaheadView'),h=b('ChatConfig'),i=b('Class'),j=b('ChatTypeaheadConstants'),k=b('copyProperties'),l=b('tx'),m=h.get('divebar_typeahead_group_fof',0);function n(o,p){this.parent.construct(this,o,p);this.typeObjects={};this.typeObjectsOrder=[];this.typeObjects[j.NON_FRIEND_TYPE]={uid:j.NON_FRIEND_TYPE,type:j.HEADER_TYPE,text:"FRIENDS OF FRIENDS"};this.typeObjectsOrder.push(j.NON_FRIEND_TYPE);this.typeObjects[j.THREAD_TYPE]={uid:j.THREAD_TYPE,type:j.HEADER_TYPE,text:"GROUP CONVERSATIONS"};this.typeObjectsOrder.push(j.THREAD_TYPE);this.typeObjects[j.FRIEND_TYPE]={disabled:true,uid:j.FRIEND_TYPE,type:j.HEADER_TYPE,text:"FRIENDS"};this.typeObjectsOrder.push(j.FRIEND_TYPE);}i.extend(n,g);k(n.prototype,{buildBuckets:function(o,p){if(m)p=p.reverse();p=this.parent.buildBuckets(o,p);if(!m)p=p.filter(function(q){return q&&!q.disabled;});return p;},getDefaultIndex:function(o){if(!m)return this.parent.getDefaultIndex(o);if(o.length===0)return -1;var p=o.length-1;while(!this.isHighlightable(o[p])&&p>=0)p--;return p;}});e.exports=n;});
  42. __d("ChatBehavior",["Arbiter","AvailableList","AvailableListConstants","ChatConfig","copyProperties","MercuryConstants","ChatSidebarCalloutData"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('AvailableList'),i=b('AvailableListConstants'),j=b('ChatConfig'),k=b('copyProperties'),l=b('MercuryConstants').ChatNotificationConstants,m=b('ChatSidebarCalloutData').isShown,n=h.getWebChatNotification(),o=m,p=true,q=k(new g(),{ON_CHANGED:'changed',notifiesUserMessages:function(){return n!==l.NO_USER_MESSAGE_NOTIFICATION;},ignoresRemoteTabRaise:function(){return o;},showsTabUnreadUI:function(){if(j.get('web_messenger_suppress_tab_unread'))return p;return true;}});function r(){q.inform(q.ON_CHANGED);}h.subscribe(i.ON_CHAT_NOTIFICATION_CHANGED,function(){var s=n,t=h.getWebChatNotification();n=t;if(s!=t)r();});g.subscribe('chat/set_does_page_occlude_tabs',function(s,t){o=!!t;r();});g.subscribe('chat/set_show_tab_unread_ui',function(s,t){p=!!t;r();});e.exports=q;});
  43. __d("ChatSidebarSheet",["JSXDOM","Event","function-extensions","ArbiterMixin","BlackbirdUpsell","ChannelConnection","ChannelConstants","ChatBehavior","ChatConfig","ChatVisibility","CSS","DOM","JSLogger","PresencePrivacy","Tooltip","csx","cx","copyProperties","tx"],function(a,b,c,d,e,f){var g=b('JSXDOM'),h=b('Event');b('function-extensions');var i=b('ArbiterMixin'),j=b('BlackbirdUpsell'),k=b('ChannelConnection'),l=b('ChannelConstants'),m=b('ChatBehavior'),n=b('ChatConfig'),o=b('ChatVisibility'),p=b('CSS'),q=b('DOM'),r=b('JSLogger'),s=b('PresencePrivacy'),t=b('Tooltip'),u=b('csx'),v=b('cx'),w=b('copyProperties'),x=b('tx'),y=r.create('sidebar_sheet');function z(ca){switch(ca){case l.HINT_AUTH:return "Your session has timed out. Please log in.";case l.HINT_CONN:return x._("Facebook {Chat} is currently unavailable.",{Chat:"Chat"});case l.HINT_MAINT:return x._("Facebook {Chat} is currently down for maintenance.",{Chat:"Chat"});default:return x._("Facebook {Chat} is currently unavailable.",{Chat:"Chat"});}}function aa(ca){var da;if(ca===null){da="Unable to connect to chat. Check your Internet connection.";}else if(ca>n.get('warning_countdown_threshold_msec')){var ea=q.create('a',{href:'#',className:'fbChatReconnectLink'},"Try again");da=q.tx._("Unable to connect to chat. {try-again-link}",{'try-again-link':ea});}else if(ca>1000){da=x._("Unable to connect to chat. Reconnecting in {seconds}...",{seconds:Math.floor(ca/1000)});}else da="Unable to connect to chat. Reconnecting...";return da;}function ba(ca){this._root=ca;this._litestandOffline=q.scry(ca,"._52d2");this._message=q.find(ca,'div.fbChatSidebarMessage div.message');k.subscribe([k.CONNECTED,k.SHUTDOWN,k.RECONNECTING],this._handleConnectionChange.bind(this));k.subscribe([k.MUTE_WARNING,k.UNMUTE_WARNING],this._render.bind(this));s.subscribe('privacy-user-presence-changed',this._render.bind(this));m.subscribe(m.ON_CHANGED,this._render.bind(this));this._render();}w(ba.prototype,i,{_channelStatus:null,_channelData:null,_handleConnectionChange:function(ca,da){this._channelStatus=ca;this._channelData=da;this._render();},_showWarningTimeout:null,_warningMsgEventListener:null,_renderChannelDisconnect:function(){if(this._channelStatus===k.SHUTDOWN){return q.setContent(this._message,z(this._channelData));}else if(this._channelStatus===k.RECONNECTING){var ca=this._channelData;q.setContent(this._message,aa(ca));if(ca>1000){if(ca>n.get('warning_countdown_threshold_msec'))this._warningMsgEventListener=h.listen(this._message,'click',function(event){if(p.hasClass(event.getTarget(),'fbChatReconnectLink')){k.reconnect();return false;}});this._showWarningTimeout=setTimeout(this._handleConnectionChange.bind(this,k.RECONNECTING,ca-1000),1000,false);}}},_goOnlineEventListener:null,_renderOffline:function(){if(this._isLitestand)return;if(this._litestandOffline&&this._litestandOffline.length)this._renderLitestandOffline();var ca='fbChatGoOnlineLink',da="Turn on chat",ea=q.create('a',{href:'#',className:ca},da),fa=q.tx._("{=Go online} to see who's available.",{'=Go online':ea});q.setContent(this._message,fa);this._goOnlineEventListener=h.listen(this._message,'click',function(event){if(p.hasClass(event.getTarget(),ca)){y.log('sidebar_go_online');o.goOnline();return false;}});},_renderLitestandOffline:function(){this._litestandOffline=this._litestandOffline[0];this._isLitestand=true;var ca=g.div({className:"_4_vf"},null),da=g.a({className:"_52cx _52i7"},[g.i({className:"_52c_"},null),g.div({className:"_52cz"},g.div({className:"_52c-"},[g.i({className:"_52d1"},null),g.div({className:"_52cy"},q.tx._("Turn on Chat"))])),g.i({className:"_52d0"},null),ca]);t.set(ca,q.tx._("Turn on Chat"),'right','center');q.replace(this._litestandOffline,da);this._litestandOffline=null;h.listen(da,'click',function(event){y.log('sidebar_go_online');o.goOnline();event.prevent();});},_renderBlackbirdUpsell:function(){q.setContent(this._message,j.getOfflineContent());},_renderBlackbird:function(ca){q.setContent(this._message,j.getBlackbirdContent(ca));},_clear:function(){if(this._showWarningTimeout){clearTimeout(this._showWarningTimeout);this._showWarningTimeout=null;}if(this._warningMsgEventListener){this._warningMsgEventListener.remove();this._warningMsgEventListener=null;}if(this._goOnlineEventListener){this._goOnlineEventListener.remove();this._goOnlineEventListener=null;}p.removeClass(this._root,'upsell');p.removeClass(this._root,'offline');p.removeClass(this._root,'blackbird');p.removeClass(this._root,'error');p.removeClass(this._root,'notice');q.empty(this._message);},_render:function(){this._clear();if(j.shouldShow()){if(o.hasBlackbirdEnabled()){var ca=o.isOnline()?'blackbird':'upsell';p.addClass(this._root,ca);this._renderBlackbird(s.getVisibility());}else if(!o.isOnline()){p.addClass(this._root,'upsell');this._renderBlackbirdUpsell();}}else if(!o.isOnline()){p.addClass(this._root,'offline');this._renderOffline();}else if(k.disconnected()){p.addClass(this._root,'error');this._renderChannelDisconnect();}else if(!m.notifiesUserMessages()){p.addClass(this._root,'notice');q.setContent(this._message,"Alerts are off while you use another client to chat.");}this.inform('updated');}});e.exports=ba;});
  44. __d("FBDesktopPlugin",["CacheStorage","DOM","Env","FBDesktopDetect","URI","Style"],function(a,b,c,d,e,f){var g=b('CacheStorage'),h=b('DOM'),i=b('Env'),j=b('FBDesktopDetect'),k=b('URI'),l=b('Style'),m=new g('localstorage','_socialfox_'),n={_plugin:'_not_checked',arbiterInform:function(o,p){var q=JSON.stringify({name:o,payload:p});this._transmitCommand('arbiterinform',q);},bringToFront:function(){this._transmitCommand('bringtofront');},dock:function(){this._transmitCommand('dock');},getPlugin:function(){if(this._plugin==='_not_checked'){this._plugin=null;if(j.isPluginInstalled()){var o=h.create('object',{id:'kiwi_plugin',type:j.mimeType});l.set(o,'width',0);l.set(o,'height',0);var p=h.create('div',{},o);l.set(p,'width',0);l.set(p,'height',0);document.body.appendChild(p);this._plugin=o;}}return this._plugin;},getUserID:function(){var o=this.getPlugin();return o&&'getUserID' in o&&o.getUserID();},getVersion:function(){var o=this.getPlugin();return o&&'getVersion' in o&&o.getVersion();},isAppRunning:function(){var o=this.getPlugin();return o&&'isAppRunning' in o&&o.isAppRunning();},launchApp:function(){var o=this.getPlugin();return o&&'launchApp' in o&&o.launchApp();},login:function(o,p){if(p&&o&&o.length>0){var q=this.getPlugin();if(q){this._transmitCommand('relogin\n'+o+'\n'+p);return;}}},logout:function(o){o=o||"0";var p=this.getPlugin();if(p)p.logout(o);},recheck:function(){if(this._plugin===null)this._plugin='_not_checked';},shouldSuppressBeeper:function(){return this.isAppRunning();},shouldSuppressMessages:function(){if(m&&m.get('connected'))return true;var o=this.getUserID();if(o){return o===i.user;}else return this.isAppRunning();},shouldSuppressSidebar:function(){var o=this.getPlugin(),p=o&&'isAppDocked' in o&&o.isAppDocked(),q=m&&m.get('active')==='true';return p||q;},transferAuthToken:function(o,p){if(o&&o.length>0){var q=this.getPlugin();if(q){q.setAccessToken(o,p);var r=setInterval(function(){q.setAccessToken(o,p);},500);setTimeout(function(){clearInterval(r);},10*1000);}}if(this.redirectHome)window.location.href=k().setPath().toString();},_transmitCommand:function(o,p){p=p||'';var q=this.getPlugin();if(q&&'transmitCommand' in q)q.transmitCommand(o,p);}};e.exports=n;});
  45. __d("ChatSidebar",["JSXDOM","ChatOrderedList","ChatTypeaheadBehavior","ChatTypeaheadCore","ChatTypeaheadDataSource","ChatTypeaheadRenderer","ChatTypeaheadView","Typeahead","Arbiter","ArbiterMixin","AsyncRequest","Bootloader","Chat","ChatConfig","ChatHovercard","ChatImpressionLogger","ChatOptions","ChatSidebarSheet","CSS","DOM","DOMDimensions","Event","FBDesktopPlugin","JSLogger","OrderedFriendsList","Parent","PresencePrivacy","ScrollableArea","Style","UserAgent","ViewportBounds","copyProperties","createArrayFrom","csx","cx","debounce","emptyFunction","ge"],function(a,b,c,d,e,f){var g=b('JSXDOM');b('ChatOrderedList');b('ChatTypeaheadBehavior');b('ChatTypeaheadCore');b('ChatTypeaheadDataSource');b('ChatTypeaheadRenderer');b('ChatTypeaheadView');b('Typeahead');var h=b('Arbiter'),i=b('ArbiterMixin'),j=b('AsyncRequest'),k=b('Bootloader'),l=b('Chat'),m=b('ChatConfig'),n=b('ChatHovercard'),o=b('ChatImpressionLogger'),p=b('ChatOptions'),q=b('ChatSidebarSheet'),r=b('CSS'),s=b('DOM'),t=b('DOMDimensions'),u=b('Event'),v=b('FBDesktopPlugin'),w=b('JSLogger'),x=b('OrderedFriendsList'),y=b('Parent'),z=b('PresencePrivacy'),aa=b('ScrollableArea'),ba=b('Style'),ca=b('UserAgent'),da=b('ViewportBounds'),ea=b('copyProperties'),fa=b('createArrayFrom'),ga=b('csx'),ha=b('cx'),ia=b('debounce'),ja=b('emptyFunction'),ka=b('ge'),la,ma=false,na=false,oa=false,pa=false,qa=false,ra=false,sa,ta,ua,va,wa,xa=null,ya,za,ab,bb,cb,db,eb,fb=28,gb=38,hb=w.create('chat_sidebar');function ib(){if(ya)return;r.removeClass(document.documentElement,'sidebarMode');if(!pa||!qb.isVisible()){h.inform('reflow');return;}oa=false;xa=null;sa.hide();va.getCore().reset();r.hide(ta);hb.rate('sidebar_hide',pa);qb.inform('sidebar/hide',qb);h.inform('sidebar/hide',qb);h.inform('reflow');}function jb(){var rb=qb.shouldShowSidebar();r.conditionClass(document.documentElement,'sidebarCapable',rb);if(qb.isEnabled()&&rb){lb();var sb;if(ya&&za){var tb=r.hasClass(ta,"_4w59");if(tb)return;eb=eb||s.find(ta,"._50g0");if(za.has_favorites_editing)cb=cb||s.scry(ta,"._52s9")[0];if(za.has_chat_header)db=db||s.find(ta,"._53sr");sb=[eb,db];}else sb=fa(ta.childNodes);var ub=kb(sb),vb=sa.getItemHeight()||32,wb=sa.getPaddingOffset()||8,xb;if(ya){if(!m.get('litestand_sidebar_flyout')||ab.isExpanded()){wb=wb+fb;if(za&&za.always_show_one_see_more)wb+=vb;}if(!l.isOnline())wb+=gb;var yb=Math.floor(sa.getItemPadding()/2);xb=Math.floor((ub-wb+yb)/vb);if(!sa.isVisible())ba.set(la,'height',ub+'px');}else{xb=Math.floor((ub-wb)/(vb+1));ba.set(la,'height',ub+'px');}sa.setNumTopFriends(xb);var zb=xb;if(nb())zb=(xb-2)>0?xb-2:0;va.getData().setMaxResults(zb);qb.inform('sidebar/resized',qb);h.inform('sidebar/resized',qb);h.inform('reflow');}else ib();if(!pa){pb();pa=true;}xa=null;}function kb(rb){if(!rb)if(ya&&za){eb=eb||s.find(ta,"._50g0");if(za.has_chat_header)db=db||s.find(ta,"._53sr");rb=[eb,db];}else rb=fa(ta.childNodes);var sb=wa.height;if(ya&&bb)sb-=bb.getFullHeight();rb.forEach(function(tb){if(tb&&tb!==la)sb-=t.getElementDimensions(tb).height;});return Math.max(0,sb);}function lb(){if(qb.isVisible())return;oa=true;xa=null;r.show(ta);r.addClass(document.documentElement,'sidebarMode');sa.show();hb.rate('sidebar_show',pa);qb.inform('sidebar/show',qb);h.inform('sidebar/show',qb);}function mb(){p.setSetting('sidebar_mode',qb.isEnabled(),'sidebar');new j('/ajax/chat/settings.php').setHandler(ja).setErrorHandler(ja).setData({sidebar_mode:qb.isEnabled()}).setAllowCrossPageTransition(true).send();}function nb(){return m.get('divebar_typeahead_group_fof',0);}function ob(){return x.getList().length<=m.get('sidebar.min_friends');}function pb(){var rb=true;if(!qb.isEnabled()){hb.log('state_not_enabled');rb=false;}if(!qb.isViewportCapable()){hb.log('state_not_shown_viewport');rb=false;}if(na){hb.log('state_not_shown_hidden');rb=false;}if(ob()){hb.log('state_not_shown_num_friends');rb=false;}if(v.shouldSuppressSidebar()){hb.log('state_not_shown_fbdesktop');rb=false;}hb.log(rb?'state_shown':'state_not_shown');}var qb={init:function(rb,sb,tb,ub){qb.init=ja;qa=true;ta=rb;sa=sb;va=tb;ua=ub;la=s.find(rb,'div.fbChatSidebarBody');ya=ub&&ub.has_lsb;ab=ub&&ub.ls_module;za=ub&&ub.ls_config;if(ab){h.subscribe('ViewportSizeChange',function(){h.inform('ChatOrderedList/itemHeightChange');jb();});h.subscribe('Sidebar/BookmarksHeightChange',jb);var vb=sa.getHoverController();vb.subscribe('hovercard_show',ab.allowCollapse.curry(false,'hover_card'));vb.subscribe('hovercard_hide',ab.allowCollapse.curry(true,'hover_card'));k.loadModules(['LitestandSidebarBookmarksDisplay'],function(xb){bb=xb;});}else u.listen(window,'resize',jb);new n(sb);var wb=new q(rb);wb.subscribe('updated',jb);h.subscribe('sidebar/invalidate',jb);sb.setScrollContainer(y.byClass(sb.getRoot(),'uiScrollableAreaWrap'));sb.subscribe(['render','show','hide'],ia(function(xb){if(xb==='render'&&!ra){ra=true;qb.inform('sidebar/chatRendered',null,h.BEHAVIOR_PERSISTENT);}var yb=sb.getRoot(),zb=aa.getInstance(yb);zb&&zb.adjustGripper();}));sb.subscribe(['editStart','editEnd'],function(xb){r.conditionClass(va.getView().element,"_4-d6",xb=='editStart');});if(ca.firefox()>=17)u.listen(window,'storage',function(xb){if(xb.key=='_socialfox_active'&&xb.oldValue!=xb.newValue)jb();});h.subscribe('chat/option-changed',function(xb,yb){if(yb.name=="sidebar_mode"){ma=!!p.getSetting('sidebar_mode');jb();}});tb.getCore().subscribe('sidebar/typeahead/active',qb.updateOnActiveTypeahead);tb.subscribe('reset',function(){if(!tb.getCore().getValue()&&!sa.isVisible())qb.updateOnActiveTypeahead(null,false);});if(ya){tb.getCore().subscribe('sidebar/typeahead/preActive',function(xb,yb){if(ma&&va.getView().isVisible()){h.inform(xb,yb);}else jb();});}else h.subscribe('buddylist-nub/initialized',function(xb,yb){u.listen(yb.getButton(),'click',function(event){qb.enable();return !qb.shouldShowSidebar();});});ma=!!p.getSetting('sidebar_mode');z.subscribe('privacy-user-presence-changed',jb);jb();o.init(sa);if(ya){da.addLeft(qb.getVisibleWidth);}else da.addRight(qb.getVisibleWidth);qb.inform('sidebar/initialized',qb,h.BEHAVIOR_PERSISTENT);h.inform('sidebar/initialized',qb,h.BEHAVIOR_PERSISTENT);},updateOnActiveTypeahead:function(rb,sb){if(!oa)return;if(sb){sa.hide();if(ya){r.addClass(ta,"_5384");var tb=kb();if(cb)tb+=t.getElementDimensions(cb).height;ba.set(la,'height',tb+'px');}}else{sa.show();if(ya){ba.set(la,'height','auto');r.removeClass(ta,"_5384");h.inform('sidebar/typeahead/active',false);jb();}else jb();}},isInitialized:function(){return pa;},disable:function(){if(!qb.isEnabled())return;ma=false;mb();ib();},enable:function(){if(qb.isEnabled())return;ma=true;mb();jb();!function(){if(qb.isVisible())va.getCore().getElement().focus();}.defer();},forceEnsureLoaded:function(){if(qa)return;if(ka('pagelet_sidebar'))return;d(['UIPagelet'],function(rb){var sb=g.div({id:"pagelet_sidebar"},null);s.appendContent(document.body,sb);rb.loadFromEndpoint('SidebarPagelet','pagelet_sidebar');});qa=true;},ensureLoaded:function(){if(!ma)return;qb.forceEnsureLoaded();},hide:function(){if(na)return;na=true;ib();},unhide:function(){if(!na)return;na=false;jb();},getBody:function(){return la;},getRoot:function(){return ta;},getVisibleWidth:function(){if(!oa||!ta)return 0;if(xa===null)xa=ta.offsetWidth;return xa;},isEnabled:function(){return ma;},isViewportCapable:function(){wa=t.getViewportWithoutScrollbarDimensions();if(ya)return true;var rb=m.get('sidebar.minimum_width');return wa.width>rb;},shouldShowSidebar:function(){var rb=qb.isViewportCapable();return ya||(rb&&!na&&!ob()&&!v.shouldSuppressSidebar());},isVisible:function(){return oa;},resize:jb,toggle:function(){if(ya){ab.toggle();}else qb.isEnabled()?qb.disable():qb.enable();},isLitestandSidebar:function(){return ya;}};ea(qb,i);e.exports=qb;});
  46. __d("VideoCallingTour",["Arbiter","ArbiterMixin","Chat","ChatSidebar","ChatVisibility","CSS","DOM","PresencePrivacy","Run","Toggler","Vector","copyProperties"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('ArbiterMixin'),i=b('Chat'),j=b('ChatSidebar'),k=b('ChatVisibility'),l=b('CSS'),m=b('DOM'),n=b('PresencePrivacy'),o=b('Run'),p=b('Toggler'),q=b('Vector'),r=b('copyProperties'),s,t,u,v,w=[],x=function(){};function y(){if(j.isVisible()){z();}else if(u)aa();}function z(){s.setContext(t.getBody());ba();s.show();ca();}function aa(){if(!v)v=p.createInstance(u.getRoot());var fa=m.scry(u.getRoot(),'div.fbNubFlyout')[0];if(fa){s.setContext(fa);ba();s.show();ca();}}function ba(){var fa=q.getElementDimensions(s.getContext()).y;s.setOffsetY(fa*.6);s.updatePosition();}function ca(){if(u)w.push(u.subscribe('hide',function(){da();if(!j.isVisible())s.hide();}),u.subscribe('show',function(){s.show();}),u.subscribe('resize',function(){ba();s.updatePosition();}));w.push(g.subscribe('sidebar/show',z),g.subscribe('sidebar/hide',aa),g.subscribe('sidebar/resized',ba));}function da(){if(v){v.setSticky(false);v=null;}}function ea(){while(w.length)w.pop().unsubscribe();if(u)da();s.hide();l.show('fbVideoCallingGetStarted');}r(x,h,{start:function(fa){s=fa;l.hide('fbVideoCallingGetStarted');k.goOnline(function(){w.push(n.subscribe('privacy-user-presence-changed',ea));o.onLeave(ea);i.openBuddyList();var ga=null;w.push(j.subscribe('sidebar/initialized',function(ha,ia){t=ia;clearTimeout(ga);ga=y.defer();}),x.subscribe('videocallingtour/end',ea));w.push(g.subscribe('buddylist-nub/initialized',function(ha,ia){u=ia;clearTimeout(ga);ga=y.defer();}));});x.inform('videocallingtour/start');}});e.exports=x;});
  47. __d("ModuleDependencies",[],function(a,b,c,d,e,f){function g(k,l,m){var n=a.require.__debug.modules[m],o=a.require.__debug.deps;if(l[m])return;l[m]=true;if(!n){o[m]&&(k[m]=true);return;}if(!n.dependencies||!n.dependencies.length){if(n.waiting)k[m]=true;return;}n.dependencies.forEach(function(p){g(k,l,p);});}function h(k){if(a.require.__debug){var l={};g(l,{},k);var m=Object.keys(l);m.sort();return m;}return null;}function i(){var k={loading:{},missing:[]};if(!a.require.__debug)return k;var l={},m=a.require.__debug.modules,n=a.require.__debug.deps;for(var o in m){var p=m[o];if(p.waiting){var q={};g(q,{},p.id);delete q[p.id];k.loading[p.id]=Object.keys(q);k.loading[p.id].sort();k.loading[p.id].forEach(function(r){if(!(r in m)&&n[r])l[r]=1;});}}k.missing=Object.keys(l);k.missing.sort();return k;}var j={getMissing:h,getNotLoadedModules:i};e.exports=j;});
  48. __d("legacy:ChatTypeaheadBehavior",["ChatTypeaheadBehavior"],function(a,b,c,d){var e=b('ChatTypeaheadBehavior');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.chatTypeahead=function(f){f.enableBehavior(e);};},3);
  49. __d("ChatPeopleSuggestionList.react",["ReactDOM","ChatSidebarItem.react","fbt","React","ShortProfiles","PresenceStatus","cx"],function(a,b,c,d,e,f){var g=b('ReactDOM'),h=b('ChatSidebarItem.react'),i=b('fbt'),j=b('React'),k=b('ShortProfiles'),l=b('PresenceStatus'),m=b('cx'),n=j.createClass({displayName:'ChatPeopleSuggestionList',_renderPeopleList:function(){var o=[];this.props.uids.map(function(p){var q=k.getNow(p);if(q)o.push(g.li(null,h({isAdded:false,showEditButton:true,images:q.thumbSrc,name:q.name,status:l.get(p),onClick:this.props.onClick.curry(p)},null)));}.bind(this));return o;},render:function(){return (g.div(null,[g.div({className:"_57zm"},g.span({className:"_57zn"},"SUGGESTIONS")),g.ul({className:"_56ym"},this._renderPeopleList())]));}});e.exports=n;});
  50. __d("Dock",["function-extensions","Event","shield","WebMessengerWidthControl","Arbiter","ArbiterMixin","ChatQuietLinks","CSS","DataStore","DOM","Parent","Style","Toggler","Vector","copyProperties","csx","emptyFunction","ge"],function(a,b,c,d,e,f){b('function-extensions');var g=b('Event'),h=b('shield');b('WebMessengerWidthControl');var i=b('Arbiter'),j=b('ArbiterMixin'),k=b('ChatQuietLinks'),l=b('CSS'),m=b('DataStore'),n=b('DOM'),o=b('Parent'),p=b('Style'),q=b('Toggler'),r=b('Vector'),s=b('copyProperties'),t=b('csx'),u=b('emptyFunction'),v=b('ge');function w(){}s(w,j,{MIN_HEIGHT:140,INITIAL_FLYOUT_HEIGHT_OFFSET:10,init:function(x){this.init=u;this.rootEl=x;this.calculateViewportDimensions();this.calculateFlyoutHeightOffset();k.removeEmptyHrefs(this.rootEl);g.listen(x,'click',this._onClick.bind(this));g.listen(window,'resize',this._onWindowResize.bind(this));q.subscribe(['show','hide'],function(y,z){var aa=z.getActive();if(!n.contains(x,aa))return;if(l.hasClass(aa,'fbNub')){this.notifyNub(aa,y);if(y==='show')this._resizeNubFlyout(aa);}else{var ba=o.byClass(aa,'fbNubFlyout');if(ba)l.conditionClass(ba,'menuOpened',y==='show');}}.bind(this));this.inform('init',{},i.BEHAVIOR_PERSISTENT);},calculateViewportDimensions:function(){return (this.viewportDimensions=r.getViewportDimensions());},calculateFlyoutHeightOffset:function(){this.flyoutHeightOffset=this.INITIAL_FLYOUT_HEIGHT_OFFSET+r.getElementDimensions(this.rootEl).y;var x=v('blueBar');if(x){var y=p.isFixed(x)?'viewport':'document';this.flyoutHeightOffset+=r.getElementPosition(x,y).y+r.getElementDimensions(x).y;}},toggle:function(x){var y=this._findFlyout(x);if(!y)return;this.subscribe('init',function(){q.toggle(x);});},show:function(x){this.subscribe('init',function(){q.show(x);});},showNub:function(x){l.show(x);},hide:function(x){this.subscribe('init',function(){var y=q.getInstance(x);n.contains(x,y.getActive())&&y.hide();});},hideNub:function(x){l.hide(x);this.hide(x);},setUseMaxHeight:function(x,y){l.conditionClass(x,'maxHeight',y!==false);this._resizeNubFlyout(x);},_resizeNubFlyout:function(x){var y=this._findFlyout(x);if(!y||!(l.hasClass(x,'openToggler')||l.hasClass(x,'opened')))return;var z=n.find(y,'div.fbNubFlyoutOuter'),aa=n.find(z,'div.fbNubFlyoutInner'),ba=n.find(aa,'div.fbNubFlyoutBody'),ca=ba.scrollTop,da=ba.offsetHeight;p.set(ba,'height','auto');var ea=r.getElementPosition(y,'viewport'),fa=r.getElementDimensions(y),ga=r.getElementDimensions(ba),ha=this.getMaxFlyoutHeight(x);p.set(y,'max-height',ha+'px');p.set(z,'max-height',ha+'px');fa=r.getElementDimensions(y);var ia=r.getElementDimensions(aa),ja=ia.y-ga.y;if(fa.y>ja)p.set(ba,'height',(fa.y-ja)+'px');l.removeClass(y,'swapDirection');var ka=r.getElementPosition(y).x;l.conditionClass(y,'swapDirection',function(){if(ka<0)return true;return (ka+fa.x>this.viewportDimensions.x);}.bind(this)());if(ca+da>=ga.y){ba.scrollTop=ba.scrollHeight;}else ba.scrollTop=ca;this.notifyNub(x,'resize');},getMaxFlyoutHeight:function(x){var y=this._findFlyout(x),z=r.getElementPosition(y,'viewport'),aa=r.getElementDimensions(y),ba=Math.max(this.MIN_HEIGHT,this.viewportDimensions.y-this.flyoutHeightOffset)-(this.viewportDimensions.y-z.y-aa.y);return Math.max(ba,0);},resizeAllFlyouts:function(){var x=n.scry(this.rootEl,"div._50-v.openToggler");x=x.concat(n.scry(this.rootEl,"div._50-v.opened"));var y=x.length;while(y--)this._resizeNubFlyout(x[y]);},_onClick:function(event){var x=event.getTarget(),y=o.byClass(x,'fbNub');if(y){if(o.byClass(x,'fbNubFlyoutTitlebar')){var z=o.byTag(x,'a'),aa=x.nodeName=='INPUT'&&x.getAttribute('type')=='submit';if(!z&&!aa){this.hide(y);return false;}}this.notifyNub(y,'click');}},_onWindowResize:function(event){this.calculateViewportDimensions();this.resizeAllFlyouts();},_findFlyout:function(x){return l.hasClass(x,'fbNubFlyout')?x:n.scry(x,'div.fbNubFlyout')[0]||null;},registerNubController:function(x,y){m.set(x,'dock:nub:controller',y);y.subscribe('nub/button/content-changed',h(this.inform,this,'resize',x));y.subscribe('nub/flyout/content-changed',h(this._resizeNubFlyout,this,x));},unregisterNubController:function(x){m.remove(x,'dock:nub:controller');},notifyNub:function(x,y,z){var aa=m.get(x,'dock:nub:controller');aa&&aa.inform(y,z);}});e.exports=a.Dock||w;});
  51. __d("NubController",["ArbiterMixin","Dock","copyProperties"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('Dock'),i=b('copyProperties');function j(){}i(j.prototype,g,{init:function(k){this.el=k;h.registerNubController(k,this);return this;},buttonContentChanged:function(){this.inform('nub/button/content-changed');},flyoutContentChanged:function(){this.inform('nub/flyout/content-changed');},hide:function(){h.hide(this.el);},show:function(){h.show(this.el);}});e.exports=j;});
  52. __d("DropdownContextualHelpLink",["DOM","ge"],function(a,b,c,d,e,f){var g=b('DOM'),h=b('ge'),i={set:function(j){var k=h('navHelpCenter');if(k!==null)g.replace(k,j);}};e.exports=i;});
  53. __d("ChatActivity",["Event","Arbiter","AvailableList","AvailableListConstants","JSLogger","MercuryConfig","PresenceState","UserActivity","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('AvailableList'),j=b('AvailableListConstants'),k=b('JSLogger'),l=b('MercuryConfig'),m=b('PresenceState'),n=b('UserActivity'),o=b('copyProperties'),p=l.activity_limit||60000,q=l.idle_limit||1800000,r=l.idle_poll_interval||300000,s=k.create('chat_activity'),t=Date.now(),u=t,v=true;function w(){var aa=Date.now();return !!(v&&(aa-t<p));}var x=o(new h(),{isActive:w});function y(){var aa=t;t=Date.now();if(t-aa>q){s.debug('idle_to_active',aa);m.doSync();}x.inform('activity');}i.subscribe(j.ON_AVAILABILITY_CHANGED,function(){if(!i.isUserIdle())u=Date.now();});g.listen(window,'focus',function(){v=true;y();});g.listen(window,'blur',function(){v=false;});n.subscribe(function(){y();});function z(aa){var ba=aa&&aa.at&&m.verifyNumber(aa.at);if(typeof ba!=='number')ba=null;return ba||0;}setInterval(function(){var aa=Date.now(),ba=z(m.get()),ca=Math.max(t,ba,u);if(aa-ca>q){s.debug('idle',{cookie:ba,local:t,presence:u});x.inform('idle',aa-ca);}},r);m.registerStateStorer(function(aa){var ba=z(aa);if(ba<t)aa.at=t;return aa;});h.subscribe(k.DUMP_EVENT,function(aa,ba){ba.chat_activity={activity_limit:p,idle_limit:q,idle_poll_interval:r,last_active_time:t,last_global_active_time:u};});e.exports=x;});
  54. __d("MercuryNotificationRenderer",["MercuryAssert","MercuryMessages","MercuryParticipants","MercuryThreads","tx"],function(a,b,c,d,e,f){var g=b('MercuryAssert'),h=b('MercuryMessages').get(),i=b('MercuryParticipants'),j=b('MercuryThreads').get(),k=b('tx');function l(m,n){g.isThreadID(m);j.getThreadMeta(m,function(o){h.getThreadMessagesRange(m,0,1,function(p){var q=p.length&&p[p.length-1];if(q&&q.author!=i.user){i.get(q.author,function(r){if(o.name){n(k._("{senderName} messaged {groupName}",{senderName:r.short_name,groupName:o.name}));}else n(k._("{name} messaged you",{name:r.short_name}));});}else n("New message!");});});}e.exports={renderDocumentTitle:l};});
  55. __d("MercuryTimestampTracker",["MercuryActionTypeConstants","MercuryPayloadSource","MercurySingletonMixin","MercuryServerRequests","copyProperties"],function(a,b,c,d,e,f){var g=b('MercuryActionTypeConstants'),h=b('MercuryPayloadSource'),i=b('MercurySingletonMixin'),j=b('MercuryServerRequests'),k=b('copyProperties');function l(m){this._fbid=m;this._serverRequests=j.getForFBID(this._fbid);this._lastTimestamp=0;this._serverRequests.subscribe('update-messages',function(n,o){if(!o.actions||!o.actions.length)return;if(o.payload_source==h.CLIENT_SEND_MESSAGE||o.payload_source==h.UNKNOWN)return;for(var p=0;p<o.actions.length;p++){var q=o.actions[p],r=q.action_type;if(r==g.USER_GENERATED_MESSAGE&&q.thread_id&&q.timestamp>this._lastTimestamp)this._lastTimestamp=q.timestamp;}}.bind(this));}k(l.prototype,{getLastUserMessageTimestamp:function(){return this._lastTimestamp;}});k(l,i);e.exports=l;});
  56. __d("ChatTitleBarBlinker",["ChatActivity","DocumentTitle","JSLogger","MercuryThreadInformer","MercuryNotificationRenderer","PresenceState","MercuryTimestampTracker"],function(a,b,c,d,e,f){var g=b('ChatActivity'),h=b('DocumentTitle'),i=b('JSLogger'),j=b('MercuryThreadInformer').get(),k=b('MercuryNotificationRenderer'),l=b('PresenceState'),m=b('MercuryTimestampTracker').get(),n=i.create('chat_title'),o=null,p=0,q=false;function r(){if(o){o.stop();o=null;return true;}return false;}function s(x){var y=x||m.getLastUserMessageTimestamp();if(p<=y){p=y;if(r()||q)l.doSync();}}var t={blink:function(x,y){if(!o&&p<y)k.renderDocumentTitle(x,function(z){if(!o)o=h.blink(z);});},stopBlinking:function(){s();},blinkingElsewhere:function(){q=true;}};function u(x){var y=l.verifyNumber(x.sb2);if(!y||y<=p)return null;return y;}function v(x){var y=x&&u(x);if(y){p=y;n.debug('load',p);r();q=false;}}function w(x){var y=u(x);if(!y){n.debug('store',p);x.sb2=p;q=false;}return x;}l.registerStateStorer(w);l.registerStateLoader(v);j.subscribe('thread-read-changed',function(x,y){var z=m.getLastUserMessageTimestamp(),aa=0;for(var ba in y)if(y[ba].mark_as_read&&y[ba].timestamp>=z&&y[ba].timestamp>aa)aa=y[ba].timestamp;aa&&s(aa);});g.subscribe('activity',function(){s();});(function(){var x=l.getInitial();if(x)p=u(x)||0;})();e.exports=t;});
  57. __d("MercuryBrowserAlerts",["ArbiterMixin","ChatActivity","ChatConfig","ChatOptions","ChatTitleBarBlinker","MercuryConfig","MercuryParticipants","MercuryThreadMuter","MercuryThreads","MessagingTag","Sound","copyProperties"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('ChatActivity'),i=b('ChatConfig'),j=b('ChatOptions'),k=b('ChatTitleBarBlinker'),l=b('MercuryConfig'),m=b('MercuryParticipants'),n=b('MercuryThreadMuter'),o=b('MercuryThreads').get(),p=b('MessagingTag'),q=b('Sound'),r=b('copyProperties');q.init(['audio/ogg','audio/mpeg']);function s(u){if(j.getSetting('sound'))q.play([i.get('sound.notif_ogg_url'),i.get('sound.notif_mp3_url')],u,false);}var t={messageReceived:function(u){if(u.author==m.user||!u.is_unread||(u.folder!=p.INBOX&&u.folder!=p.ARCHIVED))return;var v=u.thread_id,w=h.isActive();if(w){var x=false;t.inform('before-alert',{threadID:v,cancelAlert:function(){x=true;}});}o.getThreadMeta(v,function(y){var z=n.isThreadMuted(y);if(l.MuteThreadsOnDesktopGK&&z)return;var aa=u.timestamp;if(w){!x&&s(aa);}else{k.blink(v,aa);s(aa);}k.blinkingElsewhere();}.bind(this));}};e.exports=r(t,g);});
  58. __d("ActiveXSupport",[],function(a,b,c,d,e,f){var g=null,h={isSupported:function(){if(g!==null)return g;try{g=!!window.ActiveXObject&&!!new ActiveXObject("htmlfile");}catch(i){g=false;}return g;}};e.exports=h;});
  59. __d("VideoCallRecordMessageDialog",["AsyncDialog","AsyncRequest","Dialog","URI","tx"],function(a,b,c,d,e,f){var g=b('AsyncDialog'),h=b('AsyncRequest'),i=b('Dialog'),j=b('URI'),k=b('tx'),l={get:function(m,n){var o="Would you like to leave a message?",p="New Message";return new i().setTitle(k._("{firstname} is Unavailable",{firstname:n})).setBody(o).setButtons([{name:'record-message',label:p},i.CANCEL]).setHandler(function(){var q=j('/ajax/messaging/composer.php').setQueryData({ids:[m],autoloadvideo:true}).toString();g.send(new h(q));});}};e.exports=l;});
  60. __d("VideoCallCore",["Event","ActiveXSupport","Arbiter","AsyncRequest","AvailableList","AvailableListConstants","Bootloader","ChannelConstants","Cookie","CSS","Dialog","MercuryConfig","UserAgent","emptyFunction","ge","ShortProfiles","VideoCallRecordMessageDialog"],function(a,b,c,d,e,f){var g=b('Event'),h=b('ActiveXSupport'),i=b('Arbiter'),j=b('AsyncRequest'),k=b('AvailableList'),l=b('AvailableListConstants'),m=b('Bootloader'),n=b('ChannelConstants'),o=b('Cookie'),p=b('CSS'),q=b('Dialog'),r=b('MercuryConfig'),s=b('UserAgent'),t=b('emptyFunction'),u=b('ge'),v=[],w=[],x={isSupported:function(){if(s.windows()){if(s.ie()>=9&&!s.ie64()){return h.isSupported();}else return (s.ie()>=7&&!s.ie64())||s.firefox()>=3.6||s.chrome()>=5||s.opera()>=12;}else if(s.osx()>10.4)return (s.firefox()>=3.6||s.chrome()>=5||s.webkit()>=500||s.opera()>=12);return false;},isInstalled:function(){var ba=false;if(this.isSupported())if(y()){var ca=null;try{ca=new ActiveXObject('SkypeLimited.SkypeWebPlugin');ba=!!ca;}catch(da){}ca=null;}else{ba=z();if(r.VideoCallingNoJavaGK)if(ba&&s.osx()>=10.8)if(ba.description&&ba.description.charAt(0)!='v')ba=false;}return ba;},mightReloadPostInstall:function(){return s.windows();},onVideoMessage:function(ba){v.push(ba);m.loadModules(['VideoCallController'],t);},onRTCMessage:function(ba){if(r.NewVCGK){w.push(ba);m.loadModules(['FBRTCCallController'],t);}},setMessageHandler:function(ba){this.onVideoMessage=ba;if(ba)while(v.length)ba(v.shift());},setRTCMessageHandler:function(ba){this.onRTCMessage=ba;if(ba)while(w.length)ba(w.shift());},availableForCall:function(ba){var ca=k.get(ba);return ca==l.ACTIVE||ca==l.IDLE;},onProfileButtonClick:function(ba){x.startCallOrLeaveMessage(ba,'profile_button_click');},attachListenerToProfileButton:function(ba){var ca=u('videoCallProfileButton');if(ca){if(!x.isSupported()){p.hide(ca);return;}g.listen(ca,'click',function(event){x.startCallOrLeaveMessage(ba,'profile_button_click_timeline');});}},startCallOrLeaveMessage:function(ba,ca){if(this.availableForCall(ba)){x.showOutgoingCallDialog(ba,ca);}else b('ShortProfiles').get(ba,function(da){b('VideoCallRecordMessageDialog').get(ba,da.firstName).show();});},showOutgoingCallDialog:function(ba,ca){var da=ca||'unknown';x.logClick(ba,da);var ea=x.isInstalled()||r.NewVCGK?'outgoing_dialog.php':'intro.php',fa='/ajax/chat/video/'+ea+'?idTarget='+ba;new q().setAllowCrossPageTransition(true).setAsync(new j(fa)).show();},logClick:function(ba,ca){new j().setURI('/ajax/chat/video/log_click.php').setData({targetUserID:ba,clickSource:ca}).setAllowCrossPageTransition(true).setErrorHandler(t).send();}};function y(){return s.ie()&&s.windows()&&!s.opera();}function z(){if(!navigator)return null;navigator.plugins.refresh(false);var ba=navigator.mimeTypes['application/skypesdk-plugin'];return ba&&ba.enabledPlugin;}function aa(){if(!x.mightReloadPostInstall())return;var ba=o.get('vcpwn');if(ba){o.clear('vcpwn');var ca=o.get('vctid');if(ca){o.clear('vctid');if(o.get('vctid'))return;if(ca&&x.isInstalled()){var da='/ajax/chat/video/outgoing_dialog.php?idTarget='+ca;new q().setAllowCrossPageTransition(true).setAsync(new j(da)).show();}}}}i.subscribe(n.getArbiterType('video'),function(ba,ca){x.onVideoMessage(ca.obj);});i.subscribe(n.getArbiterType('webrtc'),function(ba,ca){x.onRTCMessage(ca.obj);});i.subscribe(n.getArbiterType('chat_event'),function(ba,ca){if(ca.obj.event_name=="missed-call")m.loadModules(['VideoCallController'],function(da){da.onMissedCallEvent(ca.obj);});});aa();e.exports=x;});
  61. __d("ChatApp",["CSS","JSLogger"],function(a,b,c,d,e,f){var g=b('CSS'),h=b('JSLogger'),i=false,j=false,k=false,l=null,m={init:function(n,o,p){if(l){h.create('chat_app').error('repeated_init');return;}l=n;d(['TabsViewport','ChatTabController','ChatTabViewCoordinator','MercuryServerRequests','MercuryChannelHandler','MercuryStateCheck'],function(q,r,s,t,u,v){t.get().handleUpdate(p);this.tabsViewport=new q(o);this.tabController=new r(this.tabsViewport);this.tabViewCoordinator=new s(o,this.tabsViewport);i=j=true;}.bind(this));},hide:function(){if(!i||k)return;g.hide(l);k=true;},unhide:function(){if(i){if(k){g.show(l);this.tabsViewport.checkWidth();d(['Dock'],function(n){n.resizeAllFlyouts();});k=false;}}else if(!j){d(['UIPagelet'],function(n){n.loadFromEndpoint('ChatTabsPagelet','ChatTabsPagelet');n.loadFromEndpoint('BuddylistPagelet','BuddylistPagelet');});j=true;}}};e.exports=m;});
  62. __d("DataViewPolyfill",["copyProperties"],function(a,b,c,d,e,f){var g=b('copyProperties');function h(i,j,k){if(j===undefined){this._ba=new Uint8Array(i);}else if(k===undefined){this._ba=new Uint8Array(i,j);}else this._ba=new Uint8Array(i,j,k);this.byteLength=this._ba.byteLength;}g(h,{isSupported:function(){return !!a.Uint8Array;}});g(h.prototype,{getUint8:function(i){if(i>=this._ba.length)throw new Error('Trying to read beyond bounds of DataViewPolyfill');return this._ba[i];},getUint16:function(i,j){var k=this.getUint8(i),l=this.getUint8(i+1);return j?(l*256)+k:(k*256)+l;},getUint32:function(i,j){var k=this.getUint8(i),l=this.getUint8(i+1),m=this.getUint8(i+2),n=this.getUint8(i+3);return j?(((n*256+m)*256+l)*256)+k:(((k*256+l)*256+m)*256)+n;}});e.exports=h;});
  63. __d("getImageSize",["DataViewPolyfill"],function(a,b,c,d,e,f){var g=b('DataViewPolyfill'),h=a.DataView||g;function i(m){return {width:m.getUint16(6,true),height:m.getUint16(8,true)};}function j(m){return {width:m.getUint32(16,false),height:m.getUint32(20,false)};}function k(m){var n=m.byteLength,o=2;while(o<n){var p=m.getUint16(o,false);o+=2;if(p==65472||p==65474){return {width:m.getUint16(o+5,false),height:m.getUint16(o+3,false)};}else o+=m.getUint16(o,false);}return null;}function l(m){var n=new h(m);if(n.getUint8(0)==255&&n.getUint8(1)==216)return k(n);if(n.getUint8(0)==71&&n.getUint8(1)==73&&n.getUint8(2)==70)return i(n);if(n.getUint8(0)==137&&n.getUint8(1)==80&&n.getUint8(2)==78&&n.getUint8(3)==71)return j(n);return null;}e.exports=l;l.gif=i;l.png=j;l.jpeg=k;});
  64. __d("ChatAutoSendPhotoUploader",["ArbiterMixin","DOM","Event","FileForm","FileFormResetOnSubmit","FileInput","FormSubmitOnChange","MercuryAttachmentType","SubscriptionsHandler","copyProperties","csx","getImageSize","removeFromArray","shield"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('DOM'),i=b('Event'),j=b('FileForm'),k=b('FileFormResetOnSubmit'),l=b('FileInput'),m=b('FormSubmitOnChange'),n=b('MercuryAttachmentType'),o=b('SubscriptionsHandler'),p=b('copyProperties'),q=b('csx'),r=b('getImageSize'),s=b('removeFromArray'),t=b('shield'),u=0;function v(w,x,y){this._idElem=y;this._input=x;this._subscriptionsHandler=new o();this._uploadBatches=[];var z=new j(w,[m,k]),aa=h.find(w,"._4q60"),ba=h.find(aa,"._4q61");new l(aa,ba,x);this._subscriptionsHandler.addSubscriptions(z.subscribe('submit',this._onFileSubmit.bind(this)),z.subscribe('success',this._onFileUploadSuccess.bind(this)),z.subscribe('failure',this._onFileUploadFailure.bind(this)),i.listen(ba,'click',t(this.inform,this,'open')));}p(v.prototype,g,{isUploading:function(){return this._uploadBatches.length>0;},destroy:function(){this._subscriptionsHandler.release();},_getPreviewAttachment:function(w){var x={attach_type:n.PHOTO,preview_uploading:true};if(w){x.preview_width=w.width;x.preview_height=w.height;}return x;},_onFileSubmit:function(){u+=1;var w='upload_'+u;this._idElem.value=w;this._uploadBatches.push(w);if(typeof FileReader!=='undefined'&&FileReader.prototype.readAsArrayBuffer&&this._input.files&&this._input.files.length===1){var x=new FileReader();x.onload=function(){this.inform('submit',{upload_id:w,raw_attachments:[this._getPreviewAttachment(r(x.result))]});}.bind(this);x.onerror=function(){this.inform('submit',{upload_id:w,raw_attachments:[this._getPreviewAttachment(null)]});}.bind(this);x.readAsArrayBuffer(this._input.files[0]);}else{var y=1;if(this._input.files)y=this._input.files.length;var z=[];for(var aa=0;aa<y;++aa)z.push(this._getPreviewAttachment(null));this.inform('submit',{upload_id:w,raw_attachments:z});}},_onFileUploadSuccess:function(event,w){var x=w.response.getPayload(),y=x.metadata,z=x.uploadID;s(this._uploadBatches,z);var aa=[];for(var ba=0;ba<y.length;++ba)aa.push(y[ba]);this.inform('all-uploads-completed',{upload_id:x.uploadID,attachments:aa});},_onFileUploadFailure:function(event,w){var x=this._uploadBatches[this._uploadBatches.length-1];s(this._uploadBatches,x);this.inform('all-uploads-failed',{upload_id:x});}});e.exports=v;});
  65. __d("ChatTabModel",["function-extensions","Arbiter","ArbiterMixin","ChatBehavior","ChatConfig","JSLogger","MercuryAssert","MercuryServerRequests","MercuryThreads","MercuryTimestampTracker","PresenceInitialData","PresenceState","PresenceUtil","areObjectsEqual","copyProperties"],function(a,b,c,d,e,f){b('function-extensions');var g=b('Arbiter'),h=b('ArbiterMixin'),i=b('ChatBehavior'),j=b('ChatConfig'),k=b('JSLogger'),l=b('MercuryAssert'),m=b('MercuryServerRequests').get(),n=b('MercuryThreads').get(),o=b('MercuryTimestampTracker').get(),p=b('PresenceInitialData'),q=b('PresenceState'),r=b('PresenceUtil'),s=b('areObjectsEqual'),t=b('copyProperties'),u=[],v=null,w=null,x=null,y=null;function z(){return parseInt(p.serverTime,10);}var aa=j.get('tab_max_load_age')||3600000,ba=z()-aa,ca=0,da=20,ea=k.create('chat_tab_model'),fa=false;function ga(xa){var ya=q.verifyNumber(xa.uct2);if(!ya||typeof ya!=='number'){ea.warn('bad_cookie_version',xa.uct2);return null;}if(ya<ca||ya<ba)return null;return ya;}function ha(xa){var ya=ga(xa);if(!ya){var za={};za.old_tabs=xa&&xa.t2&&JSON.stringify(xa.t2);za.old_promoted=xa&&xa.lm2;za.old_time=xa&&xa.uct2;za.old_reason=xa&&xa.tr;za.old_window=xa&&xa.tw;var ab;if(w&&xa.t2)for(var bb=0;bb<xa.t2.length;bb++){var cb=xa.t2[bb];if(cb.i===w)ab=cb.r;}var db=[];u.forEach(function(eb){if(!eb.fragile){var fb={i:eb.id,si:eb.server_id};if(eb.raised||(eb.id===w&&ab))fb.r=1;db.push(fb);}});xa.t2=db;xa.uct2=ca;xa.lm2=v;xa.tr=y;xa.tw=r.getSessionID();za.new_tabs=JSON.stringify(xa.t2);za.new_promoted=xa.lm2;za.new_time=xa.uct2;za.new_reason=xa.tr;za.new_window=xa.tw;ea.debug('store',za);}return xa;}function ia(xa){if(xa){var ya=ga(xa);if(ya&&ya!==ca){var za={};za.old_tabs=JSON.stringify(u);za.old_promoted=v;za.old_time=ca;za.old_reason=y;za.window_id=r.getSessionID();za.cookie_tabs=xa&&xa.t2&&JSON.stringify(xa.t2);za.cookie_promoted=xa&&xa.lm2;za.cookie_time=xa&&xa.uct2;za.cookie_reason=xa&&xa.tr;za.cookie_window=xa&&xa.tw;ca=ya;y='load';var ab=ja(xa.t2,xa.lm2||null);za.load_result=ab;za.new_tabs=JSON.stringify(u);za.new_promoted=v;za.new_time=ca;za.new_reason=y;var event='load';if(!fa)event+='_init';ea.log(event,za);return ab;}}return false;}function ja(xa,ya){if(ka(xa,ya)){var za=u.filter(function(cb){return cb.fragile;}),ab={};v=null;u=xa.map(function(cb){var db={id:cb.i,server_id:cb.si};if(db.id==ya)v=db.id;if(w==cb.i){var eb=pa(w);if(eb!=-1){db.raised=u[eb].raised;return db;}else return null;}if(cb.r)db.raised=true;ab[db.id]=db;return db;});u=u.filter(function(cb){return cb!=null;});if(x)for(var bb in x)if(!ab[bb]||!ab[bb].raised)delete x[bb];za=za.filter(function(cb){return !ab[cb.id];});u=u.concat(za);oa();return true;}return false;}function ka(xa,ya){if(ya!=v)return true;var za=u.filter(function(cb){return !cb.fragile;});if(xa.length!=za.length)return true;for(var ab=0,bb=xa.length;ab<bb;ab++){if(xa[ab].id===w)continue;if(!s(xa[ab],za[ab]))return true;}return false;}function la(xa,ya,za){var ab=ia(q.get());if(ya===undefined||ya>ca){if(xa()){ab=true;y=za||null;na(ya);}}else ea.error('rejected',{change_time:ya,state_time:ca});ab&&ma();}function ma(){if(fa)va.inform('chat/tabs-changed',va.get());}function na(xa){if(xa===undefined)xa=Math.max(o.getLastUserMessageTimestamp()||1,ca+1);ca=xa;q.doSync();}function oa(){var xa=u.length-da;if(xa>0)u=u.filter(function(ya){return ya.raised||xa--<=0;});}function pa(xa){for(var ya=0;ya<u.length;ya++)if(u[ya].id==xa)return ya;return -1;}function qa(xa,ya){var za=n.getThreadMetaNow(xa);if(!za)return false;if(za.is_canonical_user){return sa(xa,ya);}else{var ab=ra(xa);if(ab)m.getServerThreadID(xa,function(bb){if(ta(xa,bb)){na();ma();}});return ab;}}function ra(xa){if(pa(xa)===-1){u.push({id:xa,fragile:true});ea.log('open_fragile_tab',{tabs:JSON.stringify(u),opened:xa,window_id:r.getSessionID()});return true;}return false;}function sa(xa,ya){var za=pa(xa);if(za!=-1)if(u[za].fragile){u.splice(za,1);}else{u[za].signatureID=ya;return true;}for(var ab=0;ab<=u.length;ab++)if(ab==u.length||u[ab].fragile){u.splice(ab,0,{id:xa,signatureID:ya});oa();ea.log('open_tab',{tabs:JSON.stringify(u),opened:xa,window_id:r.getSessionID()});return true;}}function ta(xa,ya){var za=pa(xa);if(za!=-1&&u[za].fragile){var ab=u[za];ab.fragile=false;ab.server_id=ya;var bb=[];u.forEach(function(cb){if(cb.id!=xa){if(ab&&cb.fragile){bb.push(ab);ab=null;}bb.push(cb);}});if(ab)bb.push(ab);u=bb;ea.log('make_permanent',{tabs:JSON.stringify(u),tab_id:xa,window_id:r.getSessionID()});return true;}return false;}function ua(xa){var ya=pa(xa);if(xa==v)v=null;if(ya!=-1){u.splice(ya,1);ea.log('close_tab',{tabs:JSON.stringify(u),closed:xa,window_id:r.getSessionID()});return true;}return false;}q.registerStateStorer(ha);q.registerStateLoader(function(xa){if(ia(xa))ma();});function va(){}t(va,h,{indexOf:function(xa){return pa(xa);},getTab:function(xa){l.isThreadID(xa);var ya=this.indexOf(xa);if(ya>-1){var za=u[ya];return t({},za);}return null;},getEmptyTab:function(){for(var xa=0;xa<u.length;xa++){var ya=u[xa].id;if(n.isNewEmptyLocalThread(ya))return ya;}return null;},getServerTime:function(){return z();},closeAllTabs:function(){if(u.length){ea.log('close_all_tabs',{closed_tabs:JSON.stringify(u),window_id:r.getSessionID()});u=[];v=null;if(x)x={};na();ma();}},closeFragileTabs:function(){var xa=[];for(var ya=0;ya<u.length;ya++)if(u[ya].fragile){xa.push(u[ya]);u.splice(ya);ma();break;}ea.log('close_fragile_tabs',{tabs:JSON.stringify(u),fragile_closed:xa,window_id:r.getSessionID()});},closeTab:function(xa,ya){l.isThreadID(xa);var za=false;if(x){delete x[xa];za=true;}la(function(){if(ua(xa))za=true;return za;},undefined,ya);},closeTabAndDemote:function(xa,ya,za){l.isThreadID(xa);var ab=false;if(x){delete x[xa];ab=true;}la(function(){if(ua(xa)){if(v){var bb=pa(v);if(bb>ya){var cb=u.splice(bb,1)[0];u.splice(ya,0,cb);v=null;}}ab=true;}return ab;},undefined,za);},raiseTab:function(xa,ya,za){l.isThreadID(xa);var ab=false;if(x&&ya){x[xa]=true;ab=true;}if(!ya&&xa===w){ab&&ma();return;}la(function(){if(qa(xa,za))ab=true;var bb=pa(xa);if(bb!=-1&&!u[bb].raised){u[bb].raised=true;ab=true;ea.log('raise_tab',{tabs:JSON.stringify(u),raised:xa,window_id:r.getSessionID()});}return ab;});},get:function(){var xa=u.map(function(ya){var za=t({},ya);delete za.fragile;if(x)za.raised=x[za.id];return za;});return {tabs:xa,promoted:v};},openFragileTab:function(xa){l.isThreadID(xa);if(ra(xa))ma();},openTab:function(xa){l.isThreadID(xa);la(qa.curry(xa));},lowerTab:function(xa){l.isThreadID(xa);var ya=false;if(x){delete x[xa];ya=true;}la(function(){var za=pa(xa);if(za!=-1&&u[za].raised){delete u[za].raised;ea.log('lower_tab',{tabs:JSON.stringify(u),lowered:xa,window_id:r.getSessionID()});ya=true;}return ya;});},raiseAndPromoteTab:function(xa,ya,za,ab,bb){l.isThreadID(xa);var cb=false;if(x&&ya){x[xa]=true;cb=true;}if(!ya&&xa===w){cb&&ma();return;}la(function(){if(qa(xa,za))cb=true;var db=pa(xa);if(db!=-1&&(!u[db].raised||v!=xa)){u[db].raised=true;v=xa;cb=true;ea.log('raise_and_promote_tab',{tabs:JSON.stringify(u),promoted:xa,window_id:r.getSessionID()});}return cb;},ab,bb);},promoteThreadInPlaceOfThread:function(xa,ya){l.isThreadID(xa);l.isThreadID(ya);la(function(){var za=pa(xa),ab=pa(ya);if(v===ya)v=xa;var bb=u[za];u[za]=u[ab];u[ab]=bb;return true;});},squelchTab:function(xa){l.isThreadID(xa);w=xa;this.lowerTab(xa);ea.log('squelch_tab',{squelched:xa,tabs:JSON.stringify(u),window_id:r.getSessionID()});},clearSquelchedTab:function(){if(w)ea.log('unsquelch_tab',{squelched:w,tabs:JSON.stringify(u),window_id:r.getSessionID()});w=null;},persistLocalRaised:function(){if(x){la(function(){var xa=false;u.forEach(function(ya){if(ya.raised!=x[ya.id]){xa=true;if(x[ya.id]){ya.raised=true;}else delete ya.raised;}});return xa;});ea.log('persist_local_raise',{tabs:JSON.stringify(u),window_id:r.getSessionID()});}}});g.subscribe(k.DUMP_EVENT,function(xa,ya){ya.chat_tabs={promoted:v,tabs:u.map(function(za){return t({},za);}),time:ca,max_load_age:aa};});function wa(){var xa=i.ignoresRemoteTabRaise();if(xa&&!x){ea.log('start_ignore_remote_raise');x={};ma();}else if(!xa&&x){ea.log('stop_ignore_remote_raise');x=null;ma();}}i.subscribe(i.ON_CHANGED,wa);wa();ia(q.getInitial(),true);if(ca===0)ca=z()-600000;fa=true;e.exports=va;});
  66. __d("VideoCallPromo",["ArbiterMixin","AsyncRequest","ChatConfig","ChatVisibility","LegacyContextualDialog","CSS","MercuryParticipants","MercuryThreads","ChatTabTemplates","VideoCallCore","copyProperties","emptyFunction"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('AsyncRequest'),i=b('ChatConfig'),j=b('ChatVisibility'),k=b('LegacyContextualDialog'),l=b('CSS'),m=b('MercuryParticipants'),n=b('MercuryThreads').get(),o=b('ChatTabTemplates'),p=b('VideoCallCore'),q=b('copyProperties'),r=b('emptyFunction');function s(){this._dialog=null;}function t(v){if(!(p.isSupported()&&i.get('video.show_promo')))return false;var w=n.getCanonicalUserInThread(v);if(!w)return false;return j.isOnline()&&p.availableForCall(w);}function u(v){new h().setURI('/ajax/chat/video/log_promo.php').setData({viewedUserID:v}).setAllowCrossPageTransition(true).setErrorHandler(r).send();}q(s.prototype,g);q(s.prototype,{render:function(v,w){var x=t(w);if(!x)return;var y=n.getCanonicalUserInThread(w);m.get('fbid:'+y,function(z){if(!z.call_promo)return;var aa=o[':fb:mercury:call:promo'].build();this._dialog=new k();this._dialog.init(aa.getRoot()).setWidth(250).setAlignH('center').setContext(v).show();l.addClass(this._dialog.getRoot(),'uiContextualDialogWithFooterArrowBottom');l.addClass(v,'video_call_promo');u(n.getCanonicalUserInThread(w));this.inform('chat/dialog-rendered',{dialog:this,thread_id:w});}.bind(this));},updatePosition:function(){if(this._dialog&&this._dialog.isShown())this._dialog.updatePosition();},hide:function(){if(this._dialog&&this._dialog.isShown()){this._dialog.hide();this._dialog=null;}}});e.exports=s;});
  67. __d("VideoCallTourDialog",["ArbiterMixin","LegacyContextualDialog","CSS","MercuryThreads","ChatTabTemplates","VideoCallCore","VideoCallingTour","copyProperties"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('LegacyContextualDialog'),i=b('CSS'),j=b('MercuryThreads').get(),k=b('ChatTabTemplates'),l=b('VideoCallCore'),m=b('VideoCallingTour'),n=b('copyProperties');function o(){this._dialog=null;}n(o.prototype,g);n(o.prototype,{render:function(p,q){var r=j.getCanonicalUserInThread(q);if(!r||!l.availableForCall(r))return;var s=k[':fb:mercury:call:tour'].build();this._dialog=new h();this._dialog.init(s.getRoot()).setWidth(250).setAlignH('center').setContext(p).show();i.addClass(this._dialog.getRoot(),'uiContextualDialogWithFooterArrowBottom');i.addClass(p,'video_call_tour');this.inform('chat/dialog-rendered',{dialog:this,thread_id:q});m.inform('videocallingtour/end');},updatePosition:function(){if(this._dialog&&this._dialog.isShown())this._dialog.updatePosition();},hide:function(){if(this._dialog&&this._dialog.isShown()){this._dialog.hide();this._dialog=null;}}});e.exports=o;});
  68. __d("ChatContextualDialogController",["Event","ArbiterMixin","ChatTabModel","VideoCallingTour","VideoCallPromo","VideoCallTourDialog","copyProperties","setTimeoutAcrossTransitions"],function(a,b,c,d,e,f){var g=b('Event'),h=b('ArbiterMixin'),i=b('ChatTabModel'),j=b('VideoCallingTour'),k=b('VideoCallPromo'),l=b('VideoCallTourDialog'),m=b('copyProperties'),n=b('setTimeoutAcrossTransitions'),o=60000,p=false,q=false,r=function(y,z){this._videoCallPromo=new k();this._videoCallTour=new l();this._threadID=y;this._tabMainElement=z;this._openDialog=null;this._subscriptionTokens=[];this._scrollListener=null;this._timeout=null;};function s(y,event,z){if(y._openDialog)y._openDialog.updatePosition();}function t(y){if(y._openDialog)y._openDialog.updatePosition();}function u(y){if(y._openDialog){y._openDialog.hide();y._openDialog=null;}if(y._timeout){clearTimeout(y._timeout);y._timeout=null;}while(y._subscriptionTokens.length)y._subscriptionTokens.pop().unsubscribe();if(y._scrollListener){y._scrollListener.remove();y._scrollListener=null;}}function v(y,event,z){if(z.thread_id===y._threadID){y._openDialog=z.dialog;p=true;x(y);y._timeout=n(y.destroy.bind(y,y._threadID),o);y._scrollListener=g.listen(window,'scroll',t.curry(y));}}function w(y,z){if(!y._openDialog){y._subscriptionTokens.push(z.subscribe('chat/dialog-rendered',v.curry(y)));z.render(y._tabMainElement,y._threadID);}}function x(y){y._subscriptionTokens.push(i.subscribe('chat/tabs-changed',s.curry(y)),r.subscribe('dialog/close-all',u.curry(y)));}m(r,h);m(r.prototype,{destroy:function(){u(this);},tabFocused:function(){if(q){w(this,this._videoCallTour);return;}if(!p)w(this,this._videoCallPromo);},tabNotActive:function(){u(this);},hideVideoCallouts:function(){u(this);}});j.subscribe('videocallingtour/start',function(){q=true;r.inform('dialog/close-all');});j.subscribe('videocallingtour/end',function(){q=false;});e.exports=r;});
  69. __d("ChatPrivacyActionController",["ChatVisibility","JSLogger","PresencePrivacy","copyProperties"],function(a,b,c,d,e,f){var g=b('ChatVisibility'),h=b('JSLogger'),i=b('PresencePrivacy'),j=b('copyProperties'),k=function(l,m){this._userID=l;this._logger=h.create('blackbird');this._getState=function(){if(g.isOnline())return i.allows(this._userID)?k.NORMAL:k.BLOCKED;return k.OFFLINE;};this._togglePrivacy=function(){var n=this._getState();switch(this._getState()){case k.OFFLINE:if(g.isOnline()){this._logger.error('tabs_already_online');break;}this._logger.log('tabs_go_online',{tab_id:this._userID});g.goOnline(function(){if(!i.allows(this._userID)){if(this._getState()!==k.BLOCKED)this._logger.error('privacy_action_controller_blocked_inconsistency');this._togglePrivacy();}}.bind(this));break;case k.BLOCKED:i.allow(this._userID);this._logger.log('tabs_unblock',{tab_id:this._userID});break;case k.NORMAL:i.disallow(this._userID);this._logger.log('tabs_block',{tab_id:this._userID});break;}};(function(){var n=function(){m&&m(this._getState());}.bind(this);n();this._subscribeToken=i.subscribe('privacy-changed',n);}.bind(this)).defer();};k.OFFLINE='offline';k.BLOCKED='blocked';k.NORMAL='normal';j(k.prototype,{togglePrivacy:function(){this._logger.log('gear_menu_toggle_privacy',{tab_id:this._userID});this._togglePrivacy();},destroy:function(){i.unsubscribe(this._subscribeToken);}});e.exports=k;});
  70. __d("MercuryTypingIndicator",["Animation","CSS","DOM","MercuryTypingReceiver","MercuryParticipants","Style","ChatTabTemplates","MercuryThreadInformer","Tooltip","copyProperties","cx","tx"],function(a,b,c,d,e,f){var g=b('Animation'),h=b('CSS'),i=b('DOM'),j=b('MercuryTypingReceiver'),k=b('MercuryParticipants'),l=b('Style'),m=b('ChatTabTemplates'),n=b('MercuryThreadInformer').get(),o=b('Tooltip'),p=b('copyProperties'),q=b('cx'),r=b('tx'),s=[];n.subscribe('messages-received',function(v,w){s.forEach(function(x){var y=w[x._threadID];y&&x.receivedMessages(y);});});j.subscribe('state-changed',function(v,w){s.forEach(function(x){var y=w[x._threadID];y&&x._handleStateChanged(y);});});function t(v){var w=m[':fb:chat:conversation:message-group'].build(),x=m[':fb:mercury:typing-indicator:typing'].build();h.addClass(w.getRoot(),"_50kd");var y=w.getNode('profileLink');o.set(y,v.name,'left');y.href=v.href;w.setNodeContent('profileName',v.name);w.setNodeProperty('profilePhoto','src',v.image_src);var z=r._("{name} is typing...",{name:v.short_name});o.set(x.getRoot(),z,'above');i.appendContent(w.getNode('messages'),x.getRoot());return w;}function u(v,w,x){this._animations={};this._activeUsers={};this._typingIndicator=w;this._messagesView=x;this._threadID=v;this._subscription=j.subscribe('state-changed',function(y,z){var aa=z[this._threadID];aa&&this._handleStateChanged(aa);}.bind(this));s.push(this);}p(u.prototype,{destroy:function(){Object.keys(this._activeUsers).forEach(this._removeUserBubble.bind(this));this._controller.destroy();s.remove(this);},receivedMessages:function(v){v.forEach(function(w){if(!k.isAuthor(w.author))this._removeUserBubble(w.author);}.bind(this));},_handleStateChanged:function(v){for(var w in this._activeUsers)if(v.indexOf(w)===-1){this._slideOutUserBubble(w);delete this._activeUsers[w];}if(v.length)k.getMulti(v,function(x){var y=this._messagesView.isScrolledToBottom(),z={};for(var aa in x){var ba=this._activeUsers[aa];z[aa]=ba||t(x[aa]).getRoot();if(!ba)i.appendContent(this._typingIndicator,z[aa]);}var ca=Object.keys(z).length>0;y&&this._messagesView.scrollToBottom(ca);this._activeUsers=z;}.bind(this));},_removeUserBubble:function(v,w){var x=this._getCurrentAnimation(v,w);if(x){x.animation.stop();i.remove(x.elem);delete this._animations[v];}if(v in this._activeUsers){i.remove(this._activeUsers[v]);delete this._activeUsers[v];}w&&i.remove(w);},_slideOutUserBubble:function(v){var w=this._activeUsers[v];if(this._getCurrentAnimation(v,w)){return;}else if(w){l.set(w,'overflow','hidden');var x=(new g(w)).from('opacity',1).from('height',w.offsetHeight).to('height',0).to('opacity',0).ease(g.ease.end).duration(250).ondone(this._removeUserBubble.bind(this,v,w)).go();this._animations[v]={animation:x,elem:w};}},_getCurrentAnimation:function(v,w){if(this._animations[v]&&(!w||this._animations[v].elem===w))return this._animations[v];}});e.exports=u;});
  71. __d("ChatTabMessagesView",["JSXDOM","Animation","Arbiter","ArbiterMixin","MercuryAttachment","MercuryAttachmentRenderer","ChannelConstants","ChatConfig","ChatVisibility","createArrayFrom","CSS","DOM","Env","Event","JoinableConversationMessageFilter","MercuryActionTypeConstants","MercuryAPIArgsSource","MercuryLastMessageIndicator","MercuryLogMessageType","MercurySourceType","shield","MercuryMessages","MercuryServerRequests","MercuryThreadMetadataRawRenderer","MercuryThreadMetadataRenderer","MercuryThreads","MercuryThreadlistConstants","MercuryTypingIndicator","MercuryMessageRenderer","Parent","MercuryParticipants","MercuryStatusTemplates","Style","ChatTabTemplates","MercuryThreadInformer","Tooltip","VideoCallCore","copyProperties","csx","cx","formatDate","isRTL","removeFromArray","throttle","tx"],function(a,b,c,d,e,f){var g=b('JSXDOM'),h=b('Animation'),i=b('Arbiter'),j=b('ArbiterMixin'),k=b('MercuryAttachment'),l=b('MercuryAttachmentRenderer'),m=b('ChannelConstants'),n=b('ChatConfig'),o=b('ChatVisibility'),p=b('createArrayFrom'),q=b('CSS'),r=b('DOM'),s=b('Env'),t=b('Event'),u=b('JoinableConversationMessageFilter'),v=b('MercuryActionTypeConstants'),w=b('MercuryAPIArgsSource'),x=b('MercuryLastMessageIndicator'),y=b('MercuryLogMessageType'),z=b('MercurySourceType'),aa=b('shield'),ba=b('MercuryMessages').get(),ca=b('MercuryServerRequests').get(),da=b('MercuryThreadMetadataRawRenderer'),ea=b('MercuryThreadMetadataRenderer').get(),fa=b('MercuryThreads').get(),ga=b('MercuryThreadlistConstants'),ha=b('MercuryTypingIndicator'),ia=b('MercuryMessageRenderer'),ja=b('Parent'),ka=b('MercuryParticipants'),la=b('MercuryStatusTemplates'),ma=b('Style'),na=b('ChatTabTemplates'),oa=b('MercuryThreadInformer').get(),pa=b('Tooltip'),qa=b('VideoCallCore'),ra=b('copyProperties'),sa=b('csx'),ta=b('cx'),ua=b('formatDate'),va=b('isRTL'),wa=b('removeFromArray'),xa=b('throttle'),ya=b('tx'),za,ab=34;function bb(lb){return ua(new Date(lb),n.get('24h_times')?'H:i':'g:ia');}function cb(lb){var mb=na[':fb:chat:conversation:message-group'].build(),nb=mb.getNode('profileLink'),ob=n.get('chat_tab_bubbles'),pb=ka.isAuthor(lb.author),qb=ca.tokenizeThreadID(lb.thread_id),rb=qb.type!=='user',sb=!pb||!ob;if(!ob)mb.setNodeContent('timestamp',bb(lb.timestamp));q.conditionClass(mb.getRoot(),"_50kd",!pb&&ob);q.conditionClass(mb.getRoot(),"_50x4",rb&&!pb&&ob);q.conditionShow(nb,sb);ka.get(lb.author,function(tb){if(sb){nb.href=tb.href;var ub=pb?"You":tb.name;if(!pb&&ob)ub=g.div({className:"_522l"},[g.div({className:"_522m"},bb(lb.timestamp)),tb.name]);pa.set(nb,ub,'left');if(!pb&&ob&&rb)mb.setNodeContent('profileName',tb.name);mb.setNodeProperty('profilePhoto','src',tb.image_src);}});return mb;}function db(lb){var mb=na[':fb:chat:conversation:message:event'].build(),nb=n.get('chat_tab_bubbles'),ob=bb(lb.timestamp);if(nb){mb.getRoot().setAttribute('title',ob);}else mb.setNodeContent('timestamp',ob);ia.renderLogMessage(mb.getNode('icon'),mb.getNode('message'),mb.getNode('attachment'),lb);var pb=fb(lb);if(pb)r.appendContent(mb.getNode('message'),pb);return mb.getRoot();}function eb(lb){if(!n.get('chat_tab_bubbles'))return;if(!q.hasClass(lb,"_kso")){var mb=r.scry(lb,"._kso");if(mb.length===1){lb=mb[0];}else return;}var nb,ob,pb=lb.firstChild;if(lb.childNodes.length===1&&pb.getAttribute('data-measureme')){nb=pb.getClientRects();var qb=pb.offsetHeight;if(nb&&nb.length>1&&nb[0].height<qb){ob=true;if(!za){r.remove(pb);za=lb.offsetWidth;r.appendContent(lb,pb);}var rb=pb.offsetWidth,sb=lb.offsetWidth-rb-za;if(sb>0)ma.set(lb,'max-width',rb+'px');}}var tb=ja.byClass(lb,"_50x4");if(tb)q.conditionClass(tb,"_51lo",nb?!ob:lb.offsetHeight<ab);}function fb(lb){var mb,nb;if(lb.log_message_type==y.VIDEO_CALL)if(lb.log_message_data.event_name=='install_canceled'){mb=r.tx._("Retry setup and call back.");nb='callback_cancelinstall_link';return gb(mb,lb.thread_id,lb.log_message_data.to,nb);}else if(!lb.log_message_data.event_name&&lb.log_message_data.callee==ka.user&&!lb.log_message_data.answered){mb=r.tx._("Call Back");nb='callback_link';return gb(mb,lb.thread_id,lb.log_message_data.caller.split(':')[1],nb);}return null;}function gb(lb,mb,nb,ob){if(qa.isSupported()){var pb=!o.isOnline()||!qa.availableForCall(nb),qb=r.create('a',{href:'#',className:'callBackLink'},lb);if(pb)q.hide(qb);qb.setAttribute('data-gt',JSON.stringify({videochat:'clicked_callback_link'}));t.listen(qb,'click',function(){jb.inform('video-call-clicked',{userID:nb,threadID:mb,clickSource:ob});});return qb;}return null;}function hb(lb){var mb=na[':fb:mercury:chat:message:forward'].build(),nb=mb.getNode('forwardText');if(nb){q.hide(mb.getRoot());ea.renderTitanLink(lb.thread_id,mb.getNode('forwardLink'),q.show.bind(q,mb.getRoot()));if(lb.forward_count>1){r.appendContent(nb,ya._("{count} forwarded messages",{count:lb.forward_count}));}else r.appendContent(nb,"1 forwarded message");}return mb.getRoot();}var ib=[];function jb(lb,mb,nb,ob,pb,qb,rb){this.loadingIcon=pb;this.threadID=lb;this.sheetController=mb;this.scrollContainer=nb;this.conversationElem=ob;this.messageElements={};this.messageGroup=null;this.prevMessage=null;this._fetchMultiplier=1;this._oldestMessageDisplayedTimestamp=null;this._loadingMoreMessages=false;this._currentMessageCount=0;this._hasReachedClearedMessages=false;var sb=ga.MESSAGE_TIMESTAMP_THRESHOLD;this._oldestMessageDisplayedTimestamp=Date.now()-sb;ib.push(this);this._subscription=i.subscribe('overflow-applied-to-body',this.scrollToBottom.bind(this));t.listen(this.scrollContainer,'scroll',xa(this.scrolling,50,this));var tb=n.get('chat_tab_bubbles');this.lastMessageIndicator=new x(this.threadID,qb,tb,this);if(tb)this.typingIndicator=new ha(this.threadID,rb,this);ba.getThreadMessagesRange(this.threadID,0,ga.RECENT_MESSAGES_LIMIT,this._updateTimestamp.bind(this));this.rerender();}ra(jb,j);ra(jb.prototype,{scrolling:function(){if(!this._loadingMoreMessages&&this.isScrolledNearTop()&&!this.isScrolledToBottom()&&!this._hasReachedClearedMessages)this.loadMoreMessages();if(!this._newMessagesSheetOpened)return;if(this.isScrolledToBottom()){this.sheetController.closeNewMessagesSheet();this._newMessagesSheetOpened=false;}},destroy:function(){r.empty(this.conversationElem);this._subscription.unsubscribe();wa(ib,this);this.lastMessageIndicator&&this.lastMessageIndicator.destroy();this.destroyed=true;},_appendMessage:function(lb){if(lb==this.prevMessage)return;var mb=ga,nb=mb.GROUPING_THRESHOLD,ob=lb.action_type==v.LOG_MESSAGE&&lb.log_message_type==y.SERVER_ERROR;if(lb.is_cleared){this._hasReachedClearedMessages=true;return;}var pb=null;if(this.prevMessage)pb=new Date(this.prevMessage.timestamp);var qb=new Date(lb.timestamp);if(!ob&&(!pb||pb.getDate()!=qb.getDate()||pb.getMonth()!=qb.getMonth()||pb.getFullYear()!=qb.getFullYear())){var rb=na[':fb:chat:conversation:date-break'].build();r.setContent(rb.getNode('date'),ia.renderDate(qb));r.appendContent(this.conversationElem,rb.getRoot());this.messageGroup=null;}if(lb.action_type==v.LOG_MESSAGE){r.appendContent(this.conversationElem,db(lb));this.messageGroup=null;this.prevMessage=lb;return;}var sb=n.get('chat_tab_bubbles');if(!this.messageGroup||sb&&lb.author!==ka.user||this.prevMessage.author!=lb.author||this.prevMessage.timestamp<lb.timestamp-nb){this.messageGroup=cb(lb);r.appendContent(this.conversationElem,this.messageGroup.getRoot());}var tb=this._makeSingleMessage(lb);this.messageElements[lb.message_id]=tb;r.appendContent(this.messageGroup.getNode('messages'),tb);eb(tb);this.prevMessage=lb;},rerender:function(){if(!this._oldestMessageDisplayedTimestamp)return;var lb=this._finishedFetchingMoreMessages&&this.scrollContainer.scrollHeight,mb=this._finishedFetchingMoreMessages&&this.scrollContainer.scrollTop,nb=this.isScrolledToBottom();r.empty(this.conversationElem);this.messageElements={};this.messageGroup=null;this.prevMessage=null;var ob=ba.getThreadMessagesSinceTimestamp(this.threadID,this._oldestMessageDisplayedTimestamp);this._renderOlderMessages(ob,lb,mb,nb);this._finishedFetchingMoreMessages=false;},update:function(lb){for(var mb in lb){var nb=this.messageElements[mb];if(nb){var ob=this.isScrolledToBottom(),pb=this._makeSingleMessage(ba.getMessagesFromIDs([mb])[0]);this.messageElements[mb]=pb;r.replace(nb,pb);eb(pb);if(ob)this.scrollToBottom();}}},_getLoadingHeight:function(){return this.loadingHeight||this.loadingIcon.clientHeight;},_appendMessages:function(lb){lb.forEach(this._appendMessage.bind(this));this.lastMessageIndicator&&this.lastMessageIndicator.setLastMessage(this.prevMessage);this.sheetController.displayMessengerPromoTabSheet(this.prevMessage);},_appendNewMessages:function(lb){lb=u.filterMessages(function(ob){this.sheetController.openUserJoinStatusSheet(ob);}.bind(this),lb,true);var mb=this.isScrolledToBottom(),nb=this._messagesOnlySentFromSelf(lb);this._appendMessages(lb);if(mb){this.scrollToBottom();}else if(!nb){this.sheetController.openNewMessagesSheet();this._newMessagesSheetOpened=true;}},_messagesOnlySentFromSelf:function(lb){for(var mb=0;mb<lb.length;mb++)if(lb[mb].author!==ka.user)return false;return true;},_renderOlderMessages:function(lb,mb,nb,ob){if(!lb)return;lb=u.filterMessages(function(pb){this.sheetController.openUserJoinStatusSheet(pb);}.bind(this),lb,false);this._appendMessages(lb);if(ob){this.scrollToBottom();}else if(this._finishedFetchingMoreMessages)this.scrollToPosition(this.scrollContainer.scrollHeight-mb-this.loadingHeight+nb);},_updateTimestamp:function(lb){if(lb&&lb.length){this._oldestMessageDisplayedTimestamp=lb[0].timestamp;this._currentMessageCount=lb.length;}this._loadingMoreMessages=false;this._finishedFetchingMoreMessages=true;q.hide(this.loadingIcon);},isScrolledToBottom:function(){var lb=this.scrollContainer;return lb.scrollTop+lb.clientHeight>=lb.scrollHeight-1;},isScrolledNearTop:function(){return this.scrollContainer.scrollTop<this.scrollContainer.clientHeight;},scrollToBottom:function(lb){this.scrollToPosition(this.scrollContainer.scrollHeight,lb);},scrollToPosition:function(lb,mb){this._scrollTopAnimation&&this._scrollTopAnimation.stop();if(mb===true){this._scrollTopAnimation=(new h(this.scrollContainer)).to('scrollTop',lb).ease(h.ease.end).duration(400).go();}else this.scrollContainer.scrollTop=lb;},loadMoreMessages:function(){if(ba.hasLoadedExactlyNMessages(this.threadID,this._currentMessageCount)&&ba.hasLoadedAllMessages(this.threadID))return;if(fa.isNewEmptyLocalThread(this.threadID))return;q.show(this.loadingIcon);this.loadingHeight=this._getLoadingHeight();this._loadingMoreMessages=true;if(this._fetchMultiplier<10)this._fetchMultiplier+=1;var lb=ga.RECENT_MESSAGES_LIMIT*this._fetchMultiplier,mb=this._currentMessageCount+lb,nb=ba.hasLoadedNMessages(this.threadID,mb);ba.getThreadMessagesRange(this.threadID,0,mb,this._updateTimestamp.bind(this),null,w.CHAT);if(nb)this.rerender();},_makeSingleMessage:function(lb){var mb=this._renderSingleMessage(lb);q.addClass(mb,"_55r0");return mb;},_renderSingleMessage:function(lb){var mb=na[':fb:chat:conversation:message'].render(),nb=n.get('chat_tab_bubbles');if(nb&&ka.isAuthor(lb.author))mb.setAttribute('title',bb(lb.timestamp));if(lb.subject){var ob=na[':fb:chat:conversation:message:subject'].render();r.setContent(ob,lb.subject);r.appendContent(mb,ob);}function pb(xb){if(nb)xb=r.create('span',{'data-measureme':1},xb);return xb;}if(lb.is_filtered_content){var qb=la[':fb:mercury:filtered-message'].build();r.appendContent(mb,pb(qb.getRoot()));return mb;}if(lb.body.substr(0,4)=='?OTR'){r.setContent(mb,pb("[encrypted message]"));q.addClass(mb,"_542c");}else{q.addClass(mb,va(lb.body)?'direction_rtl':'direction_ltr');var rb=ia.formatMessageBody(lb.body);r.appendContent(mb,pb(rb));}if(lb.has_attachment){var sb=g.div(null,null),tb=this._appendMessageAttachments(sb,lb);if(nb&&!lb.body&&!tb)return sb;r.appendContent(mb,p(sb.childNodes));}if(lb.forward_count)r.appendContent(mb,hb(lb));if(lb.is_spoof_warning){var ub=na[':fb:chat:conversation:message:undertext'].build();r.appendContent(ub.getNode('message'),mb);ka.get(lb.author,function(xb){ea.renderChatSpoofWarning(ub.getNode('status'),lb.is_spoof_warning,xb);});return ub.getRoot();}var vb=da.renderStatusIndicator(lb.status,lb.error_data,aa(ba.resendMessage,ba,lb));if(vb){var wb=na[':fb:chat:conversation:message:status'].build();r.appendContent(wb.getNode('message'),mb);r.appendContent(wb.getNode('status'),vb);return wb.getRoot();}return mb;},_appendMessageAttachments:function(lb,mb){var nb=0,ob=mb.attachments;ob.sort(l.booleanLexicographicComparator([l.isPhotoAttachment,l.isShareAttachment,l.isFileAttachment,l.isErrorAttachment]));if(mb.raw_attachments&&mb.raw_attachments.length>0)ob=k.convertRaw(mb.raw_attachments);var pb=l.renderPhotoAttachments(ob.filter(l.isPhotoAttachment),mb,176,4);if(pb)r.appendContent(lb,pb);for(var qb=0;qb<ob.length;qb++){if(l.isPhotoAttachment(ob[qb])){nb=1;continue;}var rb=l.renderAttachment(true,ob[qb],mb);rb.error&&r.appendContent(lb,rb.error);rb.content&&r.appendContent(lb,rb.content);nb|=rb.bubblePreferred;}var sb=r.scry(lb,'img');sb.forEach(function(tb){t.listen(tb,'load',aa(this._thumbLoaded,this,tb));}.bind(this));return !!nb;},_thumbLoaded:function(lb){var mb=this.scrollContainer.scrollTop+this.scrollContainer.clientHeight;if(mb+lb.offsetHeight>=this.scrollContainer.scrollHeight)this.scrollToBottom();}});oa.subscribe('messages-reordered',function(lb,mb){ib.forEach(function(nb){mb[nb.threadID]&&nb.rerender();});});oa.subscribe('messages-updated',function(lb,mb){ib.forEach(function(nb){mb[nb.threadID]&&nb.update(mb[nb.threadID]);});});oa.subscribe('messages-received',function(lb,mb){ib.forEach(function(nb){var ob=mb[nb.threadID];if(ob&&ob.length)nb._currentMessageCount+=ob.length;ob&&nb._appendNewMessages(ob);});});i.subscribe(m.getArbiterType('chat_event'),function(lb,mb){if(kb(mb.obj)){var nb=(s.user==mb.obj.from)?mb.obj.to:mb.obj.from,ob=fa.getThreadIdForUser(nb),pb=ib.filter(function(sb){return sb.threadID===ob;});if(pb.length>0){var qb=pb[0],rb=ba.constructLogMessageObject(z.CHAT_WEB,ob,y.VIDEO_CALL,mb.obj);rb.author='fbid:'+mb.obj.from;qb._appendNewMessages([rb]);}}});function kb(lb){return (lb.event_name==='installing'||lb.event_name==='install_canceled');}e.exports=jb;});
  72. __d("MercuryPeopleSuggestions",["KeyedCallbackManager","MercuryServerDispatcher","OrderedFriendsList","ShortProfiles","arrayContains"],function(a,b,c,d,e,f){var g=b('KeyedCallbackManager'),h=b('MercuryServerDispatcher'),i=b('OrderedFriendsList'),j=b('ShortProfiles'),k=b('arrayContains'),l=new g(),m=6;function n(s){return s.sort().join(',');}function o(s,t){if(s.length<m){var u=i.getList();for(var v=0;v<u.length;v++)if(!(k(s,u[v])||k(t,u[v]))){s.push(u[v]);if(s.length>=m)break;}}return s;}function p(s){h.trySend('/ajax/chat/people_suggest.php',s);}function q(s,t,u){s=s.filter(function(w){return !k(t,w);});var v=o(s,t);j.getMulti(v,function(){u(v);});}var r={getPeopleSuggestions:function(s,t){if(s)if(s.length){var u=n(s),v=l.executeOrEnqueue(u,function(x){q(x,s,t);}),w=l.getUnavailableResources(v);if(w.length)p({query:u,size:m});return v;}else q([],[],t);return 0;},handleUpdate:function(s){if(s.query){var t=s.suggestions||"",u=t.length?t.split(','):[];l.setResource(s.query,u);}}};h.registerEndpoints({'/ajax/chat/people_suggest.php':{mode:h.IMMEDIATE,handler:r.handleUpdate}});e.exports=r;});
  73. __d("ChatTabPeopleSuggestionView",["ReactDOM","ChatPeopleSuggestionList.react","ChatQuietLinks","CSS","DOM","MercuryPeopleSuggestions","MercuryIDs","React","ShortProfiles","Style","copyProperties"],function(a,b,c,d,e,f){var g=b('ChatPeopleSuggestionList.react'),h=b('ChatQuietLinks'),i=b('CSS'),j=b('DOM'),k=b('MercuryPeopleSuggestions'),l=b('MercuryIDs'),m=b('React'),n=b('ShortProfiles'),o=b('Style'),p=b('copyProperties');function q(r,s,t){this.sheetController=r;this.viewNode=s;this.loadingIcon=t;this.addFriendsSheet=r.getAddFriendsTabSheet();this.mercuryTypeahead=this.addFriendsSheet&&this.addFriendsSheet._typeahead;this.typeaheadView=this.mercuryTypeahead&&this.mercuryTypeahead.getTypeahead().getView();var u=this.showSuggestions.bind(this);if(this.typeaheadView){this.typeaheadView.subscribe('reset',u);this.typeaheadView.subscribe('render',this.clearSuggestions.bind(this));}this.tokenizer=this.mercuryTypeahead&&this.mercuryTypeahead.getTokenizer();if(this.tokenizer)this.tokenizer.subscribe('removeToken',u);this.showSuggestions();}p(q.prototype,{addSelectedParticipant:function(r){var s=n.getNow(r);if(s&&this.tokenizer){this.tokenizer.addToken(this.tokenizer.createToken({uid:r,text:s.name}));this.showSuggestions();}},showSuggestions:function(){if(this.mercuryTypeahead){var r=this.mercuryTypeahead.getSelectedParticipantIDs();r=r.map(l.getUserIDFromParticipantID);j.empty(this.viewNode);i.show(this.loadingIcon);k.getPeopleSuggestions(r,function(s){var t=g({uids:s,onClick:this.addSelectedParticipant.bind(this)},null);i.hide(this.loadingIcon);m.renderComponent(t,this.viewNode);h.removeAllHrefs(this.viewNode);var u=this.getSheetHeight();o.set(this.viewNode,'margin-top',u);}.bind(this));}},clearSuggestions:function(){j.empty(this.viewNode);i.hide(this.loadingIcon);o.set(this.viewNode,'margin-top',0);},getSheetHeight:function(){if(this.addFriendsSheet)return this.addFriendsSheet.getHeight();return 0;},destroy:function(){this.clearSuggestions();}});e.exports=q;});
  74. __d("ChatAddFriendsTabSheetRawRenderer",["ContextualTypeaheadView","DOM","Event","MercuryTypeahead","ChatTabTemplates","tx","MercuryDataSourceWrapper"],function(a,b,c,d,e,f){var g=b('ContextualTypeaheadView'),h=b('DOM'),i=b('Event'),j=b('MercuryTypeahead'),k=b('ChatTabTemplates'),l=b('tx'),m=b('MercuryDataSourceWrapper').source,n={render:function(o,p,q,r,s,t){var u=t?k[':fb:mercury:chat:tab-sheet:add-friends-empty-tab'].build():k[':fb:mercury:chat:tab-sheet:add-friends'].build(),v=new j(m,g);v.setExcludedParticipants(r.participants);if(!t)v.setPlaceholder("Add friends to this chat");v.build();h.replace(u.getNode('participantsTypeahead'),v.getElement());h.setContent(q,u.getRoot());v.getTokenizer().adjustWidth();v.focus();if(!t){var w=function(){var x=v.getSelectedParticipantIDs();if(x.length)s(x);p.close(o);};i.listen(u.getNode('doneButton'),'click',w);}return v;}};e.exports=n;});
  75. __d("MultiChatController",["Arbiter","AsyncSignal","copyProperties","Form","MercuryMessages","MercuryServerRequests","MercuryThreads"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('AsyncSignal'),i=b('copyProperties'),j=b('Form'),k=b('MercuryMessages').get(),l=b('MercuryServerRequests').get(),m=b('MercuryThreads').get();function n(){}i(n,{subscribe:function(o,p){o.subscribe('confirm',function(){this.createGroupThreadFromChooserDialog(o,p);}.bind(this));},createGroupThreadFromChooserDialog:function(o,p){var q=j.serialize(o.getRoot()),r=JSON.parse(q.profileChooserItems),s=[];for(var t in r)if(r[t])s.push(t);var u=n.createThreadForFBIDs(s);l.subscribe('update-thread-ids',function(v,w){for(var x in w)if(w[x]==u)new h('/ajax/groups/chat/log',{group_id:p,message_id:x}).send();});o.hide();},createThreadForTokens:function(o){if(!o.length)return;var p;if(o.length==1){p='user:'+o[0].split(':')[1];}else p='root:'+k.generateNewClientMessageID(Date.now());m.createNewLocalThread(p,o);g.inform('chat/open-tab',{thread_id:p});return p;},createThreadForFBIDs:function(o){var p=[];for(var q=0;q<o.length;q++)p.push("fbid:"+o[q]);return n.createThreadForTokens(p);}});e.exports=n;});
  76. __d("ChatAddFriendsTabSheet",["Arbiter","ChatAddFriendsTabSheetRawRenderer","MercuryLogMessageType","MercurySourceType","MercuryMessages","MultiChatController","Style","MercuryThreads","copyProperties"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('ChatAddFriendsTabSheetRawRenderer'),i=b('MercuryLogMessageType'),j=b('MercurySourceType'),k=b('MercuryMessages').get(),l=b('MultiChatController'),m=b('Style'),n=b('MercuryThreads').get(),o=b('copyProperties');function p(s,t,u){this._threadID=s;this._rootElement=t;this._sheetView=u;this._typeahead=null;}o(p.prototype,{render:function(){n.getThreadMeta(this._threadID,function(s){var t=s.is_canonical_user?q:r;this._typeahead=h.render(this,this._sheetView,this._rootElement,s,t.curry(s),n.isNewEmptyLocalThread(this._threadID));}.bind(this));},getParticipants:function(){if(!this._typeahead)return null;return this._typeahead.getSelectedParticipantIDs();},isPermanent:function(){return true;},getType:function(){return 'add_friends_type';},open:function(){this._sheetView.open(this);},close:function(){this._sheetView.close(this);},getHeight:function(){return m.get(this._rootElement,'height');}});function q(s,t){var u=s.participants;l.createThreadForTokens(u.concat(t));}function r(s,t){var u=s.thread_id;if(n.isEmptyLocalThread(u)){n.addParticipantsToThreadLocally(u,t);g.inform('chat/open-tab',{thread_id:u});}else{k.sendMessage(k.constructLogMessageObject(j.CHAT_WEB,u,i.SUBSCRIBE,{added_participants:t}));g.inform('chat/open-tab',{thread_id:u});}}e.exports=p;});
  77. __d("ChatMessengerUpsellConfig",["AsyncRequest","KeyedCallbackManager"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('KeyedCallbackManager'),i=new h(),j={get:function(k,l){var m=i.executeOrEnqueue(k,l),n=i.getUnavailableResources(m);if(n.length)new g().setURI('/ajax/chat/messenger_upsell/config.php').setHandler(this._setPromoConfig.bind(this)).send();},_setPromoConfig:function(k){var l=k.payload;if(l){i.setResource('impression_count',l.number_of_impressions);i.setResource('max_impressions',l.max_impressions);i.setResource('promo_timeout',l.promo_timeout);i.setResource('post_click_timeout',l.post_click_timeout);i.setResource('should_show_orca_promotion',true);}else i.setResource('should_show_orca_promotion',false);},getNow:function(k){return i.getResource(k);},setImpressionCount:function(k,l){new g().setURI('/ajax/chat/messenger_upsell/update_impressions.php').setData({impressions:l,friend_id:k}).send();i.setResource('impression_count',l);if(l>=i.getResource('max_impressions'))i.setResource('should_show_orca_promotion',false);}};e.exports=j;});
  78. __d("ChatMessengerPromoTabSheet",["AsyncRequest","DOM","Event","MercuryParticipants","MercurySourceType","MercuryThreads","ChatTabTemplates","ChatMessengerUpsellConfig","URI","copyProperties","tx"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('DOM'),i=b('Event'),j=b('MercuryParticipants'),k=b('MercurySourceType'),l=b('MercuryThreads').get(),m=b('ChatTabTemplates'),n=b('ChatMessengerUpsellConfig'),o=b('URI'),p=b('copyProperties'),q=b('tx');function r(s,t,u){this._threadID=s;this._rootElement=t;this._sheetView=u;this._sheetHasBeenDisplayed=false;this._canonicalUser=l.getCanonicalUserInThread(s);this._timeoutResetCallback=null;this._template;}p(r.prototype,{render:function(){this._template=m[':fb:mercury:chat:tab-sheet:promo-sheet'].build();var s=j.getIDForUser(this._canonicalUser);j.get(s,function(t){h.setContent(this._template.getNode('text'),q._("{name} is using Messenger. Get the app to chat on the go.",{name:t.short_name}));}.bind(this));this._button=this._template.getNode('installButton');i.listen(this._template.getNode('installButton'),'click',this.installButtonClickHandler.bind(this));h.setContent(this._rootElement,this._template.getRoot());},rerender:function(){h.empty(this._rootElement);h.setContent(this._template.getNode('text'),"A link has been sent to your phone to install Messenger");h.remove(this._template.getNode('installButton'));h.setContent(this._rootElement,this._template.getRoot());n.get('post_click_timeout',function(s){this._timeoutResetCallback(this,s);}.bind(this));},installButtonClickHandler:function(){var s=new o('/ajax/marketing/messenger_send_to_mobile').setQueryData({fb_source:'web_chat_upsell'});new g().setURI(s).setMethod('POST').setHandler(function(v){this.rerender();}.bind(this)).send();var t=n.getNow('impression_count'),u=t*100;n.setImpressionCount(this._canonicalUser,u);},isPermanent:function(){return false;},timeoutCanBeReset:function(){return true;},setResetTimeoutCallback:function(s){this._timeoutResetCallback=s;},getType:function(){return 'messenger_promo_type';},getCloseTimeout:function(){return n.getNow('promo_timeout');},_displayUpsellCallback:function(s){if(!s)return;this._sheetView.open(this);this._sheetHasBeenDisplayed=true;var t=n.getNow('impression_count');n.setImpressionCount(this._canonicalUser,t+1);return;},displayPromo:function(s){if(!s||(s.source!=k.CHAT_ORCA&&s.source!=k.TITAN_ORCA)||j.getUserID(s.author)!=this._canonicalUser||this._sheetHasBeenDisplayed)return;n.get('should_show_orca_promotion',function(t){this._displayUpsellCallback(t);}.bind(this));}});e.exports=r;});
  79. __d("ChatNameConversationTabSheetRawRenderer",["DOM","Event","Input","ChatTabTemplates"],function(a,b,c,d,e,f){var g=b('DOM'),h=b('Event'),i=b('Input'),j=b('ChatTabTemplates'),k={render:function(l,m,n,o,p){var q=j[':fb:mercury:chat:tab-sheet:name-conversation'].build(),r=q.getNode("nameInput"),s=o.name;if(s)i.setValue(r,s);h.listen(q.getNode('doneButton'),'click',function(){var t=i.getValue(r);if(t)p(t);m.close(l);});g.setContent(n,q.getRoot());}};e.exports=k;});
  80. __d("ChatNameConversationTabSheet",["ChatNameConversationTabSheetRawRenderer","MercuryAPIArgsSource","MercuryLogMessageType","MercurySourceType","MercuryMessages","MercuryThreads","copyProperties"],function(a,b,c,d,e,f){var g=b('ChatNameConversationTabSheetRawRenderer'),h=b('MercuryAPIArgsSource'),i=b('MercuryLogMessageType'),j=b('MercurySourceType'),k=b('MercuryMessages').get(),l=b('MercuryThreads').get(),m=b('copyProperties');function n(p,q,r){this._threadID=p;this._rootElement=q;this._sheetView=r;}m(n.prototype,{render:function(){l.getThreadMeta(this._threadID,function(p){g.render(this,this._sheetView,this._rootElement,p,o.curry(p));}.bind(this));},isPermanent:function(){return true;},getType:function(){return 'name_conversation_type';},open:function(){this._sheetView.open(this);},close:function(){this._sheetView.close(this);}});function o(p,q){var r=p.name;if((q||r)&&(q!=r))k.sendMessage(k.constructLogMessageObject(j.CHAT_WEB,p.thread_id,i.THREAD_NAME,{name:q}),null,h.CHAT);}e.exports=n;});
  81. __d("ChatNewMessagesTabSheet",["Event","ArbiterMixin","DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('ArbiterMixin'),i=b('DOM'),j=b('ChatTabTemplates'),k=b('copyProperties');function l(m,n,o){this._threadID=m;this._rootElement=n;this._sheetView=o;}k(l.prototype,h,{render:function(){var m=j[':fb:mercury:chat:tab-sheet:clickable-message-icon-sheet'].build();i.setContent(m.getNode('text'),i.tx._("Scroll down to see new messages."));i.setContent(this._rootElement,m.getRoot());g.listen(m.getRoot(),'click',function(){this.inform('clicked',this._threadID);}.bind(this));},isPermanent:function(){return true;},getType:function(){return 'new_messages_type';},open:function(){this._sheetView.open(this);},close:function(){this._sheetView.close(this);}});e.exports=l;});
  82. __d("ChatNoRecipientsTabSheet",["DOM","MercuryParticipants","ChatTabTemplates","MercuryThreadInformer","MercuryThreads","copyProperties"],function(a,b,c,d,e,f){var g=b('DOM'),h=b('MercuryParticipants'),i=b('ChatTabTemplates'),j=b('MercuryThreadInformer').get(),k=b('MercuryThreads').get(),l=b('copyProperties');function m(n,o,p){this._threadID=n;this._rootElement=o;this._sheetView=p;j.subscribe('threads-updated',this._handleThreadsUpdated.bind(this));}l(m.prototype,{render:function(){var n=i[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build();g.setContent(n.getNode('text'),g.tx._("All recipients have left this conversation. Please close the stale tab."));g.setContent(this._rootElement,n.getRoot());},isPermanent:function(){return true;},getType:function(){return 'no_recipients_type';},_handleThreadsUpdated:function(){k.getThreadMeta(this._threadID,function(n){var o=h.user,p=n.participants.filter(function(q){return q!=o;});if(p.length<1&&!n.is_joinable&&!k.isNewEmptyLocalThread(this._threadID)){this._sheetView.open(this);}else this._sheetView.close(this);}.bind(this));}});e.exports=m;});
  83. __d("ChatOfflineTabSheet",["ChatPrivacyActionController","ChatVisibility","CSS","DOM","Event","JSLogger","MercuryParticipants","MercuryThreads","ChatTabTemplates","copyProperties","cx"],function(a,b,c,d,e,f){var g=b('ChatPrivacyActionController'),h=b('ChatVisibility'),i=b('CSS'),j=b('DOM'),k=b('Event'),l=b('JSLogger'),m=b('MercuryParticipants'),n=b('MercuryThreads').get(),o=b('ChatTabTemplates'),p=b('copyProperties'),q=b('cx');function r(s,t,u){this._rootElement=t;this._sheetView=u;this._logger=l.create('blackbird');this._canonicalUser=n.getCanonicalUserInThread(s);if(this._canonicalUser)this._privacyActionController=new g(this._canonicalUser,this._handlePrivacyChange.bind(this));}p(r.prototype,{render:function(){if(!this._canonicalUser){this._logger.error('offline_sheet_open_with_non_friend');return;}var s=o[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build(),t='fbid:'+this._canonicalUser;m.get(t,function(u){var v='fbChatGoOnlineLink',w=j.tx._("turn on chat"),x=j.create('a',{href:'#',className:v},w),y=j.tx._("To chat with {name} and other friends, {link}.",{name:u.short_name,link:x});j.setContent(s.getNode('text'),y);i.addClass(s.getRoot(),"_1sk1");j.setContent(this._rootElement,s.getRoot());k.listen(this._rootElement,'click',function(event){if(i.hasClass(event.getTarget(),v)){if(h.isOnline())this._logger.error('tab_sheet_already_online');this._privacyActionController.togglePrivacy();this._logger.log('tab_sheet_go_online',{tab_id:this._canonicalUser});return false;}}.bind(this));}.bind(this));},_handlePrivacyChange:function(s){if(!this._canonicalUser)this._logger.error('user_blocked_sheet_privacy_changed_non_friend');switch(s){case g.OFFLINE:this._sheetView.open(this);break;case g.NORMAL:case g.BLOCKED:this._sheetView.close(this);break;}},isPermanent:function(){return true;},getType:function(){return 'offline_type';},destroy:function(){this._privacyActionController&&this._privacyActionController.destroy();}});e.exports=r;});
  84. __d("ChatUploadWarningTabSheet",["DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){var g=b('DOM'),h=b('ChatTabTemplates'),i=b('copyProperties');function j(k,l,m){this._threadID=k;this._rootElement=l;this._sheetView=m;}i(j.prototype,{render:function(){var k=h[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build();g.setContent(k.getNode('text'),g.tx._("Please wait until the upload is complete before you send your message."));g.setContent(this._rootElement,k.getRoot());},isPermanent:function(){return false;},getType:function(){return 'upload_warning_type';},open:function(){this._sheetView.open(this);},close:function(){this._sheetView.close(this);}});e.exports=j;});
  85. __d("ChatThreadIsMutedTabSheet",["Event","ArbiterMixin","DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('ArbiterMixin'),i=b('DOM'),j=b('ChatTabTemplates'),k=b('copyProperties');function l(m,n,o){this._threadID=m;this._rootElement=n;this._sheetView=o;}k(l.prototype,h,{render:function(){var m=j[':fb:mercury:chat:tab-sheet:message-mute-sheet'].build();i.setContent(m.getNode('text'),i.tx._("This conversation is muted. Chat tabs will not pop up for it and push notifications are off."));i.setContent(this._rootElement,m.getRoot());g.listen(m.getNode('unmuteButton'),'click',function(){this.inform('clicked',this._threadID);}.bind(this));},isPermanent:function(){return false;},getType:function(){return 'chat-thread-is-muted';},open:function(){this._sheetView.open(this);},close:function(){this._sheetView.close(this);}});e.exports=l;});
  86. __d("ChatUserBlockedTabSheet",["ChatPrivacyActionController","CSS","DOM","Event","GenderConst","JSLogger","MercuryParticipants","MercuryThreads","ChatTabTemplates","copyProperties","cx","tx"],function(a,b,c,d,e,f){var g=b('ChatPrivacyActionController'),h=b('CSS'),i=b('DOM'),j=b('Event'),k=b('GenderConst'),l=b('JSLogger'),m=b('MercuryParticipants'),n=b('MercuryThreads').get(),o=b('ChatTabTemplates'),p=b('copyProperties'),q=b('cx'),r=b('tx');function s(t,u,v){this._rootElement=u;this._sheetView=v;this._logger=l.create('blackbird');this._canonicalUser=n.getCanonicalUserInThread(t);if(this._canonicalUser)this._privacyActionController=new g(this._canonicalUser,this._handlePrivacyChange.bind(this));}p(s.prototype,{render:function(){if(!this._canonicalUser){this._logger.error('user_blocked_sheet_open_with_non_friend');return;}var t=o[':fb:mercury:chat:tab-sheet:user-blocked'].build(),u='fbid:'+this._canonicalUser;m.get(u,function(v){var w=null;switch(v.gender){case k.FEMALE_SINGULAR:case k.FEMALE_SINGULAR_GUESS:w=r._("You turned off chat for {name} but you can still send her a message. ",{name:v.short_name});break;case k.MALE_SINGULAR:case k.MALE_SINGULAR_GUESS:w=r._("You turned off chat for {name} but you can still send him a message. ",{name:v.short_name});break;default:w=r._("You turned off chat for {name} but you can still send them a message. ",{name:v.short_name});}i.setContent(t.getNode('text'),w);var x=r._("Turn on chat for {name}?",{name:v.short_name});i.setContent(t.getNode('actionLink'),x);h.addClass(t.getRoot(),"_1sk0");i.setContent(this._rootElement,t.getRoot());j.listen(t.getNode('actionLink'),'click',this._privacyActionController.togglePrivacy.bind(this._privacyActionController));}.bind(this));},_handlePrivacyChange:function(t){if(!this._canonicalUser)this._logger.error('user_blocked_sheet_privacy_changed_non_friend');switch(t){case g.BLOCKED:this._sheetView.open(this);break;case g.NORMAL:case g.OFFLINE:this._sheetView.close(this);break;}},isPermanent:function(){return true;},getType:function(){return 'user_blocked_type';},destroy:function(){this._privacyActionController&&this._privacyActionController.destroy();}});e.exports=s;});
  87. __d("ChatUserJoinStatusTabSheet",["copyProperties","CSS","DOM","MercuryLogMessageType","MercuryParticipants","ChatTabTemplates"],function(a,b,c,d,e,f){var g=b('copyProperties'),h=b('CSS'),i=b('DOM'),j=b('MercuryLogMessageType'),k=b('MercuryParticipants'),l=b('ChatTabTemplates');function m(n){this._rootElement=n;this._messageQueue=[];this._timeout=null;}g(m.prototype,{addToQueue:function(n){this._messageQueue.push(n);if(!this._timeout)this._refresh();},_setMessage:function(n,o){var p=n.author,q=n.log_message_type;if(q==j.JOINABLE_JOINED){var r=n.log_message_data.joined_participant;if(r!=k.user)k.get(r,function(s){i.setContent(o,i.tx._("{actor} joined the chat.",{actor:s.name}));});}else if(q==j.UNSUBSCRIBE)if(p!=k.user)k.get(p,function(s){i.setContent(o,i.tx._("{actor} left the conversation.",{actor:s.name}));});},_refresh:function(){if(this._messageQueue.length>0)this._render(this._messageQueue.shift());},_render:function(n){var o=l[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build();this._setMessage(n,o.getNode('text'));i.setContent(this._rootElement,o.getRoot());h.show(this._rootElement);this._timeout=setTimeout(this._removeOldMessageAndShowNextMessage.bind(this),2000);},_removeOldMessageAndShowNextMessage:function(){i.empty(this._rootElement);this.destroy();this._refresh();},destroy:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=null;}});e.exports=m;});
  88. __d("ChatTabSheetController",["ChatAddFriendsTabSheet","ChatMessengerPromoTabSheet","ChatNameConversationTabSheet","ChatNewMessagesTabSheet","ChatNoRecipientsTabSheet","ChatOfflineTabSheet","ChatUploadWarningTabSheet","ChatThreadIsMutedTabSheet","ChatUserBlockedTabSheet","ChatUserJoinStatusTabSheet","copyProperties","MercurySheetView","MercuryThreads"],function(a,b,c,d,e,f){var g=b('ChatAddFriendsTabSheet'),h=b('ChatMessengerPromoTabSheet'),i=b('ChatNameConversationTabSheet'),j=b('ChatNewMessagesTabSheet'),k=b('ChatNoRecipientsTabSheet'),l=b('ChatOfflineTabSheet'),m=b('ChatUploadWarningTabSheet'),n=b('ChatThreadIsMutedTabSheet'),o=b('ChatUserBlockedTabSheet'),p=b('ChatUserJoinStatusTabSheet'),q=b('copyProperties'),r=b('MercurySheetView'),s=b('MercuryThreads').get(),t=function(u,v,w){this._sheetView=new r(u,v,w);this._addFriendsTabSheet=new g(u,v,this._sheetView);this._nameConversationTabSheet=new i(u,v,this._sheetView);this._userBlockedTabSheet=new o(u,v,this._sheetView);this._offlineTabSheet=new l(u,v,this._sheetView);this._messengerPromoTabSheet=new h(u,v,this._sheetView);this._newMessagesTabSheet=new j(u,v,this._sheetView);this._uploadWarningTabSheet=new m(u,v,this._sheetView);this._threadIsMutedTabSheet=new n(u,v,this._sheetView);this._userJoinStatusTabSheet=new p(v);if(!s.getCanonicalUserInThread(u))this._noRecipientsTabSheet=new k(u,v,this._sheetView);};q(t.prototype,{openAddFriendsSheet:function(){this._addFriendsTabSheet.open();},openUserJoinStatusSheet:function(u){this._userJoinStatusTabSheet.addToQueue(u);},getAddFriendsTabSheet:function(){return this._addFriendsTabSheet;},getAddFriendsParticipants:function(){var u=this._addFriendsTabSheet.getParticipants();this._addFriendsTabSheet.close();return u;},openNameConversationSheet:function(){this._nameConversationTabSheet.open();},openNewMessagesSheet:function(){this._newMessagesTabSheet.open();},openUploadWarningTabSheet:function(){this._uploadWarningTabSheet.open();},openThreadIsMutedTabSheet:function(){this._threadIsMutedTabSheet.open();},closeThreadIsMutedTabSheet:function(){this._threadIsMutedTabSheet.close();},closeNewMessagesSheet:function(){this._newMessagesTabSheet.close();},displayMessengerPromoTabSheet:function(u){this._messengerPromoTabSheet.displayPromo(u);},closeUploadWarningTabSheet:function(){this._uploadWarningTabSheet.close();},onClickNewMessagesSheet:function(u){this._newMessageClickSub=this._newMessagesTabSheet.subscribe('clicked',u);},onClickThreadIsMutedSheet:function(u){this._threadIsMutedClickSub=this._threadIsMutedTabSheet.subscribe('clicked',u);},destroy:function(){this._sheetView.destroy();this._offlineTabSheet.destroy();this._userBlockedTabSheet.destroy();this._userJoinStatusTabSheet.destroy();this._newMessageClickSub&&this._newMessageClickSub.unsubscribe();this._threadIsMutedClickSub&&this._threadIsMutedClickSub.unsubscribe();}});e.exports=t;});
  89. __d("ChatTabView",["Event","function-extensions","Arbiter","ArbiterMixin","AsyncDialog","AsyncRequest","AsyncSignal","AvailableListConstants","Bootloader","ChatBehavior","ChatConfig","ChatContextualDialogController","ChatAutoSendPhotoUploader","ChatPrivacyActionController","ChatQuietLinks","ChatTabMessagesView","ChatTabPeopleSuggestionView","ChatTabSheetController","ChatVisibility","MercuryConfig","MercuryConstants","CSS","Dialog","Dock","DOM","Input","JSLogger","Keys","Locale","MercuryActionStatus","MercuryFileUploader","MercuryLogMessageType","MercuryMessages","MercuryParticipants","MercuryServerRequests","MercurySourceType","MercuryThreadInformer","MercuryThreadMetadataRawRenderer","MercuryThreadMetadataRenderer","MercuryThreadMuter","MercuryThreads","MercuryTypingReceiver","MessagesEmoticonView","NubController","Parent","PhotosUploadWaterfall","PresencePrivacy","PresenceStatus","Run","Style","SubscriptionsHandler","ChatTabTemplates","TextAreaControl","Tooltip","TypingDetectorController","URI","UserAgent","VideoCallCore","WaterfallIDGenerator","copyProperties","cx","extendArray","setIntervalAcrossTransitions","tx"],function(a,b,c,d,e,f){var g=b('Event');b('function-extensions');var h=b('Arbiter'),i=b('ArbiterMixin'),j=b('AsyncDialog'),k=b('AsyncRequest'),l=b('AsyncSignal'),m=b('AvailableListConstants'),n=b('Bootloader'),o=b('ChatBehavior'),p=b('ChatConfig'),q=b('ChatContextualDialogController'),r=b('ChatAutoSendPhotoUploader'),s=b('ChatPrivacyActionController'),t=b('ChatQuietLinks'),u=b('ChatTabMessagesView'),v=b('ChatTabPeopleSuggestionView'),w=b('ChatTabSheetController'),x=b('ChatVisibility'),y=b('MercuryConfig'),z=b('MercuryConstants'),aa=b('CSS'),ba=b('Dialog'),ca=b('Dock'),da=b('DOM'),ea=b('Input'),fa=b('JSLogger'),ga=b('Keys'),ha=b('Locale'),ia=b('MercuryActionStatus'),ja=b('MercuryFileUploader'),ka=b('MercuryLogMessageType'),la=b('MercuryMessages').get(),ma=b('MercuryParticipants'),na=b('MercuryServerRequests').get(),oa=b('MercurySourceType'),pa=b('MercuryThreadInformer').get(),qa=b('MercuryThreadMetadataRawRenderer'),ra=b('MercuryThreadMetadataRenderer').get(),sa=b('MercuryThreadMuter'),ta=b('MercuryThreads').get(),ua=b('MercuryTypingReceiver'),va=b('MessagesEmoticonView'),wa=b('NubController'),xa=b('Parent'),ya=b('PhotosUploadWaterfall'),za=b('PresencePrivacy'),ab=b('PresenceStatus'),bb=b('Run'),cb=b('Style'),db=b('SubscriptionsHandler'),eb=b('ChatTabTemplates'),fb=b('TextAreaControl'),gb=b('Tooltip'),hb=b('TypingDetectorController'),ib=b('URI'),jb=b('UserAgent'),kb=b('VideoCallCore'),lb=b('WaterfallIDGenerator'),mb=b('copyProperties'),nb=b('cx'),ob=b('extendArray'),pb=b('setIntervalAcrossTransitions'),qb=b('tx'),rb=/^\s*$/,sb=fa.create('tab_view'),tb={};function ub(nc,oc){var pc=da.create('div');oc=oc.filter(function(qc){return qc!=ma.user;});ma.getMulti(oc,function(qc){for(var rc in qc){var sc=qc[rc],tc=eb[':fb:mercury:chat:multichat-tooltip-item'].build();da.setContent(tc.getNode('name'),sc.name);var uc=ma.getUserID(rc),vc=uc&&ab.get(uc)==m.ACTIVE;aa.conditionShow(tc.getNode('icon'),vc);aa.conditionClass(tc.getNode('name'),'tooltipItemWithIcon',vc);da.appendContent(pc,tc.getRoot());}gb.set(nc,pc,'above','center');});}var vb={},wb=null,xb=false;function yb(nc,oc,pc){if(pc){vb[nc]=oc;if(!wb)wb=pb(zb,600);}else{aa.removeClass(oc,'highlightTitle');delete vb[nc];}}function zb(){for(var nc in vb){var oc=vb[nc];if(oc.parentNode){aa.conditionClass(oc,'highlightTitle',xb);}else delete vb[nc];}xb=!xb;if(!Object.keys(vb).length){clearInterval(wb);wb=null;}}function ac(nc){var oc=na.tokenizeThreadID(nc);switch(oc.type){case 'user':return eb[':fb:mercury:chat:user-tab'].build();}return eb[':fb:mercury:chat:multichat-tab'].build();}function bc(nc){var oc=nc._tabTemplate.getNode('input').value||'',pc=nc._fileUploader.getAttachments();if(nc._photoUploader&&!nc._isAutoSendPhoto)ob(pc,nc._photoUploader.getAttachments());if(!rb.test(oc)||pc.length>0)dc(nc,oc,pc,function(qc){la.sendMessage(qc);nc._fileUploader.removeAttachments();if(nc._photoUploader&&!nc._isAutoSendPhoto){cc(nc,nc._photoUploader.getAttachments());nc._photoUploader.removeAttachments();}nc._getNode('input').value='';nc._lastMessageIndicator&&nc._lastMessageIndicator.resetState();nc._messagesView&&nc._messagesView.scrollToBottom();});}function cc(nc,oc){if(!oc.length)return;jc(nc,ya.POST_PUBLISHED,{count:oc.length});nc._waterfallID=lb.generate();}function dc(nc,oc,pc,qc){ta.getThreadMeta(nc._threadID,function(rc){var sc=la.constructUserGeneratedMessageObject(oc,oa.CHAT_WEB,nc._threadID);if(pc.length>0){sc.has_attachment=true;sc.raw_attachments=pc;}if(ta.isNewEmptyLocalThread(nc._threadID)){var tc=nc._sheetController.getAddFriendsParticipants();if(tc===null||tc.length===0){return;}else if(tc.length===1){var uc='user:'+ma.getUserID(tc[0]);sc.thread_id=uc;}else ta.addParticipantsToThreadLocally(nc._threadID,tc);}if(ta.isEmptyLocalThread(nc._threadID)){var vc=na.tokenizeThreadID(nc._threadID);sc.message_id=vc.value;sc.specific_to_list=rc.participants;}if(typeof sc!='undefined')sc.signatureID=nc._signatureID;sc.ui_push_phase=z.UIPushPhase;qc(sc);if(nc._threadID!==sc.thread_id){kc.inform('closed-tab',nc._threadID);h.inform('chat/open-tab',{thread_id:sc.thread_id});}});}function ec(nc){nc._blocked=true;nc._sheetController.openUploadWarningTabSheet();}function fc(nc){if(nc._fileUploader.isUploading())return true;if(nc._photoUploader&&nc._photoUploader.isUploading())return true;return false;}function gc(){if(this._blocked){if(fc(this))return;this._blocked=false;bc(this);this._sheetController.closeUploadWarningTabSheet();}}function hc(){this._nubController.flyoutContentChanged();this._attachmentsDiv.scrollTop=this._attachmentsDiv.scrollHeight;}function ic(nc,oc,pc){nc._subscriptionsHandler.addSubscriptions(nc._photoUploader.subscribe(oc,function(qc,rc){jc(nc,pc,rc);}));}function jc(nc,oc,pc){ya.sendSignal(mb({qn:nc._waterfallID,step:oc,uploader:ya.APP_CHAT},pc||{}));}function kc(nc,oc,pc){if(oc)na.ensureThreadIsFetched(oc);this._threadID=nc;this._signatureID=pc;this._eventListeners=[];this._tabTemplate=ac(nc);this._tabElem=this._tabTemplate.getRoot();this._isAutoSendPhoto=p.get('auto_photo_send',0);this._waterfallID=lb.generate();if(!(this._getNode instanceof Function))sb.log('getnode_undefined',{is_getnode_set:!!this._getNode,is_prototype_set:!!kc.prototype,is_window:window==this,is_chat_tab_view:this instanceof kc,ctor_name:this.constructor&&this.constructor.name});this._subscriptionsHandler=new db();this._fileUploader=new ja(this._tabTemplate.getNode('attachmentShelf'),this._tabTemplate.getNode('attachButtonForm'),this._tabTemplate.getNode('fileInput'),this._tabTemplate.getNode('attachID'));this._initializeUploader(this._fileUploader);this._photoUploader=null;var qc=this._tabTemplate.getNode('photoAttachButtonForm');if(qc)if(this._isAutoSendPhoto){this._initializeAutoSendPhotoUploader();}else{this._photoUploader=new ja(this._tabTemplate.getNode('attachmentShelf'),qc,this._tabTemplate.getNode('photoFileInput'),this._tabTemplate.getNode('photoAttachID'));this._initializeUploader(this._photoUploader);ic(this,'open',ya.SELECT_START);ic(this,'submit',ya.UPLOAD_START);ic(this,'one-upload-completed',ya.ONE_UPLOAD_DONE);ic(this,'all-uploads-completed',ya.ALL_UPLOADS_DONE);ic(this,'upload-canceled-after-uploaded',ya.ONE_UPLOAD_CANCELED);ic(this,'upload-canceled-during-upload',ya.ONE_UPLOAD_CANCELED_DURING_UPLOAD);ic(this,'one-upload-failed',ya.CLIENT_ERROR);ic(this,'all-uploads-failed',ya.CLIENT_ERROR);}this._attachmentsDiv=this._getNode('attachmentShelf');this._sheetController=new w(this._threadID,this._getNode('sheet'),this._tabElem);this._sheetController.onClickNewMessagesSheet(function(){this._messagesView&&this._messagesView.scrollToBottom();this.focus();kc.inform('read',this._threadID);}.bind(this));this._sheetController.onClickThreadIsMutedSheet(function(){sa.showMuteChangeDialog(0,this._threadID);this.focus();}.bind(this));this._contextualDialogController=new q(this._threadID,this._getNode('videoCallLink'));this._messagesView=null;var rc=this._getNode('conversationLink');if(rc){aa.hide(rc);ra.renderTitanLink(nc,rc,aa.show.bind(aa,rc));}if(!ta.getCanonicalUserInThread(this._threadID))this._titlebarTooltipAnchor=this._getNode('titlebarText');var sc=this._getCanonicalUserID();if(this._isTitleTextLinked())ma.get('fbid:'+sc,function(cd){if(cd.href){var dd=this._getNode('titlebarText');dd.setAttribute('href',cd.href);dd.removeAttribute('rel');aa.removeClass(dd,'noLink');}}.bind(this));this._nubController=new wa().init(this._tabElem);fb.getInstance(this._getNode('input')).subscribe('resize',function(){this._nubController.flyoutContentChanged();}.bind(this));var tc=null,uc=this._getNode('inputContainer');this._nubController.subscribe('resize',function(){if(!tc)tc=this._tabElem.clientWidth;var cd=2,dd=tc-(uc.clientWidth+cd),ed=ha.isRTL()?'left':'right';cb.set(this._iconsContainerNode,ed,dd+'px');fb.getInstance(this._getNode('input')).update();}.bind(this));var vc=p.get('chat_tab_height');if(vc){var wc=this._tabTemplate.getNode('chatWrapper');cb.set(wc,'height',vc+'px');}this._listen('closeButton','click',this._closeClicked);this._listen('titlebarCloseButton','click',this._closeClicked);this._listen('titlebarCloseButton','mousedown',this._closePreClicked);this._listen('dockButton','click',this._nubClicked);this._listen('dockButton','keydown',this._dockKeyDown);this._listen('nubFlyoutTitlebar','click',this._titleClicked);this._listen('chatConv','click',this._chatConvClicked);this._listen('inputContainer','click',this._inputContainerClicked);this._listen('addFriendLink','click',this._addFriendLinkClicked,true);this._listen('addToThreadLink','click',this._addFriendLinkClicked,true);this._listen('nameConversationLink','click',this._nameConversationLinkClicked,true);this._listen('clearWindowLink','click',this._clearHistory,true);this._listen('unsubscribeLink','click',this._unsubscribeLinkClicked,true);this._listen('videoCallLink','click',this._callClicked,true);this._listen('reportSpamLink','click',this._reportSpamClicked,true);this._listen('muteThreadLink','click',this._showMuteSettingDialog.bind(this,-1),true);this._listen('unmuteThreadLink','click',this._showMuteSettingDialog.bind(this,0),true);this._listen('input','focus',this._focusTab);this._listen('input','blur',this._blurTab);this._iconsContainerNode=this._getNode('iconsContainer');var xc=this._getNode('emoticons');this._emoticonView=null;if(xc)this._emoticonView=new va(xc,this._getNode('input'));var yc=this._getNode('stickers');if(yc)n.loadModules(['MercuryStickers'],function(cd){this._stickerController=new cd(yc);this._subscriptionsHandler.addSubscriptions(this._stickerController.subscribe('stickerselected',function(dd,ed){this._stickerSelected(ed.id);}.bind(this)));}.bind(this));if(jb.firefox()){this._listen('input','keypress',this._inputKeyDown);}else this._listen('input','keydown',this._inputKeyDown);this._privacyLink=this._getNode('privacyLink');if(this._privacyLink){this._privacyActionController=new s(sc,this._updatePrivacyLink.bind(this));this._eventListeners.push(g.listen(this._privacyLink,'click',this._privacyActionController.togglePrivacy.bind(this._privacyActionController)));}ta.getThreadMeta(this._threadID,function(cd){var dd=sc||(p.get('chat_multi_typ_send')&&!cd.is_canonical);if(dd)na.getServerThreadID(this._threadID,function(ed){this._lastMessageIndicator=new hb(sc,this._getNode('input'),'mercury-chat',null,ed);}.bind(this));this._setUpMutingSettings(cd);}.bind(this));var zc=this._getNode('muteGroupLink');if(zc){var ad=ta.getCanonicalGroupInThread(this._threadID);if(ad)zc.setAttribute('ajaxify',ib(zc.getAttribute('ajaxify')).addQueryData({id:ad}));}t.removeEmptyHrefs(this._tabElem);tb[nc]=this;this.updateAvailableStatus();this.updateTab();this._setCloseTooltip(false);var bd={threadID:nc,userID:sc,signatureID:this._signatureID};new l('/ajax/chat/opentab_tracking.php',bd).send();bb.onBeforeUnload(function(){var cd=this._tabTemplate.getNode('input').value||'',dd=this._fileUploader.getAttachments();if(this._photoUploader&&!this._isAutoSendPhoto)ob(dd,this._photoUploader.getAttachments());if(!rb.test(cd)||fc(this)||dd.length>0)return "You haven't sent your message yet. Do you want to leave without sending?";if(la.getNumberLocalMessages(this._threadID))return "Your message is still being sent. Are you sure you want to leave?";return null;}.bind(this),false);bb.onUnload(function(){this._photoUploader&&lc(this);}.bind(this));}function lc(nc){if(nc._photoUploader.isUploading()){jc(nc,ya.CANCEL_DURING_UPLOAD);}else if(!nc._isAutoSendPhoto&&nc._photoUploader.getAttachments().length>0)jc(nc,ya.CANCEL);}function mc(){for(var nc in tb){tb[nc].updateAvailableStatus();tb[nc].updateMultichatTooltip();}}h.subscribe(['buddylist/availability-changed'],mc);za.subscribe(['privacy-changed','privacy-availability-changed'],mc);o.subscribe(o.ON_CHANGED,function(){for(var nc in tb)ta.getThreadMeta(nc,function(oc){tb[nc]._updateUnreadCount(oc);});});ua.subscribe('state-changed',function(nc,oc){for(var pc in oc){var qc=oc[pc]&&oc[pc].length,rc=tb[pc];rc&&rc.showTypingIndicator(qc);}});pa.subscribe('threads-updated',function(nc,oc){for(var pc in tb)oc[pc]&&tb[pc].updateTab();});pa.subscribe('threads-deleted',function(nc,oc){for(var pc in tb)oc[pc]&&kc.inform('thread-deleted',pc);});mb(kc,i,{get:function(nc){return tb[nc];}});mb(kc.prototype,{getThreadID:function(){return this._threadID;},showAddFriend:function(){(function(){this._sheetController.openAddFriendsSheet();}).bind(this).defer();},showPeopleSuggestions:function(){(function(){this._peopleSuggestions=new v(this._sheetController,this._getNode('conversation'),this._getNode('loadingIndicator'));}).bind(this).defer();},showNameConversation:function(){(function(){this._sheetController.openNameConversationSheet();}).bind(this).defer();},isVisible:function(){return aa.shown(this._tabElem);},setVisibleState:function(nc,oc){var pc=aa.shown(this._tabElem),qc=aa.hasClass(this._tabElem,'opened');aa.conditionShow(this._tabElem,nc);aa.conditionClass(this._tabElem,'opened',oc);if(!(pc&&qc)&&nc&&oc){if(!this._messagesView)this._messagesView=new u(this._threadID,this._sheetController,this._getNode('chatConv'),this._getNode('conversation'),this._getNode('loadingIndicator'),this._getNode('lastMessageIndicator'),this._getNode('typingIndicator'));this._nubController.flyoutContentChanged();this._messagesView.scrollToBottom();}if(pc&&qc&&!(nc&&oc))this._contextualDialogController.tabNotActive();},focus:function(){var nc=aa.hasClass(this._tabElem,'opened')?'input':'dockButton';this._getNode(nc).focus();},isFocused:function(){var nc=document.activeElement;return xa.byClass(nc,"_50mz")===this._tabElem;},hasEmptyInput:function(){return rb.test(this._getNode('input').value);},setInput:function(nc){this._getNode('input').value=nc;},insertBefore:function(nc){da.insertBefore(nc._tabElem,this._tabElem);},appendTo:function(nc){da.appendContent(nc,this._tabElem);},nextTabIs:function(nc){var oc=nc&&nc._tabElem;return this._tabElem.nextSibling==oc;},getScrollTop:function(){return da.find(this._tabElem,'.scrollable').scrollTop;},setScrollTop:function(nc){da.find(this._tabElem,'.scrollable').scrollTop=nc;},destroy:function(){da.remove(this._tabElem);this._emoticonView&&this._emoticonView.destroy();this._stickerController&&this._stickerController.destroy();while(this._eventListeners.length)this._eventListeners.pop().remove();this._messagesView&&this._messagesView.destroy();this._sheetController.destroy();this._fileUploader.destroy();this._photoUploader&&this._photoUploader.destroy();this._subscriptionsHandler.release();this._contextualDialogController.destroy();this._privacyActionController&&this._privacyActionController.destroy();delete tb[this._threadID];ca.unregisterNubController(this._nubController);ea.reset(this._getNode('input'));},updateAvailableStatus:function(){ta.getThreadMeta(this._threadID,function(nc){var oc=m.OFFLINE,pc=this._getCanonicalUserID();if(pc){oc=ab.get(pc);}else{var qc=nc.participants.map(function(sc){return ma.getUserID(sc);});oc=ab.getGroup(qc);}if(!x.isOnline())oc=m.OFFLINE;if(pc)this._updateCallLink(oc);aa.conditionClass(this._tabElem,"_5238",oc===m.ACTIVE);aa.conditionClass(this._tabElem,"_5239",oc===m.MOBILE);var rc=this._getNode('presenceIndicator');switch(oc){case m.ACTIVE:rc.setAttribute('alt',"Online");break;case m.MOBILE:rc.setAttribute('alt',"Mobile");break;default:rc.removeAttribute('alt');break;}}.bind(this));},updateTab:function(){ta.getThreadMeta(this._threadID,function(nc){if(!nc.is_subscribed){kc.inform('unsubscribed',this._threadID);return;}ra.renderAndSeparatedParticipantList(this._threadID,[this._getNode('name'),this._getNode('titlebarText')],{names_renderer:qa.renderShortNames,check_length:true});this._updateMutingSettings(nc);this._updateUnreadCount(nc);this.updateMultichatTooltip();this._updateArchiveWarning(nc);if(ta.isNewEmptyLocalThread(this._threadID)){this.showAddFriend();if(p.get('www_chat_compose_suggestions',0))this.showPeopleSuggestions();}else if(this._peopleSuggestions){this._peopleSuggestions.destroy();this._peopleSuggestions=null;}}.bind(this));},updateSignatureID:function(nc){this._signatureID=nc;},_setUpMutingSettings:function(nc){var oc=sa.isThreadMuted(nc);if(oc&&y.MuteThreadsOnDesktopGK)this._sheetController.openThreadIsMutedTabSheet();this._updateActionMenu(oc);},_updateMutingSettings:function(nc){if(!y.MuteThreadsOnDesktopGK)return;var oc=sa.isThreadMuted(nc);if(oc&&aa.shown(this._getNode('muteThreadLink').parentNode)){this._sheetController.openThreadIsMutedTabSheet();}else if(!oc&&aa.shown(this._getNode('unmuteThreadLink').parentNode))this._sheetController.closeThreadIsMutedTabSheet();this._updateActionMenu(oc);},_updateActionMenu:function(nc){aa.conditionShow(this._getNode('muteThreadLink').parentNode,y.MuteThreadsOnDesktopGK&&!nc);aa.conditionShow(this._getNode('unmuteThreadLink').parentNode,y.MuteThreadsOnDesktopGK&&nc);},_updateArchiveWarning:function(nc){var oc=false;ma.get(ma.user,function(pc){oc=pc.employee;if(oc)ma.getMulti(nc.participants,this._showArchiveWarningIfAllParticipantsAreEmployees.bind(this));}.bind(this));},_showArchiveWarningIfAllParticipantsAreEmployees:function(nc){var oc=true;for(var pc in nc)oc=oc&&nc[pc].employee;var qc=this._getNode('titanArchiveWarning');if(qc){if(this._titlebarTooltipAnchor)aa.conditionClass(this._titlebarTooltipAnchor,'narrowTitleBar',oc);aa.conditionShow(qc,oc);}},updateMultichatTooltip:function(){ta.getThreadMeta(this._threadID,function(nc){if(!nc.is_canonical)ub(this._titlebarTooltipAnchor,nc.participants);}.bind(this));},_getNode:function(nc){return this._tabTemplate.getNode(nc);},_getCanonicalUserID:function(){return ta.getCanonicalUserInThread(this._threadID);},_listen:function(nc,event,oc,pc){var qc=this._getNode(nc);if(qc){this._eventListeners.push(g.listen(qc,event,oc.bind(this)));}else if(!pc)throw new Error('Could not find node "'+nc+'"');},_closePreClicked:function(nc){this._closeMouseDown=true;},_closeClicked:function(nc){this._photoUploader&&lc(this);kc.inform('closed-tab',this._threadID);nc.kill();},_nubClicked:function(nc){nc.kill();return kc.inform('nub-activated',this._threadID);},_dockKeyDown:function(event){if(event.keyCode===ga.RETURN||event.keyCode===ga.SPACE){kc.inform('nub-activated',this._threadID);event.kill();}else this._handleHotkeyPressed(event);},_handleHotkeyPressed:function(event){if(event.keyCode===ga.ESC){this._photoUploader&&lc(this);kc.inform('esc-pressed',this._threadID);event.kill();}else if(event.keyCode===ga.TAB&&!event.ctrlKey){var nc=kc.inform('tab-pressed',{id:this._threadID,shiftPressed:event.shiftKey});!nc&&event.kill();}},_isTitleTextLinked:function(){var nc=this._getCanonicalUserID();return nc&&p.get('chat_tab_title_link_timeline');},_titleClicked:function(event){var nc=event.getTarget(),oc=xa.byClass(nc,'titlebarText'),pc=oc&&this._isTitleTextLinked();if(!pc&&!xa.byClass(nc,'uiSelector')&&!xa.byClass(nc,'addToThread')){kc.inform('lower-activated',this._threadID);event.kill();}},_callClicked:function(nc){var oc=this._getCanonicalUserID();if(kb.availableForCall(oc)){var pc='chat_tab_icon';if(nc.target&&aa.hasClass(nc.target,'video_call_promo')){pc='chat_tab_icon_promo';}else if(nc.target&&aa.hasClass(nc.target,'video_call_tour'))pc='chat_tab_icon_tour';kc.inform('video-call-clicked',{threadID:this._threadID,userID:oc,clickSource:pc});}return false;},_addFriendLinkClicked:function(){this.showAddFriend();},_nameConversationLinkClicked:function(){this.showNameConversation();},_clearHistory:function(){var nc=ta.getThreadMetaNow(this._threadID);if(nc){var oc=this._getCanonicalUserID();na.clearChat(this._threadID,oc,nc.timestamp);}},_unsubscribeLinkClicked:function(){var nc=[];nc.push({name:'unsubscribe',label:"Leave Conversation",handler:this._unsubscribeToThread.bind(this)});nc.push(ba.CANCEL);new ba().setTitle("Leave Conversation?").setBody("You will stop receiving messages from this conversation and people will see that you left.").setButtons(nc).show();},_reportSpamClicked:function(){var nc=this._getCanonicalUserID(),oc=ib('/ajax/chat/report.php').addQueryData({id:nc}).addQueryData({src:'top_report_link'});j.send(new k(oc));},_showMuteSettingDialog:function(nc){sa.showMuteChangeDialog(nc,this._threadID);},_focusTab:function(){aa.addClass(this._tabElem,'focusedTab');this.tryMarkAsRead();this._contextualDialogController.tabFocused();this._closeMouseDown=false;this._setCloseTooltip(true);},_blurTab:function(){aa.removeClass(this._tabElem,'focusedTab');!this._closeMouseDown&&this._setCloseTooltip(false);},_setCloseTooltip:function(nc){var oc=this._getNode('titlebarCloseButton'),pc=nc?"Press Esc to close":"Close tab";gb.set(oc,pc,'above','center');},_inputKeyDown:function(event){if(event.keyCode===ga.RETURN&&!event.shiftKey){if(fc(this)){ec(this);event.kill();return;}bc(this);event.kill();return;}if(event.keyCode===ga.DOWN&&event.shiftKey&&this._getNode('input').value===''){kc.inform('lower-activated',this._threadID);event.kill();return;}this._handleHotkeyPressed(event);},tryMarkAsRead:function(){if(!this._messagesView||this._messagesView.isScrolledToBottom()){kc.inform('read',this._threadID);return true;}return false;},_chatConvClicked:function(nc){this.tryMarkAsRead();if(xa.byTag(nc.getTarget(),'a')||da.getSelection())return;this.focus();},_inputContainerClicked:function(nc){this.tryMarkAsRead();this.focus();},showTypingIndicator:function(nc){var oc=ta.getThreadMetaNow(this._threadID),pc=this._getCanonicalUserID()||(p.get('chat_multi_typ')&&oc&&!oc.is_canonical);if(pc)aa.conditionClass(this._tabElem,'typing',nc);},_updateUnreadCount:function(nc){var oc=nc.unread_count;if(typeof oc!='undefined'){var pc=!!oc&&(!o.showsTabUnreadUI||o.showsTabUnreadUI()),qc=this._getNode('numMessages');aa.conditionShow(qc,pc);aa.conditionClass(this._tabElem,'highlightTab',pc);yb(this._threadID,this._tabElem,pc);da.setContent(qc,oc);}},_updateCallLink:function(nc){var oc=this._getNode('videoCallLink');if(x.isOnline()){var pc=this._getCanonicalUserID(),qc='fbid:'+pc;ma.get(qc,function(rc){if(kb.availableForCall(pc)){gb.set(oc,qb._("Start a video call with {firstname}",{firstname:rc.short_name}));this._updateCallBackLinks(this._tabElem,true);}else{gb.set(oc,qb._("{firstname} is currently unavailable for video calling",{firstname:rc.short_name}));this._hideVideoCallouts();this._updateCallBackLinks(this._tabElem,false);}}.bind(this));}else{gb.set(oc,"You must be online to make a call.");this._hideVideoCallouts();this._updateCallBackLinks(document.body,false);}},_updateCallBackLinks:function(nc,oc){var pc=da.scry(nc,'a.callBackLink');if(oc){pc.forEach(aa.show);}else pc.forEach(aa.hide);},_hideVideoCallouts:function(){this._contextualDialogController.hideVideoCallouts();},_updatePrivacyLink:function(nc){if(nc==s.OFFLINE){da.setContent(this._privacyLink,"Go online");}else{var oc=this._getCanonicalUserID(),pc='fbid:'+oc;ma.get(pc,function(qc){var rc=null;if(nc==s.BLOCKED){rc=qb._("Turn On Chat for {name}",{name:qc.short_name});}else rc=qb._("Turn Off Chat for {name}",{name:qc.short_name});da.setContent(this._privacyLink,rc);}.bind(this));}},_unsubscribeToThread:function(){if(ta.isEmptyLocalThread(this._threadID)){kc.inform('unsubscribed',this._threadID);}else{var nc=la.constructLogMessageObject(oa.CHAT_WEB,this._threadID,ka.UNSUBSCRIBE,{});la.sendMessage(nc);}return true;},_initializeUploader:function(nc){this._subscriptionsHandler.addSubscriptions(nc.subscribe(['all-uploads-completed','upload-canceled'],gc.bind(this)),nc.subscribe('dom-updated',hc.bind(this)),nc.subscribe('submit',function(){this._getNode('input').focus();}.bind(this)));},_initializeAutoSendPhotoUploader:function(){this._photoUploader=new r(this._tabTemplate.getNode('photoAttachButtonForm'),this._tabTemplate.getNode('photoFileInput'),this._tabTemplate.getNode('photoAttachID'));var nc={};ic(this,'submit',ya.UPLOAD_START);ic(this,'all-uploads-completed',ya.ALL_UPLOADS_DONE);ic(this,'all-uploads-failed',ya.CLIENT_ERROR);this._subscriptionsHandler.addSubscriptions(this._photoUploader.subscribe('submit',function(oc,pc){dc(this,'',pc.raw_attachments,function(qc){nc[pc.upload_id]=qc;qc.do_not_send_to_server=true;qc.status=ia.RESENDING;la.sendMessage(qc);});this._getNode('input').focus();}.bind(this)),this._photoUploader.subscribe('all-uploads-failed',function(oc,pc){var qc=nc[pc.upload_id];delete nc[pc.upload_id];la.deleteMessages(qc.thread_id,[qc.message_id]);}.bind(this)),this._photoUploader.subscribe('all-uploads-completed',function(oc,pc){var qc=nc[pc.upload_id];delete nc[pc.upload_id];qc.raw_attachments=pc.attachments;qc.do_not_send_to_server=false;la.sendMessage(qc);cc(this,pc.attachments);}.bind(this)));},_stickerSelected:function(nc){dc(this,'',[],function(oc){oc.has_attachment=true;oc.sticker_id=nc;la.sendMessage(oc);});},_emoticonView:null});e.exports=kc;});
  90. __d("ChatNewMessageHandler",["ChatActivity","ChatConfig","ChatTabModel","ChatTabView","JSLogger","MercuryAssert","MercuryBrowserAlerts","MercuryUnseenState"],function(a,b,c,d,e,f){var g=b('ChatActivity'),h=b('ChatConfig'),i=b('ChatTabModel'),j=b('ChatTabView'),k=b('JSLogger'),l=b('MercuryAssert'),m=b('MercuryBrowserAlerts'),n=b('MercuryUnseenState').get(),o=k.create('chat_new_message'),p={_raiseTab:function(q,r){var s=i.getTab(q),t=false;if(s){t=s.raised;}else{i.raiseTab(q,false);t=true;}r.to_new_tab=!s;r.to_raised_tab=!!t;},_notify:function(q,r,s){var t=j.get(q);s.view_is_visible=t&&t.isVisible();s.view_is_focused=t&&t.isFocused();if(!s.view_is_visible)o.log('message_to_hidden');s.is_active=g.isActive();m.messageReceived(r);},_promoteTab:function(q,r,s){if(h.get('chat_promote_new_messages'))if(s&&!s[q]&&r)i.promoteThreadInPlaceOfThread(q,r);},newMessage:function(q,r,s,t){l.isThreadID(q);var u={thread_id:q,message_id:r.message_id};this._raiseTab(q,u);this._promoteTab(q,s,t);this._notify(q,r,u);o.log('message',u);}};m.subscribe('before-alert',function(q,event){var r=event.threadID,s=j.get(r),t=i.getTab(r);if(t&&t.raised&&s&&s.isVisible()&&s.isFocused()&&s.tryMarkAsRead()){n.markThreadSeen(r);event.cancelAlert();}});e.exports=p;});
  91. __d("ChatTabPresence",["AvailableList","ChatTabModel","MercuryThreads"],function(a,b,c,d,e,f){var g=b('AvailableList'),h=b('ChatTabModel'),i=b('MercuryThreads').get(),j={};function k(l){var m=i.getCanonicalUserInThread(l);if(m)g.updateForID(m);}h.subscribe('chat/tabs-changed',function(event,l){l.tabs.forEach(function(m){if(m.raised&&!j[m.id])k(m.id);});j={};l.tabs.forEach(function(m){if(m.raised)j[m.id]=true;});});e.exports={};});
  92. __d("ChatTabPolicy",["ChatBehavior","MercuryConfig","FBDesktopPlugin","JSLogger","MercuryActionTypeConstants","MercuryAssert","MercuryParticipants","MercuryParticipantTypes","MercurySourceType","MercuryThreadMode","MercuryThreadMuter","MercuryUnseenState","MessagingTag","PresencePrivacy","ShortProfiles"],function(a,b,c,d,e,f){var g=b('ChatBehavior'),h=b('MercuryConfig'),i=b('FBDesktopPlugin'),j=b('JSLogger'),k=b('MercuryActionTypeConstants'),l=b('MercuryAssert'),m=b('MercuryParticipants'),n=b('MercuryParticipantTypes'),o=b('MercurySourceType'),p=b('MercuryThreadMode'),q=b('MercuryThreadMuter'),r=b('MercuryUnseenState').get(),s=b('MessagingTag'),t=b('PresencePrivacy'),u=b('ShortProfiles'),v=j.create('tab_policy');function w(x,y){r.markThreadSeen(x,y);}e.exports={messageIsAllowed:function(x,y,z){var aa=x.thread_id,ba=y.message_id;l.isThreadID(aa);l.isParticipantID(y.author);var ca;if(h.MuteThreadsOnDesktopGK&&q.isThreadMuted(x)){ca={thread_id:aa,message_id:ba,mute_settings:x.mute_settings};v.log('message_thread_muted',ca);return;}if(x.mode==p.OBJECT_ORIGINATED){ca={thread_id:aa,message_id:ba,mode:x.mode};v.log('message_object_originated',ca);return;}if(y.source==o.EMAIL||y.source==o.TITAN_EMAIL_REPLY){ca={thread_id:aa,message_id:ba,source:y.source};v.log('message_source_not_allowed',ca);return;}var da=m.getUserID(y.author);if(!da){v.log('message_bad_author',{thread_id:aa,message_id:ba,user:da});return;}if(y.action_type!=k.USER_GENERATED_MESSAGE){ca={thread_id:aa,message_id:ba,type:y.action_type};v.log('message_non_user_generated',ca);return;}if(x.is_canonical_user&&!g.notifiesUserMessages()){v.log('message_jabber',{thread_id:aa,message_id:ba});w(aa,true);return;}if(x.is_canonical&&!x.canonical_fbid){v.log('message_canonical_contact',{thread_id:aa,message_id:ba});return;}if(i.shouldSuppressMessages()){v.log('message_desktop',{thread_id:aa,message_id:ba});return;}if(x.folder!=s.INBOX){v.log('message_folder',{thread_id:aa,message_id:ba,folder:x.folder});return;}var ea=m.getUserID(m.user);u.getMulti([da,ea],function(fa){if(!t.allows(da)){v.log('message_privacy',{thread_id:aa,message_id:ba,user:da});return;}var ga=fa[da].employee&&fa[ea].employee;if(!ga&&fa[da].type!==n.FRIEND){v.log('message_non_friend',{thread_id:aa,message_id:ba,user:da});return;}z();});}};});
  93. __d("ChatTabViewSelector",["Event","Arbiter","CSS","DataStore","DOM","MenuDeprecated","MercuryThreadInformer","MercuryThreads","NubController","ChatTabTemplates","MercuryThreadMetadataRenderer","Toggler","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('CSS'),j=b('DataStore'),k=b('DOM'),l=b('MenuDeprecated'),m=b('MercuryThreadInformer').get(),n=b('MercuryThreads').get(),o=b('NubController'),p=b('ChatTabTemplates'),q=b('MercuryThreadMetadataRenderer').get(),r=b('Toggler'),s=b('copyProperties');function t(u){var v=p[':fb:chat:tab:selector'].build(),w=v.getRoot(),x=v.getNode('menu'),y=k.find(x,'.uiMenuInner'),z={},aa=new o().init(w);i.hide(w);k.insertBefore(u,w);function ba(ea){var fa=0;for(var ga in z){var ha=z[ga],ia=n.getThreadMetaNow(ga),ja=ha.getNode('unreadCount'),ka=(ia&&ia.unread_count)||0;fa+=ka;if(ka>9)ka='+';i.conditionClass(ja,'invisible_elem',!ka);k.setContent(ja,ka);}var la=v.getNode('numMessages');i.conditionShow(la,fa);k.setContent(la,fa);}this.setTabData=function(ea){z={};if(ea.length<1){i.hide(w);return;}i.show(w);k.empty(y);ea.forEach(function(fa){var ga=p[':fb:chat:tab:selector:item'].build();z[fa.id]=ga;var ha=ga.getNode('content');q.renderAndSeparatedParticipantList(fa.id,ha);k.prependContent(y,ga.getRoot());j.set(ga.getRoot(),'threadID',fa.id);var ia=ga.getNode('closeButton');g.listen(ia,'click',function(event){t.inform('selector/close-tab',fa.id);event.kill();});});aa.flyoutContentChanged();k.setContent(v.getNode('numTabs'),ea.length);ba();};function ca(event,ea){if(ea.menu!=x)return;var fa=j.get(ea.item,'threadID');t.inform('selected',fa);r.hide(w);}function da(event,ea){l.register(x);}l.subscribe('select',ca.bind(this));r.listen('show',w,function(){h.inform('layer_shown',{type:'ChatTabSelector'});da();});r.listen('hide',w,function(){h.inform('layer_hidden',{type:'ChatTabSelector'});});m.subscribe('threads-updated',ba);}s(t,new h());e.exports=t;});
  94. __d("ChatTabController",["ChatTabPresence","ChatTypeaheadBehavior","Arbiter","ChatActivity","ChatBehavior","ChatConfig","ChatNewMessageHandler","ChatTabMessagesView","ChatTabModel","ChatTabPolicy","ChatTabView","ChatTabViewSelector","JSLogger","MercuryParticipants","MercuryServerRequests","MercuryThreadInformer","MercuryThreads","MercuryUnseenState","Style","UserAgent","VideoCallCore"],function(a,b,c,d,e,f){b('ChatTabPresence');b('ChatTypeaheadBehavior');var g=b('Arbiter'),h=b('ChatActivity'),i=b('ChatBehavior'),j=b('ChatConfig'),k=b('ChatNewMessageHandler'),l=b('ChatTabMessagesView'),m=b('ChatTabModel'),n=b('ChatTabPolicy'),o=b('ChatTabView'),p=b('ChatTabViewSelector'),q=b('JSLogger'),r=b('MercuryParticipants'),s=b('MercuryServerRequests').get(),t=b('MercuryThreadInformer').get(),u=b('MercuryThreads').get(),v=b('MercuryUnseenState').get(),w=b('Style'),x=b('UserAgent'),y=b('VideoCallCore'),z=j.get('tab_auto_close_timeout')||7200000,aa=q.create('tab_controller');function ba(oa){u.changeThreadReadStatus(oa,true);ca(oa);}function ca(oa){v.markThreadSeen(oa);}function da(){var oa=m.get();oa.tabs.forEach(function(pa){if(pa.raised||i.showsTabUnreadUI())ca(pa.id);});}function ea(oa,pa,qa){var ra=m.get().tabs;oa+=pa?1:-1;while(oa>=0&&oa<ra.length){var sa=ra[oa],ta=o.get(sa.id);if(ta&&ta.isVisible()&&(!qa||sa.raised)){ta.focus();return true;}oa+=pa?1:-1;}return false;}function fa(oa,pa,qa){var ra=pa.shouldPromoteOnRaise(oa);g.inform("chat/promote-tab",oa);if(ra){m.raiseAndPromoteTab(oa,true,qa);}else m.raiseTab(oa,true,qa);var sa=o.get(oa);sa&&sa.focus();}function ga(oa,pa,qa){var ra=qa.getMaxTabsToShow(),sa=m.indexOf(oa);m.closeTabAndDemote(oa,ra-2,pa);return sa;}function ha(oa){var pa=Object.keys(oa.getTabsToShow()||{}),qa=1*60,ra=null,sa=Infinity;for(var ta=0;ta<pa.length;ta++){var ua=pa[ta],va=u.getThreadMetaNow(ua);if(!o.get(ua).hasEmptyInput()||!va)continue;var wa=(m.getServerTime()-va.timestamp)/1000;if(!va.timestamp||(va.timestamp&&va.timestamp<sa&&wa>qa)){ra=va.thread_id;sa=va.timestamp;}}return ra;}function ia(oa){p.subscribe('selected',function(qa,ra){fa(ra,oa);});g.subscribe('chat/open-tab',function(qa,ra){fa(ra.thread_id,oa,ra.signature_id);});g.subscribe('page_transition',function(qa,ra){m.closeFragileTabs();});s.subscribe('model-update-completed',da);o.subscribe('read',function(event,qa){ba(qa);});h.subscribe('idle',function(qa,ra){if(ra>z){var sa=m.get().tabs;sa.forEach(function(ta){var ua=ta.id;u.getThreadMeta(ua,function(va){if(!va.unread_count){aa.log('autoclose_idle_seen',{thread_id:ua,idleness:ra});m.closeTab(ua,'autoclose_idle_seen');}});});}});o.subscribe('nub-activated',function(qa,ra){fa(ra,oa);});o.subscribe('lower-activated',function(qa,ra){m.lowerTab(ra);var sa=o.get(ra);sa&&sa.focus();});function pa(qa,ra){y.showOutgoingCallDialog(ra.userID,ra.clickSource);m.lowerTab(ra.threadID);}o.subscribe('video-call-clicked',pa);l.subscribe('video-call-clicked',pa);o.subscribe('closed-tab',function(qa,ra){aa.log('close_view',{thread_id:ra});ga(ra,'close_view',oa);return false;});o.subscribe('thread-deleted',function(qa,ra){aa.log('close_thread_deleted',{thread_id:ra});ga(ra,'close_thread_deleted',oa);return false;});o.subscribe('unsubscribed',function(qa,ra){aa.log('close_view_unsubscribed',{thread_id:ra});ga(ra,'close_view_unsubscribed',oa);return false;});o.subscribe('esc-pressed',function(qa,ra){aa.log('close_esc',{thread_id:ra});var sa=ga(ra,'close_esc',oa);(function(){ea(sa-1,true,true)||ea(sa,false,true);}).defer();});p.subscribe('selector/close-tab',function(qa,ra){aa.log('close_chat_from_selector',{thread_id:ra});ga(ra,'close_chat_from_selector',oa);});t.subscribe('messages-received',function(qa,ra){for(var sa in ra){var ta=ra[sa];for(var ua=0;ua<ta.length;ua++){var va=ta[ua];if(va.author!=r.user){if(!va.is_unread){aa.log('message_already_read',{action_id:va.action_id,thread_id:va.thread_id});continue;}u.getThreadMeta(sa,function(wa){n.messageIsAllowed(wa,va,function(){var xa=oa.hasRoomForRaisedTab()?undefined:ha(oa);k.newMessage(sa,va,xa,oa.getTabsToShow());});});}}}});t.subscribe('thread-read-changed',function(qa,ra){for(var sa in ra)if(!ra[sa].mark_as_read){aa.log('autoclose_marked_unread',{thread_id:sa});m.closeTab(sa,'autoclose_marked_unread');}});o.subscribe('tab-pressed',function(qa,ra){return !ea(m.indexOf(ra.id),ra.shiftPressed);});g.subscribe(q.DUMP_EVENT,function(qa,ra){ra.chat_controller={auto_close_timeout:z};});}if(x.firefox()){var ja=function(){return w.get(document.body,'overflowX')+' '+w.get(document.body,'overflowY');},ka=ja(),la=function(){var oa=ja();if(oa!==ka){ka=oa;g.inform('overflow-applied-to-body');}};if('MutationObserver' in window){var ma=new MutationObserver(la),na={attributes:true,attributeFilter:['class','style']};ma.observe(document.documentElement,na);}else document.documentElement.addEventListener('DOMAttrModified',function(event){if(event.getTarget()===document.documentElement&&(event.attrName==='class'||event.attrName==='style'))la();},false);}e.exports=ia;});
  95. __d("ChatTabViewCoordinator",["Arbiter","ChatTabModel","ChatTabView","ChatTabViewSelector","CSS","VideoCallCore"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('ChatTabModel'),i=b('ChatTabView'),j=b('ChatTabViewSelector'),k=b('CSS'),l=b('VideoCallCore');function m(n,o){var p=new j(n),q={},r=false;function s(){var w=h.get(),x={};w.tabs.forEach(function(z){x[z.id]=1;});for(var y in q)if(!x[y]){q[y].destroy();delete(q[y]);}t(w);u(w);}function t(w){var x=null;w.tabs.forEach(function(y){var z=y.id,aa=false;if(!q[z]){q[z]=new i(z,y.server_id,y.signatureID);aa=true;}else q[z].updateSignatureID(y.signatureID);if(aa||!q[z].nextTabIs(x)){var ba=q[z].getScrollTop();if(x){q[z].insertBefore(x);}else q[z].appendTo(n);if(ba)q[z].setScrollTop(ba);}x=q[z];});}function u(w){var x=o.getTabsToShow(w),y=[],z=false;w.tabs.forEach(function(aa){if(!x[aa.id]){q[aa.id].setVisibleState(false,aa.raised);y.push(aa);}});w.tabs.forEach(function(aa){if(x[aa.id]){q[aa.id].setVisibleState(true,aa.raised);z|=aa.raised;}});p.setTabData(y);v(z);}function v(w){if(!w&&r){g.inform('layer_hidden',{type:'ChatTab'});r=false;}else if(w&&!r){g.inform('layer_shown',{type:'ChatTab'});r=true;}}if(l.isSupported())k.addClass(n,'videoCallEnabled');o.subscribe('tabs-changed',s);s();}e.exports=m;});
  96. __d("TabsViewport",["ArbiterMixin","ChatTabModel","Dock","DOM","DOMDimensions","Event","Parent","Vector","areObjectsEqual","copyProperties","csx","shield"],function(a,b,c,d,e,f){var g=b('ArbiterMixin'),h=b('ChatTabModel'),i=b('Dock'),j=b('DOM'),k=b('DOMDimensions'),l=b('Event'),m=b('Parent'),n=b('Vector'),o=b('areObjectsEqual'),p=b('copyProperties'),q=b('csx'),r=b('shield'),s=164,t=264;function u(v){this._root=v;l.listen(window,'resize',this._recalculateWidth.bind(this));i.subscribe('resize',this._recalculateWidth.bind(this));h.subscribe('chat/tabs-changed',r(this._recalculateTabs,this,true));this._recalculateWidth();this._initialized=true;}p(u.prototype,g,{_root:null,_initialized:false,_availableWidth:0,_maxShown:1,_viewState:null,_recalculateWidth:function(){var v=u._getAvailableDockWidth(this._root),w=Math.max(1,Math.floor(v/t)),x=w!=this._maxShown;if(!this._viewState||x||v<=this._viewState.usedWidth||v>this._viewState.widthToShowNext){this._availableWidth=v;this._maxShown=w;this._viewState=null;this._recalculateTabs(x);}},_onTabsChanged:function(){if(this._initialized){this.inform('tabs-changed');this.inform('max-to-show-changed',this._maxShown);this.inform('max-to-show-change-completed');}},_recalculateTabs:function(v){var w=u._getTabsToShow(h.get(),this._availableWidth);if(v||!o(this._viewState,w)){this._viewState=w;this._onTabsChanged();}},getMaxTabsToShow:function(){return this._maxShown;},checkWidth:function(){this._recalculateWidth();},hasRoomForRaisedTab:function(){return this._availableWidth-this._viewState.usedWidth>t;},getTabsToShow:function(){return JSON.parse(JSON.stringify(this._viewState.tabsToShow));},shouldPromoteOnRaise:function(v){if(!this._viewState.tabsToShow[v])return true;if(this._viewState.nextToHide!=v)return false;var w=h.getTab(v),x=w&&w.raised;return !x&&(this._availableWidth-this._viewState.usedWidth<100);}});p(u,{_getAvailableDockWidth:function(v){var w=k.getViewportWithoutScrollbarDimensions().width;w-=205;w-=50;var x=m.byClass(v,'fbDock'),y=j.find(x,"._56ox"),z=n.getElementDimensions(y).x,aa=j.find(x,"._56oy");z+=n.getElementDimensions(aa).x;var ba=n.getElementDimensions(x),ca=ba.x-z;w-=ca;w-=15;return Math.max(w,0);},_getTabsToShow:function(v,w){w=Math.max(w,t+1);function x(ma){return ma.raised?t:s;}var y=JSON.parse(JSON.stringify(v.tabs)),z=-1,aa=null;if(v.promoted)y.forEach(function(ma,na){if(ma.id===v.promoted){z=na;aa=ma;}});var ba=0,ca=0,da=!aa;y.forEach(function(ma,na){var oa=x(ma);ma.leftmostOffset=ba+t;ba+=oa;if(ma.leftmostOffset<w)ca++;da|=na==z;ma.alreadyPlacedPromoted=da;});function ea(ma,na,oa){var pa={};for(var qa=0;qa<na;qa++){var ra=ma[qa];if(!ra.alreadyPlacedPromoted&&qa==na-1){pa[oa]=true;}else pa[ra.id]=true;}return pa;}var fa=ea(y,ca,v.promoted),ga=ea(y,ca-1,v.promoted),ha=null;for(var ia in fa)if(!ga[ia])ha=ia;var ja=y[ca-1],ka=ja?ja.leftmostOffset:0,la=Infinity;if(ca<y.length)la=y[ca].leftmostOffset;return {nextToHide:ha,tabsToShow:fa,usedWidth:ka,widthToShowNext:la};}});e.exports=u;});
  97. __d("LinkshimHandler",["Event","LinkshimAsyncLink","LinkshimHandlerConfig","URI","shield"],function(a,b,c,d,e,f){var g=b('Event'),h=b('LinkshimAsyncLink'),i=b('LinkshimHandlerConfig'),j=b('URI'),k=b('shield'),l={setUpLinkshimHandling:function(r){var s=j(r.getAttribute('href')),t=m(s);if(t&&n(s)){g.listen(r,'mouseover',k(h.swap,null,r,t));var u=p(s);g.listen(r,'click',function(){if(i.supports_meta_referrer){h.referrer_log(r,u,o(s).toString());}else h.swap(r,s);});}}};function m(r){return r.getQueryData().u?new j(r.getQueryData().u):null;}function n(r){return r.getQueryData().hasOwnProperty('s');}function o(r){return j('/si/ajax/l/render_linkshim_log/').setSubdomain('www').setQueryData(r.getQueryData());}function p(r){var s;if(q()){s=j(r).addQueryData({render_verification:true});}else s=m(r);return s;}function q(){var r=i.render_verification_rate||0;return Math.floor(Math.random()*r+1)===r;}e.exports=l;});
  98. __d("TooltipLink",["Parent","Tooltip"],function(a,b,c,d,e,f){var g=b('Parent'),h=b('Tooltip'),i={setTooltipText:function(j,k){j=g.byTag(j,'a');j&&h.set(j,k);}};e.exports=i;});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement