/*1358142559,178142493*/

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

function MetaComposerMessageBox(){}copyProperties(MetaComposerMessageBox.prototype,{init:function(a,b){this.inputContainer=DOM.scry(a,'div.inputContainer')[0];this.textInput=DOM.scry(a,'textarea.mentionsTextarea')[0];this.metaArea=DOM.scry(a,'div.attachmentMetaArea')[0];this.bottomArea=DOM.scry(a,'div.attachmentBottomArea')[0];this.barArea=DOM.scry(a,'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("SubscribeButton",["Event","Arbiter"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i={SUBSCRIBED:'FollowingUser',UNSUBSCRIBED:'UnfollowingUser',init:function(j,k,l,m,n){g.listen(k,'click',function(){h.inform(i.SUBSCRIBED,{profile_id:m});});h.subscribe(i.SUBSCRIBED,function(o,p){if(m===p.profile_id){if(!n)l.suppressNextMouseEnter();j.swap();}});h.subscribe(i.UNSUBSCRIBED,function(o,p){if(m===p.profile_id){j.unswap();l.hideFlyout();h.inform('SubMenu/Reset');}});},initUnsubscribe:function(j,k){g.listen(j,'click',function(){h.inform.bind(h,i.UNSUBSCRIBED,{profile_id:k}).defer();});}};e.exports=i;});
__d("legacy:SubscribeButton",["SubscribeButton"],function(a,b,c,d){a.SubscribeButton=b('SubscribeButton');},3);
__d("WebMessengerMenuFolderControl",["WebMessengerAuxMenu","CSS","WebMessengerTemplates","copyProperties","cx"],function(a,b,c,d,e,f){var g=b('WebMessengerAuxMenu'),h=b('CSS'),i=b('WebMessengerTemplates'),j=b('copyProperties'),k=b('cx'),l,m;function n(o,p,q){var r=!l||l!=p;l=p;this._template=i[':fb:web-messenger:master-view:tab-bar:menu-option'].build();this._template.setNodeContent('folderLabel',o);if(!m||r){m=new g(l,"_1j");h.show(l.parentNode);}this._menuItem=m.addOption(this._template.getRoot(),q);this._menuItem.getRoot();}j(n.prototype,{getCountBadge:function(){return this._template.getNode('count');},setSelected:function(o){h.conditionClass(l.parentNode,'selectedFolder',o);if(o){this._menuItem.select();}else this._menuItem.deselect();},destroy:function(){m&&m.destroy();}});e.exports=n;});
__d("MessagingFilteringNux",["Arbiter","AsyncRequest","LayerDestroyOnHide","LayerHideOnTransition","MercuryConfig","WebMessengerPermalinks"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('AsyncRequest'),i=b('LayerDestroyOnHide'),j=b('LayerHideOnTransition'),k=b('MercuryConfig'),l=b('WebMessengerPermalinks'),m=null,n,o={ACCEPTED_EVENT:'filtering/accepted',DIALOG_REGISTERED_EVENT:'filtering/dialog-registered',tryShow:function(p){g.subscribe(o.DIALOG_REGISTERED_EVENT,function(){if(!m)return;m.setContext(p);m.show();m=null;},g.SUBSCRIBE_ALL);},registerDialog:function(p){m=p.disableBehavior(i).disableBehavior(j);n=g.subscribe('page_transition',function(q,r){if(!l.isWebMessengerURI(r.uri)){p&&p.destroy();n.unsubscribe();}},g.SUBSCRIBE_NEW);if(p)p.subscribe('confirm',function(){k.filtering_active=true;new h('/ajax/web_messenger/dismiss_filtering_nux.php').send();p.hide();g.inform(o.ACCEPTED_EVENT,{});});g.inform(o.DIALOG_REGISTERED_EVENT,{},g.BEHAVIOR_PERSISTENT);}};e.exports=o;});
__d("ScrollableTypeaheadBehavior",["DOM","CSS","Style","Parent","cx","ScrollableArea","copyProperties"],function(a,b,c,d,e,f){var g=b('DOM'),h=b('CSS'),i=b('Style'),j=b('Parent'),k=b('cx'),l=b('ScrollableArea'),m=b('copyProperties');function n(o){this._typeahead=o;}m(n.prototype,{_subscriptions:null,_scrollableElems:null,_scrollableArea:null,_showScrollbar:null,enable:function(){this._scrollableElems=(l.renderDOM());h.addClass(this._scrollableElems.root,"_ml");g.appendContent(this._typeahead.getView().element,this._scrollableElems.root);this._typeahead.getView().content=this._scrollableElems.content;this._scrollableArea=(l.fromNative(this._scrollableElems.root,{fade:false}));this._subscriptions=[this._typeahead.getView().subscribe('reset',this._reset.bind(this)),this._typeahead.getView().subscribe('render',this._render.bind(this)),this._typeahead.getView().subscribe('beforeRender',this._beforeRender.bind(this)),this._typeahead.getView().subscribe('next',this._scrollHelper.bind(this)),this._typeahead.getView().subscribe('prev',this._scrollHelper.bind(this))];i.set(this._scrollableElems.wrap,'height','0px');h.removeClass(this._scrollableElems.root,"_mm");},disable:function(){while(this._subscriptions.length)this._subscriptions.pop().unsubscribe();this._subscriptions=null;},_reset:function(){i.set(this._scrollableElems.wrap,'height','0px');h.removeClass(this._scrollableElems.root,"_mm");this._scrollableArea.scrollToTop();},_render:function(){this._scrollableArea.poke();this._showScrollbar?this._scrollableArea.showScrollbar(false):this._scrollableArea.hideScrollbar(true);h.addClass(this._scrollableElems.root,"_mm");},_beforeRender:function(o,p){var q=5;if(this._typeahead.getView().maxResults<10)q=3;i.set(this._scrollableElems.body,'width',this._scrollableElems.wrap.offsetWidth+'px');if(p.results.length<q){i.set(this._scrollableElems.wrap,'height',(38*p.results.length+4)+'px');this._showScrollbar=false;}else{this._scrollableArea.showScrollbar(false);i.set(this._scrollableElems.wrap,'height',(38*q+4)+'px');this._showScrollbar=true;}},_scrollHelper:function(o,p){if(!j.byClass(p,'uiScrollableArea'))return;this._typeahead.getView().ignoreMouseover=true;var q=j.byClass(p,'uiScrollableAreaWrap'),r=p.offsetTop-q.offsetTop;if(r<q.scrollTop){q.scrollTop=r;return;}var s=r+p.offsetHeight;if(s>q.scrollTop+q.offsetHeight)q.scrollTop=s-q.offsetHeight;}});e.exports=n;});
__d("legacy:LegacyScrollableTypeaheadBehavior",["ScrollableTypeaheadBehavior"],function(a,b,c,d){var e=b('ScrollableTypeaheadBehavior');if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};a.TypeaheadBehaviors.scrollArea=function(f){f.enableBehavior(e);};},3);
__d("PhotosUploadID",[],function(a,b,c,d,e,f){var g=1024,h={getNewID:function(){return g++;}};e.exports=h;});
__d("Tour",["Arbiter","LayerDestroyOnHide","LayerHideOnEscape","copyProperties","NavigationMessage"],function(a,b,c,d,e,f){var g=b('Arbiter'),h=b('LayerDestroyOnHide'),i=b('LayerHideOnEscape'),j=b('copyProperties'),k=b('NavigationMessage');function l(){if(l._instance)l._instance.setTourComplete();l._instance=this;}j(l.prototype,{tourStarted:false,tourComplete:false,_navigationBeginToken:null,_pageLeaveToken:null,steps:{},openDialog:null,init:function(){this._pageLeaveToken=g.subscribe('onload/exit',this.handleLeavePage.bind(this));this._navigationBeginToken=g.subscribe(k.NAVIGATION_BEGIN,this.handleTransition.bind(this));this.steps={};return this;},registerStep:function(m,n){m.disableBehavior(h);m.disableBehavior(i);this.steps[n]=m;m.subscribe('show',function(){m.inform('tour-dialog-show',m);});if(!this.getTourStarted())this.setTourStart();},_unsubscribeSubscriptions:function(){this._navigationBeginToken.unsubscribe();this._pageLeaveToken.unsubscribe();},handleLeavePage:function(){this._unsubscribeSubscriptions();},handleTransition:function(){this._unsubscribeSubscriptions();},handleTourStart:function(){},handleTourStop:function(){},handleTourComplete:function(){},showStep:function(m){var n=this.steps[m];if(!(this.openDialog==n))this.hideOpenDialog();if(!n)return;this.openDialog=n;n.show();},hideOpenDialog:function(){if(this.openDialog){this.openDialog.hide();this.openDialog=null;}},getTourStarted:function(){return this.tourStarted;},setTourStart:function(){this.tourStarted=true;this.handleTourStart();},setTourStop:function(){this.tourStarted=false;this.hideOpenDialog();this.handleTourStop();},setTourComplete:function(){if(this.tourComplete)return;this.setTourStop();this.tourComplete=true;this.handleTourComplete();},hideStep:function(m){var n=this.steps[m];n&&n.hide();}});j(l,{getInstance:function(){return l._instance||(l._instance=new l());}});e.exports=l;});
__d("legacy:tour",["Tour"],function(a,b,c,d){a.Tour=b('Tour');},3);
var PageLikeButton=window.PageLikeButton||(function(){function a(c,d,e,f,g){Tour.getInstance().hideStep('low_page_likes');fbpage_set_fan_status(c,d,e,false,function(){PageLikeButton.informLikeSuccess(d);},f,{fan_origin:g});}function b(c,d,event){a(event.getTarget(),c,true,function(e){Arbiter.inform(PageLikeButton.UNLIKED,{profile_id:c});AsyncResponse.defaultErrorHandler(e);},d);PageLikeButton.informLike(c);}return {LIKED:'liked',UNLIKED:'unliked',LIKED_SUCCESS:'liked_success',init:function(c,d,e,f,g,h,i,j){Arbiter.subscribe(PageLikeButton.LIKED,function(k,l){if(f===l.profile_id){if(!i)e.suppressNextMouseEnter();c.swap();if(j===true)new AsyncRequest().setURI('/ajax/pages/suggestions_on_liking.php').setData({pageid:f}).send();}});Arbiter.subscribe(PageLikeButton.UNLIKED,function(k,l){if(f===l.profile_id){c.unswap();e.hideFlyout();}});if(h)Arbiter.subscribe(PageLikeButton.LIKED_SUCCESS,function(k,l){app_data=URI.getRequestURI().getQueryData().app_data;if(l.profile_id==f)new AsyncRequest().setURI('/ajax/pages/fetch_app_column.php').setData({profile_id:f,tab_key:h,app_data:app_data}).send();});Event.listen(d,'click',bind(this,b,f,g));},initCallout:function(c,d){callout=document.getElementById('pageActionLikeCalloutButton');Event.listen(callout,'click',bind(this,b,c,d));},initUnlike:function(c,d,e){Event.listen(c,'click',function(event){a(event.getTarget(),d,false,function(f){Arbiter.inform(PageLikeButton.LIKED,{profile_id:d});AsyncResponse.defaultErrorHandler(f);},e);PageLikeButton.informUnlike(d);});},informLike:function(c){var d={profile_id:c};Arbiter.inform(PageLikeButton.LIKED,d);Arbiter.inform(SubscribeButton.SUBSCRIBED,d);},informLikeSuccess:function(c){var d={profile_id:c};Arbiter.inform(PageLikeButton.LIKED_SUCCESS,d);},informUnlike:function(c){var d={profile_id:c};Arbiter.inform.bind(Arbiter,PageLikeButton.UNLIKED,d).defer();Arbiter.inform.bind(Arbiter,SubscribeButton.UNSUBSCRIBED,d).defer();}};})();
__d("PhotoTagStore",["AsyncRequest","copyProperties","isEmpty"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('copyProperties'),i=b('isEmpty');function j(){this._tagList={};this._textTagList={};this._originalTagList={};this._dirtyPhotosByUid={};j.instance=this;}j.instance=null;j.getInstance=function(){if(j.instance===null)new j();return j.instance;};h(j.prototype,{getPhotoTags:function(k){return this._tagList[k]||{};},clear:function(){this._tagList={};this._textTagList={};this._originalTagList={};this._dirtyPhotosByUid={};},revert:function(k){for(var l in this._tagList)if(!this._originalTagList[l][k]){delete this._tagList[l][k];}else this._tagList[l][k]=this._originalTagList[l][k];this._dirtyPhotosByUid={};},hasNewTags:function(){return !i(this._tagList)||!i(this._textTagList);},userHasDirtyTags:function(k){return !i(this._dirtyPhotosByUid[k]);},handleTagFetch:function(k){for(var l in k)this.loadTagInfo(l,k[l]);},saveAlbumTagsForUser:function(k,l){var m={},n=[],o=this._dirtyPhotosByUid[k]||{};for(var p in o){var q=this._tagList[p][k];if(q===undefined){n[n.length]=p;continue;}m[p]={x:q.x,y:q.y};}var r={subject:k,action:'save',save_tags:m,remove_from:n};new g().setURI('/ajax/photos/album/tags.php').setData(r).setHandler(function(s){l(s.payload);}).setAllowCrossPageTransition(true).send();delete this._dirtyPhotosByUid[k];},getTagsFromList:function(k){var l=[];for(var m in k)if(k.hasOwnProperty(m))for(var n in k[m])if(k[m].hasOwnProperty(n))l.push(k[m][n]);return l;},getAllTags:function(){var k=this.getTagsFromList(this._tagList),l=this.getTagsFromList(this._textTagList);return k.concat(l);},removeTag:function(k,l){var m=this._tagList[k],n=this._originalTagList[k]||{};if(n[l]){this._dirtyPhotosByUid[l]=this._dirtyPhotosByUid[l]||{};this._dirtyPhotosByUid[l][k]=true;}else delete this._dirtyPhotosByUid[l][k];for(var o in m)if(o==l){delete this._tagList[k][o];if(i(this._tagList[k]))delete this._tagList[k];}},removeTextTag:function(k,l){var m=this._textTagList[k];if(!i(m[l])){delete this._textTagList[k][l];if(i(this._textTagList[k]))delete this._textTagList[k];}},removeAllTagsFromPhoto:function(k){if(!i(this._tagList[k]))for(var l in this._tagList[k]){if(!this._tagList[k].hasOwnProperty(l))continue;this.removeTag(k,l);}if(!i(this._textTagList[k]))for(var m in this._textTagList[k]){if(!this._textTagList[k].hasOwnProperty(m))continue;this.removeTextTag(k,m);}},storeTag:function(k,l,m,n,o){this.storeTagWithOptions(k,l,m,n,{can_remove:o});},storeTagWithOptions:function(k,l,m,n,o){this._dirtyPhotosByUid[l]=this._dirtyPhotosByUid[l]||{};this._dirtyPhotosByUid[l][k]=true;var p={x:m,y:n};h(p,o);if(!l){this._textTagList[k]=this._textTagList[k]||{};this._textTagList[k][p.name]=p;}else{this._tagList[k]=this._tagList[k]||{};this._tagList[k][l]=p;}},loadTagInfo:function(k,l){this._tagList[k]={};this._originalTagList[k]={};for(var m=0;m<l.length;m++){var n=l[m];this._tagList[k][n.subject]=n;this._originalTagList[k][n.subject]=n;}}});e.exports=j;});
__d("PhotosUploadWaterfall",["AsyncSignal"],function(a,b,c,d,e,f){var g=b('AsyncSignal'),h={APP_FLASH:'flash_pro',APP_SIMPLE:'simple',APP_ARCHIVE:'archive',APP_COMPOSER:'composer',APP_MESSENGER:'messenger',INSTALL_CANCEL:1,INSTALL_INSTALL:2,INSTALL_UPDATE:3,INSTALL_REINSTALL:4,INSTALL_PERMA_CANCEL:5,INSTALL_SILENT_SKIP:6,INSTALL_DOWNLOAD:7,BEGIN:1,UPLOAD_START:4,ALL_UPLOADS_DONE:6,IMAGES_SELECTED:9,UPGRADE_REQUIRED:11,VERSION:15,SELECT_CANCELED:19,CANCEL:22,PROGRESS_BAR_STOPPED:44,MISSED_BEAT:45,HEART_ATTACK:46,RESIZER_AVAILABLE:20,OVERLAY_FIRST:61,ASYNC_AVAILABLE:63,VAULT_IMAGES_SELECTED:62,VAULT_CREATE_POST_CANCEL:65,VAULT_SEND_IN_MESSAGE_CLICKED:66,VAULT_DELETE_CANCEL:68,VAULT_ADD_TO_ALBUM_CANCEL:74,VAULT_SHARE_IN_AN_ALBUM_CLICKED:76,VAULT_SHARE_OWN_TIMELINE_CLICKED:77,VAULT_SHARE_FRIENDS_TIMELINE_CLICKED:78,VAULT_SHARE_IN_A_GROUP_CLICKED:79,METHOD_DRAGDROP:'dragdrop',METHOD_FILE_SELECTOR:'file_selector',VAULTBOX:'vaultbox',GRID:'grid',sendSignal:function(i,j){new g('/ajax/photos/waterfall.php',{data:JSON.stringify(i)}).setHandler(j).send();}};e.exports=h;});
var PlaceActionLink={start_claim_link:function(a){var b=new AsyncRequest().setMethod('POST').setURI('/ajax/places/claim/start_claim.php').setData({id:a});new Dialog().setAsync(b).show();return false;},refer_claim_link:function(a){var b=new AsyncRequest().setMethod('POST').setURI('/ajax/places/claim/refer_claim.php').setData({id:a});new Dialog().setAsync(b).show();return false;}};
__d("TimelinePageMostRecent",["CSS","DOMQuery","Parent","Style","TimelineCapsule","$"],function(a,b,c,d,e,f){var g=b('CSS'),h=b('DOMQuery'),i=b('Parent'),j=b('Style'),k=b('TimelineCapsule'),l=b('$'),m={init:function(n,o){if(!g.shown(n)){g.show(n);var p=l(o);j.set(h.find(p,'div.sArea'),'height',(p.offsetHeight||0)+'px');k.balanceCapsule(i.byClass(l(n),'fbTimelineCapsule'));}}};e.exports=m;});
__d("SwapButton",["Event","Arbiter","copyProperties","CSS"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('copyProperties'),j=b('CSS');function k(l,m,n){this._swapperButton=l;this._swappeeButton=m;g.listen(l,'click',this.swap.bind(this));if(n)g.listen(m,'click',this.unswap.bind(this));h.subscribe('SwapButton/focusOnJoinButton',this.setFocusOnSwapper.bind(this),h.SUBSCRIBE_ALL);}i(k.prototype,{_swapperButton:null,_swappeeButton:null,swap:function(){j.hide(this._swapperButton);j.show(this._swappeeButton);this._swappeeButton.focus();},unswap:function(){j.show(this._swapperButton);j.hide(this._swappeeButton);this._swapperButton.focus();},toggle:function(){j.toggle(this._swapperButton);j.toggle(this._swappeeButton);},setFocusOnSwapper:function(){this._swapperButton.focus();}});e.exports=k;});
__d("HoverButton",["AsyncRequest","CSS","DOM","URI","copyProperties"],function(a,b,c,d,e,f){var g=b('AsyncRequest'),h=b('CSS'),i=b('DOM'),j=b('URI'),k=b('copyProperties');function l(m,n,o,p){this._button=m;this._flyout=n;this._flyoutAjaxify=p;this._flyoutContent=o;n.subscribe('show',this._onShow.bind(this));n.subscribe('hide',this._onHide.bind(this));}k(l.prototype,{_button:null,_flyout:null,_flyoutAjaxify:null,_flyoutContent:null,showFlyoutBriefly:function(){this.showFlyout();this._flyout.hideFlyoutDelayed(5000);},showFlyout:function(){this._flyout.showFlyout(this._button,true);this._flyout.inform('show',this._button);},hideFlyout:function(){this._flyout.hideFlyout(true);this._flyout.inform('hide',this._button);},_onShow:function(m,n){h.addClass(n,'uiHoverButtonSelected');h.addClass(n,'selected');if(this._flyoutAjaxify){h.addClass(this._flyoutContent,'async_saving');new g().setURI(new j(this._flyoutAjaxify)).setHandler(function(o){h.removeClass(this._flyoutContent,'async_saving');i.setContent(this._flyoutContent,o.payload);}.bind(this)).send();this._flyoutAjaxify=null;}},_onHide:function(m,n){h.removeClass(n,'uiHoverButtonSelected');h.removeClass(n,'selected');},destroy:function(){this.hideFlyout();this._flyout.destroy();},suppressNextMouseEnter:function(){this._flyout.setActiveNode(this._button);}});e.exports=l;});
__d("HoverFlyout",["Event","Arbiter","ArbiterMixin","DataStore","Keys","copyProperties"],function(a,b,c,d,e,f){var g=b('Event'),h=b('Arbiter'),i=b('ArbiterMixin'),j=b('DataStore'),k=b('Keys'),l=b('copyProperties');function m(n,o,p,q){if(n){this._showDelay=p;this._hideDelay=q;this.init(n);if(o)this.initNode(o);}h.subscribe('SwapButton/focusOnJoinButton',this.hideFlyout.shield(this),h.SUBSCRIBE_ALL);}l(m.prototype,i,{init:function(n){this._flyout=n;this._showDelay=this._showDelay||0;this._hideDelay=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()+'_listeners';return this;},initNode:function(n){if(this._nodes.contains(n))return this;this._nodes.push(n);j.set(n,this._dataStoreUnique,[g.listen(n,'mouseenter',this._onNodeMouseEnter.bind(this,n)),g.listen(n,'mouseleave',this.hideFlyout.shield(this)),g.listen(n,'click',this._onNodeMouseEnter.bind(this,n)),g.listen(n,'keydown',this._onNodeKeyEscape.bind(this))]);return this;},deactivateNode:function(n){var o=j.get(n,this._dataStoreUnique);if(o)while(o.length)o.pop().remove();this._nodes.remove(n);},setShowDelay:function(n){this._showDelay=n;return this;},setHideDelay:function(n){this._hideDelay=n;return this;},showFlyout:function(n,o){this.setActiveNode(n);if(o){this._flyout.setContext(n).show();this.inform('show',n);}else this._showTimeout=this.showFlyout.bind(this,n,true).defer(this._showDelay);return this;},hideFlyout:function(n){clearTimeout(this._showTimeout);if(n){this._flyout.hide();this._activeNode&&this.inform('hide',this._activeNode);this._activeNode=null;}else this._hideTimeout=this.hideFlyout.bind(this,true).defer(this._hideDelay);},hideFlyoutDelayed:function(n){clearTimeout(this._showTimeout);clearTimeout(this._hideTimeout);this._hideTimeout=this.hideFlyout.bind(this,true).defer(n);},getActiveNode:function(){return this._activeNode;},setActiveNode:function(n){clearTimeout(this._hideTimeout);if(this._activeNode&&this._activeNode!==n)this.hideFlyout(true);this._activeNode=n;return this;},clearNodes:function(){for(var n=this._nodes.length;n>0;n--)this.deactivateNode(this._nodes[n-1]);},destroy:function(){while(this._flyoutSubscriptions.length)this._flyout.unsubscribe(this._flyoutSubscriptions.pop());this.clearNodes();},_onNodeMouseEnter:function(n){if(this._activeNode===n){clearTimeout(this._hideTimeout);}else this.showFlyout(n);},_onFlyoutMouseEnter:function(){clearTimeout(this._hideTimeout);},_onNodeKeyEscape:function(event){if(g.getKeyCode(event)===k.ESC){this._activeNode&&this.inform('hide',this._activeNode);this._activeNode=null;}}});e.exports=a.HoverFlyout||m;});
__d("FreeformTokenizerBehavior",["Input","Keys","Event","function-extensions"],function(a,b,c,d,e,f){var g=b('Input'),h=b('Keys'),i=b('Event');b('function-extensions');function j(k,l){var m=l.tokenize_on_blur!==false,n=l.tokenize_on_paste!==false,o=l.matcher&&new RegExp(l.matcher,'i'),p=l.paste_split&&new RegExp(l.paste_split);function q(event){var r=g.getValue(k.getInput()).trim();if(p&&event&&event.type=='paste'){r=r.split(p);}else r=[r];var s=false;for(var t=0;t<r.length;t++){var u=r[t].trim();if(u&&(!o||o.test(u))){var v={uid:u,text:u,freeform:true};k.addToken(k.createToken(v));s=true;}}if(event&&s){k.getTypeahead().getCore().afterSelect();event.kill();}}k.subscribe('keydown',function(r,s){var event=s.event,t=i.getKeyCode(event);if(t==h.COMMA||t==h.RETURN){var u=k.getTypeahead().getView();if(u.getSelection()){u.select();event.kill();}else q(event);}});k.subscribe('paste',function(r,s){if(n)q.bind(null,s.event).defer(20);});k.subscribe('blur',function(r,s){if(m)q();k.getTypeahead().getCore().reset();});}e.exports=j;});