text: if (self.CavalryLogger) { CavalryLogger.start_js(["csaj2"]); }
  
  __d('DraggableItemMixin',['cssVar','cx','DOMDimensions','Draggable','Event','Keys','React','ReactDOM','Rect','joinClasses','getScrollPosition','getViewportDimensions'],function a(b,c,d,e,f,g,h,i){if(c.__markCompiled)c.__markCompiled();var j=c('React').PropTypes,k=parseInt("1024px",10),l={_draggable:null,_keyDownListener:null,propTypes:{item:j.shape({className:j.string,id:j.string.isRequired,isMovable:j.bool,isRemovable:j.bool,label:j.oneOfType([j.object,j.string]).isRequired}).isRequired,onCancelDrag:j.func.isRequired,onDrag:j.func.isRequired,onDrop:j.func.isRequired,onGrab:j.func.isRequired,onRemove:j.func.isRequired},getInitialState:function(){return {dragging:false,width:null};},_toggleDraggable:function(m){var n=c('ReactDOM').findDOMNode(this);if(m&&!this._draggable){this._draggable=new (c('Draggable'))(n).setNamespace('AbstractDraggableList').setUseAbsolute(true).setGrabHandler(this._onGrab).setDragHandler(this._onDrag).setDropHandler(this._onDrop).addHandle(c('ReactDOM').findDOMNode(this.refs.dragHandle));}else if(!m&&this._draggable){if(this._draggable.active)this._cancelDrag();this._draggable.destroy();}},componentDidMount:function(){this._toggleDraggable(this.props.item.isMovable);},componentWillUnmount:function(){this._toggleDraggable(false);},componentWillReceiveProps:function(m){this._toggleDraggable(m.item.isMovable);},_onGrab:function(){if(this.state.dragging)return;var m=c('ReactDOM').findDOMNode(this);this._keyDownListener=c('Event').listen(document,'keydown',function(p){if(p.keyCode===c('Keys').ESC){this._cancelDrag();p.preventDefault();}}.bind(this));var n=c('DOMDimensions').getElementDimensions(m),o=n.width;this.setState({dragging:true,width:o});this.props.onGrab(this.props.item.id,m);},_onDrag:function(){var m=c('ReactDOM').findDOMNode(this),n=250,o=m.parentNode,p=new (c('Rect'))(o),q=c('getViewportDimensions')(),r=c('getScrollPosition')(window),s=Math.max(q.width,k),t=new (c('Rect'))(r.y,Math.min(s,p.r+n),q.height+r.y,Math.max(0,p.l-n));this._draggable&&this._draggable.setBoundingBox(t);this.props.onDrag();},_cancelDrag:function(){this._draggable&&this._draggable.killDrag();this._endDrag();this.props.onCancelDrag();},_endDrag:function(){this._draggable&&this._draggable.resetPosition();this.setState({dragging:false,width:null});this._keyDownListener&&this._keyDownListener.remove();delete this._keyDownListener;},_onDrop:function(){this._endDrag();this.props.onDrop();},_onRemoveButtonClick:function(){this.props.onRemove(this.props.item.id);},_getRootClassName:function(){var m=this.props.item,n=(m.isMovable?"_58zo":'')+(this.state.dragging?' '+"_58zp":'')+(' '+"_58z_")+(!m.isMovable?' '+"_58-6":'');return c('joinClasses')(n,this.props.item.className||"_58-8");}};f.exports=l;},null);
  __d('BUIDefaultDraggableItem.react',['cx','DraggableItemMixin','FBOverlayContainer.react','FBOverlayElement.react','React','ReactComponentWithPureRenderMixin','XUICloseButton.react'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i=c('React').createClass({displayName:'BUIDefaultDraggableItem',mixins:[c('DraggableItemMixin'),c('ReactComponentWithPureRenderMixin')],render:function(){var j=this.props.item,k=null;if(j.isMovable)k=c('React').createElement(c('FBOverlayElement.react'),{horizontal:'left',vertical:'top'},c('React').createElement('div',{className:"_58zl"}));var l=null;if(j.isRemovable)l=c('React').createElement(c('FBOverlayElement.react'),{horizontal:'right',vertical:'fit'},c('React').createElement(c('XUICloseButton.react'),{className:"_58zm",onClick:this._onRemoveButtonClick}));var m=c('React').createElement(c('FBOverlayElement.react'),{horizontal:'left',ref:'dragHandle',vertical:'fit'},c('React').createElement('div',{className:"_58zn"}));return (c('React').createElement(c('FBOverlayContainer.react'),{className:this._getRootClassName(),key:j.id,style:{width:this.state.width}},j.label,k,m,l));}});f.exports=i;},null);
  __d('AbstractDraggableList.react',['cx','invariant','BinarySearch','BUIDefaultDraggableItem.react','DOMDimensions','joinClasses','React','ReactDOM','Rect'],function a(b,c,d,e,f,g,h,i){'use strict';var j,k;if(c.__markCompiled)c.__markCompiled();var l=c('React').PropTypes;j=babelHelpers.inherits(m,c('React').PureComponent);k=j&&j.prototype;function m(){var n,o;for(var p=arguments.length,q=Array(p),r=0;r<p;r++)q[r]=arguments[r];return n=(o=k.constructor).call.apply(o,[this].concat(q)),this.state={targetIndex:null,sourceHeight:null},this.$AbstractDraggableList5=function(s){var t=c('ReactDOM').findDOMNode(this),u=t.childNodes,v=u.length-1-(this.state.targetIndex!==null?1:0),w=c('BinarySearch').leastUpperBound(function(x){if(this.sourceIndex<=x)x+=1;if(this.state.targetIndex!==null&&this.state.targetIndex<=x)x+=1;var y=new (c('Rect'))(u[x]);return (y.t+y.b)/2;}.bind(this),s,0,v,function(x,y){return x-y;});return this.sourceIndex<=w?w+1:w;}.bind(this),this.$AbstractDraggableList4=function(s,t){this.sourceIndex=this.props.itemIDs.indexOf(s);this.sourceElem=t;var u=c('DOMDimensions').getElementDimensions(this.sourceElem),v=u.height;this.setState({sourceHeight:v});this.$AbstractDraggableList2();}.bind(this),this.$AbstractDraggableList2=function(){var s=new (c('Rect'))(this.sourceElem),t=(s.t+s.b)/2,u=this.$AbstractDraggableList5(t);while(u!==this.props.itemIDs.length&&(!this.props.itemsByID[this.props.itemIDs[u]].isMovable||u===this.sourceIndex))u+=1;this.setState({targetIndex:u});}.bind(this),this.$AbstractDraggableList3=function(){var s=this.props.itemIDs[this.sourceIndex],t=this.state.targetIndex!==this.props.itemIDs.length?this.props.itemIDs[this.state.targetIndex]:null;this.endDrag();this.props.onReorder(s,t);}.bind(this),this.$AbstractDraggableList1=function(){this.endDrag();}.bind(this),this.endDrag=function(){delete this.sourceIndex;delete this.sourceElem;this.setState({sourceHeight:null,targetIndex:null});}.bind(this),n;}m.prototype.render=function(){!(this.props.itemIDs.length!==0)?i(0):void 0;var n=this.props.itemsRenderer,o=this.props.itemIDs.map(function(s){return c('React').createElement(n,{className:this.props.className,item:this.props.itemsByID[s],key:s,onCancelDrag:this.$AbstractDraggableList1,onDrag:this.$AbstractDraggableList2,onDrop:this.$AbstractDraggableList3,onGrab:this.$AbstractDraggableList4,onRemove:this.props.onRemove,onSettingsClick:this.props.onSettingsClick});}.bind(this));if(this.state.targetIndex!==null){var p=this.props.itemIDs[this.sourceIndex],q=this.props.itemsByID[p],r=c('React').createElement('li',{className:q.placeholderClassName||"_58-9",key:'_placeholder',style:{height:this.state.sourceHeight}});o.splice(this.state.targetIndex,0,r);}return c('React').createElement('ul',babelHelpers['extends']({},this.props,{className:c('joinClasses')(this.props.className,"_58-a")}),o);};m.propTypes={className:l.string,itemIDs:l.array.isRequired,itemsByID:l.object.isRequired,itemsRenderer:l.func.isRequired,onRemove:l.func.isRequired,onReorder:l.func.isRequired,onSettingsClick:l.func};m.defaultProps={itemsRenderer:c('BUIDefaultDraggableItem.react')};f.exports=m;},null);
  __d('BUIDraggableList.react',['cx','invariant','AbstractDraggableList.react','FBOverlayBase.react','joinClasses','mapObject','React','XUIGrayText.react'],function a(b,c,d,e,f,g,h,i){'use strict';var j,k;if(c.__markCompiled)c.__markCompiled();var l=c('React').PropTypes;j=babelHelpers.inherits(m,c('React').PureComponent);k=j&&j.prototype;function m(){var n,o;for(var p=arguments.length,q=Array(p),r=0;r<p;r++)q[r]=arguments[r];return n=(o=k.constructor).call.apply(o,[this].concat(q)),this.$BUIDraggableList1=function(s){var t=c('React').createElement(c('FBOverlayBase.react'),null,c('React').createElement('div',null,c('React').createElement(c('XUIGrayText.react'),{shade:'medium'},c('React').createElement('div',{className:"ellipsis"},s))));return t;},this.$BUIDraggableList2=function(s){var t=c('mapObject')(s,function(u){var v=this.$BUIDraggableList1(u.label),w=babelHelpers['extends']({},u,{label:v});return w;}.bind(this));return t;}.bind(this),n;}m.prototype.render=function(){!(this.props.itemIDs.length!==0)?i(0):void 0;var n=c('joinClasses')(this.props.className,"_5nz6");return (c('React').createElement(c('AbstractDraggableList.react'),babelHelpers['extends']({},this.props,{className:n,itemsByID:this.$BUIDraggableList2(this.props.itemsByID)})));};m.propTypes={itemIDs:l.arrayOf(l.string.isRequired).isRequired,itemsByID:l.object.isRequired,onRemove:l.func.isRequired,onReorder:l.func.isRequired};f.exports=m;},null);
  __d('PollAddOptionMutation',['GraphQLMutatorConstants','Relay','RelayMutationType'],function a(b,c,d,e,f,g){'use strict';var h,i;if(c.__markCompiled)c.__markCompiled();h=babelHelpers.inherits(j,c('Relay').Mutation);i=h&&h.prototype;j.prototype.getMutation=function(){return function(){return {calls:[{kind:'Call',metadata:{},name:'question_add_option',value:{kind:'CallVariable',callVariableName:'input'}}],children:[{fieldName:'client_mutation_id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],kind:'Mutation',metadata:{inputType:'QuestionAddOptionData!'},name:'PollAddOptionMutation',responseType:'QuestionAddOptionResponsePayload'};}();};j.prototype.getVariables=function(){return {question_id:this.props.question.id,option_text:this.props.optionText,option_page_id:this.props.optionPageID,actor_id:this.props.viewer.actor.id};};j.prototype.getConfigs=function(){return [{type:c('RelayMutationType').RANGE_ADD,parentName:'question',parentID:this.props.question.id,connectionName:'options',edgeName:'question_options_edge',rangeBehaviors:{'':c('GraphQLMutatorConstants').PREPEND,'orderby(vote_count)':c('GraphQLMutatorConstants').APPEND}},{type:c('RelayMutationType').FIELDS_CHANGE,fieldIDs:{question:this.props.question.id}}];};j.prototype.getFatQuery=function(){return function(){return {children:[{children:[{fieldName:'options',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionsConnection'},{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'question',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id'},type:'Question'},{children:[{fieldName:'cursor',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'},{children:[{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'node',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isGenerated:true,isRequisite:true},type:'QuestionOption'}],fieldName:'question_options_edge',kind:'Field',metadata:{canHaveSubselections:true},type:'QuestionOptionsEdge'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollAddOptionMutationRelayQL',type:'QuestionAddOptionResponsePayload'};}();};j.prototype.$PollOptionMutation1=function(){var k=this.props.question.author.id===this.props.viewer.actor.id;return {node:{text_with_entities:{text:this.props.optionText},viewer_has_voted:!k,voters:{count:k?0:1,edges:k?[]:[{node:{is_viewer_friend:false}}]}}};};j.prototype.getOptimisticResponse=function(){var k=this.props.question.author.id===this.props.viewer.actor.id,l=this.props.question.options.edges.map(function(m){var n=babelHelpers['extends']({},m.node);if(this.props.question.response_method==='CHOOSE_ONE'&&m.node.viewer_has_voted&&!k){n.viewer_has_voted=false;n.voters={count:m.node.voters.count-1};}return {node:n};}.bind(this));l.push(this.$PollOptionMutation1());return {question:{id:this.props.question.id,options:{count:this.props.question.options.count+1,edges:l}},question_options_edge:this.$PollOptionMutation1()};};function j(){h.apply(this,arguments);}j.initialVariables={num_options_to_show:100};j.fragments={question:function(){return function(){return {children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'__typename',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'String'}],fieldName:'author',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isAbstract:true},type:'Actor'},{fieldName:'response_method',kind:'Field',metadata:{},type:'QuestionResponseMethod'},{calls:[{kind:'Call',metadata:{type:'[QuestionOptionsOrdering]'},name:'orderby',value:{kind:'CallValue',callValue:'vote_count'}},{kind:'Call',metadata:{},name:'first',value:{kind:'CallVariable',callVariableName:'num_options_to_show'}}],children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'},{children:[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'viewer_has_voted',kind:'Field',metadata:{},type:'Boolean'},{children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'}],fieldName:'voters',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionVotersConnection'}],fieldName:'node',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isRequisite:true},type:'QuestionOption'},{fieldName:'cursor',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'edges',kind:'Field',metadata:{canHaveSubselections:true,isPlural:true},type:'QuestionOptionsEdge'},{children:[{fieldName:'has_next_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'},{fieldName:'has_previous_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'}],fieldName:'page_info',kind:'Field',metadata:{canHaveSubselections:true,isGenerated:true,isRequisite:true},type:'PageInfo'}],fieldName:'options',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionsConnection'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollAddOptionMutation_QuestionRelayQL',type:'Question'};}();},viewer:function(){return function(){return {children:[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'__typename',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'String'}],fieldName:'actor',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isAbstract:true},type:'Actor'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollAddOptionMutation_ViewerRelayQL',type:'Viewer'};}();}};f.exports=j;},null);
  __d('PollVoteMutation',['Relay','RelayMutationType'],function a(b,c,d,e,f,g){'use strict';var h,i;if(c.__markCompiled)c.__markCompiled();h=babelHelpers.inherits(j,c('Relay').Mutation);i=h&&h.prototype;j.prototype.getMutation=function(){return this.props.option.viewer_has_voted?function(){return {calls:[{kind:'Call',metadata:{},name:'question_remove_vote',value:{kind:'CallVariable',callVariableName:'input'}}],children:[{fieldName:'client_mutation_id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],kind:'Mutation',metadata:{inputType:'QuestionRemoveVoteData!'},name:'PollVoteMutation',responseType:'QuestionRemoveVoteResponsePayload'};}():function(){return {calls:[{kind:'Call',metadata:{},name:'question_add_vote',value:{kind:'CallVariable',callVariableName:'input'}}],children:[{fieldName:'client_mutation_id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],kind:'Mutation',metadata:{inputType:'QuestionAddVoteData!'},name:'PollVoteMutation',responseType:'QuestionAddVoteResponsePayload'};}();};j.prototype.getVariables=function(){return {question_id:this.props.question.id,option_id:this.props.option.id,actor_id:this.props.viewer.actor.id,rank:this.props.rank};};j.prototype.getConfigs=function(){return [{type:c('RelayMutationType').FIELDS_CHANGE,fieldIDs:{question:this.props.question.id}}];};j.prototype.getCollisionKey=function(){return 'question_vote_'+this.props.option.id;};j.prototype.getFatQuery=function(){return function(){return {children:[{children:[{fieldName:'viewer_has_voted',kind:'Field',metadata:{},type:'Boolean'},{children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'}],fieldName:'voters',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionVotersConnection'},{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'option',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id'},type:'QuestionOption'},{children:[{fieldName:'options',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionsConnection'},{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'question',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id'},type:'Question'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{pattern:true},name:'PollVoteMutationRelayQL',type:'QuestionAddVoteResponsePayload'};}();};j.prototype.getOptimisticResponse=function(){var k=this.props.question.options.edges.map(function(l){var m=babelHelpers['extends']({},l.node);if(this.props.option.id===l.node.id){m.viewer_has_voted=!this.props.option.viewer_has_voted;m.voters.count=this.props.option.viewer_has_voted?this.props.option.voters.count-1:this.props.option.voters.count+1;}else if(this.props.question.response_method==='CHOOSE_ONE'&&!this.props.option.viewer_has_voted&&l.node.viewer_has_voted){m.viewer_has_voted=false;m.voters.count=l.node.voters.count-1;}return {node:m};}.bind(this));return {question:{id:this.props.question.id,options:{edges:k}}};};function j(){h.apply(this,arguments);}j.initialVariables={num_options_to_show:100};j.fragments={question:function(){return function(){return {children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'response_method',kind:'Field',metadata:{},type:'QuestionResponseMethod'},{calls:[{kind:'Call',metadata:{type:'[QuestionOptionsOrdering]'},name:'orderby',value:{kind:'CallValue',callValue:'vote_count'}},{kind:'Call',metadata:{},name:'first',value:{kind:'CallVariable',callVariableName:'num_options_to_show'}}],children:[{children:[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'viewer_has_voted',kind:'Field',metadata:{},type:'Boolean'},{calls:[{kind:'Call',metadata:{},name:'first',value:{kind:'CallValue',callValue:5}}],children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'}],fieldName:'voters',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionVotersConnection'}],fieldName:'node',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isRequisite:true},type:'QuestionOption'},{fieldName:'cursor',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'edges',kind:'Field',metadata:{canHaveSubselections:true,isPlural:true},type:'QuestionOptionsEdge'},{children:[{fieldName:'has_next_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'},{fieldName:'has_previous_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'}],fieldName:'page_info',kind:'Field',metadata:{canHaveSubselections:true,isGenerated:true,isRequisite:true},type:'PageInfo'}],fieldName:'options',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionsConnection'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollVoteMutation_QuestionRelayQL',type:'Question'};}();},option:function(){return function(){return {children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'viewer_has_voted',kind:'Field',metadata:{},type:'Boolean'},{children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'}],fieldName:'voters',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionVotersConnection'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollVoteMutation_OptionRelayQL',type:'QuestionOption'};}();},viewer:function(){return function(){return {children:[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'__typename',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'String'}],fieldName:'actor',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isAbstract:true},type:'Actor'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollVoteMutation_ViewerRelayQL',type:'Viewer'};}();}};f.exports=j;},null);
  __d('PollAttachmentAddOption.react',['cx','fbt','xuiglyph','AbstractTextArea.react','Image.react','React','TextAreaControl'],function a(b,c,d,e,f,g,h,i,j){'use strict';var k,l;if(c.__markCompiled)c.__markCompiled();var m=c('React').PropTypes,n={addOption:"_31qf _31qg",addOptionLabel:"_31qh _31qi",charCount:"_31qk",addOptionInput:"_4sjs"};k=babelHelpers.inherits(o,c('React').Component);l=k&&k.prototype;function o(p){l.constructor.call(this,p);this.state={text:'',isFocused:false};}o.prototype.componentDidMount=function(){var p=this.refs.textArea.getTextFieldDOM();this.$PollAttachmentAddOption1=new (c('TextAreaControl'))(p);this.$PollAttachmentAddOption1.setAutogrow(true);this.$PollAttachmentAddOption1.onupdate();};o.prototype.componentDidUpdate=function(){this.$PollAttachmentAddOption1.onupdate();};o.prototype.componentWillUnmount=function(){this.$PollAttachmentAddOption1=null;};o.prototype.render=function(){return (c('React').createElement('div',null,c('React').createElement('div',{className:n.charCount},c('React').createElement('div',{hidden:!this.state.isFocused},this.state.text.length,'/',this.props.maxOptionLength)),c('React').createElement('div',{className:n.addOption},c('React').createElement('div',{className:n.addOptionLabel},c('React').createElement(c('Image.react'),{src:j({name:'plus',size:'small',shade:'light'})})),c('React').createElement('div',{className:n.addOptionInput},c('React').createElement(c('AbstractTextArea.react'),{onChange:function(event){return this.$PollAttachmentAddOption2(event);}.bind(this),onEnter:function(event){return this.$PollAttachmentAddOption3(event);}.bind(this),maxLength:this.props.maxOptionLength,disabled:this.props.disabled,onFocus:function(){return this.setState({isFocused:true});}.bind(this),onBlur:function(){return this.setState({isFocused:false});}.bind(this),placeholder:i._("Add an option..."),value:this.state.text,ref:'textArea'})))));};o.prototype.$PollAttachmentAddOption2=function(event){if(event.target.value.length>this.props.maxOptionLength)return;this.setState({text:event.target.value});};o.prototype.$PollAttachmentAddOption3=function(event){this.props.onAdd(event);this.setState({text:''});};o.propTypes={onAdd:m.func.isRequired,maxOptionLength:m.number.isRequired,disabled:m.bool.isRequired};f.exports=o;},null);
  __d('RankedPollAttachmentItem.react',['cx','DraggableItemMixin','React','ReactComponentWithPureRenderMixin','TextWithEntities.react','getURLRanges'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i={row:"_31qf",optionRow:"_31qf _20h9",optionBar:"_3col",optionText:"_3con"},j=c('React').createClass({displayName:'RankedPollAttachmentItem',mixins:[c('DraggableItemMixin'),c('ReactComponentWithPureRenderMixin')],render:function(){var k=this.props.item,l=k.canViewerChange,m=k.option;return (c('React').createElement('div',{key:m.node.id,ref:'dragHandle'},c('React').createElement('div',{className:l?i.optionRow:i.row},c('React').createElement('div',{className:i.optionBar},c('React').createElement('div',{className:i.optionText},c('React').createElement(c('TextWithEntities.react'),{ranges:c('getURLRanges')(m.node.text_with_entities.text),renderEmoticons:false,renderEmoji:true,text:m.node.text_with_entities.text}))))));}});f.exports=j;},null);
  __d("XWebQuestionsRankedPollsRankingController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/ajax\/questions\/polls\/ranked\/ranking\/",{question_id:{type:"Int",required:true}});},null);
  __d('RankedPollAttachmentComponent.react',['cx','AsyncRequest','BUIDraggableList.react','InsightsTabbedSection.react','InsightsTabbedSections.react','PollVoteMutation','RankedPollAttachmentItem.react','React','Relay','XUIButton.react','XWebQuestionsRankedPollsRankingController'],function a(b,c,d,e,f,g,h){var i,j;if(c.__markCompiled)c.__markCompiled();i=babelHelpers.inherits(k,c('React').Component);j=i&&i.prototype;function k(){var m;'use strict';(m=j.constructor).call.apply(m,[this].concat(Array.prototype.slice.call(arguments)));this.$RankedPollAttachmentComponent2=function(n){var o=n.type.getKey(n.props);if(o==='results'){this.$RankedPollAttachmentComponent6();}else this.setState({activeKey:o});}.bind(this);this.$RankedPollAttachmentComponent5=function(){var n=this.props,o=n.question,p=n.viewer,q=this.state,r=q.itemIDs,s=q.itemsByID;r.forEach(function(t,u){var v=s[t].option;this.setState({isLocked:true});c('Relay').Store.commitUpdate(new (c('PollVoteMutation'))({question:o,option:v.node,viewer:p,rank:u+1,num_options_to_show:o.options.count}),{onSuccess:function(){this.setState({isLocked:false});this.$RankedPollAttachmentComponent6();}.bind(this),onFailure:function(w){this.setState({isLocked:false});}.bind(this)});}.bind(this));}.bind(this);this.$RankedPollAttachmentComponent4=function(n,o){var p=this.state.itemIDs.slice(0),q=p.indexOf(n);p.splice(q,1);if(o){var r=p.indexOf(o);p.splice(r,0,n);}else p.push(n);this.setState({itemIDs:p,reordered:true});}.bind(this);this.$RankedPollAttachmentComponent1=l();this.state={itemIDs:[],orderedItemIDs:[],itemsByID:{},orderedItemsByID:{},isLocked:false,disableShuffle:false,reordered:false,activeKey:'vote'};}k.prototype.componentWillMount=function(){'use strict';var m=this.props.question,n=this.state.isLocked,o=!n&&m.can_viewer_post,p=[],q={},r={},s=m.options.edges;s.forEach(function(t){var u=this.$RankedPollAttachmentComponent1();p.push(u);q[u]={canViewerChange:o,option:t,id:u,isMovable:true};r[u]={canViewerChange:o,option:t,id:u,isMovable:false};}.bind(this));this.setState({itemIDs:p,itemsByID:q,orderedItemsByID:r});};k.prototype.render=function(){'use strict';return c('React').createElement(c('InsightsTabbedSections.react'),{activeKey:this.state.activeKey,onTabClick:this.$RankedPollAttachmentComponent2},c('React').createElement(c('InsightsTabbedSection.react'),{sectionKey:'vote',title:'Vote'},c('React').createElement('div',null,c('React').createElement(c('BUIDraggableList.react'),{className:"_151l",itemIDs:this.state.itemIDs,itemsByID:this.state.itemsByID,itemsRenderer:c('RankedPollAttachmentItem.react'),onRemove:this.$RankedPollAttachmentComponent3,onReorder:this.$RankedPollAttachmentComponent4,style:{paddingBottom:'10px'}}),c('React').createElement(c('XUIButton.react'),{disabled:!this.state.reordered,label:'Submit',use:'confirm',onClick:this.$RankedPollAttachmentComponent5}))),c('React').createElement(c('InsightsTabbedSection.react'),{sectionKey:'results',title:'Results'},c('React').createElement(c('BUIDraggableList.react'),{itemIDs:this.state.orderedItemIDs,itemsByID:this.state.orderedItemsByID,itemsRenderer:c('RankedPollAttachmentItem.react'),onRemove:function(){return null;},onReorder:function(){return null;}})));};k.prototype.$RankedPollAttachmentComponent6=function(){'use strict';var m=c('XWebQuestionsRankedPollsRankingController').getURIBuilder().setInt('question_id',this.props.question.id).getURI();new (c('AsyncRequest'))().setURI(m).setHandler(function(n){var o=n.getPayload().orderedItemIDs,p=[];for(var q=0;q<o.length;q++)for(var r in this.state.itemsByID){var s=this.state.itemsByID[r].option.node.id;if(s===o[q]){p.push(r);break;}}this.setState({orderedItemIDs:p,activeKey:'results'});}.bind(this)).send();};k.prototype.$RankedPollAttachmentComponent3=function(){'use strict';};function l(){var m=0;return function(){return (m++).toString(32);};}f.exports=k;},null);
  __d('PollAttachmentComponent.react',['cx','fbt','getURLRanges','Facepile.react','PollAddOptionMutation','PollVoteMutation','PollAttachmentAddOption.react','ProfileBrowserLink','ReactComposerQuestionAttachmentConfig','RankedPollAttachmentComponent.react','React','Relay','TextWithEntities.react','randomShuffle'],function a(b,c,d,e,f,g,h,i){'use strict';var j,k;if(c.__markCompiled)c.__markCompiled();var l={root:"_3cof",facepile:"_3cog",row:"_31qf",optionRow:"_31qf _1jwy",optionLabel:"_31qh _3coj",optionSelector:"_3cok",optionBar:"_3col",optionVotes:"_3com",optionText:"_3con",optionExpanderLink:"_3coo",optionExpander:"_31qf _3cop",space:"_3coq"};j=babelHelpers.inherits(m,c('React').Component);k=j&&j.prototype;function m(n){k.constructor.call(this,n);this.state={isLocked:false,disableShuffle:false};}m.prototype.render=function(){var n=this.props.question;if(c('ReactComposerQuestionAttachmentConfig').ranked_polls_gk){var o=n.response_method;if(o==='RANKED')return c('React').createElement(c('RankedPollAttachmentComponent.react'),this.props);}var p=!this.state.isLocked&&n.can_viewer_post,q=this.props.relay.variables.num_options_to_show,r=n.options.edges.reduce(function(y,z){return Math.max(y,z.node.voters.count);},1),s=n.options.edges;if(this.props.relay.route.params.shouldShuffle&&!this.state.disableShuffle)s=c('randomShuffle')(s);s=s.slice(0,q).map(function(y){var z=function(ea){if(!p)return;if(ea.target.href!==undefined)return;this.setState({isLocked:true});c('Relay').Store.commitUpdate(new (c('PollVoteMutation'))({question:n,option:y.node,viewer:this.props.viewer,num_options_to_show:n.options.count}),{onSuccess:function(){this.setState({isLocked:false});}.bind(this),onFailure:function(fa){this.setState({isLocked:false});}.bind(this)});}.bind(this),aa=y.node.voters.edges.filter(function(ea){return ea.node.is_viewer_friend;}).slice(0,5).map(function(ea){return ea.node;});if(y.node.viewer_has_voted)aa.unshift(this.props.viewer.actor);var ba=aa.map(function(ea){return {URL:ea.url,name:ea.name,uniqueID:parseInt(ea.id,10),profilePicURI:ea.profile_picture.uri};}),ca=c('ProfileBrowserLink').constructPageURI('option_voters',{option_id:y.node.id}).toString(),da=c('ProfileBrowserLink').constructDialogURI('option_voters',{option_id:y.node.id}).toString();return (c('React').createElement('div',{key:y.node.id},c('React').createElement('div',{className:l.facepile},c('React').createElement(c('Facepile.react'),{moreColor:'gray',moreCount:y.node.voters.count-Math.min(5,ba.length),moreDialogLink:da,morePageLink:ca,numFaces:5,profiles:ba,showHovercard:true,size:28})),c('React').createElement('div',{className:p?l.optionRow:l.row},c('React').createElement('div',{className:l.optionLabel,onClick:z},c('React').createElement('input',{type:n.response_method==='CHOOSE_MULTIPLE'?'checkbox':'radio',disabled:!p,className:l.optionSelector,checked:y.node.viewer_has_voted})),c('React').createElement('div',{className:l.optionBar,onClick:z},c('React').createElement('div',{className:l.optionVotes,style:{width:100*y.node.voters.count/r+'%'}}),c('React').createElement('div',{className:l.optionText},c('React').createElement(c('TextWithEntities.react'),{ranges:c('getURLRanges')(y.node.text_with_entities.text),renderEmoticons:false,renderEmoji:true,text:y.node.text_with_entities.text}))))));}.bind(this));var t=null,u=null;if(n.options.count>q){var v=n.options.count-q,w=i._({"*":"{options} More Options..."},[i.param('options',v,[0])]),x=i._("1 More Option...");t=c('React').createElement('div',null,c('React').createElement('div',{className:l.space}),c('React').createElement('a',{className:l.optionExpanderLink,onClick:function(){return this.$PollAttachmentComponent1();}.bind(this)},c('React').createElement('div',{className:l.optionExpander},v>1?w:x)));}else if(n.poll_answers_state==='OPEN'&&n.can_viewer_post)u=c('React').createElement(c('PollAttachmentAddOption.react'),{onAdd:function(y){return this.$PollAttachmentComponent2(y);}.bind(this),maxOptionLength:this.props.maxOptionLength,disabled:this.state.isLocked});return (c('React').createElement('div',{className:l.root},s,t,u));};m.prototype.$PollAttachmentComponent1=function(){this.setState({disableShuffle:true});this.props.relay.setVariables({num_options_to_show:this.props.question.options.count});};m.prototype.$PollAttachmentComponent2=function(event){this.setState({isLocked:true});this.props.relay.setVariables({num_options_to_show:this.props.relay.variables.num_options_to_show+1});c('Relay').Store.commitUpdate(new (c('PollAddOptionMutation'))({question:this.props.question,optionText:event.target.value,viewer:this.props.viewer}),{onSuccess:function(){this.setState({isLocked:false});}.bind(this),onFailure:function(n){this.setState({isLocked:false});this.props.relay.setVariables({num_options_to_show:this.props.relay.variables.num_options_to_show-1});}.bind(this)});};f.exports=m;},null);
  __d('PollAttachmentContainer.react',['PollAttachmentComponent.react','PollAddOptionMutation','PollVoteMutation','Relay'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('Relay').createContainer(c('PollAttachmentComponent.react'),{initialVariables:{num_options_to_show:5,should_shuffle:false},fragments:{viewer:function(){return function(i,j){return {children:[].concat.apply([],[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'name',kind:'Field',metadata:{},type:'String'},{calls:[{kind:'Call',metadata:{},name:'size__width',value:{kind:'CallValue',callValue:32}}],children:[{fieldName:'uri',kind:'Field',metadata:{},type:'Url'}],directives:[{kind:'Directive',name:'fixme_call_args',args:[]}],fieldName:'profile_picture',kind:'Field',metadata:{canHaveSubselections:true},type:'Image'},{fieldName:'__typename',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'String'},{children:[{calls:[{kind:'Call',metadata:{type:'SiteEnum'},name:'site',value:{kind:'CallValue',callValue:'www'}}],fieldName:'url',kind:'Field',metadata:{},type:'Url'},{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'User',type:'User'}],fieldName:'actor',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isAbstract:true},type:'Actor'},c('Relay').QL.__frag(i),c('Relay').QL.__frag(j)]),id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollAttachmentContainer_react_ViewerRelayQL',type:'Viewer'};}(c('PollVoteMutation').getFragment('viewer'),c('PollAddOptionMutation').getFragment('viewer'));},question:function(i){var j=i.num_options_to_show,k=i.should_shuffle;return function(l,m,n,o){return {children:[].concat.apply([],[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'response_method',kind:'Field',metadata:{},type:'QuestionResponseMethod'},{fieldName:'poll_answers_state',kind:'Field',metadata:{},type:'QuestionPollAnswersState'},{fieldName:'can_viewer_post',kind:'Field',metadata:{},type:'Boolean'},{calls:[{kind:'Call',metadata:{type:'[QuestionOptionsOrdering]'},name:'orderby',value:{kind:'CallValue',callValue:'vote_count'}},{kind:'Call',metadata:{},name:'first',value:c('Relay').QL.__var(l)}],children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'},{children:[{children:[].concat.apply([],[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{children:[{fieldName:'text',kind:'Field',metadata:{},type:'String'},{fieldName:'ranges',kind:'Field',metadata:{canHaveSubselections:true,isPlural:true},type:'EntityAtRange'}],fieldName:'text_with_entities',kind:'Field',metadata:{canHaveSubselections:true},type:'TextWithEntities'},{fieldName:'viewer_has_voted',kind:'Field',metadata:{},type:'Boolean'},{calls:[{kind:'Call',metadata:{},name:'first',value:{kind:'CallValue',callValue:5}}],children:[{fieldName:'count',kind:'Field',metadata:{},type:'Int'},{children:[{children:[{fieldName:'id',kind:'Field',metadata:{isRequisite:true},type:'ID'},{fieldName:'name',kind:'Field',metadata:{},type:'String'},{fieldName:'is_viewer_friend',kind:'Field',metadata:{},type:'Boolean'},{calls:[{kind:'Call',metadata:{type:'SiteEnum'},name:'site',value:{kind:'CallValue',callValue:'www'}}],fieldName:'url',kind:'Field',metadata:{},type:'Url'},{calls:[{kind:'Call',metadata:{},name:'size__width',value:{kind:'CallValue',callValue:30}}],children:[{fieldName:'uri',kind:'Field',metadata:{},type:'Url'}],directives:[{kind:'Directive',name:'fixme_call_args',args:[]}],fieldName:'profile_picture',kind:'Field',metadata:{canHaveSubselections:true},type:'Image'}],fieldName:'node',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isRequisite:true},type:'User'},{fieldName:'cursor',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'edges',kind:'Field',metadata:{canHaveSubselections:true,isPlural:true},type:'QuestionOptionVotersEdge'},{children:[{fieldName:'has_next_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'},{fieldName:'has_previous_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'}],fieldName:'page_info',kind:'Field',metadata:{canHaveSubselections:true,isGenerated:true,isRequisite:true},type:'PageInfo'}],fieldName:'voters',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionVotersConnection'},c('Relay').QL.__frag(m)]),fieldName:'node',kind:'Field',metadata:{canHaveSubselections:true,inferredRootCallName:'node',inferredPrimaryKey:'id',isRequisite:true},type:'QuestionOption'},{fieldName:'cursor',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'}],fieldName:'edges',kind:'Field',metadata:{canHaveSubselections:true,isPlural:true},type:'QuestionOptionsEdge'},{children:[{fieldName:'has_next_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'},{fieldName:'has_previous_page',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'Boolean'}],fieldName:'page_info',kind:'Field',metadata:{canHaveSubselections:true,isGenerated:true,isRequisite:true},type:'PageInfo'}],fieldName:'options',kind:'Field',metadata:{canHaveSubselections:true,isConnection:true,isFindable:true},type:'QuestionOptionsConnection'},c('Relay').QL.__frag(n),c('Relay').QL.__frag(o)]),id:c('Relay').QL.__id(),kind:'Fragment',metadata:{},name:'PollAttachmentContainer_react_QuestionRelayQL',type:'Question'};}(k?200:j,c('PollVoteMutation').getFragment('option'),c('PollVoteMutation').getFragment('question',{num_options_to_show:j}),c('PollAddOptionMutation').getFragment('question',{num_options_to_show:j}));}}});f.exports=h;},null);
  __d('PollAttachment.react',['PollAttachmentContainer.react','React','Relay','RelayRootContainer'],function a(b,c,d,e,f,g){'use strict';var h,i,j,k;if(c.__markCompiled)c.__markCompiled();var l=c('React').PropTypes;h=babelHelpers.inherits(m,c('Relay').Route);i=h&&h.prototype;function m(){h.apply(this,arguments);}m.routeName='PollAttachmentRoute';m.paramDefinitions={question:{type:'String',required:true},shouldShuffle:{type:'Boolean',required:false}};m.queries={viewer:function(o){return function(p){return {children:[].concat.apply([],[c('Relay').QL.__frag(p)]),fieldName:'viewer',kind:'Query',metadata:{},name:'PollAttachment_react',type:'Viewer'};}(o.getFragment('viewer'));},question:function(o){return function(p){return {calls:[{kind:'Call',metadata:{type:'ID!'},name:'id',value:{kind:'CallVariable',callVariableName:'question'}}],children:[].concat.apply([],[{fieldName:'id',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'ID'},{fieldName:'__typename',kind:'Field',metadata:{isGenerated:true,isRequisite:true},type:'String'},c('Relay').QL.__frag(p)]),fieldName:'node',kind:'Query',metadata:{isAbstract:true,identifyingArgName:'id',identifyingArgType:'ID!'},name:'PollAttachment_react',type:'Node'};}(o.getFragment('question'));}};j=babelHelpers.inherits(n,c('React').Component);k=j&&j.prototype;n.prototype.render=function(){return (c('React').createElement(c('RelayRootContainer'),{Component:c('PollAttachmentContainer.react'),route:new m({question:this.props.question,maxOptionLength:this.props.maxOptionLength,shouldShuffle:this.props.shouldShuffle})}));};function n(){j.apply(this,arguments);}n.propTypes={question:l.string.isRequired,maxOptionLength:l.number.isRequired,shouldShuffle:l.bool};f.exports=n;},null);