/*1327103337,176832696*/ if (window.CavalryLogger) { CavalryLogger.start_js(["zK1Mu"]); } __d("ObjectUtils",["copyProperties","hasArrayNature"],function(d,g,h,f,c){var b=g("copyProperties");var e=g("hasArrayNature");var a={object:function(j){var i=new Function();i.prototype=j;return new i();},isScalar:function(i){return (/string|number|boolean/).test(typeof i);},getKeys:function(k){var j=[];for(var i in k)j.push(i);return j;},getValues:function(j){var k=[];for(var i in j)k.push(j[i]);return k;},countKeys:function(k){var i=0;for(var j in k)i++;return i;},areEqual:function(i,j){return JSON.stringify(i)==JSON.stringify(j);},merge:function(){var j={};for(var i=0;i10000;n=zc;if(zb)d.inform(d.TIME_TRAVEL,za);return zb;}g.push(f);function v(za){var zb=za?{line:za.lineNumber||za.line,message:za.message,name:za.name,script:za.fileName||za.sourceURL,stack:za.stackTrace||za.stack}:{};if(z.chrome()&&za.stack&&/(\w{3,5}:\/\/[^:]+):(\d+)/.test(za.stack)){zb.script=RegExp.$1;zb.line=parseInt(RegExp.$2,10);}for(var zc in zb)if(zb[zc]==null)delete zb[zc];return zb;}var h=null;var o=false;function y(zb,za){if(z.ie())return zb;if(/nocatch/.test(location.search))return zb;return function(){if(o)return zb.apply(this,arguments);try{o=true;var res=zb.apply(this,arguments);o=false;return res;}catch(zc){o=false;h=d.normalizeError(zc);if(za)za(h);throw zc;}};}function t(za){if(za instanceof Error)za=v(za);d.inform(d.ERROR,za);}function j(zc,zd,zb){var za=h||{message:zc,script:zd,line:zb};h=null;za.script=za.script||zd;za.line=za.line||zb;t(za);}function k(){window.onerror=j;}a.setErrorHandler(d.informError);k();g.push(k);s.SystemEvents=u.exports=q(d,{USER:'SystemEvents/USER',ONLINE:'SystemEvents/ONLINE',TIME_TRAVEL:'SystemEvents/TIME_TRAVEL',ERROR:'SystemEvents/ERROR',trapError:y,normalizeError:v,informError:t,isPageOwner:function(za){return za||i()==m;},checkTimeTravel:f});},3); function _onloadHook(){!window.loaded&&window.CavalryLogger&&CavalryLogger.getInstance().setTimeStamp('t_prehooks');_runHooks('onloadhooks');!window.loaded&&window.CavalryLogger&&CavalryLogger.getInstance().setTimeStamp('t_hooks');window.loaded=true;Arbiter.inform('uipage_onload',true,Arbiter.BEHAVIOR_STATE);}function _onafterloadHook(){_runHooks('onafterloadhooks');window.afterloaded=true;}function _runHook(b,c){if(/nocatch/.test(location.search))return b();try{return b();}catch(a){var err=SystemEvents.normalizeError(a);err.event_type=c;err.category='runhook';SystemEvents.informError(err);}}function _runHooks(b){var d=b=='onbeforeleavehooks'||b=='onbeforeunloadhooks';var e=null;do{var a=window[b];if(!d)window[b]=null;if(!a)break;for(var c=0;c=f.length&&this.substring(this.length-f.length)==f;};String.prototype.split=(function(f){return function(m,j){var g="";if(m===null||j===null){return [];}else if(typeof m=='string'){return f.call(this,m,j);}else if(m===undefined){return [this.toString()];}else if(m instanceof RegExp){if(!m._2||!m._1){g=m.toString().replace(/^[\S\s]+\//,"");if(!m._1)if(!m.global){m._1=new RegExp(m.source,"g"+g);}else m._1=1;}separator1=m._1===1?m:m._1;var n=(m._2?m._2:m._2=new RegExp("^"+separator1.source+"$",g));if(j===undefined||j<0){j=false;}else{j=Math.floor(j);if(!j)return [];}var k,l=[],i=0,h=0;while(( j?h++<=j:true)&&(k=separator1.exec(this))){if((k[0].length===0)&&(separator1.lastIndex>k.index))separator1.lastIndex--;if(separator1.lastIndex>i){if(k.length>1)k[0].replace(n,function(){for(var o=1;o'+this._extra_action+'';return k;},setAction:function(k){this._extra_action=k;return this;},getAction:function(){this._fillCache();var k=function(){this._inline_js();d(this._extra_action);}.bind(this);if(this.getDeferred()){return k.de fer.bind(k);}else return k;},setDeferred:function(k){this._defer=!!k;return this;},getDeferred:function(){return this._defer;},getContent:function(){return this._content;},getNodes:function(){this._fillCache();return this._nodes;},getRootNode:function(){return this.getNodes()[0];},ieCloneBug:function(){this._fillCache();return this._ie_clone_bug;},_fillCache:function(){if(null!==this._nodes)return;var n=this._content;if(!n){this._nodes=[];return;}n=n.replace(/(<(\w+)[^>]*?)\/>/g,function(v,w,x){return x.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?v:w+'>';});var r=n.trim().toLowerCase(),u=document.createElement('div'),l=false;var t=(!r.indexOf('',''])||(!r.indexOf('',''])||(r.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,'','
'])||(!r.indexOf('',''])||((!r.indexOf('',''])||(!r.indexOf('',''])||null;if(null===t){u.className='__WRAPPER';if(j.ie()){t=[0,' ',''];l=true;}else t=[0,'',''];}u.innerHTML=t[1]+n+t[2];while(t[0]--)u=u.lastChild;if(l)u.removeChild(u.firstChild);u.className!='__WRAPPER';if(0!==u.getElementsByTagName('option').length||0!==u.getElementsByTagName('object').length)this._ie_clone_bug=true;if(j.ie()){var s;if(!r.indexOf(''&&-1==r.indexOf('=0;--p)if(s[p].nodeName&&s[p].nodeName.toLowerCase()=='tbody'&&s[p].childNodes.length==0)s[p].parentNode.removeChild(s[p]);}var q=u.getElementsByTagName('script');var k=[];for(var o=0;o=0;o--)q[o].parentNode.removeChild(q[o]);var m=function(){for(var v=0;v7&&!e.isNodeOfType(ze,['table','tbody','thead','tfoot','tr','select','fieldset']))){var z=y?" ":"";ze.innerHTML=z+v;y&&ze.removeChild(ze.firstChild);return c.createFrom(ze.childNodes);}}else if(e.isTextNode(ze)){ze.data=v;return [v];}var zb,w=[],t=[];var x=document.createDocumentFragment();if(!(v instanceof Array))v=[v];for(var za=0;za=300&&err<=399){summary="Redirection";desc="Your access to Facebook was redirected or blocked by a third party at this time, please contact your ISP or reload. ";redir_url=this.transport.getResponseHeader("Location");if(redir_url)goURI(redir_url,true);silent=true;}else{summary="Oops!";desc="Something went wrong. We're working on getting this fixed as soon as we can. You may be able to try again.";}!this.getOption('suppressErrorAlerts');copyProperties(r,{error:err,errorSummary:summary,errorDescription:desc,silentError:silent});dispatchErrorResponse(r,true);}});var handleResponse=function(response){var asyncResponse=this.interpretResponse(response);this.invokeResponseHandler(asyncResponse);};var onStateChange=function(){try{if(this.transport.readyState==4){AsyncRequest._inflightPurge();try{if(typeof(this.transport.getResponse Header)!='undefined'&&this.transport.getResponseHeader('X-FB-Debug'))this._xFbServer=this.transport.getResponseHeader('X-FB-Debug');}catch(ex){}if(this.transport.status>=200&&this.transport.status<300){invokeResponseHandler(_interpretTransportResponse());}else if(ua.safari()&&(typeof(this.transport.status)=='undefined')){invokeErrorHandler(1002);}else if(window.Env&&window.Env.retry_ajax_on_network_error&&this.transport.status in {0:1,12029:1,12030:1,12031:1,12152:1}&&this.remainingRetries>0){--this.remainingRetries;delete this.transport;this.send(true);return;}else invokeErrorHandler();if(this.getOption('asynchronous')!==false)delete this.transport;}}catch(exception){try{if(!window.loaded)return;}catch(ex){return;}delete this.transport;if(this.remainingRetries>0){--this.remainingRetries;this.send(true);}else{!this.getOption('suppressErrorAlerts');if(window.send_error_signal)send_error_signal('async_xport_resp','1007:'+(this._xFbServer||'-')+':'+this.getURI()+':'+exception.message);invokeErrorHandler(1007);} }};var onJSONPResponse=function(data,more_chunked_response){var is_first=(this.is_first===undefined);this.is_first=is_first;if(this.transportIframe&&!more_chunked_response){if(this.cavalry)this.cavalry.collectBrowserTiming(this.transportIframe.contentWindow);(function(x){document.body.removeChild(x);}).bind(null,this.transportIframe).defer();}if(ua.ie()>=9&&window.JSON)data=window.JSON.parse(window.JSON.stringify(data));var r=this.interpretResponse(data);r.asyncResponse.is_first=is_first;r.asyncResponse.is_last=!more_chunked_response;this.invokeResponseHandler(r);return more_chunked_response;};copyProperties(this,{onstatechange:onStateChange,onjsonpresponse:onJSONPResponse,invokeResponseHandler:invokeResponseHandler,interpretResponse:interpretResponse,handleResponse:handleResponse,transport:null,method:'POST',uri:'',timeout:null,timer:null,initialHandler:bagofholding,handler:null,errorHandler:null,transportErrorHandler:null,timeoutHandler:null,finallyHandler:bagofholding,serverDialogCancelHandler:bagofholdin g,relativeTo:null,statusElement:null,statusClass:'',data:{},file:null,context:{},readOnly:false,writeRequiredParams:['post_form_id'],remainingRetries:0,option:{asynchronous:true,suppressErrorHandlerWarning:false,suppressEvaluation:false,suppressErrorAlerts:false,retries:0,jsonp:false,bundle:false,useIframeTransport:false,tfbEndpoint:true,handleErrorAfterUnload:false},userActionID:'-'});this.errorHandler=AsyncResponse.defaultErrorHandler;this.transportErrorHandler=bind(this,'errorHandler');if(uri!=undefined)this.setURI(uri);return this;}Arbiter.subscribe("page_transition",function(type,message){AsyncRequest._id_threshold=message.id;});copyProperties(AsyncRequest,{receiveJSONPResponse:function(id,data,more_chunked_response){if(this._JSONPReceivers[id]){if(!this._JSONPReceivers[id](data,more_chunked_response))delete this._JSONPReceivers[id];}else if(window.logJSError&&!more_chunked_response){var uri=(data.payload&&data.payload.uri)||'';logJSError('ajax',{error:'UnexpectedJsonResponse',extra:{id:id,uri:uri}});}} ,_bundleRequest:function(request){if(request.getOption('jsonp')||request.getOption('useIframeTransport')){request.setOption('bundle',false);return false;}else if(!request.uri.isFacebookURI()){request.setOption('bundle',false);return false;}else if(!request.getOption('asynchronous')){request.setOption('bundle',false);return false;}var path=request.uri.getPath();if(!AsyncRequest._bundleTimer)AsyncRequest._bundleTimer=setTimeout(function(){AsyncRequest._sendBundledRequests();},0);AsyncRequest._allBundledRequests.push([path,request]);return true;},_sendBundledRequests:function(){clearTimeout(AsyncRequest._bundleTimer);AsyncRequest._bundleTimer=null;var bundled_requests=AsyncRequest._allBundledRequests;AsyncRequest._allBundledRequests=[];if(bundled_requests.length==1){var request=bundled_requests[0][1];request.setOption('bundle',false).send();return request;}if(bundled_requests.length===0)return null;var data=[];for(var ii=0;iiAsyncRequest._id_threshold;},clearStatusIndicator:function(){var statusElem=this.getStatusElement();if(statusElem){CSS.removeClass(statusElem,'async_saving');CSS.removeClass(statusElem,this.statusClass);}},addStatusIndicator:function(){var statusElem=this.getStatusElement();if(statusElem){CSS.addClass(statusElem,'async_saving');CSS.addClass(statusElem,this.statusClass);}},specifiesWriteRequiredParams:function(){return this.writeRequiredParams.every(function(param){this.data[param]=this.data[param]||Env[param]||(ge(param)||{}).value;if(this.data[param]!==undefined)return true;return false;},this);},setOption:function(opt,v){if(typeof(this.option[opt])!='undefined')this.option[opt]=v;return this;},getOption:function(opt){typeof(this.opti on[opt])=='undefined';return this.option[opt];},abort:function(){if(this.transport){var old_handler=this.getTransportErrorHandler();this.setOption('suppressErrorAlerts',true);this.setTransportErrorHandler(bagofholding);this._requestAborted=1;this.transport.abort();this.setTransportErrorHandler(old_handler);}},abandon:function(){clearTimeout(this.timer);this.setOption('suppressErrorAlerts',true).setHandler(bagofholding).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding);if(this.transport){this._requestAborted=1;this.transport.abort();}},setNectarData:function(nctrParams){if(nctrParams){if(this.data.nctr===undefined)this.data.nctr={};copyProperties(this.data.nctr,nctrParams);}return this;},setNectarModuleDataSafe:function(elem){if(this.setNectarModuleData)this.setNectarModuleData(elem);return this;},setNectarImpressionIdSafe:function(){if(this.setNectarImpressionId)this.setNectarImpressionId();return this;},setAllowCrossPageTransition:function(allow){this._allowCrossPageTransition=!!allow;if( this.timer)this.resetTimeout(this.timeout);return this;},send:function(isRetry){isRetry=isRetry||false;if(!this.uri)return false;!this.errorHandler&&!this.getOption('suppressErrorHandlerWarning');if(this.getOption('jsonp')&&this.method!='GET')this.setMethod('GET');if(this.getOption('useIframeTransport')&&this.method!='GET')this.setMethod('GET');this.timeoutHandler!==null&&(this.getOption('jsonp')||this.getOption('useIframeTransport'));if(!this.getReadOnly()){this.specifiesWriteRequiredParams();if(this.method!='POST')return false;}if(this.method=='POST'&&this.getOption('tfbEndpoint')){this.data.fb_dtsg=Env.fb_dtsg;this.data.lsd=Cookie.get('lsd');}if(!isEmpty(this.context)&&this.getOption('tfbEndpoint')){copyProperties(this.data,this.context);this.data.ajax_log=1;}if(window.Env&&Env.force_param)copyProperties(this.data,Env.force_param);if(!this.getReadOnly()&&this.getOption('tfbEndpoint')&&this.method=='POST'&&this.data.post_form_id_source===undefined)this.data.post_form_id_source='AsyncRequest';if(window.Env) this.data.__user=Env.user;this._setUserActionID();if(this.getOption('bundle')&&AsyncRequest._bundleRequest(this))return true;this.setNewSerial();if(this.getOption('tfbEndpoint')){this.uri.addQueryData({__a:1});if(!this.getOption('asynchronous'))this.uri.addQueryData({__s:1});if(Env.fb_isb)this.uri.addQueryData({fb_isb:Env.fb_isb});}this.finallyHandler=async_callback(this.finallyHandler,'final');var uri_str,query;if(this.method=='GET'||this.file){uri_str=this.uri.addQueryData(this.data).toString();query='';}else{uri_str=this.uri.toString();this._setDataHash();query=URI.implodeQuery(this.data);}if(this.getOption('jsonp')||this.getOption('useIframeTransport')){uri_str=this.uri.addQueryData({__a:this.id}).toString();AsyncRequest._JSONPReceivers[this.id]=async_callback(bind(this,'onjsonpresponse'),'json');if(this.getOption('jsonp')){(function(){document.body.appendChild($N('script',{src:uri_str,type:"text/javascript"}));}).bind(this).defer();}else{var style={position:'absolute',top:'-9999999px',width:'80px',heigh t:'80px'};this.transportIframe=$N('iframe',{src:"javascript:''",style:style});document.body.appendChild(this.transportIframe);this.transportIframe.src=uri_str;}return true;}if(this.transport)return false;var transport=null;try{transport=new XMLHttpRequest();}catch(ignored){}if(!transport)try{transport=new ActiveXObject("Msxml2.XMLHTTP");}catch(ignored){}if(!transport)try{transport=new ActiveXObject("Microsoft.XMLHTTP");}catch(ignored){}if(!transport)return false;transport.onreadystatechange=async_callback(bind(this,'onstatechange'),'xhr');if(!isRetry)this.remainingRetries=this.getOption('retries');if(window.send_error_signal||window.ArbiterMonitor)this._sendTimeStamp=this._sendTimeStamp||Date.now();this.transport=transport;try{this.transport.open(this.method,uri_str,this.getOption('asynchronous'));}catch(ex){return false;}var svn_rev=Env.svn_rev;if(svn_rev)this.transport.setRequestHeader('X-SVN-Rev',String(svn_rev));if(this.method=='POST')this.transport.setRequestHeader('Content-Type','application/x-www-form -urlencoded');this.addStatusIndicator();query=this.file||query;this.transport.send(query);if(this.timeout!==null)this.resetTimeout(this.timeout);AsyncRequest._inflightAdd(this);return true;},_displayServerDialog:function(model,is_confirmation){Bootloader.loadComponents('dialog',function(){var dialog=new Dialog(model);if(is_confirmation)dialog.setHandler(this._displayConfirmationHandler.bind(this,dialog));dialog.setCancelHandler(function(){this.serverDialogCancelHandler.apply(this,arguments);this.finallyHandler.apply(this,arguments);}.bind(this)).setCausalElement(this.relativeTo).setCloseHandler(this.finallyHandler.bind(this)).show();}.bind(this));},_displayConfirmationHandler:function(dialog){this.data.confirmed=1;copyProperties(this.data,dialog.getFormData());this.send();}});module.exports=AsyncRequest;}); __d("legacy:async",["AsyncRequest","AsyncResponse"],function(a,b,c){a.AsyncRequest=b('AsyncRequest');a.AsyncResponse=b('AsyncResponse');},3); __d("legacy:data-store",["DataStore"],function(a,b,c){a.DataStore=a.DataStore||b('DataStore');},3); function EmuController(a,b){this.impression=b;this.containerId=a;DataStore.set($(a),'emuController',this);return this;}copy_properties(EmuController,{fromContainer:function(a){var b=ge(a);if(!b)return null;return DataStore.get(b,'emuController');},getEventClass:function(a){return "emuEvent"+String(a).trim();}});copy_properties(EmuController.prototype,{EVENT_HANDLER_PATH:'/ajax/emu/end.php',CLICK:1,FAN:"fad_fan",event:function(c,b,d,a){var e={eid:this.impression,f:0,ui:this.containerId,en:c,a:1};if(b)e.ed=JSON.stringify(b);if(!a)var a=bagofholding;var f=new AsyncRequest().setURI(this.EVENT_HANDLER_PATH).setData(e).setErrorHandler(a);if(d)f.setHandler(d);f.send();},redirect:function(){var a={eid:this.impression,f:0,ui:this.containerId,en:this.CLICK,a:0,sig:Math.floor(Math.random()*65535)+65536};var b=new URI(this.EVENT_HANDLER_PATH);b.setQueryData(a);goURI(b);}}); var ShortClickHandlers={EVENT_NAME_CAME_BACK:'cameback',onclicked:function(a){if(this.onsite)return;if(a.button!==0||a.getModifiers().any)return;this.click_ts=(+new Date());if(this.listeners!==undefined)for(var b in this.listeners)this.listeners[b].remove();this.listeners={focus:Event.listen(window,'focus',ShortClickHandlers.oncameback.bind(this))};},oncameback:function(c){var b=(+new Date())-this.click_ts;this.listeners[c.type].remove();var a={click_ts:this.click_ts,length:b,trigger:c.type};this.sendData(ShortClickHandlers.EVENT_NAME_CAME_BACK,a);}}; function EmuTracker(a,c){this.base=EmuController.fromContainer(a);!this.base;this.onsite=c;var b=DOM.scry($(a),"a."+EmuController.getEventClass(EmuTracker.EVENT_CLICK));b.each(function(d){Event.listen(d,'click',ShortClickHandlers.onclicked.bind(this));}.bind(this));return this;}copy_properties(EmuTracker,{EVENT_CLICK:1});copy_properties(EmuTracker.prototype,{sendData:function(b,a){this.base.event(b,a);}}); __d("Keys",[],function(c,e,f,d,b){var a={BACKSPACE:8,TAB:9,RETURN:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,COMMA:188};d.exports=a;}); __d("AjaxRequest",["array-extensions","json","SystemEvents","ua","URI","Keys"],function(h,j,k,i,g){j('array-extensions');j('json');var c=j('SystemEvents');var l=j('ua');var d=j('URI');var b=j('Keys');function a(m,o,n){if(window.XMLHttpRequest){this.xhr=new XMLHttpRequest();}else if(window.ActiveXObject)this.xhr=new ActiveXObject('MSXML2.XMLHTTP.3.0');if(!(o instanceof d))o=new d(o);if(n&&m=='GET'){o.setQueryData(n);}else this._params=n;this.method=m;this.uri=o;this.xhr.open(m,o);}a.corsEnabled=window.XMLHttpRequest&&('withCredentials' in new XMLHttpRequest());a.ERROR='ar:error';a.TIMEOUT='ar:timeout';a.PROXY_ERROR='ar:proxy error';a.TRANSPORT_ERROR='ar:transport error';a.SERVER_ERROR='ar:http error';a.PARSE_ERROR='ar:parse error';a._inflight=[];function e(){var m=a._inflight;a._inflight=[];m.each(function(n){n.abort();});}function f(m){m.onResponse=m.onError=m.onSuccess=null;clearTimeout(m._timer);if(m.xhr&&m.xhr.readyState<4){m.xhr.abort();m.xhr=null;}a._inflight=a._inflight.filter(function(n){return n&&n!= m&&n.xhr&&n.xhr.readyState<4;});}a.prototype={timeout:60000,prelude:/^for \(;;\);/,_call:function(m,n){if(this[m])this[m](this);},_parseStatus:function(){var o,n;try{o=this.xhr.status;n=this.xhr.statusText;}catch(m){this.errorType=a.TRANSPORT_ERROR;this.errorText=m+'';return;}if(o===0&&!(/^(file|ftp)/.test(this.uri))){this.errorType=a.TRANSPORT_ERROR;}else if(o>=100&&o<200){this.errorType=a.PROXY_ERROR;}else if(o>=200&&o<300){return;}else if(o>=300&&o<400){this.errorType=a.PROXY_ERROR;}else if(o>=400&&o<500){this.errorType=a.SERVER_ERROR;}else if(o>=500&&o<600){this.errorType=a.PROXY_ERROR;}else if(o==1223){return;}else if(o>=12001&&o<=12156){this.errorType=a.TRANSPORT_ERROR;}else{n='unrecognized status code: '+o;this.errorType=a.ERROR;}if(!this.errorType)this.errorText=n;},_parseContent:function(){var n;try{n=this.xhr.responseText||'';}catch(m){this.errorType=a.ERROR;this.errorText='responseText not available - '+m.message;}try{if(this.prelude){if(!this.prelude.test(n))throw new Error('Missing prelude - pos sible XSS vulnerability!)');n=n.replace(this.prelude,'');}this.json=JSON.parse(n);}catch(m){this.errorType=a.PARSE_ERROR;this.errorText='exception parsing JSON - '+m.message;}if(!this.errorType&&!this.json){this.errorType=a.PARSE_ERROR;this.errorText='empty JSON';}},_onReadyState:function(){if(!this.xhr||this.xhr.readyState<4)return;this._call('onResponse');this._parseStatus();if(!this.errorType)this._parseContent();this._call(!this.errorType?'onSuccess':'onError',true);f(this);},send:function(m){this.xhr.onreadystatechange=c.trapError(this._onReadyState.bind(this));var n=this.timeout;if(n)this._timer=setTimeout((function(){this.errorType=a.TIMEOUT;this.errorText='timeout after '+n+' ms';this._call('onError',true);f(this);}).bind(this),n,false);a._inflight.push(this);if(this.method=='POST')this.xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.xhr.send(m?d.implodeQuery(m):'');},abort:function(){f(this);},toString:function(){var m='[AjaxRequest readyState='+this.xhr.readyState;if(t his.errorType)m+=' errorType='+this.errorType+' ('+this.errorText+')';return m+']';},toJSON:function(){return {json:this.json,errorType:this.errorType,errorText:this.errorText};}};if(window.addEventListener&&l.firefox())window.addEventListener('keydown',function(event){if(event.keyCode===b.ESC)event.prevent();},false);if(window.attachEvent)window.attachEvent('onunload',e);i.exports=a;}); __d("ChannelConstants",[],function(d,f,g,e,c){var a='presence/';var b={ON_SHUTDOWN:a+'shutdown',ON_INVALID_HISTORY:a+'invalid_history',ON_CONFIG:a+'config',ON_ENTER_STATE:a+'enter_state',ON_EXIT_STATE:a+'exit_state',OK:'ok',ERROR:'error',ERROR_MAX:'error_max',ERROR_MISSING:'error_missing',ERROR_MSG_TYPE:'error_msg_type',ERROR_SHUTDOWN:'error_shutdown',HINT_AUTH:'shutdown auth',HINT_CONN:'shutdown conn',HINT_DISABLED:'shutdown disabled',HINT_INVALID_STATE:'shutdown invalid state',HINT_MAINT:'shutdown maint',HINT_UNSUPPORTED:'shutdown unsupported',reason_Unknown:0,reason_AsyncError:1,reason_TooLong:2,reason_Refresh:3,reason_RefreshDelay:4,reason_UIRestart:5,reason_NeedSeq:6,reason_PrevFailed:7,reason_IFrameLoadGiveUp:8,reason_IFrameLoadRetry:9,reason_IFrameLoadRetryWorked:10,reason_PageTransitionRetry:11,reason_IFrameLoadMaxSubdomain:12,reason_NoChannelInfo:13,reason_NoChannelHost:14,getArbiterType:function(h){return a+'message:'+h;}};e.exports=b;}); __d("UserActivity",["event-extensions","Arbiter","FunctionUtils"],function(f,h,i,g,e){h("event-extensions");var a=h("Arbiter");var b=h("FunctionUtils");var d=Date.now();var c={DEFAULT_IDLE_MS:5000,EVENT_INTERVAL_MS:500,subscribeOnce:function(k){var l=c.subscribe(function(){c.unsubscribe(l);k();});},subscribe:function(k){return a.subscribe('useractivity/activity',k);},unsubscribe:function(k){a.unsubscribe(k);},isActive:function(k){return (new Date()-d<(k||c.DEFAULT_IDLE_MS));}};var j=b.throttle(function(event){var l=Date.now();var k=l-d;d=l;a.inform('useractivity/activity',{event:event,idleness:k});},c.EVENT_INTERVAL_MS,false);Event.listen(document.documentElement,{mouseover:j,keydown:j,click:j});g.exports=c;}); __d("MovingStat",[],function(c,e,f,d,b){function a(l){l=l||60000;var h={t:new Date(),count:0,v:0};var i=h,k=0,g=0;function j(){var m=new Date()-l;while(i&&i.next&&i.t90000){zo=null;zd.log('jumpstart',{state:f.state,dormant:zu});f.enterState('init');}};setInterval(zs,10000,false);}function zb(){var zt=new Date();var zo=1;function zs(){setTimeout(zs,zo*1000,false);var z v=f.state;if(zv=='idle'&&f.shouldIdle())return;zd.bump('conn_t',zo);if(zv=='pull')zd.bump('conn_t_pull',zo);}zs();var zu=[15,30,60,120,240];var zq=false,zr=false;function zp(zv){setTimeout(function(){zd.rate('pullenter_'+zv,zq);zd.rate('pullexit_'+zv,zr);},zv*1000,false);}while(zu.length)zp(zu.shift());b.subscribe(e.ON_ENTER_STATE,function(zw,zv){if(zv.state=='pull')zq=true;zt=new Date();});b.subscribe(e.ON_EXIT_STATE,function(zw,zv){if(zv.state!='pull'||!zt)return;var zx=zv.status==e.OK?e.OK:(zv&&zv.errorType);switch(zx){case e.OK:zr=true;zx='ok';break;case a.ERROR:zx='error';break;case a.TIMEOUT:zx='timeout';break;case a.PROXY_ERROR:zx='proxy';break;case a.TRANSPORT_ERROR:zx='transport';break;case a.SERVER_ERROR:zx='http';break;case a.PARSE_ERROR:zx='parse';break;default:zx='other';break;}var zy=(new Date()-zt)/1000;if(zy<0){return;}else if(zy>3600)zy=3600;zd.bump('conn_num');zd.bump('conn_exit',zy);zd.bump('conn_num_'+zx);zd.bump('conn_exit_'+zx,zy);});}function u(zo){if(zo){v=0;z={};}else v++;}f={state:' idle',init:function(zo){this.init=function(){};if(typeof(t)!='undefined')t.subscribe(function(){x.userActive=Date.now();}.bind(this));zk.register('ch',za);var zq=function(){w=true;o.doSync(true);};if(typeof window.onpageshow!='undefined'){Event.listen(window,'pagehide',zq);}else n.runOnload(zq);this._transportRate=new m(30000);var zp=(a.corsEnabled&&!x.forceIframe)?'CORSTransport':'IframeTransport';this.transport=new h[zp](this);if(zo)this.enterState.apply(this,arguments);o.doSync();b.subscribe(k.DUMP_EVENT,function(event,zr){zr.transportRate=this._transportRate.tally();zr.transportType=zp;zr.transportVersion=2;}.bind(this));zc();zb();},configure:function(){c.createFrom(arguments).each(zf.bind(null,x));b.inform(e.ON_CONFIG,this);},getConfig:function(zp,zo){return zp in x?x[zp]:zo;},isShutdown:function(){return this.state=='shutdown';},shouldIdle:function(){return !r.isPageOwner()||!navigator.onLine;},_sendIframeError:function(zp){var zo=new d().setURI('/ajax/presence/reconnect.php').setData({reason:zp,iframe _loaded:this.iframeEverLoaded}).setOption('suppressErrorHandlerWarning',true).setOption('retries',1).setMethod('GET').setReadOnly(true).setAllowCrossPageTransition(true);zo.specifiesWriteRequiredParams()&&zo.send();},_getDelay:function(){var zq=f.getConfig('MIN_RETRY_INTERVAL',10000);var zp=f.getConfig('MAX_RETRY_INTERVAL',60000);var zo=Math.min(zq*Math.pow(2,Math.max(0,v-1)),zp);return zo*(.75+Math.random()/2)|0;},enterState:function(){this._inEnterState=true;try{this._enterState.apply(this,arguments);this._inEnterState=false;}catch(zo){this._inEnterState=false;throw zo;}},_enterState:function(zv){var zp=0;var zs=null;var zo=c.createFrom(arguments);if(this.isShutdown())return;if(zv!='idle!'&&this.shouldIdle())return;y++;x.stateId=y;clearTimeout(this._deferredTransition);this._deferredTransition=null;this.transport.enterState('idle');this.state='idle';if(/!$/.test(zv)){var zu=this._transportRate.tally().timeAverage;var zt=f.getConfig('MAX_CHANNEL_STATES_PER_SEC',1);if(zu>=zt)zp=1000/zt;}else if(!(/#$/.test(z v)))zp=this._getDelay();zv=zv.replace(/\W*$/,'');if(!q[zv])throw new Error('invalid state:'+zv);var zq;if(zp<=0){zq={state:zv};this._transportRate.add(1);this.state=zv;var zr=this['_enter_'+this.state];if(zr){zo.shift();zr.apply(this,zo);}if(/init|idle|pull|ping/.test(this.state)){ze();this.transport.enterState(this.state,x);}}else{this.state='idle';zq={state:this.state,delay:zp,nextState:zv};zo[0]=zv+'#';this._deferredTransition=(function(){this._deferredTransition=null;this.enterState.apply(this,zo);}).bind(this).defer(zp,false);}zd.log('enter_'+this.state,zq);b.inform(e.ON_ENTER_STATE,zq);},exitState:function(zs,zr){var zw=zs.stateId;var zx=zs.status;if(this.isShutdown()||zw=zr){zo=zs[zq].msg;if (zo.type)zi(e.getArbiterType(zo.type),{obj:zo});}else zd.warn('seq_regression',{seq:zv,last_seq:zr,non_transient:zt,messages:zs.length});if(zs[zq].seq!==-1)zv++;}}else{zs=zp.ms;zv=x.seq-zs.length;for(zq=0;zq=zr){zo=zs[zq];if(zo.type)zi(e.getArbiterType(zo.type),{obj:zo});}else zd.warn('seq_regression',{seq:zv,last_seq:zr,messages:zs.length});}u(true);return this.exitState({status:e.OK,stateId:zw});}return this.exitState({status:e.ERROR_MSG_TYPE,stateId:zw},'type = '+zx);},_enter_init:function(){if(z.init>=2)return this.exitState.bind(this,{status:e.ERROR_MAX,stateId:y}).defer();this._initTimer=this.exitState.bind(this,{status:e.ERROR,stateId:y},'timeout').defer(f.getConfig('IFRAME_LOAD_TIMEOUT',30000),false);},_enter_reconnect:function(zo){var zq=y;if(!p.hasUserCookie()){zd.warn('no_user_cookie');(function(){f._shutdownHint=e.HINT_AUTH;f.exitState({status:e.ERROR_SHUTDOWN,stateId:zq});}).defer();return;}var zp=new i('GET','/ajax/presence/reconnect.php',{reason:zo,iframe_loaded:this .iframeEverLoaded});zp.onSuccess=(function(){f.configure(null,zp.json);zk.store();this.exitState({status:e.OK,stateId:zq});}).bind(this);zp.onError=(function(){var zr=zp.json&&zp.json.error;if(zp.errorType==a.TRANSPORT_ERROR||zp.errorType==a.PROXY_ERROR)this._shutdownHint=e.HINT_CONN;if(zr&&zr==1356007){this._shutdownHint=e.HINT_MAINT;}else if(zr==1357001||zr==1357004||zr==1348009){this._shutdownHint=e.HINT_AUTH;}else this._shutdownHint=null;this.exitState({status:this._shutdownHint?e.ERROR_SHUTDOWN:e.ERROR,stateId:zq},zp);}).bind(this);zp.send();},_enter_shutdown:function(){zi(e.ON_SHUTDOWN,{reason:this._shutdownHint});},_exit_init:function(zo){if(this._initTimer)this._initTimer=clearTimeout(this._initTimer);if(zo==e.OK){this.iframeEverLoaded=true;}else if(zo==e.ERROR_MAX)this._sendIframeError(e.reason_IFrameLoadGiveUp);}};zj.exports=f;if(g.serverInitialized==null){f.configure(g.channelConfig);if(/shutdown/.test(g.state)){f._shutdownHint=e[g.reason];}else g.reconnectReason;f.init(g.state,g.reason);}}); __d("ChannelConnection",["Arbiter","copyProperties","ChatConfig","SystemEvents","onload","ChannelConstants","ChannelManager","JSLogger"],function(v,x,y,w,u){var a=x('Arbiter');var t=x('copyProperties');var e=x('ChatConfig');var h=x('SystemEvents');var g=x('onload');var c=x('ChannelConstants');var d=x('ChannelManager');var f=x('JSLogger');var m=f.create('channel_connection');var r=null;var p=null;var l=null;var n=null;var b=t(new a(),{CONNECTED:'chat-connection/connected',RECONNECTING:'chat-connection/reconnecting',SHUTDOWN:'chat-connection/shutdown',MUTE_WARNING:'chat-connection/mute',UNMUTE_WARNING:'chat-connection/unmute'});function j(){if(p){clearTimeout(p);p=null;}}function s(){j();m.log('unmute_warning');b.inform(b.UNMUTE_WARNING);}function o(z){j();p=s.defer(z,false);m.log('mute_warning',{time:z});b.inform(b.MUTE_WARNING);}function i(){if(l){clearTimeout(l);l=null;}}function k(za,z){i();if(za===c.ON_ENTER_STATE&&(z.state==='pull'||z.nextState==='pull')){if(n!==b.CONNECTED){m.log('connected');n=b.CONNEC TED;b.inform(b.CONNECTED);}}else if(za===c.ON_ENTER_STATE&&(z.state==='ping'||(z.state==='idle'&&(!z.nextState||z.nextState==='ping')))){l=(function(){var zb=null;if(!(z.state==='idle'&&!z.nextState))zb=(z.delay||0);m.log('reconnecting',{delay:zb});if(b.disconnected())m.log('reconnecting_ui',{delay:zb});n=b.RECONNECTING;b.inform(b.RECONNECTING,zb);}).defer(500,false);}else if(za===c.ON_SHUTDOWN){m.log('shutdown',{reason:z.reason});n=b.SHUTDOWN;b.inform(b.SHUTDOWN,z.reason);}}function q(z){if(d.state==='ping'||d.isShutdown())return;m.log('reconnect',{now:z});b.inform(b.RECONNECTING,0);if(!!z){if(r!==null){clearTimeout(r);r=null;}d.enterState('ping!');}else if(!r)r=setTimeout(function(){d.enterState('ping!');r=null;},e.get('channel_manual_reconnect_defer_msec'),false);}a.subscribe([c.ON_ENTER_STATE,c.ON_SHUTDOWN],k);h.subscribe(h.TIME_TRAVEL,function(){q();o(e.get('mute_warning_time_msec'));});g.runBeforeUnload(i,false);t(b,{disconnected:function(){return n===b.SHUTDOWN||(n===b.RECONNECTING&&!p);},isShutdown:f unction(){return n===b.SHUTDOWN;},reconnect:q,unmuteWarning:s});w.exports=b;}); __d("Button",["event-extensions","css","DataStore","dom","Parent"],function(g,i,j,h,f){i('event-extensions');var b=i('css');var d=i('DataStore');var c=i('dom');var e=i('Parent');var a=(function(){var l='uiButtonDisabled';var k='uiButtonDepressed';var n='button:blocker';var m='href';function o(t,s){var r=d.get(t,n);if(s){if(r){r.remove();d.remove(t,n);}}else if(!r)d.set(t,n,Event.listen(t,'click',bagof(false),Event.Priority.URGENT));}function p(r){var s=e.byClass(r,'uiButton');if(!s)throw new Error('invalid use case');return s;}function q(r){return c.isNodeOfType(r,'a');}return {getInputElement:function(r){r=p(r);if(q(r))throw new Error('invalid use case');return c.find(r,'input');},isEnabled:function(r){return !b.hasClass(p(r),l);},setEnabled:function(u,r){u=p(u);b.conditionClass(u,l,!r);if(q(u)){var s=u.href;var v=d.get(u,m,'#');if(r){if(!s)u.href=v;}else{if(s&&s!==v)d.set(u,m,s);u.removeAttribute('href');}o(u,r);}else{var t=a.getInputElement(u);t.disabled=!r;o(t,r);}},setDepressed:function(s,r){b.condition Class(p(s),k,r);},isDepressed:function(r){return b.hasClass(p(r),k);},setLabel:function(s,r){s=p(s);if(q(s)){var t=c.find(s,'span.uiButtonText');c.setContent(t,r);}else a.getInputElement(s).value=r;b.conditionClass(s,'uiButtonNoText',!r);},setIcon:function(s,r){if(!c.isNode(r))return;b.addClass(r,'customimg');s=p(s);var t=c.scry(s,'.img')[0];if(t!=r)if(t){c.replace(t,r);}else c.prependContent(s,r);}};})();g.Button=h.exports=a;},3); __d("DOMControl",["DataStore","dom-core"],function(e,g,h,f,d){var c=g("DataStore");var a=g("dom-core").$;function b(i){this.root=a(i);this.updating=false;c.set(i,'DOMControl',this);}b.prototype={getRoot:function(){return this.root;},beginUpdate:function(){if(this.updating)return false;this.updating=true;return true;},endUpdate:function(){this.updating=false;},update:function(i){if(!this.beginUpdate())return this;this.onupdate(i);this.endUpdate();},onupdate:function(i){}};b.getInstance=function(i){return c.get(i,'DOMControl');};f.exports=b;}); __d("InputSelection",["dom","Input"],function(e,g,h,f,d){var a=g("dom");var b=g("Input");var c={get:function(j){if(!document.selection)return {start:j.selectionStart,end:j.selectionEnd};var l=document.selection.createRange();if(l.parentElement()!==j)return {start:0,end:0};var k=j.value.length;if(a.isNodeOfType(j,'input')){return {start:-l.moveStart('character',-k),end:-l.moveEnd('character',-k)};}else{var m=l.duplicate();m.moveToElementText(j);m.setEndPoint('StartToEnd',l);var i=k-m.text.length;m.setEndPoint('StartToStart',l);return {start:k-m.text.length,end:i};}},set:function(l,n,k){if(typeof k=='undefined')k=n;if(document.selection){if(l.tagName=='TEXTAREA'){var i=(l.value.slice(0,n).match(/\r/g)||[]).length;var j=(l.value.slice(n,k).match(/\r/g)||[]).length;n-=i;k-=i+j;}var m=l.createTextRange();m.collapse(true);m.moveStart('character',n);m.moveEnd('character',k-n);m.select();}else{l.selectionStart=n;l.selectionEnd=Math.min(k,l.value.length);b.focus(l);}}};f.exports=c;}); __d("enforceMaxLength",["event-extensions","function-extensions","dom","Input","InputSelection"],function(f,i,j,h,e){i("event-extensions");i("function-extensions");var a=i("dom");var b=i("Input");var c=i("InputSelection");var d=function(m,o){var s=b.getValue(m);var n=s.length;var p=n-o;if(p>0){var q;var k;try{q=c.get(m);k=q.end;}catch(l){q=null;k=0;}if(k>=p)n=k;var r=n-p;if(r&&(s.charCodeAt(r-1)&64512)===55296)r--;k=Math.min(k,r);b.setValue(m,s.slice(0,r)+s.slice(n));if(q)c.set(m,Math.min(q.start,k),k);}};var g=function(event){var k=event.getTarget();var l=k.getAttribute&&parseInt(k.getAttribute('maxlength'),10);if(l>0&&a.isNodeOfType(k,['input','textarea']))d.bind(null,k,l).defer();};Event.listen(document.documentElement,{keydown:g,paste:g});h.exports=d;}); __d("Input",["bootloader","css-core","dom","DOMControl"],function(g,j,k,i,f){var a=j("bootloader");var b=j("css-core");var c=j("dom");var d=j("DOMControl");var h=function(l){var m=l.getAttribute('maxlength');if(m&&m>0)k(["enforceMaxLength"],function(n){n(l,m);});};var e={focus:function(l){try{l.focus();}catch(m){}},isEmpty:function(l){return !(/\S/).test(l.value||'')||b.hasClass(l,'DOMControl_placeholder');},getValue:function(l){return e.isEmpty(l)?'':l.value;},setValue:function(m,n){b.removeClass(m,'DOMControl_placeholder');m.value=n||'';h(m);var l=d.getInstance(m);l&&l.resetHeight&&l.resetHeight();},setPlaceholder:function(l,m){l.setAttribute('title',m);l.setAttribute('placeholder',m);if(l==document.activeElement)return;if(e.isEmpty(l)){b.conditionClass(l,'DOMControl_placeholder',m);l.value=m||'';}},reset:function(l){var m=l!==document.activeElement?(l.getAttribute('placeholder')||''):'';l.value=m;b.conditionClass(l,'DOMControl_placeholder',m);l.style.height='';},setSubmitOnEnter:function(l,m){b.conditionC lass(l,'enter_submit',m);},getSubmitOnEnter:function(l){return b.hasClass(l,'enter_submit');},setMaxLength:function(l,m){if(m>0){l.setAttribute('maxlength',m);h(l);}else l.removeAttribute('maxlength');}};i.exports=e;}); __d("Vector",["dom","ua","event-extensions","copyProperties"],function(f,h,i,g,e){var b=h("dom");var j=h("ua");var a=h("event-extensions").$E;var d=h("copyProperties");function c(l,m,k){d(this,{x:parseFloat(l),y:parseFloat(m),domain:k||'pure'});}d(c.prototype,{toString:function(){return '('+this.x+', '+this.y+')';},add:function(m,n){if(arguments.length==1){if(m.domain!='pure')m=m.convertTo(this.domain);return this.add(m.x,m.y);}var k=parseFloat(m);var l=parseFloat(n);return new c(this.x+k,this.y+l,this.domain);},mul:function(k,l){if(typeof l=="undefined")l=k;return new c(this.x*k,this.y*l,this.domain);},sub:function(k,l){if(arguments.length==1){return this.add(k.mul(-1));}else return this.add(-k,-l);},distanceTo:function(k){return this.sub(k).magnitude();},magnitude:function(){return Math.sqrt((this.x*this.x)+(this.y*this.y));},convertTo:function(k){if(k!='pure'&&k!='viewport'&&k!='document')return new c(0,0);if(k==this.domain)return new c(this.x,this.y,this.domain);if(k=='pure')return new c(this.x,this.y);i f(this.domain=='pure')return new c(0,0);var l=c.getScrollPosition('document');var m=this.x,n=this.y;if(this.domain=='document'){m-=l.x;n-=l.y;}else{m+=l.x;n+=l.y;}return new c(m,n,k);},setElementPosition:function(k){var l=this.convertTo('document');k.style.left=parseInt(l.x)+'px';k.style.top=parseInt(l.y)+'px';return this;},setElementDimensions:function(k){return this.setElementWidth(k).setElementHeight(k);},setElementWidth:function(k){k.style.width=parseInt(this.x,10)+'px';return this;},setElementHeight:function(k){k.style.height=parseInt(this.y,10)+'px';return this;},scrollElementBy:function(k){if(k==document.body){window.scrollBy(this.x,this.y);}else{k.scrollLeft+=this.x;k.scrollTop+=this.y;}return this;}});d(c,{getEventPosition:function(l,k){k=k||'document';l=a(l);var m=b.getDocumentScrollElement();var o=l.pageX||(l.clientX+m.scrollLeft);var p=l.pageY||(l.clientY+m.scrollTop);var n=new c(o,p,'document');return n.convertTo(k);},getScrollPosition:function(k){k=k||'document';var l=b.getDocumentScrollElement ();var m=l.scrollLeft;var n=l.scrollTop;return new c(m,n,'document').convertTo(k);},getElementPosition:function(m,l){l=l||'document';if(!m)return;if(!('getBoundingClientRect' in m))return new c(0,0,'document');var o=m.getBoundingClientRect(),k=document.documentElement,n=Math.round(o.left)-k.clientLeft,p=Math.round(o.top)-k.clientTop;return new c(n,p,'viewport').convertTo(l);},getElementDimensions:function(k){return new c(k.offsetWidth||0,k.offsetHeight||0);},getViewportDimensions:function(){var k=(window&&window.innerWidth)||(document&&document.documentElement&&document.documentElement.clientWidth)||(document&&document.body&&document.body.clientWidth)||0;var l=(window&&window.innerHeight)||(document&&document.documentElement&&document.documentElement.clientHeight)||(document&&document.body&&document.body.clientHeight)||0;return new c(k,l,'viewport');},getDocumentDimensions:function(k){k=k||document;var l=b.getDocumentScrollElement(k);if(l===k.body&&j.firefox())l=k.documentElement;var m=l.scrollWidth||0;var n =l.scrollHeight||0;return new c(m,n,'document');},deserialize:function(l){var k=l.split(',');return new c(k[0],k[1]);}});g.exports=c;}); __d("Form",["event-extensions","ArrayUtils","AsyncRequest","AsyncResponse","DataStore","dom","Env","Input","Parent","URI","Vector","trackReferrer"],function(m,o,p,n,l){o("event-extensions");var a=o("ArrayUtils");var b=o("AsyncRequest");var c=o("AsyncResponse");var e=o("DataStore");var d=o("dom");var f=o("Env");var h=o("Input");var i=o("Parent");var j=o("URI");var k=o("Vector");var q=o("trackReferrer");var g={getInputs:function(r){r=r||document;return [].concat(a.createFrom(d.scry(r,'input')),a.createFrom(d.scry(r,'select')),a.createFrom(d.scry(r,'textarea')),a.createFrom(d.scry(r,'button')));},getSelectValue:function(r){return r.options[r.selectedIndex].value;},setSelectValue:function(s,t){for(var r=0;r0){var u=0,t=true;v.sort().each(function(x){if(x!=u++)t=false;});if(t){var w=[];v.each(function(x){w[x]=r[x];});return w;}}return r;},post:function(u,s,t){var r=document.createElement('form');r.action=u.toString();r.method='POST';r.style.display='none';if(t)r.target=t;if(ge('post_form_id'))s.post_form_id=$('post_form_id').value;s.fb_dtsg=f.fb_dtsg;s.post_form_id_source='dynamic_post';g.createHiddenInputs(s,r);d.getRootElement().appendChild(r);r.submit();return false;},createHiddenInputs:function(x,r,u,w){u=u||{};var t;var y=j.implodeQuery(x,'',false);var z=y.split('&');for(var s=0;s0&&pos.x>0)return v;}catch(r){}}}return null;},focusFirst:function(s){var r=g.getFirstElement(s);if(r){r.focus();return true;}return false;}};n.exports=g;}); __d("legacy:dom-form",["Form"],function(a,b,c){a.Form=b('Form');},3); __d("legacy:event-extensions",["event-extensions"],function(a,b,c){b('event-extensions');},3); __d("legacy:input-methods",["Input","copyProperties"],function(c,d,e){var a=d('Input');var b=d('copyProperties');b(c.Input||(c.Input={}),a);},3); __d("URLScraper",["event-extensions","Class"],function(i,u,v,n,h){u("event-extensions");var a=u("Class");function b(za){this.input=za;this.enable();}a.mixin(b,'Arbiter',{reset:function(){this.lastMatch=null;},enable:function(){if(this.events)return;var za=function(zb){setTimeout(this.check.bind(this,zb),30);};this.events=Event.listen(this.input,{paste:za.bind(this,false),keydown:za.bind(this,true)});},disable:function(){if(!this.events)return;for(var event in this.events)this.events[event].remove();this.events=null;},check:function(zb){var zc=this.input.value;if(zb&&b.trigger(zc))return;var za=b.match(zc);if(za&&za!=this.lastMatch){this.lastMatch=za;this.inform('match',{url:za});}}});var c='!"#%&\'()*,-./:;<>?@[\\]^_`{|}',y='\u2000-\u206F\u00ab\u00bb';var t='(?:(?:ht|f)tps?)://',k='(?:(?:\\d{1,3}[.]){3}\\d{1,3})',z='(?:\\b)www\\d{0,3}[.]',o='[^\\s'+c+y+']',l='(?:(?:[.:\\-_%@]|'+o+')*'+o+')',w='(?:[.][a-z]{2,4})',s='(?::\\d+){0,1}',f='(?=[\/?#])';var j='(?:'+'(?:'+t+l+s+')|'+'(?:'+k+s+')|'+'(?:'+z+l+w+s+')|'+ '(?:'+l+w+s+f+')'+')';var g='[\/#?]',e='\\([^\\s()<>]+\\)',q='[^\\s()<>]+',p='[^\\s'+c+y+']';var r='(?:'+'(?:'+g+')'+'(?:'+'(?:'+e+'|'+q+')*'+'(?:'+e+'|'+p+')'+')*'+')*';var m=new RegExp('('+'(?:'+j+')'+'(?:'+r+')'+')','im');var d=new RegExp('('+'(?:'+t+l+s+')|'+'(?:'+z+l+w+s+')'+')');var x=/[\s'";]/;b.match=function(zb){var za=(m.exec(zb)||[])[1]||null;if(za&&za.indexOf('@')!=-1){return (d.exec(za))?za:null;}else return za;};b.trigger=function(za){return !x.test(za.charAt(za.length-1));};n.exports=b;}); __d("legacy:url-scraper",["URLScraper"],function(a,b,c){a.URLScraper=b('URLScraper');},3); (function(){var b=1,a=2;var f={};var e=function(){var h=DOM.scry(this.root,'span.linkAttachment')[0];if(!h&&this.isMetaComposer)h=DOM.scry(this.root,'span.attachmentAcceptsLink')[0];if(!h)return;var g=Parent.byTag(h,'form');this.scraper=new URLScraper(this.input);this.scraper.subscribe('match',function(i,j){if(this.isMetaComposer){var k=this.form.xhpc_targetid;var l=new URI('/ajax/metacomposer/attachment/link/scraper.php');l.addQueryData({scrape_url:encodeURIComponent(j.url),targetid:k.value});g.action=l.toString();}else{CSS.show(h);g.action='/ajax/composer/attachment/link/scraper.php?scrape_url='+encodeURIComponent(j.url);}g.xhpc.value=h.id;g.xhpc.disabled=false;g.xhpc.click();}.bind(this));this.isMetaComposer&&this.scraper.check();};var d=function(){var h=this.form.xhpc_targetid;var i=h.value;var g=Arbiter.subscribe('ComposerAudienceSelector/group',function(k,l){h.value=l.group;});var j=Arbiter.subscribe('ComposerAudienceSelector/nongroup',function(){h.value=i;});onunloadRegister(Arbiter.unsubscribe.curry( g));onunloadRegister(Arbiter.unsubscribe.curry(j));};var c=function(g){if(this.inform('submit')===false){g.kill();return false;}if(this.submitHandler)return (new Function(this.submitHandler)).apply(this.form);};window.Composer=function(j,i,h,g){f[j.id]=this;this.root=j;this.resetCfg=i;this.dataSource=g;this.lazyEndpoint=this.resetCfg&&this.resetCfg.lazyEndpoint;Bootloader.loadComponents('dom',function(){this.focus=DOM.find(j,'div.focus_target');this.form=DOM.find(j,'form.attachmentForm');this.content=DOM.find(j,'div.attachmentContent');this.isMetaComposer=h;if(this.isMetaComposer){this.messageBox=DOM.find(j,'div.uiMetaComposerMessageBox');this.metaArea=DOM.find(j,'div.attachmentMetaArea');this.bottomArea=DOM.find(j,'div.attachmentBottomArea');this.barArea=DOM.find(j,'div.attachmentBarArea');this.blurb=DOM.find(j,'div.uiMetaComposerMessageBox div.textBlurb');this.input=DOM.find(j,'div.uiMetaComposerMessageBox textarea.input');this.button=DOM.find(j,'div.uiMetaComposerMessageBox label.submitBtn');this.privacy= DOM.find(j,'div.uiMetaComposerMessageBox li.privacyWidget');}else{this.blurb=DOM.find(j,'div.uiComposerMessageBox div.textBlurb');this.input=DOM.find(j,'div.uiComposerMessageBox textarea.input');this.button=DOM.find(j,'div.uiComposerMessageBox label.submitBtn');this.privacy=DOM.find(j,'div.uiComposerMessageBox li.privacyWidget');}Event.listen(this.form,'submit',c.bind(this));if(this.isMetaComposer){Event.listen(this.input,'focus',this.onFocus.bind(this));if(Parent.byClass(this.input,'child_was_focused'))this.onFocus.bind(this).defer();}Arbiter.inform('xhpc/construct/'+j.id,this,Arbiter.BEHAVIOR_STATE);}.bind(this));};Class.mixin(Composer,'Arbiter',{init:function(g){this.mentionsInput=g;if(this.mentionsInput){this.mentionsInput.subscribe('init',function(){var h=this.mentionsInput.getTypeahead().getView();h.subscribe(['reset','render'],function(i){CSS.conditionClass(this.root,'uiComposerMention',(i=='render'));}.bind(this));}.bind(this));this.mentionsInput.subscribe('update',function(i,h){Arbiter.inform('Compo ser/mentions',keys(h.mentioned));});}e.call(this);if(this.isMetaComposer)d.call(this);this.inform('init',null,Arbiter.BEHAVIOR_PERSISTENT);onbeforeunloadRegister(this._handleUnsavedChanges.bind(this));},setBlurb:function(g){DOM.setContent(this.blurb,g);},setEnabled:function(g){Button.setEnabled(this.button,g);},setLoading:function(g){CSS.conditionClass(this.root,'async_saving',!!g);},setContentVisible:function(g){CSS.conditionClass(this.root,'uiComposerHideContent',!g);},setMessageBoxVisible:function(g){CSS.conditionClass(this.root,'uiComposerHideMessageBox',!g);},setInputVisible:function(g){CSS.conditionClass(this.root,'uiComposerHideInput',!g);},setTopicTaggerVisible:function(g){CSS.conditionClass(this.root,'uiTagComposerHidden',!g);},mutate:function(i){var h=ge(i.xhpc);if(h){var j=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];if(i.confirmAugmentation&&j!==h)return;j&&CSS.removeClass(j,'uiComposerAttachmentSelected');CSS.addClass(h,'uiComposerAttachmentSelected');if(!i.disableCache)Event.listen(h, 'click',function(k){$E(k).stop();i.disableCache=true;this.mutate(i);}.bind(this));}if(!i.keepContentAreas){this.setContentVisible(false);DOM.empty(this.content);if(this.isMetaComposer){this.mentionsInput&&this.mentionsInput.setAuxContent(null);DOM.empty(this.metaArea);DOM.empty(this.bottomArea);DOM.empty(this.barArea);}}if(i.content){DOM.setContent(this.content,HTML(i.content));this.setContentVisible(true);}if(this.isMetaComposer){i.metaContent&&DOM.setContent(this.metaArea,HTML(i.metaContent));i.bottomContent&&DOM.setContent(this.bottomArea,HTML(i.bottomContent));i.barContent&&DOM.setContent(this.barArea,HTML(i.barContent));}this.setMessageBoxVisible(!i.messageBoxHidden);CSS.conditionClass(this.root,'uiComposerWhiteMessageBox',!i.messageBoxHidden&&!i.inputHidden&&!i.content);this.setInputVisible(!i.inputHidden);CSS.conditionShow(this.privacy,!i.privacyWidgetHidden);Input.setPlaceholder(this.input,i.placeholder);Button.setLabel(this.button,i.buttonLabel);this.setBlurb(HTML(i.blurb));if(i.autoscrape){this.scr aper&&this.scraper.enable();}else this.scraper&&this.scraper.disable();this.setEnabled(!i.disabled);this.setTopicTaggerVisible(!i.hideTopicTagger);this.form.setAttribute('action',i.endpoint);if(i.formType==b){this.form.setAttribute('rel','async');}else this.form.removeAttribute('rel');if(i.formType==a){this.form.target=i.iframeName;this.form.enctype=this.form.encoding='multipart/form-data';}else{this.form.removeAttribute('target');this.form.removeAttribute('enctype');this.form.removeAttribute('encoding');}this.submitHandler=i.submitHandler;this.lazyEndpoint=i.lazyEndpoint;i.attachmentJS&&(new Function(i.attachmentJS)).apply(this);CSS.addClass(this.root,'uiComposerInteracted');CSS.addClass(this.root,'uiComposerOpen');if(i.messageBoxFocused){var g=document.activeElement;if(g===document.body||Parent.byClass(g,'attachmentLink'))this.focusInput.bind(this).defer();}Arbiter.inform('composer/mutate',this);},subscribeToMutate:function(g){return Arbiter.subscribe('composer/mutate',function(h,i){if(i===this)g();}.bind( this));},reset:function(h,g){if(!h){Input.reset(this.input);this.mentionsInput&&this.mentionsInput.reset();}if(this.isMetaComposer){DOM.empty(this.metaArea);DOM.empty(this.bottomArea);DOM.empty(this.barArea);}if(this.resetCfg){this.mutate(this.resetCfg);}else{var i=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];if(i)CSS.removeClass(i,'uiComposerAttachmentSelected');}CSS.removeClass(this.root,'uiComposerInteracted');CSS.setClass(this.focus,'focus_target');this.setLoading(false);if(g){var j=DOM.scry(this.root,'.widget')[0];j&&DOM.replace(j,g);}Arbiter.inform('composer/reset');},onFocus:function(){if(this.lazyEndpoint){var g=DOM.find(this.root,'form.attachmentSelectForm');var i=new URI(this.lazyEndpoint);i.setQueryData({isAugmentation:true});g.action=i.toString();var h=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];g.xhpc.value=h&&h.id;g.xhpc.click();CSS.removeClass.curry(this.root,'async_saving').defer();}this.inform('focus');},focusInput:function(){Input.focus(this.input);},getInput:function() {return this.input;},updateDataSourceToken:function(g){if(this.dataSource)this.dataSource.updateToken(g);},_handleUnsavedChanges:function(){var g=PageTransitions.getNextURI();if(g.getQueryData().hasOwnProperty('theater'))return;if(this.input.offsetParent!==null&&!Input.isEmpty(this.input)&&!(window.Dialog&&Dialog.getCurrent()))return "You haven't finished your post yet. Do you want to leave without finishing?";}});copy_properties(Composer,{publish:function(h,g){g=g||{};g.composer=Composer.getInstance($(h));g.composer.reset(false,g.audienceMarkup);g.audienceMarkup=null;if(g.streamMarkup)g.streamStory=HTML(g.streamMarkup).getRootNode();Arbiter.inform('composer/publish',g);},getInstance:function(g){var h=Parent.byClass($(g),'uiComposer');return h?f[h.id]:null;}});})(); function MetaComposerMessageBox(){}MetaComposerMessageBox.prototype={init:function(b,a){this.inputContainer=DOM.scry(b,'div.inputContainer')[0];this.textInput=DOM.scry(b,'textarea.mentionsTextarea')[0];this.metaArea=DOM.scry(b,'div.attachmentMetaArea')[0];this.bottomArea=DOM.scry(b,'div.attachmentBottomArea')[0];this.barArea=DOM.scry(b,'div.attachmentBarArea')[0];Event.listen(this.inputContainer,'click',function(c){var d=c.getTarget();if(!DOM.contains(this.metaArea,d)&&d!==this.textInput)this.textInput.focus();}.bind(this));}}; __d("XD",["function-extensions","copyProperties","ua","URI","Arbiter"],function(g,i,j,h,f){i("function-extensions");var e=i("copyProperties");var k=i("ua");var b=i("URI");var a=i("Arbiter");var d={_callbacks:[],_opts:{autoResize:false,allowShrink:true,channelUrl:null,hideOverflow:false,newResizeMethod:false,resizeTimeout:100,resizeWidth:false,expectResizeAck:false,resizeAckTimeout:6000},_lastResizeAckId:0,_resizeCount:0,_resizeTimestamp:0,init:function(l){this._opts=e(e({},this._opts),l);if(this._opts.autoResize)this._startResizeMonitor();a.subscribe('Connect.Unsafe.resize.ack',function(n,m){if(!m.id)m.id=this._resizeCount;if(m.id>this._lastResizeAckId)this._lastResizeAckId=m.id;}.bind(this));},send:function(m,l){l=l||this._opts.channelUrl;if(!l)return;if(l.substr(0,4)!='http')return;var t=l+'&'+b.implodeQuery(m),p='f'+(Math.random()*(1<<30)).toString(16).replace('.',''),n=document.body.appendChild(document.createElement('div')),s=false;n.style.position='absolute';n.style.top='-10000px';n.style.width='1px';n .style.height='1px';d._callbacks[p]=function(){if(s){(function(){n.parentNode.removeChild(n);}).defer(3000);delete d._callbacks[p];}};if(k.ie()){var q,o=document.createElement('div');q='';o.innerHTML=q;o.firstChild.setAttribute('src',t);q=o.innerHTML;n.innerHTML='';s=true;(function(){n.innerHTML=q;}).defer();}else{var r=document.createElement('iframe');r.onload=d._callbacks[p];n.appendChild(r);s=true;r.src=t;}},_computeSize:function(){return {width:this._opts.resizeWidth?this._calcWidth(d.forced_min_width):0,height:this._calcHeight(this._opts.newResizeMethod)};},_calcHeight:function(o){var l=document.body,m=document.documentElement,n=0;if(o){n=Math.max(Math.max(l.offsetHeight,l.scrollHeight)+l.offsetTop,Math.max(m.offsetHeight,m.scrollHeight)+m.offsetTop);}else{if(k.ie()){n=Math.max(l.offsetHeight,l.scrollHeight)+l.offsetTop;}else n=m.offsetHeight+m.offsetTop;if(window.Dialog)n=Math.max(n,Dialog.max_bottom);}return n;},_c alcWidth:function(r){var l=document.body,p=document.documentElement,s=0;if(l.offsetWidths)s=n;}}if(r)s=Math.max(s,r);if(p.clientLeft>0)s+=(p.clientLeft*2);if(p.clientTop>0)height+=(p.clientTop*2);return s;},_startResizeMonitor:function(){var m,l=document.documentElement;if(this._opts.hideOverflow){l.style.overflow='hidden';document.body.style.overflow='hidden';}setInterval((function(){var q=this._computeSize();var r=Date.now();var n=this._lastResizeAckIdthis._opts.resizeAckTimeout;if(!m||(this._opts.expectResizeAck&&n)||(this._opts.allowShrink&&m.width!=q.width)||(!this._opts.allowShrink&&m.width'+''));this._plugin=$('kiwi_plugin');}}return this._plugin;},isAppRunning:function(){var a=this.getPlugin();return a&&'isAppRunning' in a&&a.isAppRunning();},logout:function(b){b=b||"0";var a=this.getPlugin();if(a)a.logout(b);},shouldSuppressBeeper:function(){return this.isAppRunning();},shouldSuppressSidebar:function(){var a=this.getPlugin();return a&&'isAppDocked' in a&&a.isAppDocked();},transferAuthToken:function(b,c){if(b&&b.length>0){var a=this.getPlugin();if(a)a.setAccessToken(b,c);}if(this.redirectHome)window.location.href=URI().setPath().toString();}};})(); __d("legacy:cookie",["Cookie"],function(b,c,d){var a=c('Cookie');b.getCookie=a.get;b.setCookie=a.set;b.clearCookie=a.clear;},3); __d("AsyncSignal",["Env"],function(d,f,g,e,c){var b=f("Env");function a(i,h){this.data=h||{};if(b.tracking_domain&&i.charAt(0)=='/')i=b.tracking_domain+i;this.uri=i;this.handler=null;}a.prototype.setHandler=function(h){this.handler=h;return this;};a.prototype.send=function(){var j=this.handler,i=this.data,n=this.uri,m=[],k=new Image(),h=document.getElementById('post_form_id');i.asyncSignal=Math.floor(Math.random()*10000)+1;if(h)i.post_form_id=h.value;i.__user=b.user;if(b.fb_isb)i.fb_isb=b.fb_isb;for(var l in i)m.push(encodeURIComponent(l)+'='+encodeURIComponent(i[l]));if(n.indexOf('?')==-1)n+='?';n+=m.join('&');if(j)k.onload=k.onerror=(function(p,o){return function(){o((p.height==1));};})(k,j);k.src=n;return this;};e.exports=a;}); __d("legacy:async-signal",["AsyncSignal"],function(a,b,c){a.AsyncSignal=b('AsyncSignal');},3); __d("legacy:uri",["URI"],function(a,b,c){a.URI=b('URI');},3); function detect_broken_proxy_cache(d,a){var b=getCookie(a);if((b!=d)&&(b!=null)&&(d!='0')){var c={c:'si_detect_broken_proxy_cache',m:a+' '+d+' '+b};var e=new URI('/common/scribe_endpoint.php').getQualifiedURI().toString();new AsyncSignal(e,c).send();}} __d("AjaxPipeRequest",["Arbiter","AsyncRequest","BigPipe","dom","Env","JSCC","copyProperties","dom-core"],function(l,n,o,m,j){var b=n("Arbiter");var c=n("AsyncRequest");var d=n("BigPipe");var e=n("dom");var f=n("Env");var g=n("JSCC");var i=n("copyProperties");var k=n("dom-core").ge;function h(q,r){var s=k(q);if(s){if(!r)s.style.minHeight='600px';for(var t in d.pageletIDs)if(q!==t&&e.contains(s,t)){g.clearForPagelet(t);delete d.pageletIDs[t];}e.empty(s);}}function p(q,r){var s=k(q);if(s)if(!r)s.style.minHeight='100px';}function a(r,q){this._uri=r;this._query_data=q;this._request=new c();this._canvas_id=null;this._allow_cross_page_transition=true;}i(a.prototype,{setCanvasId:function(q){this._canvas_id=q;return this;},setURI:function(q){this._uri=q;return this;},setData:function(q){this._query_data=q;return this;},getData:function(q){return this._query_data;},setAllowCrossPageTransition:function(q){this._allow_cross_page_transition=q;return this;},setAppend:function(q){this._append=q;return this;},send:function (){this._request.setOption('useIframeTransport',true).setURI(this._uri).setData(i({ajaxpipe:1,ajaxpipe_token:f.ajaxpipe_token},this._query_data)).setPreBootloadHandler(this._preBootloadHandler.bind(this)).setInitialHandler(this._onInitialResponse.bind(this)).setHandler(this._onResponse.bind(this)).setMethod('GET').setReadOnly(true).setAllowCrossPageTransition(this._allow_cross_page_transition);a._current_request=this._request;this._request.send();return this;},_preBootloadFirstResponse:function(q){return false;},_fireDomContentCallback:function(){this._arbiter.inform('ajaxpipe/domcontent_callback',true,b.BEHAVIOR_STATE);},_fireOnloadCallback:function(){this._arbiter.inform('ajaxpipe/onload_callback',true,b.BEHAVIOR_STATE);},_isRelevant:function(q){return this._request==a._current_request||this._jsNonBlock;},_preBootloadHandler:function(r){var q=r.getPayload();if(!q||q.redirect||!this._isRelevant(r))return false;var s=false;if(r.is_first){!this._append&&!this._displayCallback&&h(this._canvas_id,this._constHei ght);this._arbiter=new b();s=this._preBootloadFirstResponse(r);this.pipe=new d({arbiter:this._arbiter,rootNodeID:this._canvas_id,lid:this._request.lid,rrEnabled:r.payload.roadrunner_enabled,isAjax:true,domContentCallback:this._fireDomContentCallback.bind(this),onloadCallback:this._fireOnloadCallback.bind(this),domContentEvt:'ajaxpipe/domcontent_callback',onloadEvt:'ajaxpipe/onload_callback',jsNonBlock:this._jsNonBlock,displayCallback:this._displayCallback});}return s;},_redirect:function(r){if(r.redirect){if(r.force||!this.isPageActive(r.redirect)){var q=['ajaxpipe','ajaxpipe_token'].concat(this.getSanitizedParameters());go_or_replace(window.location,URI(r.redirect).removeQueryData(q),true);}else PageTransitions.go(r.redirect,true);return true;}else return false;},isPageActive:function(q){return true;},getSanitizedParameters:function(){return [];},_versionCheck:function(q){return true;},_onInitialResponse:function(r){var q=r.getPayload();if(!this._isRelevant(r))return false;if(!q)return true;if(this._redirec t(q)||!this._versionCheck(q))return false;return true;},_processFirstResponse:function(r){var q=r.getPayload();if(k(this._canvas_id)&&q.canvas_class!==null)CSS.setClass(this._canvas_id,q.canvas_class);},setFirstResponseCallback:function(q){this._firstResponseCallback=q;return this;},setFirstResponseHandler:function(q){this._processFirstResponse=q;return this;},_onResponse:function(r){var q=r.payload;if(!this._isRelevant(r))return c.suppressOnloadToken;if(r.is_first){this._processFirstResponse(r);this._firstResponseCallback&&this._firstResponseCallback();q.provides=q.provides||[];q.provides.push('uipage_onload');if(this._append)q.append=this._canvas_id;}if(q){if('content' in q.content&&this._canvas_id!==null&&this._canvas_id!='content'){q.content[this._canvas_id]=q.content.content;delete q.content.content;}this.pipe.onPageletArrive(q);}if(r.is_last)p(this._canvas_id,this._constHeight);return c.suppressOnloadToken;},setNectarModuleDataSafe:function(q){this._request.setNectarModuleDataSafe(q);return this;},setF inallyHandler:function(q){this._request.setFinallyHandler(q);return this;},setErrorHandler:function(q){this._request.setErrorHandler(q);return this;},abort:function(){this._request.abort();if(a._current_request==this._request)a._current_request=null;this._request=null;return this;},setJSNonBlock:function(q){this._jsNonBlock=q;return this;},setDisplayCallback:function(q){this._displayCallback=q;return this;},setConstHeight:function(q){this._constHeight=q;return this;},getAsyncRequest:function(){return this._request;}});i(a,{getCurrentRequest:function(){return a._current_request;},setCurrentRequest:function(q){a._current_request=q;}});m.exports=l.AjaxPipeRequest||a;}); __d("legacy:ajaxpipe",["AjaxPipeRequest"],function(a,b,c){a.AjaxPipeRequest=b('AjaxPipeRequest');},3); __d("goOrReplace",["URI"],function(c,f,g,e,b){var a=f("URI");function d(h,k,j){var l=new a(k);if(h.pathname=='/'&&l.getPath()!='/'&&l.isQuicklingEnabled()){var i=h.search?{}:{q:''};l=new a().setPath('/').setQueryData(i).setFragment(l.getUnqualifiedURI()).toString();k=l.toString();}if(j&&!(ua.ie()<8)){h.replace(k);}else if(h.href==k){h.reload();}else h.href=k;}e.exports=d;}); __d("computeRelativeURI",["array-extensions","URI","Util","isEmpty"],function(f,i,j,h,e){i("array-extensions");var a=i("URI");var b=i("Util");var g=i("isEmpty");function c(l,k){if(!k)return l;if(k.charAt(0)=='/')return k;var m=l.split('/').slice(0,-1);m[0]!=='';k.split('/').forEach(function(n){if(!(n=='.'))if(n=='..'){if(m.length>1)m=m.slice(0,-1);}else m.push(n);});return m.join('/');}function d(n,l){var o=new a(),m=l;n=new a(n);l=new a(l);if(l.getDomain()&&!l.isFacebookURI())return m;var p=n;var k=['Protocol','Domain','Port','Path','QueryData','Fragment'];k.forEach(function(r){var q=r=='Path'&&p===n;if(q)o.setPath(c(n.getPath(),l.getPath()));if(!g(l['get'+r]()))p=l;if(!q)o['set'+r](p['get'+r]());});return o;}h.exports=d;}); __d("HistoryManager",["event-extensions","function-extensions","Cookie","Env","ua","URI","copyProperties"],function(g,i,j,h,f){i("event-extensions");i("function-extensions");var a=i("Cookie");var b=i("Env");var k=i("ua");var d=i("URI");var e=i("copyProperties");var c={_IFRAME_BASE_URI:'http://static.ak.facebook.com/common/history_manager.php',history:null,current:0,fragment:null,_setIframeSrcFragment:function(m){m=m.toString();var l=c.history.length-1;c.iframe.src=c._IFRAME_BASE_URI+'?|index='+l+'#'+encodeURIComponent(m);return c;},getIframeSrcFragment:function(){return decodeURIComponent(d(c.iframe.contentWindow.document.location.href).getFragment());},nextframe:function(l,m){if(m){c._setIframeSrcFragment(l);return;}if(l!==undefined){c.iframeQueue.push(l);}else{c.iframeQueue.splice(0,1);c.iframeTimeout=null;c.checkURI();}if(c.iframeQueue.length&&!c.iframeTimeout){var n=c.iframeQueue[0];c.iframeTimeout=setTimeout(function(){c._setIframeSrcFragment(n);},100,false);}},isInitialized:function(){return !!c._initi alized;},init:function(){if(!b.ALLOW_TRANSITION_IN_IFRAME&&window!=window.top)return;if(c._initialized)return c;var m=d();var l=m.getFragment()||'';if(l.charAt(0)==='!'){l=l.substr(1);m.setFragment(l);}if(d.getRequestURI(false).getProtocol().toLowerCase()=='https')c._IFRAME_BASE_URI='https://s-static.ak.facebook.com/common/history_manager.php';e(c,{_initialized:true,fragment:l,orig_fragment:l,history:[m],callbacks:[],lastChanged:Date.now(),canonical:d('#'),fragmentTimeout:null,user:0,iframeTimeout:null,iframeQueue:[],enabled:true,debug:bagofholding});if(window.history&&history.pushState){this.lastURI=document.URL;window.history.replaceState(this.lastURI,null);Event.listen(window,'popstate',function(n){if(n&&n.state&&c.lastURI!=n.state){c.lastURI=n.state;c.lastChanged=Date.now();c.notify(d(n.state).getUnqualifiedURI().toString());}}.bind(c));if(k.safari()<534||k.chrome()<=13){setInterval(c.checkURI,42,false);c._updateRefererURI(this.lastURI);}return c;}c._updateRefererURI(d.getRequestURI(false));if(k.safari() <500||k.firefox()<2){c.enabled=false;return c;}if(k.ie()<8){c.iframe=document.createElement('iframe');e(c.iframe.style,{width:'0',height:'0',frameborder:'0',left:'0',top:'0',position:'absolute'});c._setIframeSrcFragment(l);document.body.insertBefore(c.iframe,document.body.firstChild);}else if('onhashchange' in window){Event.listen(window,'hashchange',function(){c.checkURI.bind(c).defer();});}else setInterval(c.checkURI,42,false);return c;},registerURIHandler:function(l){c.callbacks.push(l);return c;},setCanonicalLocation:function(l){c.canonical=d(l);return c;},notify:function(n){if(n==c.orig_fragment)n=c.canonical.getFragment();for(var m=0;m=0;--m)if(c.history[m].getFragment().replace(/%23/g,'#')==l)break;++c.user;if(m>=0){c.go(m-c.current);}else c.go('#'+l);--c.user;}},_updateRefererURI:function(p){p=p.toString();if(p.charAt(0)!='/'&&p.indexOf('//')==-1)return;var o=new d(window.location);if(o.isFacebookURI()){var l=o.getPath()+window.location.search;}else var l='';var n=d(p).getQualifiedURI().setFragment(l).toString();var m=2048;if(n.length>m)n=n.substring(0,m)+'...';a.set('x-referer',n);},go:function(n,p,q){if(window.history&&history.pushState){p||typeof(n)=='number';var s=d(n).remove QueryData('ref').toString();c.lastChanged=Date.now();this.lastURI=s;if(q){window.history.replaceState(n,null,s);}else window.history.pushState(n,null,s);if(k.safari()<534)c._updateRefererURI(n);return false;}c.debug('go: '+n);if(p===undefined)p=true;if(!c.enabled)if(!p)return false;if(typeof(n)=='number'){if(!n)return false;var m=n+c.current;var o=Math.max(0,Math.min(c.history.length-1,m));c.current=o;m=c.history[o].getFragment()||c.orig_fragment;m=d(m).removeQueryData('ref').getUnqualifiedURI().toString();c.fragment=m;c.lastChanged=Date.now();if(k.ie()<8){if(c.fragmentTimeout)clearTimeout(c.fragmentTimeout);c._temporary_fragment=m;c.fragmentTimeout=setTimeout(function(){window.location.hash='#!'+m;delete c._temporary_fragment;},750,false);if(!c.user)c.nextframe(m,q);}else if(!c.user)go_or_replace(window.location,window.location.href.split('#')[0]+'#!'+m,q);if(p)c.notify(m);c._updateRefererURI(m);return false;}n=d(n);if(n.getDomain()==d().getDomain())n=d('#'+n.getUnqualifiedURI());var l=c.history[c.current]. getFragment();var r=n.getFragment();if(r==l||(l==c.orig_fragment&&r==c.canonical.getFragment())){if(p)c.notify(r);c._updateRefererURI(r);return false;}if(q)c.current--;var t=(c.history.length-c.current)-1;c.history.splice(c.current+1,t);c.history.push(d(n));return c.go(1,p,q);},getCurrentFragment:function(){var l=c._temporary_fragment!==undefined?c._temporary_fragment:d.getRequestURI(false).getFragment();return l==c.orig_fragment?c.canonical.getFragment():l;}};h.exports=c;}); __d("animation",["css"],function(d,f,g,e,c){var a=f('css');function b(h){if(h==undefined)return;if(d==this){return new b(h);}else{this.obj=h;this._reset_state();this.queue=[];this.last_attr=null;}}b.resolution=20;b.offset=0;b.prototype._reset_state=function(){this.state={attrs:{},duration:500};};b.prototype.stop=function(){this._reset_state();this.queue=[];return this;};b.prototype._build_container=function(){if(this.container_div){this._refresh_container();return;}if(this.obj.firstChild&&this.obj.firstChild.__animation_refs){this.container_div=this.obj.firstChild;this.container_div.__animation_refs++;this._refresh_container();return;}var i=document.createElement('div');i.style.padding='0px';i.style.margin='0px';i.style.border='0px';i.__animation_refs=1;var h=this.obj.childNodes;while(h.length)i.appendChild(h[0]);this.obj.appendChild(i);this._orig_overflow=this.obj.style.overflow;this.obj.style.overflow='hidden';this.container_div=i;this._refresh_container();};b.prototype._refresh_container=function(){this.c ontainer_div.style.height='auto';this.container_div.style.width='auto';this.container_div.style.height=this.container_div.offsetHeight+'px';this.container_div.style.width=this.container_div.offsetWidth+'px';};b.prototype._destroy_container=function(){if(!this.container_div)return;if(!--this.container_div.__animation_refs){var h=this.container_div.childNodes;while(h.length)this.obj.appendChild(h[0]);this.obj.removeChild(this.container_div);}this.container_div=null;this.obj.style.overflow=this._orig_overflow;};b.ATTR_TO=1;b.ATTR_BY=2;b.ATTR_FROM=3;b.prototype._attr=function(h,k,j){h=h.replace(/-[a-z]/gi,function(l){return l.substring(1).toUpperCase();});var i=false;switch(h){case 'background':this._attr('backgroundColor',k,j);return this;case 'margin':k=b.parse_group(k);this._attr('marginBottom',k[0],j);this._attr('marginLeft',k[1],j);this._attr('marginRight',k[2],j);this._attr('marginTop',k[3],j);return this;case 'padding':k=b.parse_group(k);this._attr('paddingBottom',k[0],j);this._attr('paddingLeft',k[1],j); this._attr('paddingRight',k[2],j);this._attr('paddingTop',k[3],j);return this;case 'backgroundColor':case 'borderColor':case 'color':k=b.parse_color(k);break;case 'opacity':k=parseFloat(k,10);break;case 'height':case 'width':if(k=='auto'){i=true;}else k=parseInt(k,10);break;case 'borderWidth':case 'lineHeight':case 'fontSize':case 'marginBottom':case 'marginLeft':case 'marginRight':case 'marginTop':case 'paddingBottom':case 'paddingLeft':case 'paddingRight':case 'paddingTop':case 'bottom':case 'left':case 'right':case 'top':case 'scrollTop':case 'scrollLeft':k=parseInt(k,10);break;default:throw new Error(h+' is not a supported attribute!');}if(this.state.attrs[h]===undefined)this.state.attrs[h]={};if(i)this.state.attrs[h].auto=true;switch(j){case b.ATTR_FROM:this.state.attrs[h].start=k;break;case b.ATTR_BY:this.state.attrs[h].by=true;case b.ATTR_TO:this.state.attrs[h].value=k;break;}};b._get_box_width=function(j){var k=parseInt(a.getStyle(j,'paddingLeft'),10),l=parseInt(a.getStyle(j,'paddingRight'),10),h=par seInt(a.getStyle(j,'borderLeftWidth'),10),i=parseInt(a.getStyle(j,'borderRightWidth'),10);return j.offsetWidth-(k?k:0)-(l?l:0)-(h?h:0)-(i?i:0);};b._get_box_height=function(j){var l=parseInt(a.getStyle(j,'paddingTop'),10),k=parseInt(a.getStyle(j,'paddingBottom'),10),h=parseInt(a.getStyle(j,'borderTopWidth'),10),i=parseInt(a.getStyle(j,'borderBottomWidth'),10);return j.offsetHeight-(l?l:0)-(k?k:0)-(h?h:0)-(i?i:0);};b.prototype.to=function(h,i){if(i===undefined){this._attr(this.last_attr,h,b.ATTR_TO);}else{this._attr(h,i,b.ATTR_TO);this.last_attr=h;}return this;};b.prototype.by=function(h,i){if(i===undefined){this._attr(this.last_attr,h,b.ATTR_BY);}else{this._attr(h,i,b.ATTR_BY);this.last_attr=h;}return this;};b.prototype.from=function(h,i){if(i===undefined){this._attr(this.last_attr,h,b.ATTR_FROM);}else{this._attr(h,i,b.ATTR_FROM);this.last_attr=h;}return this;};b.prototype.duration=function(h){this.state.duration=h?h:0;return this;};b.prototype.checkpoint=function(i,h){if(i===undefined)i=1;this.state.checkpoi nt=i;this.queue.push(this.state);this._reset_state();this.state.checkpointcb=h;return this;};b.prototype.blind=function(){this.state.blind=true;return this;};b.prototype.hide=function(){this.state.hide=true;return this;};b.prototype.show=function(){this.state.show=true;return this;};b.prototype.ease=function(h){this.state.ease=h;return this;};b.prototype.go=function(){var i=(new Date()).getTime();this.queue.push(this.state);for(var h=0;ht){j=false;continue;}if(i.checkpointcb){this._callback(i.checkpointcb,t-i.start);i.checkpointcb=null;}if(i.started== =undefined){if(i.show)this._show();for(var h in i.attrs){if(i.attrs[h].start!==undefined)continue;switch(h){case 'backgroundColor':case 'borderColor':case 'color':u=b.parse_color(a.getStyle(this.obj,h=='borderColor'?'borderLeftColor':h));if(i.attrs[h].by){i.attrs[h].value[0]=Math.min(255,Math.max(0,i.attrs[h].value[0]+u[0]));i.attrs[h].value[1]=Math.min(255,Math.max(0,i.attrs[h].value[1]+u[1]));i.attrs[h].value[2]=Math.min(255,Math.max(0,i.attrs[h].value[2]+u[2]));}break;case 'opacity':u=a.getOpacity(this.obj);if(i.attrs[h].by)i.attrs[h].value=Math.min(1,Math.max(0,i.attrs[h].value+u));break;case 'height':u=b._get_box_height(this.obj);if(i.attrs[h].by)i.attrs[h].value+=u;break;case 'width':u=b._get_box_width(this.obj);if(i.attrs[h].by)i.attrs[h].value+=u;break;case 'scrollLeft':case 'scrollTop':u=(this.obj===document.body)?k(h):this.obj[h];if(i.attrs[h].by)i.attrs[h].value+=u;i['last'+h]=u;break;default:u=parseInt(a.getStyle(this.obj,h),10)||0;if(i.attrs[h].by)i.attrs[h].value+=u;break;}i.attrs[h].start=u;}i f((i.attrs.height&&i.attrs.height.auto)||(i.attrs.width&&i.attrs.width.auto)){if(ua.firefox()<3)v=true;this._destroy_container();for(var h in {height:1,width:1,fontSize:1,borderLeftWidth:1,borderRightWidth:1,borderTopWidth:1,borderBottomWidth:1,paddingLeft:1,paddingRight:1,paddingTop:1,paddingBottom:1})if(i.attrs[h])this.obj.style[h]=i.attrs[h].value+(typeof i.attrs[h].value=='number'?'px':'');if(i.attrs.height&&i.attrs.height.auto)i.attrs.height.value=b._get_box_height(this.obj);if(i.attrs.width&&i.attrs.width.auto)i.attrs.width.value=b._get_box_width(this.obj);}i.started=true;if(i.blind)this._build_container();}var p=(t-i.start)/i.duration;if(p>=1){p=1;if(i.hide)this._hide();}else j=false;var r=i.ease?i.ease(p):p;if(!s&&p!=1&&i.blind)s=true;if(v&&this.obj.parentNode){var q=this.obj.parentNode;var o=this.obj.nextSibling;q.removeChild(this.obj);}for(var h in i.attrs)switch(h){case 'backgroundColor':case 'borderColor':case 'color':this.obj.style[h]='rgb('+b.calc_tween(r,i.attrs[h].start[0],i.attrs[h].value[0] ,true)+','+b.calc_tween(r,i.attrs[h].start[1],i.attrs[h].value[1],true)+','+b.calc_tween(r,i.attrs[h].start[2],i.attrs[h].value[2],true)+')';break;case 'opacity':a.setStyle(this.obj,'opacity',b.calc_tween(r,i.attrs[h].start,i.attrs[h].value));break;case 'height':case 'width':this.obj.style[h]=r==1&&i.attrs[h].auto?'auto':b.calc_tween(r,i.attrs[h].start,i.attrs[h].value,true)+'px';break;case 'scrollLeft':case 'scrollTop':var m=this.obj===document.body;u=m?k(h):this.obj[h];if(i['last'+h]!==u){delete i.attrs[h];}else{var n=b.calc_tween(r,i.attrs[h].start,i.attrs[h].value,true);if(!m){n=this.obj[h]=n;}else{if(h=='scrollLeft'){d.scrollTo(n,k('scrollTop'));}else d.scrollTo(k('scrollLeft'),n);n=k(h);}i['last'+h]=n;}break;default:this.obj.style[h]=b.calc_tween(r,i.attrs[h].start,i.attrs[h].value,true)+'px';break;}if(p==1){this.queue.splice(l--,1);this._callback(i.ondone,t-i.start-i.duration);}}if(v)q[o?'insertBefore':'appendChild'](this.obj,o);if(!s&&this.container_div)this._destroy_container();return !j;};b.prototy pe.ondone=function(h){this.state.ondone=h;return this;};b.prototype._callback=function(h,i){if(h){b.offset=i;h.call(this);b.offset=0;}};b.calc_tween=function(h,i,j,k){return (k?parseInt:parseFloat)((j-i)*h+i,10);};b.parse_color=function(h){var i=/^#([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i.exec(h);if(i){return [parseInt(i[1].length==1?i[1]+i[1]:i[1],16),parseInt(i[2].length==1?i[2]+i[2]:i[2],16),parseInt(i[3].length==1?i[3]+i[3]:i[3],16)];}else{var j=/^rgba? *\(([0-9]+), *([0-9]+), *([0-9]+)(?:, *([0-9]+))?\)$/.exec(h);if(j){if(j[4]==='0'){return [255,255,255];}else return [parseInt(j[1],10),parseInt(j[2],10),parseInt(j[3],10)];}else if(h=='transparent'){return [255,255,255];}else throw 'Named color attributes are not supported.';}};b.parse_group=function(h){h=trim(h).split(/ +/);if(h.length==4){return h;}else if(h.length==3){return [h[0],h[1],h[2],h[1]];}else if(h.length==2){return [h[0],h[1],h[0],h[1]];}else return [h[0],h[0],h[0],h[0]];};b.push=function(h){if(!b.active)b.active=[];b.active.push(h); if(b.active.length===1){if(!b.requestAnimationFrame){var i=d.requestAnimationFrame||d.webkitRequestAnimationFrame||d.mozRequestAnimationFrame;if(i)b.requestAnimationFrame=i.bind(d);}if(b.requestAnimationFrame){b.requestAnimationFrame(b._animate);}else b.timeout=setInterval(b._animate,b.resolution,false);}if(b.requestAnimationFrame)b._updateEndingTimer();b._animate(Date.now(),true);};b._updateEndingTimer=function(){if(!b.requestAnimationFrame)throw new Error('Ending timer only valid with requestAnimationFrame');var k=0;for(var h=0;hk)k=i;}}if(b.timeout){clearTimeout(b.timeout);delete b.timeout;}var j=Date.now();if(k>j)b.timeout=setTimeout(b._animate.shield(),k-j,false);};b._animate=function(k,j){k=k||Date.now();for(var i=(j===true)?b.active.length-1:0;i=0;i--)if(k=h.style[j[i]]!==undefined)break;a.supportsBorderRadius=bagof(k);return k;}});e.exports=a;},3); __d("Locale",["css"],function(d,f,g,e,c){var a=f("css");var b={isRTL:function(){return 'rtl'===a.getStyle(document.body,'direction');}};e.exports=b;}); __d("getOverlayZIndex",["css"],function(d,f,g,e,b){var a=f("css");function c(j,l){l=l||document.body;var i=[];while(j&&j!==l){i.push(j);j=j.parentNode;}if(j!==l)return 0;for(var k=i.length-1;k>=0;k--){var h=i[k];if(a.getStyle(h,'position')!='static'){var m=parseInt(a.getStyle(h,'z-index'),10);if(!isNaN(m))return m;}}return 0;}e.exports=c;}); __d("Dialog",["array-extensions","event-extensions","AjaxPipeRequest","animation","Arbiter","ArrayUtils","AsyncRequest","bootloader","Button","css-support","dom","Form","HTML","Input","Keys","Locale","ObjectUtils","onload","Parent","ua","URI","Vector","bind","copyProperties","getOverlayZIndex","tx"],function(global,require,requireLazy,module,exports){require("array-extensions");require("event-extensions");var AjaxPipeRequest=require("AjaxPipeRequest");var animation=require("animation");var Arbiter=require("Arbiter");var ArrayUtils=require("ArrayUtils");var AsyncRequest=require("AsyncRequest");var Bootloader=require("bootloader");var Button=require("Button");var CSS=require("css-support");var DOM=require("dom");var Form=require("Form");var HTML=require("HTML");var Input=require("Input");var Keys=require("Keys");var Locale=require("Locale");var ObjectUtils=require("ObjectUtils");var Onload=require("onload");var Parent=require("Parent");var ua=require("ua");var URI=require("URI");var Vector=require("Vector");va r bind=require("bind");var copyProperties=require("copyProperties");var getOverlayZIndex=require("getOverlayZIndex");global.tx=require("tx");var _supportsPositionFixed=function(){var body=document.body;var test=document.createElement('div');var control=document.createElement('div');body.insertBefore(test,body.firstChild);body.insertBefore(control,body.firstChild);test.style.position='fixed';test.style.top='20px';var result=test.offsetTop!==control.offsetTop;body.removeChild(test);body.removeChild(control);_supportsPositionFixed=bagof(result);return result;};function Dialog(model){this._show_loading=true;this._auto_focus=true;this._submit_on_enter=false;this._fade_enabled=true;this._onload_handlers=[];this._top=125;this._uniqueID='dialog_'+Dialog._globalCount++;this._content=null;this._obj=null;this._popup=null;this._overlay=null;this._shim=null;this._causal_elem=null;this._previous_focus=null;this._buttons=[];this._buildDialog();if(model)this._setFromModel(model);Dialog._init();}copyProperties(Dialog,{OK:{na me:'ok',label:"Okay"},CANCEL:{name:'cancel',label:"Cancel",className:'inputaux'},CLOSE:{name:'close',label:"Close"},NEXT:{name:'next',label:"Next"},SAVE:{name:'save',label:"Save"},SUBMIT:{name:'submit',label:"Submit"},CONFIRM:{name:'confirm',label:"Confirm"},DELETE:{name:'delete',label:"Delete"},_globalCount:0,_bottoms:[0],max_bottom:0,_updateMaxBottom:function(){Dialog.max_bottom=Math.max.apply(Math,Dialog._bottoms);}});copyProperties(Dialog,{OK_AND_CANCEL:[Dialog.OK,Dialog.CANCEL],_STANDARD_BUTTONS:[Dialog.OK,Dialog.CANCEL,Dialog.CLOSE,Dialog.SAVE,Dialog.SUBMIT,Dialog.CONFIRM,Dialog.DELETE],SIZE:{WIDE:555,STANDARD:445},_HALO_WIDTH:10,_BORDER_WIDTH:1,_PADDING_WIDTH:10,_PAGE_MARGIN:40,_stack:[],_isUsingCSSBorders:function(){return CSS.supportsBorderRadius()||ua.ie()<7;},newButton:function(name,label,className,handler){var button={name:name,label:label};if(className)button.className=className;if(handler)button.handler=handler;return button;},getCurrent:function(){var stack=Dialog._stack;return stack.length?st ack[stack.length-1]:null;},bootstrap:function(uri,data,read_only,method,model,elem){data=data||{};var use_pipe=elem&&elem.rel=='dialog-pipe';copyProperties(data,new URI(uri).getQueryData());method=method||(read_only?'GET':'POST');var status_elem=Parent.byClass(elem,'stat_elem')||elem;if(status_elem&&CSS.hasClass(status_elem,'async_saving'))return false;var request;if(use_pipe){request=new AjaxPipeRequest();}else request=new AsyncRequest().setReadOnly(!!read_only).setMethod(method).setRelativeTo(elem).setStatusElement(status_elem);request.setURI(uri).setNectarModuleDataSafe(elem).setData(data);var dialog=new Dialog(model).setCausalElement(elem).setAsync(request,use_pipe);dialog.show();return false;},_init:function(){this._init=bagofholding;Onload.runOnleave(Dialog._tearDown.shield(null,false));Arbiter.subscribe('page_transition',Dialog._tearDown.shield(null,true));Event.listen(document.documentElement,'keydown',function(event){if(Event.getKeyCode(event)==Keys.ESC&&!event.getModifiers().any){if(Dialog._escape( ))event.kill();}else if(Event.getKeyCode(event)==Keys.RETURN&&!event.getModifiers().any)if(Dialog._enter())event.kill();});Event.listen(window,'resize',function(event){var dialog=Dialog.getCurrent();dialog&&dialog._resetDialogObj();});},_findButton:function(buttons,name){if(buttons)for(var i=0;i=0;ii--)if(!(is_page_transition&&stack[ii]._cross_transition))stack[ii].hide();},_escape:function(){var dialog=Dialog.getCurrent();if(!dialog)return false;var semi_modal=dialog._semi_modal;var buttons=dialog._buttons;if(!buttons.length&&!semi_modal)return false;if(semi_modal&&!buttons.length){dialog.hide();return true;}var button_to_simulate;var cancel_button=Dialog._findButton(buttons,'cancel');if(dialog._cancelHandler){dialog.cancel();return true;}else if(cancel_button){button_to_simulate=cancel_button;}else if(buttons.length==1){button_to_si mulate=buttons[0];}else return false;dialog._handleButton(button_to_simulate);return true;},_enter:function(){var dialog=Dialog.getCurrent();if(!dialog||!dialog._submit_on_enter)return false;if(document.activeElement!=dialog._frame)return false;var buttons=dialog._buttons;if(!buttons)return false;dialog._handleButton(buttons[0]);return true;},call_or_eval:function(obj,func,args){if(!func)return undefined;args=args||{};if(typeof(func)=='string'){var params=ObjectUtils.getKeys(args).join(', ');func=eval('({f: function('+params+') { '+func+'}})').f;}return func.apply(obj,ObjectUtils.getValues(args));}});copyProperties(Dialog.prototype,{_cross_transition:false,_loading:false,_showing:false,show:function(){if(this._async_request&&this._show_loading){this.showLoading();}else{this._showing=true;this._update();}return this;},showLoading:function(){this._loading=true;CSS.addClass(this._frame,'dialog_loading_shown');this._renderDialog();return this;},hide:function(){if(!this._showing&&!this._loading)return this;this._ showing=false;if(this._autohide_timeout){clearTimeout(this._autohide_timeout);this._autohide_timeout=null;}if(this._fade_enabled&&Dialog._stack.length<=1){this._fadeOut();}else this._hide();return this;},cancel:function(){if(!this._cancelHandler||this._cancelHandler()!==false)this.hide();},getRoot:function(){return this._obj;},getBody:function(){return DOM.scry(this._obj,'div.dialog_body')[0];},getButtonElement:function(button){if(typeof button=='string')button=Dialog._findButton(this._buttons,button);if(!button||!button.name)return null;var inputs=DOM.scry(this._popup,'input');var name_filter=function(elem){return elem.name==button.name;};return inputs.filter(name_filter)[0]||null;},getContentNode:function(){return DOM.find(this._content,'div.dialog_content');},getFormData:function(){return Form.serialize(this.getContentNode());},setAllowCrossPageTransition:function(allow){this._cross_transition=allow;return this;},setShowing:function(){this.show();return this;},setHiding:function(){this.hide();return this; },setTitle:function(title){var node=this._nodes.title;var inner_node=this._nodes.title_inner;var content_node=this._nodes.content;DOM.setContent(inner_node,this._format(title||''));CSS.conditionShow(node,!!title);CSS.conditionClass(content_node,'dialog_content_titleless',!title);return this;},setBody:function(body){DOM.setContent(this._nodes.body,this._format(body));return this;},setExtraData:function(data){this._extra_data=data;return this;},setReturnData:function(data){this._return_data=data;return this;},setShowLoading:function(show){this._show_loading=show;return this;},setFullBleed:function(is_full_bleed){this._full_bleed=is_full_bleed;this._updateWidth();CSS.conditionClass(this._obj,'full_bleed',is_full_bleed);return this;},setCausalElement:function(elem){this._causal_elem=elem;return this;},setUserData:function(data){this._user_data=data;return this;},getUserData:function(){return this._user_data;},setAutohide:function(autohide){if(autohide){if(this._showing){this._autohide_timeout=setTimeout(this.hid e.shield(this),autohide);}else this._autohide=autohide;}else{this._autohide=null;if(this._autohide_timeout){clearTimeout(this._autohide_timeout);this._autohide_timeout=null;}}return this;},setSummary:function(summary){var node=this._nodes.summary;DOM.setContent(node,this._format(summary||''));CSS.conditionShow(node,!!summary);return this;},setButtons:function(b){var buttons,button;if(!(b instanceof Array)){buttons=ArrayUtils.createFrom(arguments);}else buttons=b;for(var i=0;i0)for(var ii=0;ii5)button_input.setAttribute(attr,button[attr]);button_content.push(button_node);}DOM.setContent(this._nodes.buttons,button_content);this._updateButtonVisibility();return this;},setButtonsMessage:function(message){DOM.setContent(this._nodes.button_message,this._format(message||''));this._has_button_message=!!message;this._updateButtonVisibility();return this;},_updateButtonVisibility:function(){var show=this._buttons.length>0||this._has_button_message;CSS.conditionShow(this._nodes.button_wrap per,show);CSS.conditionClass(this._obj,'omitDialogFooter',!show);},setClickButtonOnEnter:function(input_id,button){this._clickOnEnterTarget=input_id;if(!this._clickOnEnterListener)this._clickOnEnterListener=Event.listen(this._nodes.body,'keypress',function(event){var target=event.getTarget();if(target&&target.id===this._clickOnEnterTarget)if(Event.getKeyCode(event)==Keys.RETURN){this._handleButton(button);event.kill();}return true;}.bind(this));return this;},setStackable:function(stackable,shown){this._is_stackable=stackable;this._shown_while_stacked=stackable&&shown;return this;},setHandler:function(handler){this._handler=handler;return this;},setCancelHandler:function(cancelHandler){this._cancelHandler=Dialog.call_or_eval.bind(null,this,cancelHandler);return this;},setCloseHandler:function(close_handler){this._close_handler=Dialog.call_or_eval.bind(null,this,close_handler);return this;},clearHandler:function(){return this.setHandler(null);},setPostURI:function(post_uri,asynchronous){if(asynchronous===undef ined)asynchronous=true;if(asynchronous){this.setHandler(this._submitForm.bind(this,'POST',post_uri));}else this.setHandler(function(){Form.post(post_uri,this.getFormData());this.hide();}.bind(this));return this;},setGetURI:function(get_uri){this.setHandler(this._submitForm.bind(this,'GET',get_uri));return this;},setModal:function(modal){this._modal=modal;CSS.conditionClass(this._obj,'generic_dialog_modal',modal);return this;},setSemiModal:function(clickout){if(clickout){this.setModal(true);this._semiModalListener=Event.listen(this._obj,'click',function(e){if(!DOM.contains(this._popup,e.getTarget()))this.hide();}.bind(this));}else this._semiModalListener&&this._semiModalListener.remove();this._semi_modal=clickout;return this;},setWideDialog:function(is_wide){this._wide_dialog=is_wide;this._updateWidth();return this;},setContentWidth:function(width){this._content_width=width;this._updateWidth();return this;},setTitleLoading:function(loading){if(loading===undefined)loading=true;var header=DOM.find(this._popup,' h2.dialog_title');if(header)CSS.conditionClass(header,'loading',loading);return this;},setSecure:function(is_secure){CSS.conditionClass(this._nodes.title,'secure',is_secure);return this;},setClassName:function(class_name){CSS.addClass(this._obj,class_name);return this;},setFadeEnabled:function(enabled){this._fade_enabled=enabled;return this;},setFooter:function(footer){var node=this._nodes.footer;DOM.setContent(node,this._format(footer||''));CSS.conditionShow(node,!!footer);return this;},setAutoFocus:function(focus){this._auto_focus=focus;return this;},setTop:function(top){this._top=top;this._resetDialogObj();return this;},onloadRegister:function(handler){ArrayUtils.createFrom(handler).forEach(function(i){if(typeof i=='string')i=new Function(i);this._onload_handlers.push(i.bind(this));}.bind(this));return this;},setAsyncURL:function(url){return this.setAsync(new AsyncRequest(url));},setAsync:function(async_request,use_pipe){var handler=function(response){if(this._async_request!=async_request)return;this._asy nc_request=null;var payload=response.getPayload();var dialog=payload;var fn=function(){if(this._loading)this._showing=true;if(typeof dialog=='string'){this.setBody(dialog);}else this._setFromModel(dialog);this._update();}.bind(this);if(use_pipe){dialog=payload.dialog;Bootloader.setResourceMap(payload.resource_map);Bootloader.loadResources(payload.css,fn);}else fn();}.bind(this);var data=async_request.getData();data.__d=1;async_request.setData(data);var request;if(use_pipe){async_request.setFirstResponseHandler(handler);request=async_request.getAsyncRequest();}else{var orig_handler=async_request.getHandler()||bagofholding;async_request.setHandler(function(response){orig_handler(response);handler(response);});request=async_request;}var orig_error_handler=request.getErrorHandler()||bagofholding;var orig_trans_error_handler=request.getTransportErrorHandler()||bagofholding;var handle_error=function(){this._async_request=null;if(this._showing){this._update();}else this._hide();}.bind(this);request.setAllowCrossPag eTransition(this._cross_transition).setErrorHandler(function(response){handle_error();orig_error_handler(response);}).setTransportErrorHandler(function(response){handle_error();orig_trans_error_handler(response);});async_request.send();this._async_request=async_request;this._update();return this;},_format:function(content){if(typeof content=='string'){content=HTML(content);}else content=HTML.replaceJSONWrapper(content);if(content instanceof HTML)content.setDeferred(true);return content;},_update:function(){if(!this._showing)return;if(this._autohide&&!this._async_request&&!this._autohide_timeout)this._autohide_timeout=setTimeout(bind(this,'hide'),this._autohide);if(this._async_request&&this._show_loading){this.showLoading();}else{CSS.removeClass(this._frame,'dialog_loading_shown');this._loading=false;this._renderDialog();this._runOnloads();this._previous_focus=document.activeElement;Input.focus(this._frame);}},_runOnloads:function(){for(var i=0;i(this._modal?400:200);CSS.setStyle(this._obj,'z-index',this._hasSetZIndex?z_index:'');}this._pushOntoStack();this._obj.style.height=(this._modal&&ua.ie()<7)?Vector.getDocumentDimensions().y+'px':null;if(this._obj&&this._obj.style.display){this._obj.style.visibility='hidden';this._obj.style.display='';this.resetDialogPosition();this._obj.style.visibility='';this._obj.dialog=this;}else this.resetDialogPosition();clearInterval(this.active_hiding);this.active_hiding=setInterval(this._activeResi ze.bind(this),500);return this;},_updateShim:function(){return this._shim&&this._shim.show();},_activeResize:function(){if(this.last_offset_height!=this._content.offsetHeight){this.last_offset_height=this._content.offsetHeight;this.resetDialogPosition();}},_buildDialogContainer:function(){CSS.addClass(this._obj,'pop_dialog');if(Locale.isRTL())CSS.addClass(this._obj,'pop_dialog_rtl');var markup;if(Dialog._isUsingCSSBorders()){markup='
'+'
'+'
';}else markup='
'+'
'+'
'+'
'+'
'+'
'+'
'+'
'+'
';DOM.setContent(this._popup,HTML(markup));var frame=DOM.find(this._popup,'div.pop_content');frame.setAttribute('tabIndex','0');frame.setAttribute( 'role','alertdialog');this._frame=this._content=frame;},_buildDialogContent:function(){var loading=DOM.$N('div',{className:'dialog_loading'},"Loading...");var title_inner=DOM.$N('span');var title=DOM.$N('h2',{className:'dialog_title hidden_elem',id:'title_'+this._uniqueID},title_inner);var summary=DOM.$N('div',{className:'dialog_summary hidden_elem'});var body=DOM.$N('div',{className:'dialog_body'});var buttons=DOM.$N('div');var button_message=DOM.$N('div',{className:'dialog_buttons_msg'});var button_wrapper=DOM.$N('div',{className:'dialog_buttons clearfix hidden_elem'},[button_message,buttons]);var footer=DOM.$N('div',{className:'dialog_footer hidden_elem'});var content=DOM.$N('div',{className:'dialog_content'},[summary,body,button_wrapper,footer]);this._nodes={summary:summary,body:body,buttons:buttons,button_message:button_message,button_wrapper:button_wrapper,footer:footer,content:content,title:title,title_inner:title_inner};DOM.setContent(this._frame,[title,content,loading]);},resetDialogPosition:functio n(){if(!this._popup)return;this._resetDialogObj();this._updateShim();},_resetDialogObj:function(){var total_margin=2*Dialog._PAGE_MARGIN;var viewport_dimensions=Vector.getViewportDimensions();var viewport_width=viewport_dimensions.x-total_margin;var viewport_height=viewport_dimensions.y-total_margin;var total_halo_width=2*Dialog._HALO_WIDTH;var content_dimensions=Vector.getElementDimensions(this._content);var content_width=content_dimensions.x+total_halo_width;var content_height=content_dimensions.y+total_halo_width;var top=this._top;var empty_horiz_space=viewport_width-content_width;var empty_vertical_space=viewport_height-content_height;if(empty_vertical_space<0){top=Dialog._PAGE_MARGIN;}else if(top>empty_vertical_space)top=Dialog._PAGE_MARGIN+(Math.max(empty_vertical_space,0)/2);var is_fixed=_supportsPositionFixed();if(!is_fixed)top+=Vector.getScrollPosition().y;CSS.setStyle(this._popup,'top',top+'px');var scroll=is_fixed&&(empty_horiz_space<0||empty_vertical_space<0);CSS.conditionClass(this._obj,'generic _dialog_fixed_overflow',scroll);CSS.conditionClass(document.documentElement,'generic_dialog_overflow_mode',scroll);},_fadeOut:function(temporary){if(!this._popup)return;try{animation(this._obj).duration(0).checkpoint().to('opacity',0).hide().duration(250).ondone(this._hide.bind(this,temporary)).go();}catch(e){this._hide(temporary);}},_hide:function(temporary){if(this._obj)this._obj.style.display='none';CSS.removeClass(document.documentElement,'generic_dialog_overflow_mode');this._updateShim();clearInterval(this.active_hiding);if(this._bottom){var bs=Dialog._bottoms;bs.splice(bs.indexOf(this._bottom),1);Dialog._updateMaxBottom();}if(this._previous_focus&&document.activeElement&&DOM.contains(this._obj,document.activeElement))Input.focus(this._previous_focus);if(temporary)return;this.destroy();},destroy:function(){this._popFromStack();if(this._obj){DOM.remove(this._obj);this._obj=null;this._shim&&this._shim.hide();this._shim=null;}this._clickOnEnterListener&&this._clickOnEnterListener.remove();if(this._close_ha ndler)this._close_handler({return_data:this._return_data});},_handleButton:function(button){if(typeof button=='string')button=Dialog._findButton(this._buttons,button);var value=Dialog.call_or_eval(button,button.handler);if(value===false)return;if(button.name=='cancel'){this.cancel();}else if(Dialog.call_or_eval(this,this._handler,{button:button})!==false)this.hide();},_submitForm:function(method,uri,button){var data=this.getFormData();if(button)data[button.name]=button.label;if(this._extra_data)copyProperties(data,this._extra_data);var async_request=new AsyncRequest().setURI(uri).setData(data).setMethod(method).setNectarModuleDataSafe(this._causal_elem).setReadOnly(method=='GET');this.setAsync(async_request);return false;},_setFromModel:function(original_model){var model={};copyProperties(model,original_model);for(var propertyName in model){if(propertyName=='onloadRegister'){this.onloadRegister(model[propertyName]);continue;}var mutator=this['set'+propertyName.substr(0,1).toUpperCase()+propertyName.substr(1) ];mutator.apply(this,ArrayUtils.createFrom(model[propertyName]));}},_updateBottom:function(){var bottom=Vector.getElementDimensions(this._content).y+Vector.getElementPosition(this._content).y;Dialog._bottoms[Dialog._bottoms.length-1]=bottom;Dialog._updateMaxBottom();},_pushOntoStack:function(){var stack=Dialog._stack;if(!stack.length)Arbiter.inform('layer_shown',{type:'Dialog'});stack.remove(this);stack.push(this);for(var i=stack.length-2;i>=0;i--){var prev_dialog=stack[i];if(!prev_dialog._is_stackable&&!prev_dialog._async_request){prev_dialog._hide();}else if(!prev_dialog._shown_while_stacked)prev_dialog._hide(true);}},_popFromStack:function(){var stack=Dialog._stack;var was_top=(stack[stack.length-1]===this);stack.remove(this);if(stack.length){if(was_top)stack[stack.length-1]._showDialog();}else Arbiter.inform('layer_hidden',{type:'Dialog'});}});module.exports=Dialog;}); __d("DOMScroll",["bootloader","css","Vector","dom","dom-core"],function(h,j,k,i,f){var b=j("bootloader");var c=j("css");var e=j("Vector");var a=j("dom").$N;var g=j("dom-core").ge;var d={getScrollState:function(){var o=e.getViewportDimensions();var l=e.getDocumentDimensions();var m=(l.x>o.x);var n=(l.y>o.y);m+=0;n+=0;return new e(m,n);},_scrollbarSize:null,_initScrollbarSize:function(){var l=a('p');l.style.width='100%';l.style.height='200px';var m=a('div');m.style.position='absolute';m.style.top='0px';m.style.left='0px';m.style.visibility='hidden';m.style.width='200px';m.style.height='150px';m.style.overflow='hidden';m.appendChild(l);document.body.appendChild(m);var n=l.offsetWidth;m.style.overflow='scroll';var o=l.offsetWidth;if(n==o)o=m.clientWidth;document.body.removeChild(m);d._scrollbarSize=n-o;},getScrollbarSize:function(){if(d._scrollbarSize===null)d._initScrollbarSize();return d._scrollbarSize;},scrollTo:function(q,l,o,m,n){if(typeof l=='undefined'||l===true)l=750;if(!(q instanceof e)){var r=e.getScro llPosition().x;var s=e.getElementPosition(g(q)).y;q=new e(r,s,'document');if(!m){var p=g('blueBar');if(p&&c.isFixed(p))q.y-=e.getElementDimensions(p).y/(o?2:1);}}if(o){q.y-=e.getViewportDimensions().y/2;}else if(m){q.y-=e.getViewportDimensions().y;q.y+=m;}q=q.convertTo('document');if(l){b.loadComponents('animation',function(){var t=document.body;animation(t).to('scrollTop',q.y).to('scrollLeft',q.x).ease(animation.ease.end).duration(l).ondone(n).go();});}else if(window.scrollTo){window.scrollTo(q.x,q.y);n&&n();}}};i.exports=d;}); __d("LinkController",["event-extensions","DataStore","Parent","trackReferrer"],function(k,m,n,l,j){m("event-extensions");var a=m("DataStore");var c=m("Parent");var o=m("trackReferrer");var d='LinkControllerHandler';var h=[];var f=[];function e(event){var r=c.byTag(event.getTarget(),'a');var p=r&&r.getAttribute('href',2);if(!p||r.rel||!i(p)||a.get(r,d))return;var q=Event.listen(r,'click',function(s){if(p.charAt(p.length-1)=='#'){s.prevent();return;}o(r,p);g(r,s);});a.set(r,d,q);}function g(s,event){if(s.target||event.getModifiers().any||(event.which&&event.which!=1))return;var p=h.concat(f);for(var q=0,r=p.length;q=0;--zc){var zb=k._transition_handlers[zc];if(!zb)continue;for(var zd=zb.length-1;zd>=0;--zd)if(zb[zd](zg)===true){var ze={sender:this,uri:zg,id:zf};try{a.inform("page_transition",ze);}catch(za){}return true;}else zb.splice(zd,1);}return false;},unifyURI:function(){k._current_uri=k._most_recent_uri=k._next_uri;},transitionComplete:function(za){k._executeCompletionCallback();o.stopLookingBusy();k.unifyURI();if(!za)k.restoreScrollPosition();try{if(document.activeElement&&document.activeElement.nodeName==='A')document.activeElement.blur();}catch(zb){}},_executeCompletionCallback:function(){if(k._completionCallback)k._completionCallback();k._completionCallback=null;},setCompletionCallback:function(za){k._completionCallback=za;},rewriteCurrentURI:function(zb,za){k.registerHandler(function(){if(zb==k.getMostRecentURI().getUnqualifiedURI().toString()){k.transitionComplete();return true;}});k.go(za,true);},_warnBeforeLeaving:function(zb,za){new d().setTitle("Are you sure you want to leave t his page?").setBody(htmlize(zb)).setButtons([{name:'leave_page',label:"Leave this Page",handler:za},{name:'continue_editing',label:"Stay on this Page",className:'inputaux'}]).setModal(true).show();},restoreScrollPosition:function(){k._scroll_locked=false;var zc=k._current_uri;var ze=k._scroll_positions[zc];if(ze){c.scrollTo(ze,false);return;}function zd(zf){return (zf||null)&&(b.scry(document.body,"a[name='"+escape_js_quotes(zf)+"']")[0]||s(zf));}var za=zd(l(zc).getFragment());if(za){var zb=n.getElementPosition(za);zb.x=0;c.scrollTo(zb);}}};var o=window._BusyUIManager||{_looking_busy:false,_original_cursors:[],lookBusy:function(za){if(za)o._giveProgressCursor(za);if(o._looking_busy)return;o._looking_busy=true;o._giveProgressCursor(document.documentElement);},stopLookingBusy:function(){if(!o._looking_busy)return;o._looking_busy=false;while(o._original_cursors.length){var zc=o._original_cursors.pop();var zb=zc[0];var za=zc[1];if(zb.style)zb.style.cursor=za||'';}},_giveProgressCursor:function(za){if(!y.safari() ){o._original_cursors.push([za,za.style.cursor]);za.style.cursor='progress';}}};v.exports=k;}); __d("legacy:page-transitions",["goOrReplace","computeRelativeURI","HistoryManager","PageTransitions"],function(a,b,c){a.go_or_replace=b('goOrReplace');a.computeRelativeURI=b('computeRelativeURI');a.HistoryManager=a.HistoryManager||b('HistoryManager');a.PageTransitions=a.PageTransitions||b('PageTransitions');},3); var NavigationMessage={NAVIGATION_BEGIN:'NavigationMessage/navigationBegin',NAVIGATION_SELECT:'NavigationMessage/navigationSelect',NAVIGATION_FIRST_RESPONSE:'NavigationMessage/navigationFirstResponse',NAVIGATION_COMPLETED:'NavigationMessage/navigationCompleted',NAVIGATION_FAILED:'NavigationMessage/navigationFailed',NAVIGATION_COUNT_UPDATE:'NavigationMessage/navigationCount',NAVIGATION_FAVORITE_UPDATE:'NavigationMessage/navigationFavoriteUpdate',NAVIGATION_ITEM_REMOVED:'NavigationMessage/navigationItemRemoved',NAVIGATION_ITEM_HIDDEN:'NavigationMessage/navigationItemHidden',INTERNAL_LOADING_BEGIN:'NavigationMessage/internalLoadingBegin',INTERNAL_LOADING_COMPLETED:'NavigationMessage/internalLoadingCompleted'}; function AsyncLayout(){}AsyncLayout.prototype={init:function(a){this.canvas_id=a;if(ge('rightCol'))this.auxiliary_id='rightCol';if(ge('headerArea'))this.header_id='headerArea';if(ge('toolbarContainer'))this.toolbar_id='toolbarContainer';this.waitingForAux=false;PageTransitions.registerHandler(this.catchPageTransition.bind(this));this.subscription=Arbiter.subscribe(NavigationMessage.NAVIGATION_BEGIN,this.onNavigate.bind(this));return this;},catchPageTransition:function(a){Arbiter.unsubscribe(this.subscription);return false;},getCanvasID:function(a){return this.customCanvasID?this.customCanvasID:(a.sidecol?'contentCol':'contentArea');},onNavigate:function(c,a){var d=a.useAjaxPipe;a=a.params;if(a.endpoint){if(this.request){this.request.setFinallyHandler(bagofholding);this.request.abort();}if(this.sideRequest)this.sideRequest.abort();if(d){this.request=new AjaxPipeRequest().setURI(a.endpoint).setData(a).setCanvasId(this.getCanvasID(a)).setFinallyHandler(this.finallyHandler.bind(this)).setErrorHandler(this.errorH andler.bind(this)).setFirstResponseCallback(this.firstResponseCallback.bind(this)).send();}else{a.handled=true;this.waitingForAux=a.sidecol;var e=!!a.iframe;var b=new AsyncRequest().setOption('useIframeTransport',e).setURI(new URI(a.endpoint)).setReadOnly(true).setMethod('GET').setData(a).setHandler(this.onResponse.bind(this)).setErrorHandler(this.errorHandler.bind(this)).setFinallyHandler(this.finallyHandler.bind(this));this.request=b;b.send();}}},onSideResponse:function(b){var a=b.getPayload();if(a&&this.auxiliary_id)this.receivedAux(a);},receivedAux:function(a){!this.waitingForAux;this.waitingForAux=false;DOM.setContent($(this.auxiliary_id),HTML(a));},onResponse:function(e){var d=e.getPayload();if(d.redirect){goURI(d.redirect);}else{var c=d.html||d;DOM.setContent($(this.canvas_id),HTML(c));if(d.side_html&&this.auxiliary_id)this.receivedAux(d.side_html);if(this.header_id&&!d.keep_header){var b=$(this.header_id);DOM.setContent(b,HTML(d.header_html||''));CSS.conditionShow(b,d.header_html);}if(d.toolbar_html& &this.toolbar_id)DOM.setContent($(this.toolbar_id),HTML(d.toolbar_html));if(d.js)(new Function(d.js))();CSS.conditionClass('contentCol','hasRightCol',this.auxiliary_id&&!d.noRightSide);var f=ge('rightCol');if(f&&d.noRightSide)DOM.empty(f);}var a=e.getRequest().getData();Arbiter.inform(NavigationMessage.NAVIGATION_COMPLETED,a.key);},errorHandler:function(a){AsyncResponse.verboseErrorHandler(a);Arbiter.inform(NavigationMessage.NAVIGATION_FAILED);this.request=null;},firstResponseCallback:function(a){window.scrollTo(0,0);Arbiter.inform(NavigationMessage.NAVIGATION_FIRST_RESPONSE);},finallyHandler:function(a){this.request=null;PageTransitions.transitionComplete(true);Arbiter.inform(NavigationMessage.NAVIGATION_COMPLETED);}}; __d("legacy:vector",["Vector"],function(a,b,c){a.Vector2=b('Vector');},3); function FutureSideNav(){FutureSideNav.instance&&FutureSideNav.instance.uninstall();FutureSideNav.instance=this;}FutureSideNav.instance=null;FutureSideNav.getInstance=function(){return FutureSideNav.instance||new FutureSideNav();};FutureSideNav.prototype={init:function(c,b,a){this.root=c;this.items={};this.sections={};this.editor=null;this.editing=false;this.selected=null;this.loading=null;this.keyParam='sk';this.defaultKey=b;this.uri=URI.getRequestURI();this.ajaxPipe=a;this.ajaxPipeEndpoints={};this.sidecol=true;this._installed=true;this._handlePageTransitions=true;PageTransitions.registerHandler(function(d){return this._handlePageTransitions&&this.handlePageTransition(d);}.bind(this));this._eventHandlers=[];this._arbiterSubscriptions=[Arbiter.subscribe(NavigationMessage.NAVIGATION_COMPLETED,this.navigationComplete.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_FAILED,this.navigationFailed.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_COUNT_UPDATE,this.navigationCountUpdate.bind(thi s)),Arbiter.subscribe(NavigationMessage.NAVIGATION_SELECT,this.navigationSelect.bind(this)),Arbiter.subscribe(PresenceMessage.getArbiterMessageType('nav_update_counts'),this.navigationCountUpdateFromPresence.bind(this))];this._explicitHover=[];this._ensureHover('sideNavItem');this._eventHandlers.push(Event.listen(window,'resize',this._handleResize.bind(this)));this._checkNarrow();this._selectorSubscriptions=[];window.Selector&&this._selectorSubscriptions.push(Selector.subscribe(['open','close'],function(f,d){var e=Parent.byClass(d.selector,'sideNavItem');e&&CSS.conditionClass(e,'editMenuOpened',f==='open');}));onleaveRegister(this.uninstall.bind(this));},_handleResize:(function(){var a;return function(){a&&clearTimeout(a);a=this._checkNarrow.bind(this).defer(200);};})(),_checkNarrow:function(){CSS.conditionClass(this.root,'uiNarrowSideNav',Vector2.getElementPosition(this.root).x<20);},_ensureHover:function(a){if(ua.ie()<8)Bootloader.loadComponents('explicit-hover',function(){this._explicitHover.push(new Expl icitHover(this.root,a));}.bind(this));},uninstall:function(){if(this._installed){this._installed=false;this._handlePageTransitions=false;this._arbiterSubscriptions.forEach(Arbiter.unsubscribe);this._selectorSubscriptions.forEach(Selector.unsubscribe.bind(Selector));this._eventHandlers.forEach(function(a){a.remove();});this._explicitHover.forEach(function(a){a.uninstall();});}},initSection:function(b,a){this._initItems(a);this._initSection(b);},addItem:function(a,b){this._initItem(a,b);},_initItems:function(b){var a=function(c,e){var d=this._initItem(c,e);$(c.children).forEach(function(f){a(f,d);});}.bind(this);$A(b).forEach(function(c){a(c,null);});},_initItem:function(a,d){var b=this.items[a.id]=this._constructItem(a,d);if(b.equals(this.selected)||a.selected)this.setSelected(b);var c=b.getLinkNode();c&&this._eventHandlers.push(Event.listen(c,'click',function(event){return !this.editing;}.bind(this)));return b;},_initSection:function(a){var b=this.sections[a.id]=this._constructSection(a);this._eventHandlers. push(Event.listen(b.node,'click',this.handleSectionClick.bind(this,b)));DOM.scry(b.node,'div.bookmarksMenuButton').forEach(CSS.show);return b;},_constructItem:function(a,b){return new FutureSideNavItem(a,b);},_constructSection:function(a){return new FutureSideNavSection(a);},handleSectionClick:function(c,event){var b=this._getEventTarget(event,'a');var a=this._getItemForNode(b);if(!b){return;}else if(CSS.hasClass(b.parentNode,'uiMenuItem')){this._handleMenuClick(c,a,b.parentNode,event);}else this._handleLinkClick(c,b,event);},_getEventTarget:function(event,a){var b=event.getTarget();if(b.tagName!==a.toUpperCase()){return Parent.byTag(b,a);}else return b;},_handleMenuClick:function(c,a,b,event){if(CSS.hasClass(b,'rearrange'))this.beginEdit(c);},_handleLinkClick:function(b,a,event){if(CSS.hasClass(a,'navEditDone')){this.editing?this.endEdit():this.beginEdit(b);event.kill();}},getItem:function(a){if(this._isCurrentPath(a)){return this._getItemForKey(this._getKey(a.getQueryData())||this.defaultKey);}else return this._getItemForPath(a.getPath());},getNodeForKey:function(b){var a=this._getItemForKey(b);if(a)return a.node;},_isCurrentPath:function(a){return a.getDomain()===this.uri.getDomain()&&a.getPath()===this.uri.getPath();},_getKey:function(a){return a[this.keyParam];},_getItemForNode:function(a){a=Parent.byClass(a,'sideNavItem');return a&&this.items[a.id];},_getItemForKey:function(a){return this._findItem(function(b){return b.matchKey(a);});},_getItemForPath:function(a){return this._findItem(function(b){return b.matchPath(a);});},_findItem:function(a){for(var b in this.items)if(a(this.items[b]))return this.items[b];},removeItem:function(a){if(a&&this.items[a.id]){DOM.remove(a.node);delete this.items[a.id];}},removeItemByKey:function(a){this.removeItem(this._getItemForKey(a));},moveItem:function(d,b,c){var a=DOM.find(d.node,'ul.uiSideNav');(c?DOM.prependContent:DOM.appendContent)(a,b.node);},setLoading:function(a){this.loading&&this.loading.hideLoading();this.loading=a;this.loading&&this.loading.showLoading();},s etSelected:function(a){this.setLoading(null);if(this.selected){this.selected.hideSelected();this.selected.getTop().hideChildren();}this.selected=a;if(this.selected){this.selected.showSelected();this.selected.getTop().showChildren();}},handlePageTransition:function(c){var a=this.getItem(c);var b=a&&a.endpoint&&this._doPageTransition(a,c);return b;},_doPageTransition:function(a,b){this.setLoading(a);this._sendPageTransition(a.endpoint,copy_properties(this._getTransitionData(a,b),b.getQueryData()));return true;},_sendPageTransition:function(b,a){a.endpoint=b;Arbiter.inform(NavigationMessage.NAVIGATION_BEGIN,{useAjaxPipe:this._useAjaxPipe(b),params:a});},_getTransitionData:function(b,c){var a={};a.sidecol=this.sidecol;a.path=c.getPath();a[this.keyParam]=b.textKey;a.key=b.textKey;return a;},_useAjaxPipe:function(a){return this.ajaxPipe||this.ajaxPipeEndpoints[a];},navigationComplete:function(){this.loading&&this.setSelected(this.loading);},navigationFailed:function(){this.setLoading(null);},navigationSelect:funct ion(c,a){var b=this._getItemForKey(this._getKey(a));if(a.asLoading){this.setLoading(b);}else this.setSelected(b);},navigationCountUpdate:function(c,a){var b=this._getItemForKey(a&&a.key);if(b)if(typeof a.count!=="undefined"){b.setCount(a.count,a.hide);}else if(typeof a.increment!=="undefined")b.incrementCount(a.increment,a.hide);},navigationCountUpdateFromPresence:function(c,a){a=a.obj;if(a)if(!a.class_name||a.class_name&&CSS.hasClass(this.root,a.class_name))if(a.items)for(var b=0;b').replace(/[\r\n]/g,'
');}function escape_js_quotes(a){if(typeof(a)=='undefined'||!a.toString)return '';return a.toString().replace(/\\/g,'\\\\').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/"/g,'\\x22').replace(/'/g,'\\\'').replace(//g,'\\x3e').replace(/&/g,'\\x26');} if(typeof deconcept=="undefined")var deconcept={};if(typeof deconcept.util=="undefined")deconcept.util={};if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil={};deconcept.SWFObject=function(h,d,j,c,i,a,f,l,g,b){if(!document.getElementById)return;this.DETECT_KEY=b?b:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];this.fallback_html='';this.fallback_js_fcn=function(){};if(h)this.setAttribute('swf',h);if(d)this.setAttribute('id',d);if(j)this.setAttribute('width',j);if(c)this.setAttribute('height',c);this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(i){if(!(i instanceof Array))i=[i];var k;i.each(function(n){k=new deconcept.PlayerVersion(n.toString().split('.'));if(k.major==this.installedVer.major){this.setAttribute('version',k);return;}else if(!this.getAttribute('version')||k.major7)if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}if(a)this.addParam('bgcolor',a);var e=f?f:'high';this.addParam('quality',e);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var m=(l)?l:window.location;this.setAttribute('xiRedirectUrl',m);this.setAttribute('redirectUrl','');if(g)this.setAttribute('redirectUrl',g);this.setAttribute('useIframe',false);};deconcept.SWFObject.ieWorkaroundApplied=false;deconcept.SWFObject.ensureIEWorkaroundAttached=function(){if(!deconcept.SWFObject.ieWorkaroundApplied&&document.attachEvent){deconcept.SWFObject.ieWorkaroundApplied=true;document.attachEvent('onpropertychange',deconcept.SWFObject.onDocumentPropertyChange);}};deconcept.SWFObject.onDocumentProper tyChange=function(event){if(event.propertyName=="title"){var a=document.title;if(a!=null&&a.indexOf('#!')!=-1){a=a.substring(0,a.indexOf('#!'));document.title=a;}}};deconcept.SWFObject.prototype={useExpressInstall:function(a){this.xiSWFPath=!a?"/swf/expressinstall.swf":a;this.setAttribute('useExpressInstall',true);},setAttribute:function(a,b){this.attributes[a]=b;},getAttribute:function(a){return this.attributes[a]||"";},addParam:function(a,b){this.params[a]=b;},getParams:function(){return this.params;},addVariable:function(a,b){this.variables[a]=b;},getVariable:function(a){return this.variables[a]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var b=[];var a;var c=this.getVariables();for(a in c)b[b.length]=a+"="+c[a];return b.join('&');},getSWFHTML:function(){var f,d,a;if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}d={type:'ap plication/x-shockwave-flash',src:this.getAttribute('swf'),width:this.getAttribute('width'),height:this.getAttribute('height'),style:this.getAttribute('style')||'',id:this.getAttribute('id'),name:this.getAttribute('id')};var c=this.getParams();for(var b in c)d[b]=c[b];a=this.getVariablePairs();if(a)d.flashvars=a;f=render_tag_as_htmlstring('embed',d,null);}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}d={id:this.getAttribute('id'),classid:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',width:this.getAttribute('width'),height:this.getAttribute('height'),style:this.getAttribute('style')||''};var e=render_tag_as_htmlstring('param',{name:'movie',value:this.getAttribute('swf')},null);var c=this.getParams();for(var b in c)e+=render_tag_as_htmlstring('param',{name:b,value:c[b]},null);a=this.getVariablePairs();if(a)e+=render_tag_as_htmlstring('param',{name:'flashvars',value:a},null);f=render_tag_as_htmlstring('object',d,e);}return f;},wr ite:function(a){if(this.getAttribute('useExpressInstall')){var b=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(b)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}var c=(typeof a=='string')?document.getElementById(a):a;if(!c)return false;CSS.addClass(c,'swfObject');c.setAttribute('data-swfid',this.getAttribute('id'));if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){if(!this.getAttribute('useIframe')){deconcept.SWFObject.ensureIEWorkaroundAttached();c.innerHTML=this.getSWFHTML();}else this._createIframe(c);return true;}else{if(this.getAttribute('redirectUrl')!="")document.location.replace(this.getAttribute('redirectUrl'));need_version=this.getAttribute('ve rsion').major+'.'+this.getAttribute('version').minor+'.'+this.getAttribute('version').rev;have_version=this.installedVer.major+'.'+this.installedVer.minor+'.'+this.installedVer.rev;this.fallback_js_fcn(have_version,need_version);c.innerHTML=this.fallback_html;}return false;},_createIframe:function(b){var a=$N('iframe',{width:this.getAttribute('width'),height:this.getAttribute('height'),frameBorder:0});DOM.empty(b);b.appendChild(a);useFacebookRefererHtml.bind(null,a,this.getSWFHTML(),this.getAttribute('iframeSource')).defer();}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var a=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){for(var g=0;ga.major||(PlayerVersion_tmp.major==a.major&&(PlayerV ersion_tmp.minor>a.minor||(PlayerVersion_tmp.minor==a.minor&&PlayerVersion_tmp.rev>a.rev))))a=PlayerVersion_tmp;}}catch(f){}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var b=1;var c=3;while(b)try{c++;b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+c);a=new deconcept.PlayerVersion([c,0,0]);}catch(d){b=null;}}else{try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a=new deconcept.PlayerVersion([6,0,21]);b.AllowScriptAccess="always";}catch(e2){if(a.major==6)return a;}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e3){}}if(b!=null)a=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","));}return a;};deconcept.PlayerVersion=function(a){this.major=a[0]!=null?parseInt(a[0]):0;this.minor=a[1]!=null?parseInt(a[1]):0;this.rev=a[2]!=null?parseInt(a[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(a){if(this.majora.major)return true;if(this.minora.minor)return true;if(this.rev=0;a--){b[a].style.display='none';for(var c in b[a])if(typeof b[a][c]=='function')b[a][c]=function(){};}};if(!document.getElementById&&document.all)document.getElementById=function(a){return document.all[a];};var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;function spawn_flash_update_dialog(){new AsyncRequest().setURI('/ajax/flash_update_dialog.php').setMethod('GET').setReadOnly(true).send();}fu nction setFlashFallback(d,g){var b=ge(d);var a=deconcept.SWFObjectUtil.getPlayerVersion();var e;g.each(function(h){h=new deconcept.PlayerVersion(h.toString().split('.'));if(h.major==a.major){e=h;return;}else if(typeof e=='undefined'||h.major0){var c=a.major+'.'+a.minor+'.'+a.rev;var f=e.major+'.'+e.minor+'.'+e.rev;b.innerHTML=_tx("Flash {required-version} is required to view this content. Your current version is {current-version}. Please download the latest Flash Player.",{'required-version':f,'current-version':c});}}function showFlashErrorDialog(b,a){Bootloader.loadComponents('error-dialog',function(){ErrorDialog.show(b,a);});}function render_tag_as_htmlstring(f,b,c){var a=/^[A-Za-z0-9\-]+$/;if(!f.match(a))throw new Error('Invalid tag '+f);var e='<'+f;for(var d in b){if(!d.match(a))throw new Error('Invalid attr '+d);e+=' '+d+'="'+htmlspecialchars(b[d])+'"';}if(c===null){return e+'/>';}else return e+'>'+c+'';} function Flash(){}copy_properties(Flash,{INIT:'flash/init',READY:'flash/ready',FAILED:'flash/failed'}); window.SubscriptionLevels={ALL:'162318810514679',DEFAULT:'271670892858696',TOP:'266156873403755'};window.EditSubscriptions=window.EditSubscriptions||(function(){var b=13;var a=45;var c=[SubscriptionLevels.ALL,SubscriptionLevels.DEFAULT,SubscriptionLevels.TOP];var e={};var h={};var v={};var u={};var g={};var f={};var t="/ajax/follow/follow_profile.php";var y="/ajax/follow/unfollow_profile.php";function p(za){return c.contains(za);}function l(za,zd,zb,ze){var zc=Parent.byClass(ze,'uiMenuItem');if(!zc||!DOM.contains(za,zc)){return;}else if(CSS.hasClass(zc,'SubscribeMenuToggle')){CSS.toggleClass(za,'showSubscriptionMenu');return false;}else if(CSS.hasClass(zc,'SubscribeMenuSubscribe')){n(za,zd);return false;}else if(CSS.hasClass(zc,'SubscribeMenuUnsubscribe')){o(za,zd);return false;}else if(CSS.hasClass(zc,'SubscriptionMenuItem')){m(za,zd,zb,zc);return false;}}function m(za,zd,zb,zc){if(CSS.hasClass(zc,'SubscriptionMenuLevel')){if(Menu.isItemChecked(zc))return;q(za,zd,k(zc),true,zb);}else if(CSS.hasClass(zc,'Sub scriptionMenuCategory'))z(zd,zc,!Menu.isItemChecked(zc),true,zb);}function n(za,zc){var zb={profile_id:zc};Arbiter.inform('FollowingUser',zb);new AsyncRequest().setURI(t).setMethod('POST').setData({profile_id:zc,location:i(za)}).setErrorHandler(Arbiter.inform.curry('FollowUserFail',zb)).send();}function o(za,zc){var zb={profile_id:zc};Arbiter.inform('UnfollowingUser',zb);new AsyncRequest().setURI(y).setMethod('POST').setData({profile_id:zc,location:i(za)}).setErrorHandler(Arbiter.inform.curry('UnfollowUserFail',zb)).send();}function i(za){if(CSS.hasClass(za,'followButtonFlyout')){return b;}else return a;}function r(zc,zd,zb){var za={profile_id:zc,level:v[zc],custom_categories:u[zc],location:zb};new AsyncRequest().setURI('/ajax/follow/manage_subscriptions.php').setData(za).send();}function w(zb,zd){var za=u[zd]||[];var zc=Menu.getItems(zb);zc.forEach(function(zf){if(CSS.hasClass(zf,'SubscriptionMenuCategory')){var ze=k(zf);if(za.contains(ze)){d(zf);}else x(zf);}});q(zb,zd,v[zd],false);}function k(zb){var za=D OM.scry(zb,'input')[0];return za&&za.value;}function j(za){return DOM.find(za,'a.itemAnchor');}function d(za){CSS.addClass(za,'checked');j(za).setAttribute('aria-checked',true);}function x(za){CSS.removeClass(za,'checked');j(za).setAttribute('aria-checked',false);}function z(ze,zc,za,zf,zd){if(za){d(zc);}else x(zc);var zg=k(zc);if(p(zg)){za&&s(ze,zg);}else if(za){if(!u[ze].contains(zg))u[ze].push(zg);}else{var zb=u[ze].indexOf(zg);if(zb!==-1)u[ze].splice(zb,1);}if(zf)r(ze,zg,zd);}function s(zb,za){v[zb]=za;Arbiter.inform('SubscriptionLevelUpdated',{profile_id:zb,level:za});}function q(za,ze,zb,zg,zd){var zc=DOM.scry(za,'.SubscriptionMenuLevel');var zf=null;zc.forEach(function(zh){if(k(zh)==zb){zf=zh;}else if(Menu.isItemChecked(zh))z(ze,zh,false,false);});zf&&z(ze,zf,true,zg,zd);}Arbiter.subscribe('UnfollowUser',function(za,zb){if(g[zb.profile_id]){s(zb.profile_id,g[zb.profile_id]);u[zb.profile_id]=f[zb.profile_id].slice();}});Arbiter.subscribe('UpdateSubscriptionLevel',function(za,zd){var zf=zd.profile_id+'' ;var ze=zd.level+'';s(zf,ze);var zc;for(zc in e)if(e[zc]===zf){var zb=ge(zc);zb&&q(zb,zf,ze,false);}});return {init:function(za,zd,zc){var zb=za.id;if(!e[zb])Event.listen(za,'click',function(ze){return l(za,e[zb],zc,ze.getTarget());});if(v[zd])w(za,zd);e[zb]=zd;CSS.conditionClass(za,'NonFriendSubscriptionMenu',!h[zd]);Arbiter.subscribe(['FollowUser','FollowingUser'],function(zf,ze){CSS.conditionClass(za,'isUnsubscribed',false);CSS.conditionClass(za,'showSubscriptionMenu',zf=='FollowingUser');}.bind(this));Arbiter.subscribe(['UnfollowUser','UnfollowingUser'],function(zf,ze){CSS.conditionClass(za,'isUnsubscribed',true);CSS.removeClass(za,'showSubscriptionMenu');}.bind(this));},getSubscriptions:function(za){return {level:v[za],custom_categories:u[za]};},setSubscriptions:function(zd,zc,zf,ze,zb,za){s(zd,zf+'');h[zd]=zc;g[zd]=zb+'';u[zd]=ze.map(String);f[zd]=za.map(String);}};})(); function HoverFlyout(){}Class.mixin(HoverFlyout,'Arbiter',{init:function(a){this._flyout=a;this._showDelay=0;this._hideDelay=100;this._showTimeout=null;this._hideTimeout=null;this._flyoutSubscriptions=[this._flyout.subscribe('mouseenter',this._onFlyoutMouseEnter.bind(this)),this._flyout.subscribe('mouseleave',this.hideFlyout.shield(this))];this._nodes=[];this._dataStoreUnique='HoverFlyout_'+Date.now();return this;},initNode:function(a){this._nodes.push(a);DataStore.set(a,this._dataStoreUnique+'_listeners',[Event.listen(a,'mouseenter',this._onNodeMouseEnter.bind(this,a)),Event.listen(a,'mouseleave',this.hideFlyout.shield(this))]);return this;},deactivateNode:function(a){var b=DataStore.get(a,this._dataStoreUnique+'_listeners');if(b)while(b.length)b.pop().remove();this._nodes.remove(a);},setShowDelay:function(a){this._showDelay=a;return this;},setHideDelay:function(a){this._hideDelay=a;return this;},showFlyout:function(a,b){this.setActiveNode(a);if(b){this._flyout.setContext(a).show();this.inform('show',a);}el se this._showTimeout=this.showFlyout.bind(this,a,true).defer(this._showDelay);return this;},hideFlyout:function(a){clearTimeout(this._showTimeout);if(a){this._flyout.hide();this.inform('hide',this._activeNode);this._activeNode=null;}else this._hideTimeout=this.hideFlyout.bind(this,true).defer(this._hideDelay);},getActiveNode:function(){return this._activeNode;},setActiveNode:function(a){clearTimeout(this._hideTimeout);if(this._activeNode&&this._activeNode!==a)this.hideFlyout(true);this._activeNode=a;return this;},destroy:function(){while(this._flyoutSubscriptions.length)this._flyout.unsubscribe(this._flyoutSubscriptions.pop());for(var a=0;a0);CSS.conditionClass(this._elem,'contentAfter',a0);},_subscribeAll:function(){var a=[CounterDisplay.EVENT_TYPE_ADJUST+'/'+this._name,CounterDisplay.EVENT_TYPE_UPDATE+'/'+this._name];this._arbiterSubscription=Arbiter.subscribe(a,this._onInform.bind(this),Arbiter.SUBSCRIBE_NEW);},_onInform:function(a,b){b=parseInt(b);if(isNaN(b))return;if(a.indexOf(CounterDisplay.EVENT_TYPE_ADJUST)!=-1){this.adjustCount(b);}else if(a.indexOf(CounterDisplay.EVENT_TYPE_UPDATE)!=-1){this.setCount(b);}else return;return;}}); function adjustImage(e,g){if(!g){var a=e.parentNode;while(a.parentNode&&(CSS.getStyle(a,'display')!='block'||a.offsetWidth==0))a=a.parentNode;g=a.offsetWidth;}var c=e.offsetWidth;if(c==0){var d=e.nextSibling,f=e.parentNode;document.body.appendChild(e);c=e.offsetWidth;if(d){f.insertBefore(e,d);}else f.appendChild(e);}if(c>g)try{if(ua.ie()<8){var img_div=document.createElement('div');img_div.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+e.src.replace('"','%22')+'", sizingMethod="scale")';img_div.style.width=g+'px';img_div.style.height=Math.floor(((g/e.offsetWidth)*e.offsetHeight))+'px';if(e.parentNode.tagName=='A')img_div.style.cursor='pointer';e.parentNode.insertBefore(img_div,e);e.parentNode.removeChild(e);}else throw 1;}catch(b){e.style.width=g+'px';}CSS.removeClass(e,'img_loading');}function imageConstrainSize(e,b,c,d){var a=new Image();a.onload=function(){if(a.width>0&&a.height>0){var k=a.width;var h=a.height;if(k>b||h>c){var g=c/b;var f=h/k;if(f>g){k=k*(c/h);h=c;}else{h=h*(b/k); k=b;}}var j=ge(d);if(j){var i=document.createElement('img');i.src=e;i.width=k;i.height=h;j.parentNode.insertBefore(i,j);j.parentNode.removeChild(j);}}};a.src=e;}function image_has_loaded(a){if(a.naturalWidth!==undefined){return a.complete&&a.width!=0;}else if(a.height==20&&a.width==20&&a.complete){return false;}else if(a.complete===undefined&&ua.safari()<500){var b=new Image();b.src=a.src;return b.complete;}return a.complete;}function image_has_failed(a){if((a.complete==null&&a.width==20&&a.height==20)||(a.mimeType!=null&&a.complete&&a.mimeType=='')||(a.naturalHeight!=null&&a.complete&&a.naturalHeight==0))return true;} __d("legacy:intl-locale",["Locale"],function(a,b,c){a.intl_locale_is_rtl=b('Locale').isRTL;},3); __d("legacy:control-dom",["DOMControl"],function(a,b,c){a.DOMControl=b('DOMControl');},3); function TextInputControl(b){this.parent.construct(this,b);var a=this.getRoot();var c=function(){this.update.bind(this).defer();}.bind(this);Event.listen(a,{keydown:c,paste:c});}Class.extend(TextInputControl,'DOMControl');TextInputControl.prototype={setMaxLength:function(a){Input.setMaxLength(this.getRoot(),a);return this;},getValue:function(){return Input.getValue(this.getRoot());},isEmpty:function(){return Input.isEmpty(this.getRoot());},setValue:function(a){Input.setValue(this.getRoot(),a);this.update();return this;},clear:function(){return this.setValue('');},setPlaceholderText:function(a){Input.setPlaceholder(this.getRoot(),a);return this;}}; function TextMetrics(a){this._node=a;var b=this._shadow=$N('textarea',{className:'textMetrics'});var c=['fontSize','fontStyle','fontWeight','fontFamily','lineHeight','wordWrap'];c.each(function(d){CSS.setStyle(b,d,CSS.getStyle(a,d));});document.body.appendChild(b);}TextMetrics.prototype={measure:function(){var a=this._node;var b=this._shadow;var c=a.clientWidth-CSS.getStyleFloat(a,'paddingLeft')-CSS.getStyleFloat(a,'paddingRight');CSS.setStyle(b,'width',c+'px');b.value=a.value+'...';return {width:b.scrollWidth,height:b.scrollHeight};},destroy:function(){DOM.remove(this._shadow);}}; function TextAreaControl(a){this.autogrow=false;this.parent.construct(this,a);this.width=null;Event.listen(a,{focus:this._handleFocus.bind(this)});}Class.extend(TextAreaControl,'TextInputControl');Class.mixin(TextAreaControl,'Arbiter',{setAutogrow:function(a){this.autogrow=a;return this;},onupdate:function(){this.parent.onupdate();if(this.autogrow){var d=this.getRoot();if(!this.metrics)this.metrics=new TextMetrics(d);if(typeof this.minHeight==='undefined'){var c=CSS.getStyleFloat(d,'height');this.minHeight=c>0?c:d.offsetHeight-8;}if(typeof this.isBorderBox==='undefined')if(CSS.getStyle(d,'box-sizing')=='border-box'||CSS.getStyle(d,'-moz-box-sizing')=='border-box'||CSS.getStyle(d,'-webkit-box-sizing')=='border-box'){this.isBorderBox=true;this.borderBoxOffset=CSS.getStyleFloat(d,'padding-top')+CSS.getStyleFloat(d,'padding-bottom')+CSS.getStyleFloat(d,'border-top-width')+CSS.getStyleFloat(d,'border-bottom-width');}else this.isBorderBox=false;var b=this.metrics.measure();var a=Math.max(this.minHeight,b.height);i f(this.isBorderBox)a+=this.borderBoxOffset;if(a!=this.height){CSS.setStyle(d,'height',a+'px');this.height=a;Arbiter.inform('reflow');this.inform('resize');}}else if(this.metrics){this.metrics.destroy();this.metrics=null;}},resetHeight:function(){this.height=-1;this.update();},_handleFocus:function(){this.width=null;}});TextAreaControl.getInstance=function(b){var a=DOMControl.getInstance(b);if(!a){a=new TextAreaControl(b);CSS.hasClass(b,'uiTextareaAutogrow')&&a.setAutogrow(true);b._has_control=true;}return a;}; __d("legacy:dom-html",["HTML"],function(a,b,c){a.HTML=b('HTML');},3); function show(){for(var b=0;b=0&&a<=9){if(typeof(a)!='number')a=a.charCodeAt(0)-48;return [48+a,96+a];}var b=KeyEventController.keyCodeMap[a.toUpperCase()];if(b)return b;return [a.toUpperCase(). charCodeAt(0)];},onkeyevent:function(i,c){c=$E(c);var d=null;var g=this.handlers[c.keyCode];var b,f,a;if(g)for(var h=0;h=j.r&&i.t<=j.t&&i.b>=j.b);},add:function(k,l){if(arguments.length==1){if(k.domain!='pure')k=k.convertTo(this.domain);return this.add(k.x,k.y);}var i=parseFloat(k);var j=parseFloat(l);return new a(this.t+j,this.r+i,this.b+j,this.l+i,this.domain);},sub:function(i,j){if(arguments.length==1){return this.add(i.mul(-1));}else return this.add(-i,-j);},boundWithin:function(i){var j=0,k=0;if(this.li.r)j=i.r-this.r;if(this.t i.b)k=i.b-this.b;return this.add(j,k);},getCenter:function(){return new b(this.l+this.w()/2,this.t+this.h()/2,this.domain);},getPositionVector:function(){return new b(this.l,this.t,this.domain);},getDimensionVector:function(){return new b(this.w(),this.h(),'pure');},convertTo:function(i){if(this.domain==i)return this;if(i=='pure')return new a(this.t,this.r,this.b,this.l,'pure');if(this.domain=='pure')return new a(0,0,0,0);var j=new b(this.l,this.t,this.domain).convertTo(i);return new a(j.y,j.x+this.w(),j.y+this.h(),j.x,i);}});c(a,{deserialize:function(j){var i=j.split(':');return new a(i[1],i[2],i[3],i[0]);},newFromVectors:function(j,i){return new a(j.y,j.x+i.x,j.y+i.y,j.x,j.domain);},getElementBounds:function(i){return a.newFromVectors(b.getElementPosition(i),b.getElementDimensions(i));},getViewportBounds:function(){return a.newFromVectors(b.getScrollPosition(),b.getViewportDimensions());},minimumBoundingBox:function(l){var i=new a(Math.min(),Math.max(),Math.max(),Math.min ());var k;for(var j=0;j>>18),c.charCodeAt((e>>>12)&63),c.charCodeAt((e>>>6)&63),c.charCodeAt(e&63));}var a='>___?456789:;<=_______'+'\0\1\2\3\4\5\6\7\b\t\n\13\f\r\16\17\20\21\22\23\24\25\26\27\30\31'+'______\32\33\34\35\36\37 !"#$%&\'()*+,-./0123';function b(e){e=(a.charCodeAt(e.charCodeAt(0)-43)<<18)|(a.charCodeAt(e.charCodeAt(1)-43)<<12)|(a.charCodeAt(e.charCodeAt(2)-43)<<6)|a.charCodeAt(e.charCodeAt(3)-43);return String.fromCharCode(e>>>16,(e>>>8)&255,e&255);}return {encode:function(f){f=unescape(encodeURI(f));var e=(f.length+2)%3;f=(f+'\0\0'.slice(e)).replace(/[\s\S]{3}/g,d);return f.slice(0,f.length+e-2)+'=='.slice(e);},decode:function(g){g=g.replace(/[^A-Za-z0-9+\/]/g,'');var f=(g.length+3)&3;g=(g+'AAA'.slice(f)).replace(/..../g,b);g=g.slice(0,g.length+f-3);try{return decodeURIComponent(escape(g));}catch(e){throw ne w Error('Not valid UTF-8');}},encodeObject:function(e){return Base64.encode(JSON.stringify(e));},decodeObject:function(e){return JSON.parse(Base64.decode(e));},encodeNums:function(e){return String.fromCharCode.apply(String,e.map(function(f){return c.charCodeAt((f|-(f>63))&-(f>0)&63);}));}};})(); __d("htmlHyperlink",["Env","UntrustedLink","URLScraper"],function(e,h,i,g,d){var a=h("Env");var c=h("UntrustedLink");var b=h("URLScraper");function f(p,q,r,n){if(typeof p==='undefined'||!p.toString)return '';if(typeof q!=='function')q=htmlize;if(typeof r!=='function')r=htmlize;var p=p.toString();var o=[];var k;while((k=b.match(p))){var m=p.indexOf(k);if(m>=0)o.push(q(p.substring(0,m)));var j=r(k);var l=k.replace(/"/g,'%22');if(!(/^[a-z][a-z0-9\-+.]+:\/\//i.test(k)))l='http://'+l;o.push(''+j+'');p=p.substring(m+k.length);}p&&o.push(q(p));return o.join('');}g.exports=f;}); __d("isEmail",[],function(b,e,f,d,a){function c(g){return (/^([\w!.%+\-])+@([\w\-])+(?:\.[\w\-]+)+$/).test(g);}d.exports=c;}); __d("legacy:string-misc",["htmlHyperlink","isEmail"],function(a,b,c){a.html_hyperlink=b('htmlHyperlink');a.is_email=b('isEmail');},3); if(window==window.top)!function(){var a=function(){var b=0;return function(){if(!b){b=1;setTimeout(function(){b=0;var c=Vector2.getViewportDimensions();setCookie('wd',c.x+'x'+c.y);if(window.AsyncSignal&&Math.random()<.01)new AsyncSignal('/ajax/dimension_context.php',{'x':c.x,'y':c.y}).send();},100);}};}();onloadRegister(a);onloadRegister(function(){Event.listen(window,'resize',a);});onloadRegister(function(){Event.listen(window,'focus',a);});}(); __d("ErrorDialog",["Dialog"],function(d,f,g,e,c){var a=f("Dialog");var b={showAsyncError:function(i){try{return b.show(i.getErrorSummary(),i.getErrorDescription());}catch(h){alert(i);}},show:function(k,j,i,h){return (new a()).setTitle(k).setBody(j).setButtons([a.OK]).setStackable(true).setModal(true).setHandler(i||bagofholding).setButtonsMessage(h||'').show();}};e.exports=b;}); __d("legacy:error-dialog",["ErrorDialog"],function(b,c,d){var a=c('ErrorDialog');b.ErrorDialog=a;},3); __d("legacy:array-utils",["ArrayUtils","hasArrayNature"],function(a,b,c){a.$A=b('ArrayUtils').createFrom;a.hasArrayNature=b('hasArrayNature');},3); __d("ContextualThing",["dom"],function(e,g,h,f,d){var b=g("dom");var c=[];var a={register:function(j,i){a.remove(j);c.push({node:j,context:i});},remove:function(j){for(var i=0;i200?n:'');}},show:function(){b.addClass(this._root,'invisible_elem');d.appendContent(this._insertParent,this._root);if(this.updatePosition()!==false){this.inform('show');this._shown=true;}else d.remove(this._root);b.removeClass(this._root,'invisible_elem');return this;},hide:function(){d.remove(this._root);this.inform('hide');this._shown=false;return this;},isShown:function(){return this._shown;},updatePosition:function(){return true;},destroy:function(){this.hide();this.inform('destroy');this._root=null;a.unsubscribe(this._transitionSubscription);this._trans itionSubscription=null;}});j.exports=f;}); __d("legacy:layer",["Layer"],function(a,b,c){a.Layer=b('Layer');},3); function Overlay(){return this.parent.construct(this);}Class.extend(Overlay,'Layer');!function(){var a=null;function b(d,e){var c;d.subscribe('show',function(){c=Event.listen(document.documentElement,'keydown',function(event){if(event.keyCode==KEYS.ESC&&(document.activeElement==document.body||DOM.contains(e,document.activeElement)))d.hide();});});d.subscribe('hide',function(){c.remove();c=null;});}copy_properties(Overlay,{getInstance:function(c){var d=Parent.byClass(c,'uiOverlay');return d?DataStore.get(d,'overlay'):null;},ARROW_OFFSET:15,ARROW_LENGTH:16,ARROW_CLASS:{bottom:'uiOverlayArrowBottom',top:'uiOverlayArrowTop',right:'uiOverlayArrowRight',left:'uiOverlayArrowLeft'}});Overlay.prototype={_shouldBuildWrapper:true,_hideOnSuccess:true,_fadeOnShow:true,_fadeOnHide:true,_hasFooter:false,destroyOnHide:true,init:function(d){this.parent.init(d);this._arrow=DOM.scry(this._root,'.uiOverlayArrow')[0]||null;this._overlay=DOM.scry(this._root,'div.uiOverlay')[0]||this._root;CSS.hide(this._root);DOM.appendContent(th is._insertParent,this._root);DataStore.set(this._overlay,'overlay',this);var e=DataStore.get(this._overlay,'width');e&&this.setWidth(e);this.setHideOnSuccess(DataStore.get(this._overlay,'hideonsuccess')!='false');this.setFadeOnShow(DataStore.get(this._overlay,'fadeonshow')!='false');this.setFadeOnHide(DataStore.get(this._overlay,'fadeonhide')!='false');this.setHideOnBlur(DataStore.get(this._overlay,'hideonblur')=='true');this.setDestroyOnHide(DataStore.get(this._overlay,'destroyonhide')!='false');this.setFixed(DataStore.get(this._overlay,'fixed')=='true');this._hasFooter=DataStore.get(this._overlay,'hasfooter',false);var c=DOM.scry(this._root,'.uiOverlayFooterLink')[0]||null;if(c){Event.listen(c,'mouseenter',function(){CSS.addClass(this._overlay,'uiOverlayHoverFooterArrow');}.bind(this));Event.listen(c,'mouseleave',function(){CSS.removeClass(this._overlay,'uiOverlayHoverFooterArrow');}.bind(this));}Event.listen(this._overlay,{click:this.click.bind(this),submit:this.submit.bind(this),success:this._onsuccess.b ind(this),error:this._onerror.bind(this),mouseenter:this._onMouseEnter.bind(this),mouseleave:this._onMouseLeave.bind(this)});Arbiter.subscribe('Overlay/show',function(f,g){if(g.overlay.getContext)this._onLayerShow(g.overlay.getContext());}.bind(this));Arbiter.subscribe('Overlay/hide',function(f,g){if(g.overlay.getContext)this._onLayerHide(g.overlay.getContext());}.bind(this));b(this,this._root);return this;},initWithoutBuildingWrapper:function(){this._shouldBuildWrapper=false;return this.init.apply(this,arguments);},_buildWrapper:function(c){c=this.parent._buildWrapper(c);if(!this._shouldBuildWrapper)return c;var d=$N('div',{className:'uiOverlayContent'},c);return $N('div',{className:'uiOverlay'},d);},setHideOnBlur:function(c){if(!c&&this._hideOnBlurToken){this._removeHideOnBlurListener();this.unsubscribe(this._hideOnBlurToken);this._hideOnBlurToken=null;}else if(c&&!this._hideOnBlurToken){var d=this;var e=function(){(function(){d._hideOnBlurListener=Event.listen(document.documentElement,'click',function(eve nt){if(!ContextualThing.containsIncludingLayers(d._overlay,event.getTarget()))d.setFadeOnHide(false).hide();});}).defer();};this.subscribe('hide',this._removeHideOnBlurListener.bind(this));this._hideOnBlurToken=this.subscribe('show',e);this._shown&&e();}return this;},_removeHideOnBlurListener:function(){this._hideOnBlurListener&&this._hideOnBlurListener.remove();this._hideOnBlurListener=null;},setDestroyOnHide:function(c){this.destroyOnHide=c;return this;},setHideOnSuccess:function(c){this._hideOnSuccess=c;return this;},setFadeOnShow:function(c){this._fadeOnShow=c;return this;},setFadeOnHide:function(c){this._fadeOnHide=c;return this;},setWidth:function(c){this.width=parseInt(c,10);return this;},setFixed:function(c){this.fixed=c;return this;},getOverlay:function(){return this._overlay;},show:function(){if(!this._shown){CSS.show(this._root);if(this._fadeOnShow!==false){CSS.setStyle(this._overlay,'opacity',0);this.parent.show();animation(this._overlay).from('opacity',0).to('opacity',1).duration(100).ondone(CSS .setStyle.curry(this._overlay,'opacity','')).go();}else this.parent.show();Arbiter.inform('layer_shown',{type:'Overlay'});Arbiter.inform('Overlay/show',{overlay:this});}return this;},updatePosition:function(){if(this.width)CSS.setStyle(this._overlay,'width',this.width+'px');return true;},hide:function(){if(!this._shown||this.inform('beforehide')===false)return this;this._shown=false;if(this._fadeOnHide!==false){animation(this._overlay).from('opacity',1).to('opacity',0).duration(250).ondone(this._finishHide.bind(this)).go();}else this._finishHide();return this;},_finishHide:function(){this.parent.hide();Arbiter.inform('layer_hidden',{type:'Overlay'});Arbiter.inform('Overlay/hide',{overlay:this});this.destroyOnHide&&this.destroy();},renderArrow:function(f,d){for(var e in Overlay.ARROW_CLASS)CSS.conditionClass(this._overlay,Overlay.ARROW_CLASS[e],f==e);CSS.conditionClass(this._overlay,'uiOverlayWithFooterArrowBottom',f=='bottom'&&this._hasFooter);if(f=='none')return;if(!this._arrow){this._arrow=$N('i',{classNam e:'uiOverlayArrow'});DOM.appendContent(this._overlay,this._arrow);}CSS.setStyle(this._arrow,'top','');CSS.setStyle(this._arrow,'left','');CSS.setStyle(this._arrow,'right','');CSS.setStyle(this._arrow,'margin','');var h=f=='top'||f=='bottom';var g=h?(intl_locale_is_rtl()?'right':'left'):'top';d=d||0;CSS.setStyle(this._arrow,g,d+'%');var c=Overlay.ARROW_LENGTH+Overlay.ARROW_OFFSET*2;CSS.setStyle(this._arrow,'margin-'+g,-(c*d/100-Overlay.ARROW_OFFSET)+'px');},destroy:function(){DataStore.remove(this._root,'overlay');this.parent.destroy();},click:function(d){var e=d.getTarget();var c=Parent.byTag(e,'input')||Parent.byTag(e,'button')||Parent.byTag(e,'a');if(c){a=c;if(CSS.hasClass(c,'uiOverlayCancelButton')){if(this.inform('cancel')!==false)this.hide();d.prevent();}}},submit:function(c){var d=c.getTarget();if(this.inform('submit')===false){c.kill();return;}var e=(Form.getAttribute(d,'rel')==='async');if(!e)return this._onsuccess(c);},_onsuccess:function(c){if(this.inform('success')!==false&&this._hideOnSuccess)thi s.hide();},_onerror:function(c){var d=c.getData();if(this.inform('error',{response:d.response})===false)c.kill();},_onMouseEnter:function(){this._fireMouseLeaveOnLayerHide=false;if(!this._layerNode)this.inform('mouseenter');},_onMouseLeave:function(){if(!this._layerNode)this.inform('mouseleave');this._fireMouseLeaveOnLayerHide=!!this._layerNode;},_onLayerShow:function(c){if(c&&DOM.contains(this._root,c))this._layerNode=c;},_onLayerHide:function(c){if(c&&this._layerNode===c){this._layerNode=null;if(this._fireMouseLeaveOnLayerHide)this._onMouseLeave.bind(this).defer();}}};}(); function ContextualDialogX(){this.parent.construct(this);return this;}Class.extend(ContextualDialogX,'Overlay');copy_properties(ContextualDialogX,{ARROW_INSET:22,TOP_MARGIN:8,BOTTOM_MARGIN:30,LEFT_MARGIN:15,RIGHT_MARGIN:30,HALO_WIDTH:0,POSITION_TO_CLASS:{above:'uiContextualDialogAbove',below:'uiContextualDialogBelow',left:'uiContextualDialogLeft',right:'uiContextualDialogRight'},RIGHT_ALIGNED_CLASS:'uiContextualDialogRightAligned',POSITION_TO_ARROW:{above:'bottom',below:'top',left:'right',right:'left'},getInstance:function(b){var a=DataStore.get(b,'ContextualDialogX');if(!a){var c=Parent.byClass(b,'uiContextualDialog');a=c&&Overlay.getInstance(c);}return a;}});ContextualDialogX.prototype={_scrollListener:null,init:function(c){this.parent.init(c);var b=DataStore.get.curry(this._root);this.setAlignH(b('alignh','left'));this.setOffsetX(b('offsetx',0));this.setOffsetY(b('offsety',0));this.setPosition(b('position','above'));var a=b('context');if(a){this.setContext($(a));}else{a=b('contextselector');if(a)this.setC ontext(DOM.find(document,a));}this._content=DOM.scry(this._root,'.uiContextualDialogContent')[0];var e=null;var d=null;this.subscribe('show',function(){var f=this.updatePosition.shield(this);e=Event.listen(window,'resize',f);d=Arbiter.subscribe('reflow',f);this._setupScrollListener(this._scrollParent);ContextualThing.register(this._root,this.context);}.bind(this));this.subscribe('hide',function(){e.remove();Arbiter.unsubscribe(d);this._teardownScrollListener();ContextualThing.remove(this._root);}.bind(this));Arbiter.subscribe('Hovercard/hide',function(f,g){if(Hovercard.contains(this.getContext()))this.hide();}.bind(this));return this;},_buildWrapper:function(a){var b=this.parent._buildWrapper(a);if(!this._shouldBuildWrapper)return b;CSS.addClass(b,'uiContextualDialog');return $N('div',{className:'uiContextualDialogPositioner'},b);},setAlignH:function(a){this.alignH=a;this._updateAlignmentClass();this._shown&&this.updatePosition();this.position&&this._updateArrow();return this;},getContent:function(){return t his._content;},getContext:function(){return this.context;},setContext:function(a){a=$(a);if(this.context&&this.context!=a)DataStore.remove(this.context,'ContextualDialogX');this.context=a;var b=Parent.byClass(a,'fbPhotoSnowbox');this.setParent(b||document.body);if(this._scrollListener&&this._scrollParent!==b){this._teardownScrollListener();this._setupScrollListener(b);}this._scrollParent=b;this._stackOnTopOf(this.context);DataStore.set(this.context,'ContextualDialogX',this);return this;},listen:function(b,a){return Event.listen(this._root,b,a);},setFixed:function(a){CSS.conditionClass(this._root,'uiContextualDialogFixed',a);return this.parent.setFixed(a);},setOffsetX:function(a){this.offsetX=parseInt(a,10)||0;this._shown&&this.updatePosition();return this;},setOffsetY:function(a){this.offsetY=parseInt(a,10)||0;this._shown&&this.updatePosition();return this;},setPosition:function(b){this.position=b;for(var a in ContextualDialogX.POSITION_TO_CLASS)CSS.conditionClass(this._root,ContextualDialogX.POSITION_TO_CLA SS[a],b==a);this._updateAlignmentClass();this._shown&&this.updatePosition();this._updateArrow();return this;},updatePosition:function(){if(!this.context)return false;this.parent.updatePosition();var c=this.fixed?'viewport':'document';var g=Vector2.getElementPosition(this.context,c);var h=this._scrollParent;if(h)g=g.sub(Vector2.getElementPosition(h,'document')).add(h.scrollLeft,h.scrollTop);var a=Vector2.getElementDimensions(this.context);var k=this.position=='above'||this.position=='below';var d=intl_locale_is_rtl();if((this.position=='right'||(k&&this.alignH=='right'))!=d)g=g.add(a.x,0);if(this.position=='below')g=g.add(0,a.y);var f=new Vector2(0,0);var b=this.width+2*ContextualDialogX.HALO_WIDTH;if(k&&this.alignH=='center'){f=f.add((a.x-b)/2,0);}else{f=f.sub(k?ContextualDialogX.HALO_WIDTH:0,k?0:ContextualDialogX.HALO_WIDTH);var j=k?a.x:a.y;var e=2*(ContextualDialogX.ARROW_INSET+ContextualDialogX.HALO_WIDTH);if(j=k){var f=this.calcOffsetX(d,b,'right');if(c.x+f+this.contextElem.offsetWidth>this.RESERVED_WIDTH){a='right';e=f;}}this.showingDialog.setPosition(i).setAlignH(a).setOffsetX(e).setOffsetY(g);},calcOffsetX:function(c,b,a){if(a=='left')return b.l-c.x;return b.r-(c.x+this.contextElem.offsetWidth);},cal cOffsetY:function(b,a,c){if(c=='above')return a.t-b.y;return a.b-(b.y+this.contextElem.offsetHeight);},getBounds:function(e){var a=this.active.pos;var h=e.getClientRects();if(!a||h.length===0)return Rect.getElementBounds(e);var b;var c=false;for(var d=0;db.t)){if(c)break;b=new Rect(f.y,i.x,i.y,f.x,'document');}else{b.t=Math.min(b.t,f.y);b.b=Math.max(b.b,i.y);b.r=i.x;}if(g.contains(a))c=true;}return b;},fetch:function(c){if(c.id&&this.dialogs[c.id]!=null)return;var a=this.getEndpoint(c);if(this.dialogs[a]!=null)return;this.setFetchInProgress(a);var b=function(){this.dirty(a);this.abort();}.bind(this);new AsyncRequest(a).setData({endpoint:a}).setMethod('GET').setReadOnly(true).setErrorHandler(b).setTransportErrorHandler(b).send();},setFetchInProgress:function(a){this.dialogs [a]=false;},_getLoadingDialog:function(){var a=new ContextualDialogX();a.init($N('div',{className:'HovercardLoading'},"Loading...")).setDestroyOnHide(false).setFadeOnShow(false).setFadeOnHide(false);this._initDialogSubscriptions(a);this._getLoadingDialog=bagof(a);return a;},setDialog:function(b,a){this.dialogs[b]=a;this._initDialogSubscriptions(a);if(this.active.endpoint==b&&this.hoverElem==this.active.node)this.showDialog(a);},_initDialogSubscriptions:function(a){a.subscribe('mouseenter',function(){clearTimeout(this.hideTimer);this.hoverElem=this.active.node;}.bind(this));a.subscribe('mouseleave',function(){this.hide(false);this.hoverElem=null;}.bind(this));},contains:function(a){if(this.showingDialog)return DOM.contains(this.showingDialog.getOverlay(),a);return false;},dirty:function(b){var a=this.dialogs[b];if(a){a.destroy();delete this.dialogs[b];}},dirtyAll:function(){for(var b in this.dialogs){var a=this.dialogs[b];a&&this.dirty(b);}}};onloadRegister(Hovercard.init.bind(Hovercard)); __d("StickyController",["event-extensions","css","Vector","FunctionUtils"],function(f,h,i,g,e){h('event-extensions');var a=h('css');var d=h('Vector');var b=h('FunctionUtils');function c(j,k,l,m){this._element=j;this._marginTop=k;this._onchange=l;this._proxy=m||j.parentNode;}c.prototype={handleScroll:function(){var j=d.getElementPosition(this._proxy,'viewport').y<=this._marginTop;if(this.isFixed()!==j){a.setStyle(this._element,'top',j?this._marginTop+'px':'');a.conditionClass(this._element,'fixed_elem',j);this._onchange&&this._onchange(j);}},start:function(){if(this._event)return;this._event=Event.listen(window,'scroll',b.throttle(this.handleScroll.bind(this),100));this.handleScroll.bind(this).defer();},stop:function(){this._event&&this._event.remove();this._event=null;},isFixed:function(){return a.hasClass(this._element,'fixed_elem');}};f.StickyController=g.exports=c;},3); __d("DocumentTitle",["array-extensions","Arbiter"],function(j,l,m,k,i){l('array-extensions');var a=l('Arbiter');var n=document.title;var b=1500;var h=[];var g=0;var e=null;var f=true;function d(){if(h.length>0){if(f){c.set(h[g].title,true);g=++g%h.length;f=false;}else c.reset();}else{clearInterval(e);e=null;c.reset();}}var c={get:function(){return n;},set:function(o,p){document.title=o;if(!p){n=o;a.inform('update_title',o);}},reset:function(){c.set(c.get(),true);f=true;},blink:function(p){var o={title:p};h.push(o);if(e===null)e=setInterval(d,b);return {stop:function(){var q=h.indexOf(o);if(q>=0){h.splice(q,1);if(g>q){g--;}else if(g==q&&g==h.length)g=0;}}};}};j.DocumentTitle=k.exports=c;},3); __d("Poller",["AsyncRequest","Cookie","copyProperties","Env","Util"],function(h,j,k,i,g){var a=j('AsyncRequest');var b=j('Cookie');var f=j('copyProperties');var c=j('Env');var e=j('Util');function d(n,m,l){this._clearOnQuicklingEvent=!l;this._requestCallback=m;this.setTimePeriod(n);}d.MIN_TIME_PERIOD=2000;f(d.prototype,{stop:function(){clearTimeout(this._token);this._token=null;this._cancelRequest();},scheduleRequest:function(){this.stop();if(this._timePeriod)this._token=this._makeRequest.bind(this).defer(this._timePeriod,this._clearOnQuicklingEvent);},requestNow:function(){this.stop();this._makeRequest();},_timePeriod:null,setTimePeriod:function(l){l=l||null;if(l&&(isNaN(l)||l=48){var k=(g>=1470&&g<=1920);a.setStyle(i,'direction',k?'rtl':'ltr');return;}}}else if(l.length===0)a.setStyle(i,'direction','');});},3); onloadRegister(function(){Event.listen(document.documentElement,'submit',function(b){var a=b.getTarget().getElementsByTagName('*');for(var c=0;c(12*3600)||(new Date(k*1000).getDay()!=new Date(l*1000).getDay()))return m;var n=k-l,j=Math.floor(n/60),i=Math.floor(j/60);if(j<1){m.text="a few seconds ago";m.next=60-n%60;return m;}if(i<1){if(j==1){m.text="about a minute ago";}else m.text=_tx("{number} minutes ago",{number:j});m.next=60-n%60;return m;}if(i!=11)m.next=3600-n%3600;if(i==1){m.text="about an hour ago";return m;}m.text=_tx("{number} hours ago",{number:i});return m;}};}); __d("legacy:live-timer",["LiveTimer"],function(a,b,c){a.LiveTimer=b('LiveTimer');},3); onloadRegister(function(){add_properties('__behaviors',{});if(__behaviors.TinyViewport)return;__behaviors.TinyViewport=true;var c=document.documentElement;var a=DOM.getDocumentScrollElement();var b=debounce(function(){var d=c.clientHeight<400||a.clientWidth=z;}else{var y;if(x===window){y=j.getViewportDimensions().y;}else y=z+x.offsetHeight;var u=v+this._context.offsetHeight;return u<=y;}},_willElementFit:function(za,y,u){var w=j.getElementPosition(this._context,'viewport');var z=w.y+this._getOffsetY(y,u);if(y=='above'){z-=this._content.offsetHeight;}else if(y=='below')z+=this._context.offsetHeight;var v=z+this._content.offsetHeight;var x=w.x+this._getOffsetX(y,u);if(y=='right'){x+=this._context.offsetWidth;}else if(y=='left'){x-=this._content.offsetWidth;}else if(u=='right')x+=this._context.offsetWidth-this._content.offsetWidth;right=x+this._content.offsetWidth;return za.contains(new i(z,right,v,x));},_getOffsetX:function(v,u){if(v=='left'||v=='right'){if(this._preferredPosition!=v)return -this._offsetX;}else if(this._preferredAlignment!=u)return -this._offsetX;return this._offsetX;},_getOffsetY:function(u){if((u=='above'||u=='below')&&this._preferredPosition!= u)return -this._offsetY;return this._offsetY;},_generatePositionClass:function(v,u){if(v=='above'||v=='below')return v+u;return v;},_removePositionClass:function(v,u){b.removeClass(this._contentWrapper,this._generatePositionClass(v,u));},_addPositionClass:function(v,u){b.addClass(this._contentWrapper,this._generatePositionClass(v,u));}});r.exports=d;}); __d("ContextualLayerHideOnScroll",["event-extensions"],function(c,e,f,d,b){e("event-extensions");function a(g){this.layer=g;g.subscribe('contextchange',this._handleContextChange.bind(this));g.subscribe('show',this.attach.bind(this));g.subscribe('hide',this.detach.bind(this));}a.prototype={attach:function(){if(this._listener)return;var g=this.layer.getContextScrollParent();if(g===window)return;this._listener=Event.listen(g,'scroll',this.layer.hide.bind(this.layer));},detach:function(){this._listener&&this._listener.remove();this._listener=null;},_handleContextChange:function(){this.detach();if(this.layer.isShown())this.attach();}};d.exports=a;}); __d("PopupWindow",["copyProperties","ua","Vector"],function(e,g,h,f,d){var c=g("copyProperties");var i=g("ua");var b=g("Vector");var a={_opts:{allowShrink:true,timeout:100},init:function(j){copy_properties(a._opts,j);setInterval(a._resizeCheck,a._opts.timeout);},_resizeCheck:function(){var n=b.getViewportDimensions(),j=a._getDocumentSize(),l=j.y-n.y,m=j.x-n.x;if(m<0)m=0;if(!a._opts.allowShrink&&l<0)l=0;if(l||m)try{if(window.console&&window.console.firebug)console.log('Resizing will not work in firefox with firebug enabled. '+'See https://bugzilla.mozilla.org/show_bug.cgi?id=691693');window.resizeBy(m,l);if(m)window.moveBy(m/-2,0);}catch(k){}},_getDocumentSize:function(){var j=b.getDocumentDimensions();if(window.Dialog&&Dialog.max_bottom&&Dialog.max_bottom>j.y)j.y=Dialog.max_bottom;return j;},open:function(r,k,s){var o=typeof window.screenX!='undefined'?window.screenX:window.screenLeft,p=typeof window.screenY!='undefined'?window.screenY:window.screenTop,n=typeof window.outerWidth!='undefined'?window.outerWidt h:document.body.clientWidth,m=typeof window.outerHeight!='undefined'?window.outerHeight:(document.body.clientHeight-22),l=parseInt(o+((n-s)/2),10),q=parseInt(p+((m-k)/2.5),10),j=('width='+s+',height='+k+',left='+l+',top='+q);return window.open(r,'_blank',j);}};f.exports=a;}); function OnVisible(b,c,e,a,d){this.element=b;this.handler=c;this.strict=e;this.buffer=coalesce(a,300);this.options=d||{};this.lastY=Vector2.getScrollPosition().y;this.lastTime=Date.now();this.reset();onleaveRegister(this.remove.bind(this));}copy_properties(OnVisible.prototype,{reset:function(){if(this.scrollListener)return;var a=throttle(function(){var c=Vector2.getElementPosition(this.element);if(!c){this.remove();return;}this.targetY=c.y;var h=Vector2.getScrollPosition().y;var f=Vector2.getViewportDimensions().y;var g=h+f+this.buffer;if(g>this.targetY){var e=!this.strict||(h-this.buffer<(this.targetY+Vector2.getElementDimensions(this.element).y));if(e){this.remove();if(this.options.detect_speed){var b=(h-this.lastY);var d=b/(Date.now()-this.lastTime+1);if((d>f/100)||(g>=Vector2.getDocumentDimensions().y&&b>1000))return true;}this.handler();}}if(this.options.detect_speed){this.lastY=h;this.lastTime=Date.now();}return true;}.bind(this),100);this.scrollListener=Event.listen(window,'scroll',a);this.resizeListe ner=Event.listen(window,'resize',a);a();},remove:function(){if(this.scrollListener){this.scrollListener.remove();this.resizeListener.remove();this.scrollListener=this.resizeListener=null;}}}); var PhotosConst={VIEWER_PERMALINK:0,VIEWER_SNOWBOX:2,VIEWER_SMOWLIFT:6,BULK_EDITOR:3,FLASH_UPLOADER:4,inCenterStage:function(a){return a==PhotosConst.VIEWER_SMOWLIFT||a==PhotosConst.VIEWER_SNOWBOX;},SIZE_NORMAL:'n'}; var PhotoInlineCaptionEditor=function(a){this.instanceId=a;PhotoInlineCaptionEditor.instances[a]=this;};copy_properties(PhotoInlineCaptionEditor,{instances:{},getInstance:function(a){return this.instances[a];}});PhotoInlineCaptionEditor.prototype={init:function(a){this.element=a;Event.listen(a,'click',this.handleClick.bind(this));var b=DOM.scry(a,'input[name="caption_id"]');if(b.length)b[0].value=this.instanceId;this.inputStr='';var c=DOM.scry(this.element,'textarea.fbPhotoCaptionInput')[0];if(c)this.inputStr=Input.getValue(c);},handleClick:function(event){var a=event.getTarget();if(Parent.byClass(a,'editIcon')||Parent.byClass(a,'noCaption')){this.toggleEditDescription(true);}else if(Parent.byClass(a,'cancelEdit')){Input.setValue(DOM.find(this.element,'textarea.fbPhotoCaptionInput'),this.inputStr);this.toggleEditDescription(false);}},setCaption:function(a){DOM.setContent(DOM.find(this.element,'.fbPhotoCaptionText'),a);this.toggleEditDescription(false);this.inputStr=Input.getValue(DOM.find(this.element,'texta rea.fbPhotoCaptionInput'));},getCaption:function(){return DOM.getText(DOM.find(this.element,'.fbPhotoCaptionText'));},toggleEditDescription:function(c){if(!c)DOM.find(this.element,'textarea.fbPhotoCaptionInput').blur();CSS.conditionClass(this.element,'fbPhotoInlineCaptionEditorEditMode',!!c);if(c){var b=DOM.find(this.element,'textarea.fbPhotoCaptionInput');var a=DOMControl.getInstance(b);a&&a.update();b.focus();}else{CSS.conditionClass(DOM.find(this.element,'.noCaption'),'hidden_elem',this.getCaption().length);CSS.conditionClass(DOM.find(this.element,'.withCaption'),'hidden_elem',!this.getCaption().length);}}}; function PhotosUtils(){}PhotosUtils.getNearestBox=function(e,l,k,j,c,a){var f=e.sub(l);var d=k.magnitude();var g=null;for(var b in a){var h=a[b];var i=new Rect(h.t/100*k.y*j,h.r/100*k.x*j,h.b/100*k.y*j,h.l/100*k.x*j);var m=i.getCenter().sub(f);if(Math.abs(m.x)<=c&&Math.abs(m.y)<=c&&m.magnitude()<=d){d=m.magnitude();g=b;if(0===d)break;}}return g;}; function PhotoSessionLog(){}copy_properties(PhotoSessionLog,{UNKNOWN:0,ESC:1,X:2,OUTSIDE:3,UNLOAD:4,NAVIGATE:5,AGGREGATE:6,LEAVE:7,PERMALINK:0,SNOWBOX:2,SNOWLIFT:6,AGGREGATION_COUNT:20,set:null,time:null,views:0,fbidList:[],details:{},width:0,height:0,first:false,last:false,logIds:false,version:null,initLogging:function(b){this.set=null;this.time=new Date();this.views=0;this.first=true;this.last=false;this.logIds=false;this.version=b;if(b===PhotoSessionLog.SNOWBOX||b===PhotoSessionLog.SNOWLIFT){var a=Vector2.getViewportDimensions();this.width=a.x;this.height=a.y;}},setLogFbids:function(a){this.logIds=a;},setPhotoSet:function(a){this.set=a;},addPhotoView:function(a){if(this.logIds&&this.views>=this.AGGREGATION_COUNT)this.logPhotoViews(this.AGGREGATE);this.views++;if(a)this.fbidList.push([a.fbid,a.owner,Date.now()]);},addDetailData:function(b,a){if(!this.details[b])this.details[b]={t:a.num_tags,l:a.has_location,c:a.has_caption,cm:a.comment_count,lk:a.like_count,w:a.width,h:a.height};},logPhotoViews:function(a) {if((!this.views)||((this.version===PhotoSessionLog.SNOWBOX||this.version===PhotoSessionLog.SNOWLIFT)&&(a==PhotoSessionLog.LEAVE)))return;if(a!=this.AGGREGATE)this.last=true;var b={set:this.set,time:new Date()-this.time,fbids:this.logIds?this.fbidList:[],details:this.logIds?this.details:{},first:this.first,last:this.last,close:a?a:this.UNKNOWN,version:this.version};if(this.version===PhotoSessionLog.SNOWBOX||this.version===PhotoSessionLog.SNOWLIFT){var c=Vector2.getViewportDimensions();b.width=c.x||this.width;b.height=c.y||this.height;}new AsyncRequest().setURI('/ajax/photos/logging/session_logging.php').setAllowCrossPageTransition(true).setOption('asynchronous',(a!=PhotoSessionLog.UNLOAD)).setOption('suppressErrorHandlerWarning',true).setData(b).send();this.views=0;this.fbidList=[];this.details={};this.first=false;if(this.last){this.set=null;this.logIds=false;}}});onunloadRegister(function(){PhotoSessionLog.logPhotoViews(PhotoSessionLog.UNLOAD);});onleaveRegister(function(){PhotoSessionLog.logPhotoViews(Phot oSessionLog.LEAVE);}); __d("UIPagelet",["json","dom","AjaxPipeRequest","AsyncRequest","copyProperties"],function(g,i,j,h,f){i('json');var c=i('dom');var a=i('AjaxPipeRequest');var b=i('AsyncRequest');var e=i('copyProperties');function d(m,n,k,l){this._id=m||null;this._element=ge(m||c.$N('div'));this._src=n||null;this._context_data=k||{};this._data=l||{};this._handler=bagofholding;this._request=null;this._use_ajaxpipe=false;this._is_bundle=true;this._allow_cross_page_transition=false;this._append=false;return this;}d.loadFromEndpoint=function(m,q,k,n){n=n||{};var l='/ajax/pagelet/generic.php/';if(n.intern)l='/intern'+l;var p=(l+m).replace(/\/+/g,'/');if(n.subdomain)p=URI(p).setSubdomain(n.subdomain);var o=new d(q,p,k).setUseAjaxPipe(n.usePipe).setBundleOption(m.substring(0,8)!='/intern/'&&n.bundle!==false).setAppend(n.append).setJSNonBlock(n.jsNonblock).setDisplayCallback(n.displayCallback).setConstHeight(n.constHeight).setAllowCrossPageTransition(n.crossPage);n.handler&&o.setHandler(n.handler);o.go();return o;};e(d.prototype,{getE lement:function(k){k=k||false;if(k)this._element=ge(this._id);return this._element;},setHandler:function(k){this._handler=k;return this;},go:function(l,k){if(arguments.length>=2||typeof l=='string'){this._src=l;this._data=k||{};}else if(arguments.length==1)this._data=l;this.refresh();return this;},setAllowCrossPageTransition:function(k){this._allow_cross_page_transition=k;return this;},setBundleOption:function(k){this._is_bundle=k;return this;},refresh:function(m){var l=function(o){this._request=null;if(m&&this._id)this._element=ge(this._id);var n=HTML(o.getPayload());if(this._append){c.appendContent(this._element,n);}else c.setContent(this._element,n);this._handler();}.bind(this);if(this._use_ajaxpipe){this._request=new a();this._request.setCanvasId(this._id).setAppend(this._append).setConstHeight(this._constHeight).setJSNonBlock(this._jsNonblock).setDisplayCallback(this._displayCallback);}else{var k=this._displayCallback;this._request=new b().setMethod('GET').setReadOnly(true).setOption('bundle',this._is_b undle).setHandler(function(n){if(k){k(l.curry(n));}else l(n);});}this._request.setURI(this._src).setAllowCrossPageTransition(this._allow_cross_page_transition).setData({data:JSON.stringify(merge(this._context_data,this._data))}).send();return this;},cancel:function(){if(this._request)this._request.abort();},setUseAjaxPipe:function(k){this._use_ajaxpipe=!!k;return this;},setAppend:function(k){this._append=!!k;return this;},setJSNonBlock:function(k){this._jsNonblock=!!k;return this;},setDisplayCallback:function(k){this._displayCallback=k;return this;},setConstHeight:function(k){this._constHeight=!!k;return this;}});g.UIPagelet=h.exports=d;},3); function PhotoStreamCache(){}copy_properties(PhotoStreamCache,{ERROR:'error',HTML:'html',IMAGE_DATA:'image',EXTRA:'extra',BUFFER_SIZE:3,INIT_BUCKET_SIZE:4,FULL_BUCKET_SIZE:12,ERROR_ID:-1});copy_properties(PhotoStreamCache.prototype,{init:function(a){this.version=a;this.bufferSize=PhotoStreamCache.BUFFER_SIZE;this.fullBucketSize=PhotoStreamCache.FULL_BUCKET_SIZE;this.initError=false;this.isActive=true;this.leftLock=false;this.rightLock=false;this.reset();},reset:function(){this.cache={image:{},extra:{},html:{}};this.fbidList=[];this.loaded=false;this.allLoaded=false;this.permalinkMap={};this.position=0;this.totalCount=null;this.firstCursor=null;this.firstCursorIndex=null;},destroy:function(){this.reset();this.isActive=false;},isLoaded:function(){return this.loaded;},canPage:function(){if(this.totalCount!==null)return this.totalCount>1;return this.getLength()>1;},errorInCurrent:function(){if(this.initError){return true;}else if(!this.isLoaded())return false;return this.checkErrorAt(this.getCursor());},getLengt h:function(){return this.fbidList.length;},getPhotoSet:function(){return this.photoSetQuery.set;},getCurrentImageData:function(){return this.getImageData(this.getCursor());},getImageData:function(a){return this.getCacheContent(a,PhotoStreamCache.IMAGE_DATA);},getCurrentHtml:function(){return this.getCacheContent(this.getCursor(),PhotoStreamCache.HTML);},getCurrentExtraData:function(){return this.getCacheContent(this.getCursor(),PhotoStreamCache.EXTRA);},getCacheContent:function(a,b){if(!a||a===PhotoStreamCache.ERROR_ID)return null;return this.cache[b][a];},getCursorPos:function(){return this.position;},getCursor:function(){if(this.position>=0&&this.position0||(b>=0&&b0);},checkErrorAt:function(a){if(!this.isLoaded())return false;if(a===PhotoStreamCache.ERROR_ID)return true;return false;},getRelativeMovement:function(a){for(var b=0;ba*2){e=(this.position+f-a%f)%f;c=(this.position+a)%f;}else{e=0;c=f-1;}while(e!=c){var d=this.fbidList[e];if(b[d]&&!b[d].resource&&b[d].url){b[d].resource=new Image();b[d].resource.src=b[d].url;}e=(e+1)%f;}},loadMoreIfNeccessary:function(c){if(this.allLoaded||(c&&this.rightLock)||(!c&&this.leftLock))return;var d=c?1:-1;var a=this.fullBucketSize*d;var b=this.position+this.bufferSize*d;if(b<0&&!this.checkErrorAt(this.getEndCursor(fal se))){this.leftLock=true;this.fetch(this.fullBucketSize,false);}else if(b>this.getLength()&&!this.checkErrorAt(this.getEndCursor(true))){this.rightLock=true;this.fetch(this.fullBucketSize,true);}},getEndCursor:function(a){return a?this.fbidList[this.getLength()-1]:this.fbidList[0];},calculateRelativeIndex:function(c,a,d){if(!this.totalCount)return null;var b=this.fbidList.indexOf(a);var e=this.fbidList.indexOf(d);if(b===-1||e===-1)return null;var f=e-b;return (c+f+this.totalCount)%this.totalCount;},fetch:function(a,d){var c=this.getEndCursor(d);var b=copy_properties({cursor:c,version:this.version,end:this.getEndCursor(!d),fetchSize:d?a:-1*a},this.photoSetQuery);if(this.totalCount&&this.firstCursorIndex!==null){b.total=this.totalCount;b.cursorIndex=this.calculateRelativeIndex(this.firstCursorIndex,this.firstCursor,c);}UIPagelet.loadFromEndpoint('PhotoViewerPagelet',null,b,{usePipe:true,jsNonblock:true,crossPage:true});},storeToCache:function(a){var b={};if(!this.isActive)return b;if('error' in a){this.process ErrorResult(a.error);b.error=true;return b;}if('init' in a){this.processInitResult(a.init);b.init={logids:a.init.logids,fbid:a.init.fbid,loggedin:a.init.loggedin,fromad:a.init.fromad};}if('image' in a){this.processImageResult(a.image);b.image=true;}if('data' in a){this.processDataResult(a.data);b.data=true;}return b;},processInitResult:function(a){if(this.loaded)return;this.loaded=true;this.photoSetQuery=a.query;if(a.bufferSize)this.bufferSize=a.bufferSize;if(a.fullBucketSize)this.fullBucketSize=a.fullBucketSize;this.fbidList.push(a.fbid);this.firstCursor=a.fbid;if('initIndex' in a&&'totalCount' in a){this.firstCursorIndex=a.initIndex;this.totalCount=a.totalCount;}this.rightLock=true;if(this.version==PhotosConst.VIEWER_PERMALINK)this.fetch(PhotoStreamCache.INIT_BUCKET_SIZE,true);},processImageResult:function(b){for(var a in b){this.cache.image[a]=b[a];if(b[a].dimensions)this.cache.image[a].dimensions=Vector2.deserialize(b[a].dimensions);this.permalinkMap[URI(b[a].info.permalink).getUnqualifiedURI().toString( )]=a;}},attachToFbidsList:function(d,e,a){if(this.allLoaded)return;if(e===-1){for(var b=d.length-1;b>=0;b--){this.fbidList.unshift(d[b]);this.position++;}this.leftLock=false;}else{for(var c=0;c_:;\u2010\u2011\u2012\u2013\u2014\u2015\u30fb]/g;var d={};var r={a:"\u0430 \u00e0 \u00e1 \u00e2 \u00e3 \u00e4 \u00e5",b:"\u0431",c:"\u0446 \u00e7 \u010d",d:"\u0434 \u00f0 \u010f \u0111",e:"\u044d \u0435 \u00e8 \u00e9 \u00ea \u00eb \u011b",f:"\u0444",g:"\u0433 \u011f",h:"\u0445 \u0127",i:"\u0438 \u00ec \u00ed \u00ee \u00ef \u0131",j:"\u0439",k:"\u043a \u0138",l:"\u043b \u013e \u013a \u0140 \u0142",m:"\u043c",n:"\u043d \u00f1 \u0148 \u0149 \u014b",o:"\u043e \u00f8 \u00f6 \u00f5 \u00f4 \u00f3 \u00f2",p:"\u043f",r:"\u0440 \u0159 \u0155",s:"\u0441 \u015f \u0161 \u017f",t:"\u0442 \u0165 \u0167 \u00fe",u:"\u0443 \u044e \u00fc \u00fb \u00fa \u00f9 \u016f",v:"\u0432",y:"\u044b \u00ff \u00fd",z:"\u0437 \u017e",ae:"\u00e6",oe:"\u0153",ts:"\u0446",ch:"\u0447",ij:"\u0133",sh:"\u0448",ss:"\u00df",ya:"\u044f"};for(var m in r){var f=r[m].split(' ');for(var h=0;h=this._maxResults){var b=d.splice(c,1);d.splice(this._maxResults-1,0,b);}break;}}return d;},buildData:function(d){var c=[];var b=Math.min(d.length,this._maxResults);for(var a=0;ab){b=c.length;a=c;}return d[a]||[];},buildQueryResults:function(c){var a=TypeaheadUtil.parse(c).flatValue;var b=this.findQueryCache(a);if(this.getQueryCache().hasOwnProperty(a))return b;return this.filterQueryResults(c,b);},filterQueryResults:function(c,b){var a=this._alwaysPrefixMatch?TypeaheadUtil.isPrefixMatch:TypeaheadUtil.isQueryMatch;return b.filter(function(d){return a(c,this.getTextToIndex(this.getEntry(d)));},this);},buildCacheResults:function(r,a){var k=TypeaheadUtil.parse(r,this._alwaysPrefixMatch);var l=this._alwaysPrefixMatch?k.sortedTokens:k.tokens;var h=l.length;var i=k.isPrefixQuery?h-1:null;var e={};var j={};var o={};var f=[];var c=false;var q={};var p=0;for(var d=0;dthis.normalSize.y&&this.normalSize.x<=PhotoSnowlift.TIMELINE_STRETCH_WIDTH&&d.offsetWidth===PhotoSnowlift.TIMELINE_STRETCH_WIDTH;if(d){thumbSrc=d.src;}else if(c){thumbSrc=CSS.getStyle(c,'backgroundImage').replace(/.*url\("?([^"]*)"?\).*/,'$1');}else return;this.thumbSrc=thumbSrc;},loadFrameIfUninitialized:function(){if(this.root)re turn;new AsyncRequest('/ajax/photos/snowlift/init.php').setAllowCrossPageTransition(true).setMethod('GET').setReadOnly(true).send();},init:function(a){var b=ge('fbPhotoSnowlift');if(!b){b=DOM.appendContent(document.body,a)[0];this.initialLoad=false;}if(this.root==b)return;this.initializeNodes(b);if(!this.subscription){LinkController.registerHandler(this.handleNavigateAway.bind(this));this.subscription=Arbiter.subscribe(PhotoSnowlift.GO,function(c,d){this.openExplicitly=true;this.loading&&CSS.removeClass(this.loading,'loading');this.open(d);}.bind(this));}this.transitionHandlerRegistered=false;this.returningToStart=false;PageTransitions.registerHandler(this.openHandler.bind(this));this.openHandlerRegistered=true;Arbiter.subscribe('PhotoTagApproval.HILITE_TAG',this.onHiliteTag.bind(this));Arbiter.subscribe('PhotoTagApproval.UPDATE_TAG_BOX',this.onUpdateTagBox.bind(this));},initializeNodes:function(a){this.root=a;this.closeTheater=DOM.find(a,'a.closeTheater');this.container=DOM.find(a,'div.container');this.info Wrapper=DOM.find(a,'div.photoInfoWrapper');this.stageWrapper=DOM.find(a,'div.stageWrapper');this.errorBox=DOM.find(this.stageWrapper,'div.stageError');this.image=DOM.find(this.stageWrapper,'img.spotlight');this.stage=DOM.find(this.stageWrapper,'div.stage');this.videoStage=DOM.find(this.stageWrapper,'div.videoStage');this.stagePagers=DOM.find(a,'div.stagePagers');this.stageActions=DOM.find(a,'div.stageActions');this.buttonActions=DOM.find(this.stageActions,'div.fbPhotosPhotoButtons');this.actionList=$('fbPhotoSnowliftActions');this.sideAdUnit=$('fbPhotoSnowliftAdsSide');this.bottomAdUnit=$('fbPhotoSnowliftAdsBottom');this.sideAdDiv=DOM.find(a,'div.fbPhotoSnowliftAdsSide');this.bottomAdDiv=DOM.find(a,'div.fbPhotoSnowliftAdsBottom');},getRoot:function(){return this.root;},openHandler:function(a){if(this.isOpen||a.getPath()!='/photo.php'||this.returningToStart||a.getQueryData().closeTheater||a.getQueryData().permPage||a.getQueryData().makeprofile){this.openHandlerRegistered=false;return false;}this.open(a);this. _uriStack.push(URI(a).getQualifiedURI().toString());PageTransitions.transitionComplete();return true;},open:function(c){var a=URI(c).getQueryData();var b=a.src;if(b)delete a.src;if(this.resetUriStack)this._uriStack=[];if(!this.initialLoad){a.firstLoad=true;this.initialLoad=true;}this.loadQuery=a;this.isOpen=true;this.pagersShown=false;this.refreshOnClose=false;this.hilitedTag=null;this.lastAdsLoad=0;this.loadingStates={image:false,html:false};this.replaceUrl=false;this.stream=new PhotoStreamCache();this.stream.init(PhotosConst.VIEWER_SNOWLIFT);this.fetchInitialData();this.setLoadingState(PhotoSnowlift.STATE_HTML,true);KeyEventController.registerKey('ESCAPE',this.closeListener.bind(this));Bootloader.loadComponents(['fb-photos-photo-css','fb-photos-snowlift-css'],function(){this._open(c,b);}.bind(this));},_open:function(d,c){this.createLoader(c);CSS.show(this.root);(function(){var e=Vector2.getScrollPosition();if(!CSS.hasClass(document.documentElement,'wrapped')){CSS.addClass(document.documentElement,'theaterM ode');var f=DOMScroll.getScrollbarSize();if(f===0){this.extraClass='zeroScrollbar';}else if(f===20){this.extraClass='scrollbar20';}else this.extraClass='defaultScrollbar';CSS.addClass(document.body,this.extraClass);}DOMScroll.scrollTo(e,0);}).defer();this.ua&&this.ua.add_event('frame');Arbiter.inform('layer_shown',{type:'PhotoSnowlift'});Arbiter.inform(PhotoSnowlift.OPEN);Bootloader.loadComponents(['Hovercard','live-js','photocrop2','PhotoTag','PhotoTagger','TagToken','TagTokenizer','ui-ufi-css']);this.stageHandlers=[Event.listen(window,'resize',this.adjustForResize.bind(this)),Event.listen(this.root,'click',this.closeListener.bind(this)),Event.listen(this.stageWrapper,'click',this.buttonListener.bind(this)),Event.listen(this.actionList,'click',this.rotateListener.bind(this))];var a=ge('fbPhotoSnowliftFeedback');if(a)this.stageHandlers.push(Event.listen(a,'click',function(event){if(Parent.byClass(event.getTarget(),'like_link'))CSS.toggleClass(DOM.find(this.buttonActions,'div.likeCommentGroup'),'viewerLikesTh is');}.bind(this)));var b=ge('fbPhotoSnowliftOnProfile');if(b)this.stageHandlers.push(Event.listen(b,'click',function(event){if(Parent.byClass(event.getTarget(),'fbPhotoRemoveFromProfileLink'))this.refreshOnClose=true;}.bind(this)));if(this.resetUriStack)this.startingURI=URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI();if(!c)this.setLoadingState(PhotoSnowlift.STATE_IMAGE_DATA,true);if(!this.transitionHandlerRegistered){PageTransitions.registerHandler(this.transitionHandler.bind(this));this.transitionHandlerRegistered=true;}PhotoSessionLog.initLogging(PhotoSessionLog.SNOWLIFT);if(ua.firefox()&&!CSS.hasClass(document.documentElement,'wrapped'))this.turnFlashAutoplayOff.defer();(function(){this.adjustForResize();if(ua.ie()){this.container.focus();}else this.root.focus();}).bind(this).defer();},getStream:function(){return this.stream;},fetchInitialData:function(){this.ua&&this.ua.add_event('init_data');UIPagelet.loadFromEndpoint('PhotoViewerInitPagelet',null,this.loadQuery,{usePipe:true, jsNonblock:true,crossPage:true});},turnFlashAutoplayOff:function(){DOM.scry(document,'div.swfObject').each(function(d){var b=d.getAttribute('data-swfid');if(b&&window[b]){var c=window[b];c.addParam('autostart','false');c.addParam('autoplay','false');c.addParam('play','false');c.addVariable('video_autoplay','0');c.addVariable('autoplay','0');c.addVariable('play','0');var a=URI(c.getAttribute('swf'));a.addQueryData({autoplay:'0'});a.setPath(a.getPath().replace('autoplay=1','autoplay=0'));c.setAttribute('swf',a.toString());c.write(d);}});},closeHandler:function(){if(!this.isOpen)return;if(URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI().toString()==this.startingURI.toString()){this.close();return;}this.close();this.returnToStartingURI(this.refreshOnClose);},returnToStartingURI:function(d,b){if(!d)if(b){this.squashNextTransition(goURI.curry(b));}else this.squashNextTransition();this.returningToStart=true;var e=Arbiter.subscribe('page_transition',function(){this.returningToStart=false;Arb iter.unsubscribe(e);});var a=d||isNaN(ua.opera());var g=this._uriStack.length;if(a&&ga.y&&a.x<=PhotoSnowlift.TIMELINE_STRETCH_WIDTH&&a.x>=PhotoSnowlift.TIMELINE_STRETCH_MIN){a.y=Math.round(a.y*PhotoSnowlift.TIMELINE_STRETCH_WIDTH/a .x);a.x=PhotoSnowlift.TIMELINE_STRETCH_WIDTH;CSS.setStyle(this.image,'height',a.y+'px');CSS.setStyle(this.image,'width','auto');}var d=this.getMaxImageSize(a);if(!this.currentMinSize){this.currentMinSize=new Vector2(Math.max(d.x,PhotoSnowlift.STAGE_MIN.x),Math.max(d.y,PhotoSnowlift.STAGE_MIN.y));}else this.currentMinSize=new Vector2(Math.max(d.x,this.currentMinSize.x),Math.max(d.y,PhotoSnowlift.STAGE_MIN.y));CSS.setStyle(this.container,'width',this.currentMinSize.x+'px');CSS.setStyle(this.stageWrapper,'height',this.currentMinSize.y+'px');CSS.setStyle(this.stage,'lineHeight',this.currentMinSize.y+'px');CSS.setStyle(this.videoStage,'lineHeight',this.currentMinSize.y+'px');CSS.conditionClass(this.container,'adsOnSide',this.currentMinSize.x>=PhotoSnowlift.WIDE_ADS);this.adjustForAdUnit();if(!this.pinPagers)CSS.setStyle(this.stagePagers,'height',this.currentMinSize.y/2+'px');this.pinPagers=true;},adjustForNewData:function(){if(!this.image)return;var c=DOM.scry(this.stage,'div.tagsWrapper')[0];var a=Vector2.getEle mentDimensions(this.image);if(c){CSS.setStyle(c,'width',a.x+'px');CSS.setStyle(c,'height',a.y+'px');if(ua.ie()<=7){var b=DOM.scry(this.root,'div.tagContainer')[0];if(b)CSS.conditionClass(c,'ie7VerticalFix',Vector2.getElementDimensions(b).y>a.y);}}},setLoadingState:function(b,a){switch(b){case PhotoSnowlift.STATE_IMAGE_PIXELS:CSS.conditionClass(this.root,'imagePixelsLoading',a);break;case PhotoSnowlift.STATE_IMAGE_DATA:this.loadingStates[b]=a;CSS.conditionClass(this.root,'imageLoading',a);break;case PhotoSnowlift.STATE_HTML:this.loadingStates[b]=a;CSS.conditionClass(this.root,'dataLoading',a);CSS.conditionClass(this.root,'dataLoaded',!a);this.infoWrapper.setAttribute('aria-busy',a?'true':'false');break;}},destroy:function(){this.stageHandlers.each(function(a){a.remove();});if(this.pageHandlers){this.pageHandlers.each(function(a){a.remove();});this.pageHandlers=null;}},checkState:function(b){if(b!=PhotoSnowlift.STATE_ERROR&&!this.loadingStates[b])return;switch(b){case PhotoSnowlift.STATE_IMAGE_DATA:var a=this. stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);this.setLoadingState(b,false);}break;case PhotoSnowlift.STATE_HTML:if(this.stream.getCurrentHtml()){this.swapData();this.setLoadingState(b,false);}break;default:if(this.stream.errorInCurrent()){CSS.hide(this.image);CSS.show(this.errorBox);}break;}},buttonListener:function(event){var b=event.getTarget();var a=Date.now();if(Parent.byClass(b,'fbPhotoTagApprovalBox'))return;if(a-this.lastPage<350)return;if(Parent.byClass(b,'likeButton')){DOM.find($('fbPhotoSnowliftFeedback'),'button.like_link').click();}else if(Parent.byClass(b,'commentButton')){DOM.find(this.root,'div.commentBox textarea').focus();this.root.scrollTop=this.root.scrollHeight;}else if(Parent.byClass(b,'tagApproveIgnore'))this.updateTagBox(event,b);},rotateListener:function(event){var a=event.getTarget();if(Parent.byClass(a,'rotateRight')){this.rotate('right');}else if(Parent.byClass(a,'rotateLeft'))this.rotate('left');},up dateTagBox:function(b,a){this.unhiliteAllTags();var c=ge(b);if(!c)return;CSS.addClass(c,'tagBox');CSS.addClass(c,'tagBoxPendingResponse');CSS.removeClass(c,'tagBoxPending');CSS.hide(DOM.find(c,'span.tagForm'));if(a){CSS.show(DOM.find(c,'span.tagApproved'));}else CSS.show(DOM.find(c,'span.tagIgnored'));},rotate:function(c){var d=this.stream.getCursor();if(this.getVideoOnStage()){var b=(c=='left')?270:90;Bootloader.loadComponents(['video-rotate-viewer'],new VideoRotate(d,this.actionList).motionRotate(b));return;}var a={fbid:d,cs_ver:PhotosConst.VIEWER_SNOWLIFT};a[c]=1;this.setLoadingState(PhotoSnowlift.STATE_IMAGE_DATA,true);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);CSS.hide(this.image);new AsyncRequest('/ajax/photos/photo/rotate/').setAllowCrossPageTransition(true).setData(a).setErrorHandler(this.rotationError.bind(this,d)).setHandler(this.rotationComplete.bind(this,d)).setMethod('POST').setReadOnly(false).send();},rotationComplete:function(a,b){this.storeResponseForRotate(a,b);if(a==this.stream.getC ursor()){this.setLoadingState(PhotoSnowlift.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);this.swapData();}this.refreshOnClose=true;},storeResponseForRotate:function(a,c){this.storeFromResponse(c);var b=this.stream.getImageData(a);b.url=c.getPayload().new_urls[PhotosConst.SIZE_NORMAL];b.dimensions=Vector2.deserialize(c.getPayload().dimensions);},rotationError:function(a,b){if(a==this.stream.getCursor()){this.setLoadingState(PhotoSnowlift.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);AsyncResponse.defaultErrorHandler(b);}},saveTagComplete:function(a){this.saveTagsFromPayload(a.getPayload());},saveTagsFromPayload:function(a){this.refreshOnClose=true;this.storeFromData(a);if('data' in a&&this.stream.getCursor() in a.data)this.swapData();},mouseLeaveListener:function(event){this.unhiliteAllTags();this.reHilitePendingTag();},mouseMoveListener:function(event){var b=event.getTarget();var a=(Parent.byClass(b,'stageActions')||Parent.byClass(b,'stageW rapper'));this.hiliteTagsOnMouseMove(event);},unhiliteAllTags:function(){DOM.scry(this.stage,'div.tagsWrapper div.hover').each(function(a){CSS.removeClass(a,'hover');});this.hilitedTag=null;},switchHilitedTags:function(b,c){if(this.switchTimer!==null){clearTimeout(this.switchTimer);this.switchTimer=null;}this.unhiliteAllTags();var a=ge(b);if(a){this.hilitedTag=b;CSS.addClass(a,'hover');if(CSS.hasClass(a,'tagBoxPending')&&!CSS.hasClass(a,'showPendingTagName')&&c===true){DOM.scry(this.stage,'div.tagsWrapper div.showPendingTagName').each(function(d){CSS.removeClass(d,'showPendingTagName');});CSS.addClass(a,'showPendingTagName');}}},reHilitePendingTag:function(){var a=ge(this.hilitedTag);if(a&&CSS.hasClass(a,'showPendingTagName'))return;var b=DOM.scry(this.stage,'div.tagsWrapper div.showPendingTagName')[0];if(b)this.switchHilitedTags(b.id);},hiliteTagsOnMouseMove:function(event){if(!this.stream.getCurrentExtraData()||this.getVideoOnStage())return;if(this.switchTimer!==null)return;var m=event.getTarget();if(Paren t.byClass(m,'fbPhotoSnowliftTagApproval'))return;var i=Parent.byClass(m,'tagBoxPending');var d=(this.hilitedTag&&CSS.hasClass($(this.hilitedTag),'tagBoxPending'));var l=((!this.hilitedTag&&i)||(!d&&i));if(l){this.switchHilitedTags(i.id);return;}if(i&&(i.id==this.hilitedTag))return;var a=250;var h=Vector2.getEventPosition(event);var f=Vector2.getElementPosition(this.image);var e=Vector2.getElementDimensions(this.image);var j=this.stream.getCurrentImageData().dimensions;var k=e.x/j.x;var g=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnowlift.MIN_TAG_DISTANCE*k,this.stream.getCurrentExtraData().tagRects);if(!g){if(!d){this.unhiliteAllTags();this.reHilitePendingTag();}return;}var b=null;if(d){var c={};c[this.hilitedTag]=this.stream.getCurrentExtraData().tagRects[this.hilitedTag];b=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnowlift.MIN_TAG_DISTANCE*k,c);}if(b!==null&&d)return;if(this.hilitedTag!=g)if(d){this.switchTimer=this.switchHilitedTags.bind(this,g).defer(a);}else this.switchHilitedTags(g);},getVideoOnStage:functio n(){var a=this.stream&&this.stream.getCurrentImageData();return a&&a.video;},shouldGoForward:function(a,c){var d=(a==KEYS.RIGHT||Parent.byClass(c,'next'));if(d)return true;var b=(this.getVideoOnStage()||CSS.hasClass(this.root,'taggingMode')||Parent.byClass(c,'tagBoxPending')||Parent.byClass(c,'tagBoxPendingResponse')||Parent.byClass(c,'fbPhotoTagApprovalBox'));if(b)return false;return DOM.isNode(c)&&Parent.byClass(c,'stage');},pageListener:function(event){var a=Event.getKeyCode(event);var b=event.getTarget();if(a==KEYS.LEFT||Parent.byClass(b,'prev')){this.page(-1);user_action('a',b,event);return;}if(this.shouldGoForward(a,b)){this.page(1);user_action('a',b,event);}},page:function(c,b){if(!this.stream.isValidMovement(c))return;this.lastPage=Date.now();this.unhiliteAllTags();var d=this.getVideoOnStage();if(d)this.switchVideo(d,false);Arbiter.inform(PhotoSnowlift.PAGE);this.recacheData();this.stream.moveCursor(c);CSS.hide(this.image);if(this.stream.errorInCurrent()){this.setLoadingState(PhotoSnowlift.STATE_HTML ,true);CSS.show(this.errorBox);return;}var a=this.stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);if(!b){this.replaceUrl=true;goURI(a.info.permalink);}}else{this.setLoadingState(PhotoSnowlift.STATE_IMAGE_PIXELS,true);this.setLoadingState(PhotoSnowlift.STATE_IMAGE_DATA,true);}if(this.stream.getCurrentHtml()){this.swapData();}else this.setLoadingState(PhotoSnowlift.STATE_HTML,true);this.disableAds=!this.isLoggedInViewer;this.loadAds();},logImpressionDetailsForPhoto:function(){var b=[].concat(DOM.scry($('fbPhotoSnowliftTagList'),'input.photoImpressionDetails'),DOM.scry($('fbPhotoSnowliftFeedback'),'input.photoImpressionDetails'));if(b.length===0)return;var a={};for(var c=0;cPhotoSnowlift.ADS_REFRESH_RATE){UIPagelet.loadFromEndpoint('WebEgoPane','fbPhotoSnowliftAdsSide',{pid:34,data:[this.loadQuery.set]},{crossPage:true});this.lastAdsLoad=a;}},adjustForAdUnit:function(){var b=this.sideAdUnit.childNodes;var a=this.bottomAdUnit.childNodes;if(CSS.hasClass(this.container,'adsOnSide')){if(a.length>0&&b.length===0)DOM.setContent(this.sideAdUnit,$A(a));DOM.empty(this.bottomAdUnit);}else if(b.length>0){DOM.setContent(this.bottomAdUnit,$A(b));DOM.empty(this.sideAdUnit);}CSS.conditionClass(this.sideAdDiv,'fbPhotoSnowliftAdsNone',b.length===0);CSS.conditionClass(this.bottomAdDiv,'fbPhotoSnowliftAdsNone',a.length===0);},transitionHandler:function(c){if(c.getQueryData().closeTheater||c.getQueryData().permPage||c.getQueryData().makeprofile||this.returningToStart){if(this.isOpen)this.close();this.transitionHandlerRegistered=false;return false;}if(this.replaceUrl){this.replaceUrl=false;this._uriStack.push(c.getQu alifiedURI().toString());PageTransitions.transitionComplete();return true;}var d=this._uriStack.length;if(d>=2&&this._uriStack[d-2]==c.getQualifiedURI().toString())this._uriStack.pop();var a=this.stream.getCursorForURI(c.getUnqualifiedURI().toString());if(a){var b=this.stream.getRelativeMovement(a);this.page(b,true);PageTransitions.transitionComplete();return true;}if(this.isOpen){this.close();PageTransitions.transitionComplete();return true;}this.transitionHandlerRegistered=false;return false;},recacheData:function(){if(!this.loadingStates.html){var a=this.stream.getCurrentHtml();for(var b in a){a[b]=$A($(b).childNodes);DOM.empty($(b));}}},reloadIfTimeout:function(){if(!image_has_loaded(this.image)){var a=this.makeNewImage(this.image.src,true);Event.listen(a,'load',this.useImage.bind(this,a,null,true));}},useImage:function(c,a,b){if(b&&image_has_loaded(this.image))return;DOM.replace(this.image,c);this.image=c;this.adjustStageSize(a);},makeNewImage:function(c,a){if(this.imageLoadingTimer){clearTimeout(this.i mageLoadingTimer);this.imageLoadingTimer=null;}else if(!a)this.imageRefreshTimer=setTimeout(this.reloadIfTimeout.bind(this),PhotoSnowlift.LOADING_TIMEOUT);var b=$N('img',{className:'spotlight',alt:''});b.setAttribute('aria-describedby','fbPhotosSnowliftCaption');b.setAttribute('aria-busy','true');Event.listen(b,'load',async_callback(function(){clearTimeout(this.imageRefreshTimer);this.image.setAttribute('aria-busy','false');this.setLoadingState(this.STATE_IMAGE_PIXELS,false);(function(){this.adjustStageSize();this.adjustForNewData();}).bind(this).defer();}.bind(this),'photo_theater'));b.src=c;return b;},switchImage:function(d,b,c){CSS.hide(this.image);CSS.hide(this.errorBox);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);var a=this.stream&&this.stream.getCurrentImageData();if(a)PhotoSessionLog.addPhotoView(a.info);this.useImage(this.makeNewImage(d,false),b,false);if(c)this.stream.preloadImages();},switchVideo:function(c,a){var b='swf_'+c;if(a){CSS.addClass(this.stageWrapper,'showVideo');this.videoStage.i d=c;if(window[b]&&!ge(b))window[b].write(c);this.adjustStageSizeForVideo.bind(this,b).defer();}else{this.videoStage.id='fbVideoStage';window[b]&&window[b].addVariable('video_autoplay',0);this.videoLoadTimer&&clearTimeout(this.videoLoadTimer);DOM.empty(this.videoStage);CSS.removeClass(this.stageWrapper,'showVideo');}},checkVideoStatus:function(a){if(this.videoLoadTimer)clearTimeout(this.videoLoadTimer);video=this.getVideoOnStage();if(!video){return;}else{currentSwfID='swf_'+video;if(a!==currentSwfID)return;this.adjustStageSizeForVideo(a);}},adjustStageSizeForVideo:function(a){var b=ge(a);if(!b){this.videoLoadTimer=setTimeout(this.checkVideoStatus.bind(this,a),200);}else this.adjustStageSize(new Vector2(b.width,b.height));},setErrorBoxContent:function(a){DOM.setContent(this.errorBox,a);},swapData:function(){var b,c=this.stream.getCurrentHtml();if(c){this.setLoadingState(PhotoSnowlift.STATE_HTML,false);for(var d in c){b=ge(d);b&&DOM.setContent(b,c[d]);}var a=DOM.scry($('fbPhotoSnowliftCaption'),'div.fbPhotoInli neCaptionEditor');if(a.length)new PhotoInlineCaptionEditor('snowlift').init(a[0]);Arbiter.inform(PhotoSnowlift.DATA_CHANGE,this.stream.getCurrentImageData().info,Arbiter.BEHAVIOR_STATE);this.position=this.stream.getCursor();}this.adjustForNewData();this.logImpressionDetailsForPhoto();},updateTotalCount:function(c,b,a){element=ge('fbPhotoSnowliftPositionAndCount');element&&DOM.setContent(element,a);this.stream.setTotalCount(c);this.stream.setFirstCursorIndex(b);},addPhotoFbids:function(b,c,a){var d=this.stream.getCursor()===null;this.stream.attachToFbidsList(b,c,a);if(a&&d)this.page(0,true);if(!this.pagersShown&&this.stream.canPage())this.setStagePagersReady();},storeFromResponse:function(a){window.ArbiterMonitor&&ArbiterMonitor.stopTtiMeasurement();this.storeFromData(a.getPayload());},storeFromData:function(a){if(!this.isOpen)return;var b=this.stream.storeToCache(a);if('error' in b){this.checkState(PhotoSnowlift.STATE_ERROR);return;}if('init' in b){this.initDataFetched(b.init);if(this.openExplicitly){this.re placeUrl=true;goURI(this.stream.getCurrentImageData().info.permalink);}if(this.stream.canPage())this.setStagePagersReady();this.ua&&this.ua.add_event('ufi');}if('image' in b)this.checkState(PhotoSnowlift.STATE_IMAGE_DATA);if('data' in b)this.checkState(PhotoSnowlift.STATE_HTML);},setStagePagersReady:function(){CSS.removeClass(this.stagePagers,'pagingDisabled');CSS.addClass(this.stagePagers,'pagingReady');this.pagersShown=true;this.ua&&this.ua.add_event('arrows');},deletePhoto:function(a){this.closeRefresh();},closeRefresh:function(){this.refreshOnClose=true;this.closeHandler();},onHiliteTag:function(a,b){if(b.version!=PhotosConst.VIEWER_SNOWLIFT)return;id=b.tag;if(id){this.switchHilitedTags(id,true);}else this.unhiliteAllTags();},onUpdateTagBox:function(a,b){if(b.version==PhotosConst.VIEWER_SNOWLIFT)this.updateTagBox(b.id,b.approve);}}; function PhotoTagger(a){this.version=a;PhotoTagger.instances[a]=this;}PhotoTagger.instances={};PhotoTagger.ACTIVATE_TAGGING='PhotoTagger.ACTIVATE_TAGGING';PhotoTagger.getInstance=function(a){return PhotoTagger.instances[a];};copy_properties(PhotoTagger.prototype,{TAG_BOX_SIZE:100,datasources:{},photoData:{},elemNames:{2:{tagger:'div.snowboxTagger',addTagLink:'div.fbPhotosPhotoActions',overlayActions:'div.fbPhotosPhotoButtons',tagAction:'fbPhotosPhotoActionsTag',image:'div.stage img.spotlight'},6:{tagger:'div.snowliftTagger',addTagLink:'div.fbPhotosPhotoActions',overlayActions:'div.fbPhotosPhotoButtons',tagAction:'fbPhotosPhotoActionsTag',image:'div.stage img.spotlight'}},userActionData:{action:'tagging',namespace:'snowbox'},init:function(a,b){this.setupUserActionLogging();this.root=a;this.tokenizer=b;this._qn=null;this.typeahead=b.getTypeahead();this.clickState=DOM.find(this.root,'div.stageActions');this.tagger=DOM.find(this.clickState,this.elemNames[this.version].tagger);this.faceBox=DOM.find(this.tagger,'d iv.faceBox');this.newTagBox=DOM.find(this.clickState,'div.newTagBox');this.addTagLink=DOM.find(this.root,this.elemNames[this.version].addTagLink);this.overlayActions=DOM.find(this.root,this.elemNames[this.version].overlayActions);this.setupHandlers();this.hideNewTagTimer=null;this.fetchTaggingSuggestions({owner:this.photoData.owner});this.setDataSource(this.typeahead.getData());return this;},setupUserActionLogging:function(){this.ua=user_action(this.userActionData.action).set_namespace(this.userActionData.namespace).set_ua_id('tagging').add_event('init');},logUserActionEvent:function(a){this.ua.add_event(a);},fetchTaggingSuggestions:function(b){this.logUserActionEvent('sugg_fetch');new AsyncRequest().setURI('/ajax/photos/photo/tags/tags_init.php').setData(b).setOption('retries',1).setHandler(function(c){this.typeahead.getView().setSuggestions(c.getPayload().taggees);this.logUserActionEvent('sugg_fetch_done');}.bind(this)).send();var a=this.typeahead.subscribe('bootstrap',function(c,d){if(d&&!d.bootstrapping) {this.updateWithSuggestions();this.typeahead.unsubscribe(a);this.typeahead.subscribe('focus',this.updateWithSuggestions.bind(this));this.tokenizer.subscribe('removeToken',this.updateWithSuggestions.bind(this));this.tokenizer.subscribe('addToken',this.addSuggestion.bind(this));this.typeahead.subscribe('respond',function(e,f){if(f&&!f.results.length)this.updateWithSuggestions();}.bind(this));}}.bind(this));},setupHandlers:function(){this.handlers=[Event.listen(this.clickState,'click',this.addTag.bind(this)),Event.listen(window,'resize',this.hideTagger.bind(this)),Event.listen(this.addTagLink,'click',this.checkActions.bind(this)),Event.listen(this.overlayActions,'click',this.checkActions.bind(this))];this.subscriptions=[Arbiter.subscribe(this.getPhotoViewerObj().PAGE,this.restartTagging.bind(this)),Arbiter.subscribe(this.getPhotoViewerObj().DATA_CHANGE,this.setPhotoData.bind(this)),Arbiter.subscribe(this.getPhotoViewerObj().CLOSE,this.deactivateTagging.bind(this))];this.tokenizer.subscribe('addToken',this.saveT ag.bind(this));this.tokenizer.subscribe('removeToken',this.removeTag.bind(this));this.tokenizer.subscribe('markTagAsSpam',this.markTagAsSpam.bind(this));},getTaggingSource:function(){switch(this.version){case PhotosConst.VIEWER_SNOWBOX:return 'snowbox';case PhotosConst.VIEWER_SNOWLIFT:return 'snowlift';default:return null;}},updateWithSuggestions:function(a,c){var e=this.typeahead.getData().buildUids(' ',this.typeahead.getView().getSuggestions(),this.typeahead.getCore().getExclusions());if(!e.length)return;var d=this.typeahead.getData().respond('',e);for(var b=0;be[c]+d[c])return null;if(g[c]<(this.TAG_BOX_SIZE/2)){a[c]=g[c];}else if(d[c]this.normalSize.y&&this.normalSize.x<=PhotoSnowbox.TIMELINE_STRETCH_WIDTH&&d.offsetWidth===PhotoSnowbox.TIMELINE_STRETCH_WIDTH;if(d){thumbSrc=d.src;}else if(c){thumbSrc=CSS.getStyle(c,'backgroundImage').replace(/.*url\("?([^"]*)"?\).*/,'$1');}else return;this.thumbSrc=thumbSrc;},loadFrameIfUninitialized:function(){if(this.root)return;new Asyn cRequest('/ajax/photos/snowbox/init.php').setAllowCrossPageTransition(true).setMethod('GET').setReadOnly(true).send();},init:function(a){var b=ge('fbPhotoSnowbox');if(!b){b=DOM.appendContent(document.body,a)[0];this.initialLoad=false;}if(this.root==b)return;this.initializeNodes(b);if(!this.subscription){LinkController.registerHandler(this.handleNavigateAway.bind(this));this.subscription=Arbiter.subscribe(PhotoSnowbox.GO,function(c,d){this.openExplicitly=true;this.loading&&CSS.removeClass(this.loading,'loading');this.open(d);}.bind(this));}this.transitionHandlerRegistered=false;this.returningToStart=false;PageTransitions.registerHandler(this.openHandler.bind(this));this.openHandlerRegistered=true;Arbiter.subscribe('PhotoTagApproval.HILITE_TAG',this.onHiliteTag.bind(this));Arbiter.subscribe('PhotoTagApproval.UPDATE_TAG_BOX',this.onUpdateTagBox.bind(this));},initializeNodes:function(a){this.root=a;this.closeTheater=DOM.find(a,'a.closeTheater');this.container=DOM.find(a,'div.container');this.infoWrapper=DOM.find (a,'div.photoInfoWrapper');this.stageWrapper=DOM.find(a,'div.stageWrapper');this.errorBox=DOM.find(this.stageWrapper,'div.stageError');this.image=DOM.find(this.stageWrapper,'img.spotlight');this.pivotBar=DOM.find(this.stageWrapper,'div.pivotWrapper');this.stage=DOM.find(this.stageWrapper,'div.stage');this.videoStage=DOM.find(this.stageWrapper,'div.videoStage');this.stagePagers=DOM.find(a,'div.stagePagers');this.stageActions=DOM.find(a,'div.stageActions');this.buttonActions=DOM.find(this.stageActions,'div.fbPhotosPhotoButtons');this.actionList=$('fbPhotoSnowboxActions');this.sideAdUnit=$('fbPhotoSnowboxAdsSide');this.bottomAdUnit=$('fbPhotoSnowboxAdsBottom');this.sideAdDiv=DOM.find(a,'div.fbPhotoSnowboxAdsSide');this.bottomAdDiv=DOM.find(a,'div.fbPhotoSnowboxAdsBottom');},getRoot:function(){return this.root;},openHandler:function(a){if(this.isOpen||a.getPath()!='/photo.php'||this.returningToStart||a.getQueryData().closeTheater||a.getQueryData().permPage||a.getQueryData().makeprofile){this.openHandlerRegistere d=false;return false;}this.open(a);this._uriStack.push(URI(a).getQualifiedURI().toString());PageTransitions.transitionComplete();return true;},open:function(c){var a=URI(c).getQueryData();var b=a.src;if(b)delete a.src;if(this.resetUriStack)this._uriStack=[];if(!this.initialLoad){a.firstLoad=true;this.initialLoad=true;}this.loadQuery=a;this.isOpen=true;this.pagersShown=false;this.refreshOnClose=false;this.hilitedTag=null;this.lastAdsLoad=0;this.loadingStates={image:false,html:false};this.replaceUrl=false;this.stream=new PhotoStreamCache();this.stream.init(PhotosConst.VIEWER_SNOWBOX);this.fetchInitialData();this.setLoadingState(PhotoSnowbox.STATE_HTML,true);KeyEventController.registerKey('ESCAPE',this.closeListener.bind(this));Bootloader.loadComponents(['fb-photos-photo-css','fb-photos-snowbox-css'],function(){this._open(c,b);}.bind(this));},_open:function(d,c){this.createLoader(c);CSS.show(this.root);(function(){var e=Vector2.getScrollPosition();if(!CSS.hasClass(document.documentElement,'wrapped')){CSS.addCla ss(document.documentElement,'theaterMode');var f=DOMScroll.getScrollbarSize();if(f===0){this.extraClass='zeroScrollbar';}else if(f===20){this.extraClass='scrollbar20';}else this.extraClass='defaultScrollbar';CSS.addClass(document.body,this.extraClass);}DOMScroll.scrollTo(e,0);}).defer();this.ua&&this.ua.add_event('frame');Arbiter.inform('layer_shown',{type:'PhotoSnowbox'});Arbiter.inform(PhotoSnowbox.OPEN);Bootloader.loadComponents(['Hovercard','live-js','photocrop2','PhotoTag','PhotoTagger','TagToken','TagTokenizer','ui-ufi-css']);this.stageHandlers=[Event.listen(window,'resize',this.adjustForResize.bind(this)),Event.listen(this.root,'click',this.closeListener.bind(this)),Event.listen(this.stageWrapper,'click',this.buttonListener.bind(this)),Event.listen(this.actionList,'click',this.rotateListener.bind(this))];var a=ge('fbPhotoSnowboxFeedback');if(a)this.stageHandlers.push(Event.listen(a,'click',function(event){if(Parent.byClass(event.getTarget(),'like_link'))CSS.toggleClass(DOM.find(this.buttonActions,'div .likeCommentGroup'),'viewerLikesThis');}.bind(this)));var b=ge('fbPhotoSnowboxOnProfile');if(b)this.stageHandlers.push(Event.listen(b,'click',function(event){if(Parent.byClass(event.getTarget(),'fbPhotoRemoveFromProfileLink'))this.refreshOnClose=true;}.bind(this)));if(this.resetUriStack)this.startingURI=URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI();if(!c)this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);if(!this.transitionHandlerRegistered){PageTransitions.registerHandler(this.transitionHandler.bind(this));this.transitionHandlerRegistered=true;}PhotoSessionLog.initLogging(PhotoSessionLog.SNOWBOX);if(ua.firefox()&&!CSS.hasClass(document.documentElement,'wrapped'))this.turnFlashAutoplayOff.defer();(function(){this.adjustForResize();if(ua.ie()){this.container.focus();}else this.root.focus();}).bind(this).defer();},getStream:function(){return this.stream;},fetchInitialData:function(){this.ua&&this.ua.add_event('init_data');UIPagelet.loadFromEndpoint('PhotoViewerInitPagelet',nul l,this.loadQuery,{usePipe:true,jsNonblock:true,crossPage:true});},turnFlashAutoplayOff:function(){DOM.scry(document,'div.swfObject').each(function(d){var b=d.getAttribute('data-swfid');if(b&&window[b]){var c=window[b];c.addParam('autostart','false');c.addParam('autoplay','false');c.addParam('play','false');c.addVariable('video_autoplay','0');c.addVariable('autoplay','0');c.addVariable('play','0');var a=URI(c.getAttribute('swf'));a.addQueryData({autoplay:'0'});a.setPath(a.getPath().replace('autoplay=1','autoplay=0'));c.setAttribute('swf',a.toString());c.write(d);}});},closeHandler:function(){if(!this.isOpen)return;if(URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI().toString()==this.startingURI.toString()){this.close();return;}this.close();this.returnToStartingURI(this.refreshOnClose);},returnToStartingURI:function(d,b){if(!d)if(b){this.squashNextTransition(goURI.curry(b));}else this.squashNextTransition();this.returningToStart=true;var e=Arbiter.subscribe('page_transition',function(){ this.returningToStart=false;Arbiter.unsubscribe(e);});var a=d||isNaN(ua.opera());var g=this._uriStack.length;if(a&&ga.y&&a.x<=PhotoSnowbox.TIMELINE_STRETCH_WIDTH&&a.x>=PhotoSnowbox.TIMELINE_STRETCH_MIN){a.y=Math.round(a.y*PhotoSnowbox.TIMELI NE_STRETCH_WIDTH/a.x);a.x=PhotoSnowbox.TIMELINE_STRETCH_WIDTH;CSS.setStyle(this.image,'height',a.y+'px');CSS.setStyle(this.image,'width','auto');}var d=this.getMaxImageSize(a);if(!this.currentMinSize){this.currentMinSize=new Vector2(Math.max(d.x,PhotoSnowbox.STAGE_MIN.x),Math.max(d.y,PhotoSnowbox.STAGE_MIN.y));}else this.currentMinSize=new Vector2(Math.max(d.x,this.currentMinSize.x),Math.max(d.y,PhotoSnowbox.STAGE_MIN.y));CSS.setStyle(this.container,'width',this.currentMinSize.x+'px');CSS.setStyle(this.stageWrapper,'height',this.currentMinSize.y+'px');CSS.setStyle(this.stage,'lineHeight',this.currentMinSize.y+'px');CSS.setStyle(this.videoStage,'lineHeight',this.currentMinSize.y+'px');CSS.conditionClass(this.container,'adsOnSide',this.currentMinSize.x>=PhotoSnowbox.WIDE_ADS);this.adjustForAdUnit();if(!this.pinPagers)CSS.setStyle(this.stagePagers,'height',this.currentMinSize.y/2+'px');this.pinPagers=true;},adjustForNewData:function(){if(!this.image)return;var c=DOM.scry(this.stage,'div.tagsWrapper')[0];var a=V ector2.getElementDimensions(this.image);if(c){CSS.setStyle(c,'width',a.x+'px');CSS.setStyle(c,'height',a.y+'px');if(ua.ie()<=7){var b=DOM.scry(this.root,'div.tagContainer')[0];if(b)CSS.conditionClass(c,'ie7VerticalFix',Vector2.getElementDimensions(b).y>a.y);}}},setLoadingState:function(b,a){switch(b){case PhotoSnowbox.STATE_IMAGE_PIXELS:CSS.conditionClass(this.root,'imagePixelsLoading',a);break;case PhotoSnowbox.STATE_IMAGE_DATA:this.loadingStates[b]=a;CSS.conditionClass(this.root,'imageLoading',a);break;case PhotoSnowbox.STATE_HTML:this.loadingStates[b]=a;CSS.conditionClass(this.root,'dataLoading',a);CSS.conditionClass(this.root,'dataLoaded',!a);this.infoWrapper.setAttribute('aria-busy',a?'true':'false');break;}},destroy:function(){this.stageHandlers.each(function(a){a.remove();});if(this.pageHandlers){this.pageHandlers.each(function(a){a.remove();});this.pageHandlers=null;}},checkState:function(b){if(b!=PhotoSnowbox.STATE_ERROR&&!this.loadingStates[b])return;switch(b){case PhotoSnowbox.STATE_IMAGE_DATA:var a=this.stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);this.setLoadingState(b,false);}break;case PhotoSnowbox.STATE_HTML:if(this.stream.getCurrentHtml()){this.swapData();this.setLoadingState(b,false);}break;default:if(this.stream.errorInCurrent()){CSS.hide(this.image);CSS.show(this.errorBox);}break;}},buttonListener:function(event){var b=event.getTarget();var a=Date.now();if(Parent.byClass(b,'fbPhotoTagApprovalBox'))return;if(a-this.lastPage<350)return;if(Parent.byClass(b,'likeButton')){DOM.find($('fbPhotoSnowboxFeedback'),'button.like_link').click();}else if(Parent.byClass(b,'commentButton')){DOM.find(this.root,'div.commentBox textarea').focus();this.root.scrollTop=this.root.scrollHeight;}else if(Parent.byClass(b,'tagApproveIgnore'))this.updateTagBox(event,b);},rotateListener:function(event){var a=event.getTarget();if(Parent.byClass(a,'rotateRight')){this.rotate('right');}else if(Parent.byClass(a,'rotateLeft'))this.rotate('left' );},updateTagBox:function(b,a){this.unhiliteAllTags();var c=ge(b);if(!c)return;CSS.addClass(c,'tagBox');CSS.addClass(c,'tagBoxPendingResponse');CSS.removeClass(c,'tagBoxPending');CSS.hide(DOM.find(c,'span.tagForm'));if(a){CSS.show(DOM.find(c,'span.tagApproved'));}else CSS.show(DOM.find(c,'span.tagIgnored'));},rotate:function(c){var d=this.stream.getCursor();if(this.getVideoOnStage()){var b=(c=='left')?270:90;Bootloader.loadComponents(['video-rotate-viewer'],new VideoRotate(d,this.actionList).motionRotate(b));return;}var a={fbid:d,cs_ver:PhotosConst.VIEWER_SNOWBOX};a[c]=1;this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);CSS.hide(this.image);new AsyncRequest('/ajax/photos/photo/rotate/').setAllowCrossPageTransition(true).setData(a).setErrorHandler(this.rotationError.bind(this,d)).setHandler(this.rotationComplete.bind(this,d)).setMethod('POST').setReadOnly(false).send();},rotationComplete:function(a,b){this.storeResponseForRotate(a,b);if(a==this.stream. getCursor()){this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);this.swapData();}this.refreshOnClose=true;},storeResponseForRotate:function(a,c){this.storeFromResponse(c);var b=this.stream.getImageData(a);b.url=c.getPayload().new_urls[PhotosConst.SIZE_NORMAL];b.dimensions=Vector2.deserialize(c.getPayload().dimensions);},rotationError:function(a,b){if(a==this.stream.getCursor()){this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);AsyncResponse.defaultErrorHandler(b);}},saveTagComplete:function(a){this.saveTagsFromPayload(a.getPayload());},saveTagsFromPayload:function(a){this.refreshOnClose=true;this.storeFromData(a);if('data' in a&&this.stream.getCursor() in a.data)this.swapData();},mouseLeaveListener:function(event){this.unhiliteAllTags();this.reHilitePendingTag();},mouseMoveListener:function(event){var b=event.getTarget();var a=(Parent.byClass(b,'stageActions')||Parent.byClass(b,'stag eWrapper'));if(!a)CSS.hide(this.pivotBar);if(this.hasPivotData()&&!this.loadingStates.html)CSS.show(this.pivotBar);this.hiliteTagsOnMouseMove(event);},hasPivotData:function(){var a=this.stream.getCurrentHtml();return a&&a.fbPhotoSnowboxPivots;},unhiliteAllTags:function(){DOM.scry(this.stage,'div.tagsWrapper div.hover').each(function(a){CSS.removeClass(a,'hover');});this.hilitedTag=null;},switchHilitedTags:function(b,c){if(this.switchTimer!==null){clearTimeout(this.switchTimer);this.switchTimer=null;}this.unhiliteAllTags();var a=ge(b);if(a){this.hilitedTag=b;CSS.addClass(a,'hover');if(CSS.hasClass(a,'tagBoxPending')&&!CSS.hasClass(a,'showPendingTagName')&&c===true){DOM.scry(this.stage,'div.tagsWrapper div.showPendingTagName').each(function(d){CSS.removeClass(d,'showPendingTagName');});CSS.addClass(a,'showPendingTagName');}}},reHilitePendingTag:function(){var a=ge(this.hilitedTag);if(a&&CSS.hasClass(a,'showPendingTagName'))return;var b=DOM.scry(this.stage,'div.tagsWrapper div.showPendingTagName')[0];if(b)this. switchHilitedTags(b.id);},hiliteTagsOnMouseMove:function(event){if(!this.stream.getCurrentExtraData()||this.getVideoOnStage())return;if(this.switchTimer!==null)return;var m=event.getTarget();if(Parent.byClass(m,'fbPhotoSnowboxTagApproval'))return;var i=Parent.byClass(m,'tagBoxPending');var d=(this.hilitedTag&&CSS.hasClass($(this.hilitedTag),'tagBoxPending'));var l=((!this.hilitedTag&&i)||(!d&&i));if(l){this.switchHilitedTags(i.id);return;}if(i&&(i.id==this.hilitedTag))return;var a=250;var h=Vector2.getEventPosition(event);var f=Vector2.getElementPosition(this.image);var e=Vector2.getElementDimensions(this.image);var j=this.stream.getCurrentImageData().dimensions;var k=e.x/j.x;var g=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnowbox.MIN_TAG_DISTANCE*k,this.stream.getCurrentExtraData().tagRects);if(!g){if(!d){this.unhiliteAllTags();this.reHilitePendingTag();}return;}var b=null;if(d){var c={};c[this.hilitedTag]=this.stream.getCurrentExtraData().tagRects[this.hilitedTag];b=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnow box.MIN_TAG_DISTANCE*k,c);}if(b!==null&&d)return;if(this.hilitedTag!=g)if(d){this.switchTimer=this.switchHilitedTags.bind(this,g).defer(a);}else this.switchHilitedTags(g);},getVideoOnStage:function(){var a=this.stream&&this.stream.getCurrentImageData();return a&&a.video;},shouldGoForward:function(a,c){var d=(a==KEYS.RIGHT||Parent.byClass(c,'next'));if(d)return true;var b=(this.getVideoOnStage()||CSS.hasClass(this.root,'taggingMode')||Parent.byClass(c,'tagBoxPending')||Parent.byClass(c,'tagBoxPendingResponse')||Parent.byClass(c,'fbPhotoTagApprovalBox'));if(b)return false;return DOM.isNode(c)&&Parent.byClass(c,'stage');},pageListener:function(event){var a=Event.getKeyCode(event);var b=event.getTarget();if(a==KEYS.LEFT||Parent.byClass(b,'prev')){this.page(-1);user_action('a',b,event);return;}if(this.shouldGoForward(a,b)){this.page(1);user_action('a',b,event);}},page:function(c,b){if(!this.stream.isValidMovement(c))return;this.lastPage=Date.now();this.unhiliteAllTags();var d=this.getVideoOnStage();if(d)this.swit chVideo(d,false);Arbiter.inform(PhotoSnowbox.PAGE);this.recacheData();this.stream.moveCursor(c);CSS.hide(this.image);if(this.stream.errorInCurrent()){this.setLoadingState(PhotoSnowbox.STATE_HTML,true);CSS.show(this.errorBox);return;}var a=this.stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);if(!b){this.replaceUrl=true;goURI(a.info.permalink);}}else{this.setLoadingState(PhotoSnowbox.STATE_IMAGE_PIXELS,true);this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);}if(this.stream.getCurrentHtml()){this.swapData();}else this.setLoadingState(PhotoSnowbox.STATE_HTML,true);this.disableAds=!this.isLoggedInViewer;this.loadAds();},logImpressionDetailsForPhoto:function(){var b=[].concat(DOM.scry($('fbPhotoSnowboxTagList'),'input.photoImpressionDetails'),DOM.scry($('fbPhotoSnowboxFeedback'),'input.photoImpressionDetails'));if(b.length===0)return;var a={};for(var c=0;cPhotoSnowbox.ADS_REFRESH_RATE){UIPagelet.loadFromEndpoint('WebEgoPane','fbPhotoSnowboxAdsSide',{pid:34,data:[this.loadQuery.set]},{crossPage:true});this.lastAdsLoad=a;}},adjustForAdUnit:function(){var b=this.sideAdUnit.childNodes;var a=this.bottomAdUnit.childNodes;if(CSS.hasClass(this.container,'adsOnSide')){if(a.length>0&&b.length===0)DOM.setContent(this.sideAdUnit,$A(a));DOM.empty(this.bottomAdUnit);}else if(b.length>0){DOM.setContent(this.bottomAdUnit,$A(b));DOM.empty(this.sideAdUnit);}CSS.conditionClass(this.sideAdDiv,'fbPhotoSnowboxAdsNone',b.length===0);CSS.conditionClass(this.bottomAdDiv,'fbPhotoSnowboxAdsNone',a.length===0);},transitionHandler:function(c){if(c.getQueryData().closeTheater||c.getQueryData().permPage||c.getQueryData().m akeprofile||this.returningToStart){if(this.isOpen)this.close();this.transitionHandlerRegistered=false;return false;}if(this.replaceUrl){this.replaceUrl=false;this._uriStack.push(c.getQualifiedURI().toString());PageTransitions.transitionComplete();return true;}var d=this._uriStack.length;if(d>=2&&this._uriStack[d-2]==c.getQualifiedURI().toString())this._uriStack.pop();var a=this.stream.getCursorForURI(c.getUnqualifiedURI().toString());if(a){var b=this.stream.getRelativeMovement(a);this.page(b,true);PageTransitions.transitionComplete();return true;}if(this.isOpen){this.close();PageTransitions.transitionComplete();return true;}this.transitionHandlerRegistered=false;return false;},recacheData:function(){if(!this.loadingStates.html){var a=this.stream.getCurrentHtml();for(var b in a){a[b]=$A($(b).childNodes);DOM.empty($(b));}}},reloadIfTimeout:function(){if(!image_has_loaded(this.image)){var a=this.makeNewImage(this.image.src,true);Event.listen(a,'load',this.useImage.bind(this,a,null,true));}},useImage:function(c, a,b){if(b&&image_has_loaded(this.image))return;DOM.replace(this.image,c);this.image=c;this.adjustStageSize(a);},makeNewImage:function(c,a){if(this.imageLoadingTimer){clearTimeout(this.imageLoadingTimer);this.imageLoadingTimer=null;}else if(!a)this.imageRefreshTimer=setTimeout(this.reloadIfTimeout.bind(this),PhotoSnowbox.LOADING_TIMEOUT);var b=$N('img',{className:'spotlight',alt:''});b.setAttribute('aria-describedby','fbPhotosSnowboxCaption');b.setAttribute('aria-busy','true');Event.listen(b,'load',async_callback(function(){clearTimeout(this.imageRefreshTimer);this.image.setAttribute('aria-busy','false');this.setLoadingState(this.STATE_IMAGE_PIXELS,false);(function(){this.adjustStageSize();this.adjustForNewData();}).bind(this).defer();}.bind(this),'photo_theater'));b.src=c;return b;},switchImage:function(d,b,c){CSS.hide(this.image);CSS.hide(this.errorBox);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);var a=this.stream&&this.stream.getCurrentImageData();if(a)PhotoSessionLog.addPhotoView(a.info);this.useIm age(this.makeNewImage(d,false),b,false);if(c)this.stream.preloadImages();},switchVideo:function(c,a){var b='swf_'+c;if(a){CSS.addClass(this.stageWrapper,'showVideo');this.videoStage.id=c;if(window[b]&&!ge(b))window[b].write(c);this.adjustStageSizeForVideo.bind(this,b).defer();}else{this.videoStage.id='fbVideoStage';window[b]&&window[b].addVariable('video_autoplay',0);this.videoLoadTimer&&clearTimeout(this.videoLoadTimer);DOM.empty(this.videoStage);CSS.removeClass(this.stageWrapper,'showVideo');}},checkVideoStatus:function(a){if(this.videoLoadTimer)clearTimeout(this.videoLoadTimer);video=this.getVideoOnStage();if(!video){return;}else{currentSwfID='swf_'+video;if(a!==currentSwfID)return;this.adjustStageSizeForVideo(a);}},adjustStageSizeForVideo:function(a){var b=ge(a);if(!b){this.videoLoadTimer=setTimeout(this.checkVideoStatus.bind(this,a),200);}else this.adjustStageSize(new Vector2(b.width,b.height));},setErrorBoxContent:function(a){DOM.setContent(this.errorBox,a);},swapData:function(){var b,c=this.stream.get CurrentHtml();if(c){this.setLoadingState(PhotoSnowbox.STATE_HTML,false);for(var d in c){b=ge(d);b&&DOM.setContent(b,c[d]);}var a=DOM.scry($('fbPhotoSnowboxCaption'),'div.fbPhotoInlineCaptionEditor');if(a.length)new PhotoInlineCaptionEditor('snowbox').init(a[0]);Arbiter.inform(PhotoSnowbox.DATA_CHANGE,this.stream.getCurrentImageData().info,Arbiter.BEHAVIOR_STATE);this.position=this.stream.getCursor();}this.adjustForNewData();this.logImpressionDetailsForPhoto();},updateTotalCount:function(c,b,a){element=ge('fbPhotoSnowboxPositionAndCount');element&&DOM.setContent(element,a);this.stream.setTotalCount(c);this.stream.setFirstCursorIndex(b);},addPhotoFbids:function(b,c,a){var d=this.stream.getCursor()===null;this.stream.attachToFbidsList(b,c,a);if(a&&d)this.page(0,true);if(!this.pagersShown&&this.stream.canPage())this.setStagePagersReady();},storeFromResponse:function(a){window.ArbiterMonitor&&ArbiterMonitor.stopTtiMeasurement();this.storeFromData(a.getPayload());},storeFromData:function(a){if(!this.isOpen)return; var b=this.stream.storeToCache(a);if('error' in b){this.checkState(PhotoSnowbox.STATE_ERROR);return;}if('init' in b){this.initDataFetched(b.init);if(this.openExplicitly){this.replaceUrl=true;goURI(this.stream.getCurrentImageData().info.permalink);}if(this.stream.canPage())this.setStagePagersReady();this.ua&&this.ua.add_event('ufi');}if('image' in b)this.checkState(PhotoSnowbox.STATE_IMAGE_DATA);if('data' in b)this.checkState(PhotoSnowbox.STATE_HTML);},setStagePagersReady:function(){CSS.removeClass(this.stagePagers,'pagingDisabled');CSS.addClass(this.stagePagers,'pagingReady');this.pagersShown=true;this.ua&&this.ua.add_event('arrows');},deletePhoto:function(a){this.closeRefresh();},closeRefresh:function(){this.refreshOnClose=true;this.closeHandler();},onHiliteTag:function(a,b){if(b.version!=PhotosConst.VIEWER_SNOWBOX)return;id=b.tag;if(id){this.switchHilitedTags(id,true);}else this.unhiliteAllTags();},onUpdateTagBox:function(a,b){if(b.version==PhotosConst.VIEWER_SNOWBOX)this.updateTagBox(b.id,b.approve);}}; __d("legacy:popup-resizer",["PopupWindow"],function(a,b,c){a.PopupResizer=b('PopupWindow');},3); __d("legacy:contextual-layer",["ContextualLayer"],function(a,b,c){a.ContextualLayer=b('ContextualLayer');},3); if(!window.Toggler){window.Toggler=function(){this.init();};(function(){var e=[];var c;function d(){d=bagofholding;Event.listen(document.documentElement,'click',function(event){var f=event.getTarget();e.each(function(g){g.active&&!g.sticky&&!ContextualThing.containsIncludingLayers(g.getActive(),f)&&!g.inTargetFlyout(f)&&g.inActiveDialog()&&g.hide();});},Event.Priority.URGENT);}function a(g,f){if(g instanceof Toggler)return g;return Toggler.getInstance(f);}function b(g){var f=DOM.scry(g,'a[rel="toggle"]');if(f.length>0&&f[0].getAttribute('data-target'))return ge(f[0].getAttribute('data-target'));}Class.mixin(Toggler,'Arbiter',{init:function(){this.active=null;this.togglers={};this.setSticky(false);e.push(this);this.subscribe(['show','hide'],Toggler.inform.bind(Toggler));d();},show:function(h){var f=a(this,h);var i=f.active;if(h!==i){i&&f.hide();f.active=h;CSS.addClass(h,'openToggler');var g=DOM.scry(h,'a[rel="toggle"]');if(g.length>0&&g[0].getAttribute('data-target'))CSS.removeClass(ge(g[0].getAttribute('data -target')),'toggleTargetClosed');DOM.appendContent(h,f.getToggler('next'));DOM.prependContent(h,f.getToggler('prev'));f.inform('show',f);}},hide:function(i){var g=a(this,i);var f=g.active;if(f&&(!i||i===f)){CSS.removeClass(f,'openToggler');var h=DOM.scry(f,'a[rel="toggle"]');if(h.length>0&&h[0].getAttribute('data-target'))CSS.addClass(ge(h[0].getAttribute('data-target')),'toggleTargetClosed');values(g.togglers).each(DOM.remove);g.inform('hide',g);g.active=null;}},toggle:function(g){var f=a(this,g);if(f.active===g){f.hide();}else f.show(g);},getActive:function(){return a(this).active;},inTargetFlyout:function(g){var f=b(this.getActive());return f&&ContextualThing.containsIncludingLayers(f,g);},inActiveDialog:function(){var f=Dialog.getCurrent();return !f||DOM.contains(f.getRoot(),this.getActive());},getToggler:function(g){var f=a(this);if(!f.togglers[g])f.togglers[g]=$N('button',{className:'hideToggler',onfocus:function(){var h=DOM.scry(f.active,'a[rel="toggle"]')[0];h&&h.focus();f.hide();}});return this.togg lers[g];},setSticky:function(g){var f=a(this);g=g!==false;if(g!==f.sticky){f.sticky=g;if(g){f._pt&&Arbiter.unsubscribe(f._pt);}else f._pt=Arbiter.subscribe('page_transition',f.hide.bind(f,null));}return f;}});copy_properties(Toggler,Toggler.prototype);copy_properties(Toggler,{bootstrap:function(f){var g=f.parentNode;Toggler.getInstance(g).toggle(g);},createInstance:function(g){var f=new Toggler().setSticky(true);DataStore.set(g,'toggler',f);return f;},getInstance:function(g){while(g){var f=DataStore.get(g,'toggler');if(f)return f;if(CSS.hasClass(g,'uiToggleContext'))return Toggler.createInstance(g);g=g.parentNode;}return (c=c||new Toggler());},listen:function(h,g,f){return Toggler.subscribe($A(h),function(j,i){if(i.getActive()===g)return f(j,i);});},subscribe:(function(f){return function(h,g){h=$A(h);if(h.contains('show'))e.each(function(i){if(i.getActive())g.curry('show',i).defer();});return f(h,g);};})(Toggler.subscribe.bind(Toggler))});})();} var Tooltip=window.Tooltip||(function(){var a=null;var f=null;var b=null;var e=[];onloadRegister(function(){Event.listen(window,'scroll',Tooltip.hide);});function d(){if(!f){b=$N('div',{className:'tooltipContent'});var g=$N('i',{className:'arrow'});var h=$N('div',{className:'uiTooltipX'},[b,g]);f=new ContextualLayer();f.init(h);}}function c(g){return copy_properties({position:g.getAttribute('tooltip-position')||'above',alignH:g.getAttribute('tooltip-alignh')||'left'},DataStore.get(g,'tooltip'));}return {process:function(g,h){if(!DOM.contains(g,h))return;if(g!==a){var k=g.getAttribute('tooltip-uri');if(k){g.removeAttribute('tooltip-uri');new AsyncRequest(k).setHandler(function(l){Tooltip.set(g,l.getPayload());}).setErrorHandler(bagofholding).send();}var j=g.getAttribute('title');if(j){g.setAttribute('title','');var i=c(g);!i.content&&Tooltip.set(g,j);}Tooltip.show(g);}},remove:function(g){DataStore.remove(g,'tooltip');g.removeAttribute('data-hover');g.removeAttribute('tooltip-position');g.removeAttribute('too ltip-alignh');g===a&&Tooltip.hide();},hide:function(){if(a){f.hide();a=null;while(e.length)e.pop().remove();}},set:function(i,h,j,g){var k=c(i);DataStore.set(i,'tooltip',copy_properties(k,{content:h,position:j||k.position,alignH:g||k.alignH}));i.setAttribute('data-hover','tooltip');i===a&&Tooltip.show(i);},show:function(g){d();Tooltip.hide();var m=c(g);if(!m.content)return;var j=0;var k=0;if(m.position==='left'||m.position==='right'){k=(g.offsetHeight-20)/2;}else if(m.alignH!=='center'){var o=g.offsetWidth;if(o<18)j=(o-18)/2*(m.alignH==='right'?-1:1);}f.setContext(g).setOffsetX(j).setOffsetY(k).setPosition(m.position).setAlignment(m.alignH);var h=ge('globalContainer');if(h)f.setParent(DOM.contains(h,g)?h:document.body);if(typeof m.content==='string'){CSS.addClass(f,'invisible_elem');var i=$N('span',HTML(htmlize(m.content)));var l=$N('div',{className:'tooltipText'},i);DOM.setContent(b,l);f.show();if(l.offsetWidth=0?q.options[o+1].value:'';},getSelectorButton:function(o){return DOM.find(o,'a.uiSelectorButton');},getSelectorMenu:function(o){return DOM.scry(o,'div.uiSelectorMenu')[0];},getValue:function(s){var q=g(s);if(!q)return null;if(!i(s))return q.value;var t=[];var p=q.options;for(var o=1,r=p.length;o'+'
'+'
    '+'
  • '+'
'+'
'+'');DOM.appendContent(p.parentNode,s);q=Selector.getSelectorMenu(r);p.removeAttribute('onmouseover');}}return q;},setButtonLabel:function(r,p){var o=Selector.getSelectorButton(r);var q=parseInt(o.getAttribute('data-length'),10);p=p||o.getAttribute('data-label')||'';Button.setLabel(o,p);if(typeof p==='string'){CSS.conditionClass(o,'uiSelectorBigButtonLabel',p.length>q);if(q&&p.length>q){o.setAttribute('title',p);}else o.removeAttribute('title');}},setButt onTooltip:function(q,p){var o=Selector.getSelectorButton(q);TooltipLink.setTooltipText(o,p||o.getAttribute('data-tooltip')||'');},setEnabled:function(p,o){if(!o&&a&&c(p)===a)Selector.toggle(p);Button.setEnabled(Selector.getSelectorButton(p),o);},setOptionEnabled:function(p,o){Menu.setItemEnabled(p,o);},setSelected:function(s,t,q){q=q!==false;var p=Selector.getOption(s,t);if(!p)return;var o=Selector.isOptionSelected(p);if(q!==o){if(!i(s)&&!o){var r=Selector.getSelectedOptions(s)[0];r&&Menu.toggleItem(r);}Menu.toggleItem(p);Selector.updateSelector(s);}},toggle:function(o){Toggler.toggle(DOM.scry(c(o),'div.wrap')[0]);},updateSelector:function(z){var w=Selector.getOptions(z);var y=Selector.getSelectedOptions(z);var t=g(z).options;var v=[];var zb=[];for(var s=0,u=w.length;s24){c-=Math.ceil(c/48)*48;}else if(c<-28)c+=Math.ceil(c/-48)*48;return c*30;}function tz_autoset(d,c){if(!d||undefined==c)return;if(window.tz_autoset.calculated)return;window.tz_autoset.calculated=true;var b=-tz_calculate(d);if(b!=c){var a='/ajax/autoset_timezone_ajax.php';new AsyncRequest().setURI(a).setData({gmt_off:b}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).setOption('suppressErrorAlerts',true).send();}} var UFIOptimistic={COMMENT_SEND_EVENT:'ufi/comment',_commentSeqNo:0,init:function(a){this._commentTemplate=a;if(!this._loaded){Event.listen(document.documentElement,'click',this._clickHandler.bind(this),Event.Priority.URGENT);this._loaded=true;}},_clickHandler:function(event){var i=event.getTarget();var l=i.name=='comment'&&i.parentNode&&Parent.byClass(i,'optimistic_submit');if(!l)return true;var e=i.form;var k=DOM.find(e,'textarea');if(Input.isEmpty(k))return true;fc_uncollapse(e);var a=this._commentTemplate.render();var j=XHPTemplate.getNode(a,'text');DOM.setContent(j,HTML(htmlize(trim(k.value))));var c=DOM.scry(e,'ul.commentList')[0];if(!c)return true;CSS.show(c.parentNode);c.appendChild(a);var b=c.lastChild;var g=rand32();b.id='optimistic_comment_'+g+'_'+this._commentSeqNo++;var d=Form.serialize(e);d.comment_replace=b.id;d.comment=1;function h(){new AsyncRequest(Form.getAttribute(e,'action')).setData(d).setRelativeTo(e).setErrorHandler(function(m){CSS.addClass(b,'uiUfiCommentFailed');AsyncResponse.defaul tErrorHandler(m);}).send();}Event.listen(XHPTemplate.getNode(a,'retry_link'),'click',h);h();k.value=k.style.height='';k.focus();var f=window.MentionsInput&&MentionsInput.getInstance(k);f&&f.reset();Arbiter.inform(UFIOptimistic.COMMENT_SEND_EVENT,{form:e});return false;}}; function ufi_add_ft_hidden_node(c){if(c.link_data)return;var a=collect_data_attribs(c,['ft']).ft;if(count(a)){var b=$N('input',{type:'hidden',name:'link_data',value:JSON.stringify(a)});c.appendChild(b);}}function ufi_add_all_link_data(){Bootloader.loadComponents('dom-collect',function(){DOM.scry(document.body,'form.commentable_item').forEach(ufi_add_ft_hidden_node);});} onloadRegister(function(){Selector.subscribe('close',function(a,b){if(CSS.hasClass(b.selector,'commentHideSelector')){var c=Selector.getValue(b.selector);c&&Selector.setSelected.curry(b.selector,c,false).defer();}});}); function MentionsInput(a){DataStore.set(a,'MentionsInput',this);this._root=a;}MentionsInput.getInstance=function(a){var b=Parent.byClass(a,'uiMentionsInput');return b?DataStore.get(b,'MentionsInput'):null;};(function(){var f=['@','\\uff20','+','\\uff0b'].join('');var d='.,*?$|#{}()\\^\\-\\[\\]\\\\\/!%&\'"~=<>_:;';var c='\\b[A-Z][^ A-Z'+d+']';var e='([^'+f+d+']|['+d+'][^ '+d+'])';var b='(?:^|\\s)(?:['+f+']('+e+'{0,20}))';var a='(?:(?:'+c+'+)|'+b+')';var g='(?:'+c+'{4,})';MentionsInput.prototype={_triggers:new RegExp('['+f+']$'),_matcher:new RegExp(b+'$'),_autoMatcher:new RegExp(a+'$'),_userMatcher:new RegExp(g+'$')};})();Class.mixin(MentionsInput,'Arbiter',{init:function(a,b,c){this.init=bagofholding;this._initialized=true;this._typeahead=Typeahead.getInstance(DOM.find(this._root,'.mentionsTypeahead'));this._highlighter=DOM.find(this._root,'.highlighter');this._highlighterInner=this._highlighter.firstChild;this._highlighterContent=DOM.find(this._root,'.highlighterContent');this._hiddenInput=DOM.find(this._roo t,'.mentionsHidden');this._input=this._typeahead.getCore().getElement();this._placeholder=this._input.getAttribute('placeholder')||'';this._maxMentions=a.max||6;this._metrics=c;if(ua.firefox()<4){this._input.blur();setTimeout(function(){this._input.focus();}.bind(this));}if(!this._hiddenInput.name){var d=this._input.name;this._input.name=d+'_text';this._hiddenInput.name=d;}this._initEvents();this._initTypeahead();this.reset(b);this.inform('init',null,Arbiter.BEHAVIOR_STATE);},reset:function(b){if(!this._initialized)return;this._mentioned={};this._orderedUIDs=[];this._numMentioned=0;this._filterData=null;this._hiddenInput&&(this._hiddenInput.value='');this._highlighterContent&&DOM.empty(this._highlighterContent);this._highlighterAuxContent&&DOM.remove(this._highlighterAuxContent);this._highlighterAuxContent=null;Input.setPlaceholder(this._input,this._placeholder);CSS.setStyle(this._typeahead.getElement(),'height','auto');if(b){Input.setValue(this._input,b.flattened);for(var a in b.mention_data)this._addToken( {uid:a,text:b.mention_data[a],type:'unknown'});}this._updateTypeahead();this._updateWidth();this._update();},getRawValue:function(){return Input.getValue(this._hiddenInput);},checkValue:function(){var a=this._typeahead.getCore().getValue();if(this._triggers.exec(a)||a==='')this.inform('sessionEnd',{});},getTypeahead:function(){return this._typeahead;},_initEvents:function(){var a=this._update.bind(this);Event.listen(this._input,{input:a,keyup:a,change:a,focus:this._updateWidth.bind(this)});if(this._metrics){this._metrics._reset();this._metrics.bindSessionStart(this._typeahead,'render',true);this._metrics.bindSessionEnd(this._typeahead.getView(),'select',true);this._metrics.bindSessionEnd(this,'sessionEnd',false);Event.listen(this._input,'keyup',function(event){this.checkValue.bind(this).defer();}.bind(this));}},_initTypeahead:function(){this._typeahead.subscribe('select',function(e,f){var g=f.selected;this._addToken({uid:g.uid,text:g.text,type:g.type});this.updateValue();}.bind(this));var b=this._input;var d =null;var a=function(){if(d===null){d=Input.getSubmitOnEnter(b);Input.setSubmitOnEnter(b,false);}};var c=function(){if(d!==null){Input.setSubmitOnEnter(b,d);d=null;}};this._typeahead.subscribe('render',a);this._typeahead.subscribe('reset',c);this._typeahead.subscribe('highlight',function(e,f){f.index>=0?a():c();});this._typeahead.subscribe('query',function(){this._filterData=null;}.bind(this));this._typeahead.getCore().suffix='';this._typeahead.getData().setFilter(this._filterResults.bind(this));},_filterResults:function(d){if(this._filterData===null){var a=Input.getSelection(this._input).start||0;for(var c=0;ce[0]&&a<=e[1]){this._filterData={caretIsInsideMention:true};return false;}}var b=this._typeahead.getCore();this._filterData={value:b.getValue(),rawValue:b.getRawValue()};}if(this._filterData.caretIsInsideMention)return false;if(this._matcher.test(this._filterData.rawValue))return true;if(d.type!='user')return false;if(this._userMatcher.test(this._f ilterData.value))return true;return TypeaheadUtil.isExactMatch(this._filterData.value,this._typeahead.getData().getTextToIndex(d));},_addToken:function(a){var b=a.uid;if(!this._mentioned.hasOwnProperty(b)){this._mentioned[b]=a;this._orderedUIDs.push(b);this._numMentioned++;this._updateTypeahead();}},_removeToken:function(a){if(this._mentioned.hasOwnProperty(a)){delete this._mentioned[a];this._orderedUIDs.remove(a);this._numMentioned--;this._updateTypeahead();}},_reduceToken:function(f,d){var e=d.split(' ');var b=[];for(var a=0;a'+htmlize(d)+'');d=d.replace(/[\\\]:]/g,function(h){return '\\'+h;});g=g.replace('@['+e+':]','@['+e+':'+d+']');}if(ua.ie())a=a.replace(/ {2}/g,'  ');this._offsets=c;this._hiddenInput.value=g;DOM.setContent(this._hi ghlighterContent,HTML(a));this._updateHeight();},_updateDirection:function(){var a=CSS.getStyle(this._input,'direction');if(a==this._dir)return;this._dir=a;CSS.setStyle(this._highlighter,'direction',a);if(a=='rtl'){CSS.setStyle(this._highlighter,'text-align','right');}else CSS.setStyle(this._highlighter,'text-align','left');},_updateWidth:function(){var a=CSS.getStyleFloat.curry(this._input);var b=this._input.offsetWidth-a('paddingLeft')-a('paddingRight')-a('borderLeftWidth')-a('borderRightWidth');if(ua.firefox())b-=2;if(ua.ie()<=7){b-=CSS.getStyleFloat(this._highlighterInner,'paddingLeft');this._highlighter.style.zoom=1;}this._highlighterInner.style.width=Math.max(b,0)+'px';},_updateHeight:function(){if(this._highlighterAuxContent){var a=this._highlighter.offsetHeight;var b=this._typeahead.getElement();if(a>b.offsetHeight){CSS.setStyle(b,'height',a+'px');Arbiter.inform('reflow');}}},_updateTypeahead:function(){var a=this._typeahead.getCore();var b=null;if(!this._maxMentions||this._numMentioned0&&this.index!==this.getDefaultIndex(this.results)){var a=this.results[this.index];for(var b=0,g=e.length;bthis.items.length-1){a=-1;}else if(a<-1)a=this.items.length-1;if(a>=0&&a=0&&c>=0){d=g.charAt(b-1);if(!d||a.test(d))this.start=b;e=d+e;c=f.indexOf(e);b--;}e=g.substring(this.start,this.end);c=f.indexOf(e);b=this.end;while(b<=g.length&&c>=0){d=g.charAt(b);if(!d||a.test(d))this.end=b;e=e+d;c=f.indexOf(e);b++;}},getRawValue:function(){var a=Input.getSelection(this.element).start||0;return this. parent.getValue().substring(0,a);},getValue:function(){var a=this.matcher&&this.matcher.exec(this.getRawValue());if(!a)return '';var e=a[0];var d=a.index+e.length;e=e.replace(/^\s/,'');var b=e.length;e=e.replace(/\s$/,'');var c=b-e.length;this.start=d-b;this.end=d+c;return a[1]||a[0];}}; function TypeaheadMetrics(a){this.extraData={};copy_properties(this,a);}TypeaheadMetrics.prototype={endPoint:'/ajax/typeahead/record_basic_metrics.php',init:function(a){this.init=bagofholding;this.core=a.getCore();this.view=a.getView();this.data=a.getData();this.stats={};this.sessionActive=false;this._sessionStartEvents=[];this._sessionEndEvents=[];this._reset();this.initEvents();},_reset:function(){this.stats={};this.avgStats={};this.sessionActive=false;this.sid=Math.floor(Date.now()*Math.random());this.data.setQueryData({sid:this.sid});},recordSelect:function(a){var b=a.selected;if(b.uid==null){this.recordStat('selected_id','SELECT_NULL');}else this.recordStat('selected_id',b.uid);this.recordStat('selected_type',b.type);this.recordStat('selected_position',a.index);this.recordStat('selected_with_mouse',a.clicked?1:0);this._sessionEnd();},bindSessionStart:function(c,event,a){if(a)for(var b=0;b0){copy_properties(this.stats,this.extraData);if(t his.results){var c=(this.results).map(function(e,d){return e.uid;});this.recordStat('candidate_results',JSON.stringify(c));}if(this.query)this.recordStat('query',this.query);if(this.sid)this.recordStat('sid',this.sid);if(this.bootstrapped)this.recordStat('bootstrapped',1);for(var b in this.avgStats){var a=this.avgStats[b];this.stats[b]=a[0]/a[1];}new AsyncRequest().setURI(this.endPoint).setMethod('POST').setData({stats:this.stats}).send();this._reset();}}}; add_properties('TypeaheadBehaviors',{hoistFriends:function(a){var b=a.getView();b.subscribe('beforeRender',function(c,f){var g=[];var d=[];for(var e=0;e=0;b--)try{if(parent.frames[b]&&parent.frames[b].Arbiter&&parent.frames[b].Arbiter.inform)WidgetArbiter._siblings.push(parent.frames[b].Arbiter);}catch(a){}},inform:function(){WidgetArbiter._findSiblings();var a=$A(arguments);WidgetArbiter._siblings.each(function(b){b.inform.apply(b,a);});}}; var PlatformOptInPopup=function(){};copy_properties(PlatformOptInPopup,{DIALOG_URL:'/connect/uiserver.php',DIALOG_WIDTH:420,DIALOG_HEIGHT:450,APP_ID:127760087237610,open:function(d,c,a){if(!d)d='generic';if(!c)c='opt.in';var b=new URI(PlatformOptInPopup.DIALOG_URL);b.addQueryData({social_plugin:d,method:c,display:'popup',secure:URI.getRequestURI().isSecure(),app_id:PlatformOptInPopup.APP_ID});if(a)b.addQueryData(a);return PopupResizer.open(b.toString(),PlatformOptInPopup.DIALOG_WIDTH,PlatformOptInPopup.DIALOG_HEIGHT);}}); WindowComm={_callbacks:{},makeHandler:function(a,c){c=c||'opener';var b='f'+(Math.random()*(1<<30)).toString(16).replace('.','');WindowComm._callbacks[b]=a;return new URI('/connect/window_comm.php').setQueryData({_id:b,_relation:c}).getQualifiedURI().toString();},_recv:function(b){var a=new URI(b).getQueryData();WindowComm._callbacks[a._id](a);}};