distraction.party/priv/static/packs/features/compose.js

2 lines
No EOL
58 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{649:function(e,l,u){"use strict";(function(e){u.d(l,"a",function(){return r});var n=u(0),a=u(7),t=u(2),o=u.n(t),i=u(64),s=u.n(i),c=e.env.CDN_HOST||"",r=function(e){function t(){return e.apply(this,arguments)||this}return Object(a.a)(t,e),t.prototype.render=function(){var e,t=this.props.emoji;if(t.custom)e=t.imageUrl;else{var a=s.a[t.native]||s.a[t.native.replace(/\uFE0F$/,"")];if(!a)return null;e=c+"/emoji/"+a.filename+".svg"}return Object(n.a)("div",{className:"autosuggest-emoji"},void 0,Object(n.a)("img",{className:"emojione",src:e,alt:t.native||t.colons}),t.colons)},t}(o.a.PureComponent)}).call(this,u(52))},650:function(e,D,T){"use strict";(function(e){T.d(D,"a",function(){return I});var t,a,n,o,l,i,d=T(0),s=T(3),c=T(7),r=T(1),u=T(2),p=T.n(u),b=T(6),g=T(46),h=T(245),m=T.n(h),f=T(12),j=T.n(f),O=T(77),v=T.n(O),_=T(38),y=Object(b.f)({emoji:{id:"emoji_button.label",defaultMessage:"Insert emoji"},emoji_search:{id:"emoji_button.search",defaultMessage:"Search..."},emoji_not_found:{id:"emoji_button.not_found",defaultMessage:"No emojos!! (╯°□°)╯︵ ┻━┻"},custom:{id:"emoji_button.custom",defaultMessage:"Custom"},recent:{id:"emoji_button.recent",defaultMessage:"Frequently used"},search_results:{id:"emoji_button.search_results",defaultMessage:"Search results"},people:{id:"emoji_button.people",defaultMessage:"People"},nature:{id:"emoji_button.nature",defaultMessage:"Nature"},food:{id:"emoji_button.food",defaultMessage:"Food & Drink"},activity:{id:"emoji_button.activity",defaultMessage:"Activity"},travel:{id:"emoji_button.travel",defaultMessage:"Travel & Places"},objects:{id:"emoji_button.objects",defaultMessage:"Objects"},symbols:{id:"emoji_button.symbols",defaultMessage:"Symbols"},flags:{id:"emoji_button.flags",defaultMessage:"Flags"}}),C=e.env.CDN_HOST||"",k=function(){return C+"/emoji/sheet_10.png"},M=!!v.a.hasSupport&&{passive:!0},S=["recent","custom","people","nature","foods","activity","places","objects","symbols","flags"],w=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(r.a)(Object(s.a)(t),"handleClick",function(e){t.props.onSelect(1*e.currentTarget.getAttribute("data-index"))}),Object(r.a)(Object(s.a)(t),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(r.a)(Object(s.a)(t),"setRef",function(e){t.node=e}),t}Object(c.a)(e,o);var t=e.prototype;return t.componentWillReceiveProps=function(e){e.active?this.attachListeners():this.removeListeners()},t.componentWillUnmount=function(){this.removeListeners()},t.attachListeners=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,M)},t.removeListeners=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,M)},t.render=function(){var e=this.props.active;return p.a.createElement("div",{className:"emoji-picker-dropdown__modifiers__menu",style:{display:e?"block":"none"},ref:this.setRef},Object(d.a)("button",{onClick:this.handleClick,"data-index":1},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:1,backgroundImageFn:k})),Object(d.a)("button",{onClick:this.handleClick,"data-index":2},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:2,backgroundImageFn:k})),Object(d.a)("button",{onClick:this.handleClick,"data-index":3},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:3,backgroundImageFn:k})),Object(d.a)("button",{onClick:this.handleClick,"data-index":4},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:4,backgroundImageFn:k})),Object(d.a)("button",{onClick:this.handleClick,"data-index":5},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:5,backgroundImageFn:k})),Object(d.a)("button",{onClick:this.handleClick,"data-index":6},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:6,backgroundImageFn:k})))},e}(p.a.PureComponent),x=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(r.a)(Object(s.a)(t),"handleClick",function(){t.props.active?t.props.onClose():t.props.onOpen()}),Object(r.a)(Object(s.a)(t),"handleSelect",function(e){t.props.onChange(e),t.props.onClose()}),t}return Object(c.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.active,a=e.modifier;return Object(d.a)("div",{className:"emoji-picker-dropdown__modifiers"},void 0,Object(d.a)(i,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:a,onClick:this.handleClick,backgroundImageFn:k}),Object(d.a)(w,{active:t,onSelect:this.handleSelect,onClose:this.props.onClose}))},e}(p.a.PureComponent),N=Object(b.g)((n=a=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(r.a)(Object(s.a)(t),"state",{modifierOpen:!1,placement:null}),Object(r.a)(Object(s.a)(t),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(r.a)(Object(s.a)(t),"setRef",function(e){t.node=e}),Object(r.a)(Object(s.a)(t),"getI18n",function(){var e=t.props.intl;return{search:e.formatMessage(y.emoji_search),notfound:e.formatMessage(y.emoji_not_found),categories:{search:e.formatMessage(y.search_results),recent:e.formatMessage(y.recent),people:e.formatMessage(y.people),nature:e.formatMessage(y.nature),foods:e.formatMessage(y.food),activity:e.formatMessage(y.activity),places:e.formatMessage(y.travel),objects:e.formatMessage(y.objects),symbols:e.formatMessage(y.symbols),flags:e.formatMessage(y.flags),custom:e.formatMessage(y.custom)}}}),Object(r.a)(Object(s.a)(t),"handleClick",function(e){e.native||(e.native=e.colons),t.props.onClose(),t.props.onPick(e)}),Object(r.a)(Object(s.a)(t),"handleModifierOpen",function(){t.setState({modifierOpen:!0})}),Object(r.a)(Object(s.a)(t),"handleModifierClose",function(){t.setState({modifierOpen:!1})}),Object(r.a)(Object(s.a)(t),"handleModifierChange",function(e){t.props.onSkinTone(e)}),t}Object(c.a)(e,o);var t=e.prototype;return t.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,M)},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,M)},t.render=function(){var e=this.props,t=e.loading,a=e.style,n=e.intl,o=e.custom_emojis,i=e.skinTone,s=e.frequentlyUsedEmojis;if(t)return Object(d.a)("div",{style:{width:299}});var c=n.formatMessage(y.emoji),r=this.state.modifierOpen;return p.a.createElement("div",{className:j()("emoji-picker-dropdown__menu",{selecting:r}),style:a,ref:this.setRef},Object(d.a)(l,{perLine:8,emojiSize:22,sheetSize:32,custom:Object(_.buildCustomEmojis)(o),color:"",emoji:"",set:"twitter",title:c,i18n:this.getI18n(),onClick:this.handleClick,include:S,recent:s,skin:i,showPreview:!1,backgroundImageFn:k,autoFocus:!0,emojiTooltip:!0}),Object(d.a)(x,{active:r,modifier:i,onOpen:this.handleModifierOpen,onClose:this.handleModifierClose,onChange:this.handleModifierChange}))},e}(p.a.PureComponent),Object(r.a)(a,"defaultProps",{style:{},loading:!0,frequentlyUsedEmojis:[]}),t=n))||t,I=Object(b.g)(o=function(o){function e(){for(var n,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return n=o.call.apply(o,[this].concat(t))||this,Object(r.a)(Object(s.a)(n),"state",{active:!1,loading:!1}),Object(r.a)(Object(s.a)(n),"setRef",function(e){n.dropdown=e}),Object(r.a)(Object(s.a)(n),"onShowDropdown",function(e){var t=e.target;n.setState({active:!0}),l||(n.setState({loading:!0}),Object(g.i)().then(function(e){l=e.Picker,i=e.Emoji,n.setState({loading:!1})}).catch(function(){n.setState({loading:!1})}));var a=t.getBoundingClientRect().top;n.setState({placement:2*a<innerHeight?"bottom":"top"})}),Object(r.a)(Object(s.a)(n),"onHideDropdown",function(){n.setState({active:!1})}),Object(r.a)(Object(s.a)(n),"onToggle",function(e){n.state.loading||e.key&&"Enter"!==e.key||(n.state.active?n.onHideDropdown():n.onShowDropdown(e))}),Object(r.a)(Object(s.a)(n),"handleKeyDown",function(e){"Escape"===e.key&&n.onHideDropdown()}),Object(r.a)(Object(s.a)(n),"setTargetRef",function(e){n.target=e}),Object(r.a)(Object(s.a)(n),"findTarget",function(){return n.target}),n}return Object(c.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.intl,a=e.onPickEmoji,n=e.onSkinTone,o=e.skinTone,i=e.frequentlyUsedEmojis,s=t.formatMessage(y.emoji),c=this.state,r=c.active,l=c.loading,u=c.placement;return Object(d.a)("div",{className:"emoji-picker-dropdown",onKeyDown:this.handleKeyDown},void 0,p.a.createElement("div",{ref:this.setTargetRef,className:"emoji-button",title:s,"aria-label":s,"aria-expanded":r,role:"button",onClick:this.onToggle,onKeyDown:this.onToggle,tabIndex:0},Object(d.a)("img",{className:j()("emojione",{"pulse-loading":r&&l}),alt:"🙂",src:C+"/emoji/1f602.svg"})),Object(d.a)(m.a,{show:r,placement:u,target:this.findTarget},void 0,Object(d.a)(N,{custom_emojis:this.props.custom_emojis,loading:l,onClose:this.onHideDropdown,onPick:a,onSkinTone:n,skinTone:o,frequentlyUsedEmojis:i})))},e}(p.a.PureComponent))||o}).call(this,T(52))},688:function(e,t,a){"use strict";var n,o,i,s=a(24),u=a(0),c=a(3),r=a(7),d=a(1),l=a(2),p=a.n(l),b=a(273),g=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var a=t.prototype;return a.checkRemainingText=function(e){return e<0?Object(u.a)("span",{className:"character-counter character-counter--over"},void 0,e):Object(u.a)("span",{className:"character-counter"},void 0,e)},a.render=function(){var e=this.props.max-Object(b.length)(this.props.text);return this.checkRemainingText(e)},t}(p.a.PureComponent),h=a(196),m=a(27),f=a.n(m),j=a(5),O=a.n(j),v=a(21),_=a(199),y=a(193),C=a(67),k=a(194),M=a(6),S=a(25),w=a(275),x=Object(M.f)({cancel:{id:"reply_indicator.cancel",defaultMessage:"Cancel"}}),N=Object(M.g)((i=o=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"handleClick",function(){t.props.onCancel()}),Object(d.a)(Object(c.a)(t),"handleAccountClick",function(e){0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t.context.router.history.push("/accounts/"+t.props.status.getIn(["account","id"])))}),t}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.status,a=e.intl;if(!t)return null;var n={__html:t.get("contentHtml")},o={direction:Object(w.a)(t.get("search_index"))?"rtl":"ltr"};return Object(u.a)("div",{className:"reply-indicator"},void 0,Object(u.a)("div",{className:"reply-indicator__header"},void 0,Object(u.a)("div",{className:"reply-indicator__cancel"},void 0,Object(u.a)(C.a,{title:a.formatMessage(x.cancel),icon:"times",onClick:this.handleClick,inverted:!0})),Object(u.a)("a",{href:t.getIn(["account","url"]),onClick:this.handleAccountClick,className:"reply-indicator__display-name"},void 0,Object(u.a)("div",{className:"reply-indicator__display-avatar"},void 0,Object(u.a)(y.a,{account:t.get("account"),size:24})),Object(u.a)(k.a,{account:t.get("account")}))),Object(u.a)("div",{className:"reply-indicator__content",style:o,dangerouslySetInnerHTML:n}))},e}(S.a),Object(d.a)(o,"contextTypes",{router:O.a.object}),Object(d.a)(o,"propTypes",{status:f.a.map,onCancel:O.a.func.isRequired,intl:O.a.object.isRequired}),n=i))||n,I=Object(s.connect)(function(){var t=Object(_.f)();return function(e){return{status:t(e,{id:e.getIn(["compose","in_reply_to"])})}}},function(e){return{onCancel:function(){e(Object(v.M)())}}})(N),D=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this.props.account;return Object(u.a)("div",{className:"autosuggest-account",title:e.get("acct")},void 0,Object(u.a)("div",{className:"autosuggest-account-icon"},void 0,Object(u.a)(y.a,{account:e,size:18})),Object(u.a)(k.a,{account:e}))},t}(S.a);Object(d.a)(D,"propTypes",{account:f.a.map.isRequired});var T,P=Object(s.connect)(function(){var n=Object(_.d)();return function(e,t){var a=t.id;return{account:n(e,a)}}})(D),R=a(649),E=a(504),q=a(12),A=a.n(q),F=function(n){function e(){for(var l,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return l=n.call.apply(n,[this].concat(t))||this,Object(d.a)(Object(c.a)(l),"state",{suggestionsHidden:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(d.a)(Object(c.a)(l),"onChange",function(e){var t,a,n,o,i,s=(t=e.target.value,a=e.target.selectionStart,o=t.slice(0,a).search(/\S+$/),i=t.slice(a).search(/\s/),!(n=i<0?t.slice(o):t.slice(o,i+a))||n.trim().length<3||-1===["@",":","#"].indexOf(n[0])?[null,null]:0<(n=n.trim().toLowerCase()).length?[o+1,n]:[null,null]),c=s[0],r=s[1];null!==r&&l.state.lastToken!==r?(l.setState({lastToken:r,selectedSuggestion:0,tokenStart:c}),l.props.onSuggestionsFetchRequested(r)):null===r&&(l.setState({lastToken:null}),l.props.onSuggestionsClearRequested()),l.props.onChange(e)}),Object(d.a)(Object(c.a)(l),"onKeyDown",function(e){var t=l.props,a=t.suggestions,n=t.disabled,o=l.state,i=o.selectedSuggestion,s=o.suggestionsHidden;if(n)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===a.size||s?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),l.setState({suggestionsHidden:!0}));break;case"ArrowDown":0<a.size&&!s&&(e.preventDefault(),l.setState({selectedSuggestion:Math.min(i+1,a.size-1)}));break;case"ArrowUp":0<a.size&&!s&&(e.preventDefault(),l.setState({selectedSuggestion:Math.max(i-1,0)}));break;case"Enter":case"Tab":null!==l.state.lastToken&&0<a.size&&!s&&(e.preventDefault(),e.stopPropagation(),l.props.onSuggestionSelected(l.state.tokenStart,l.state.lastToken,a.get(i)))}!e.defaultPrevented&&l.props.onKeyDown&&l.props.onKeyDown(e)}}),Object(d.a)(Object(c.a)(l),"onBlur",function(){l.setState({suggestionsHidden:!0})}),Object(d.a)(Object(c.a)(l),"onSuggestionClick",function(e){var t=l.props.suggestions.get(e.currentTarget.getAttribute("data-index"));e.preventDefault(),l.props.onSuggestionSelected(l.state.tokenStart,l.state.lastToken,t),l.textarea.focus()}),Object(d.a)(Object(c.a)(l),"setTextarea",function(e){l.textarea=e}),Object(d.a)(Object(c.a)(l),"onPaste",function(e){e.clipboardData&&1===e.clipboardData.files.length&&(l.props.onPaste(e.clipboardData.files),e.preventDefault())}),Object(d.a)(Object(c.a)(l),"renderSuggestion",function(e,t){var a,n,o=l.state.selectedSuggestion;return n="object"==typeof e?(a=Object(u.a)(R.a,{emoji:e}),e.id):"#"===e[0]?a=e:(a=Object(u.a)(P,{id:e}),e),Object(u.a)("div",{role:"button",tabIndex:"0","data-index":t,className:A()("autosuggest-textarea__suggestions__item",{selected:t===o}),onMouseDown:l.onSuggestionClick},n,a)}),l}Object(r.a)(e,n);var t=e.prototype;return t.componentWillReceiveProps=function(e){e.suggestions!==this.props.suggestions&&0<e.suggestions.size&&this.state.suggestionsHidden&&this.setState({suggestionsHidden:!1})},t.render=function(){var e=this.props,t=e.value,a=e.suggestions,n=e.disabled,o=e.placeholder,i=e.onKeyUp,s=e.autoFocus,c=this.state.suggestionsHidden,r={direction:"ltr"};return Object(w.a)(t)&&(r.direction="rtl"),Object(u.a)("div",{className:"autosuggest-textarea"},void 0,Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,o),Object(u.a)(E.a,{inputRef:this.setTextarea,className:"autosuggest-textarea__textarea",disabled:n,placeholder:o,autoFocus:s,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:i,onBlur:this.onBlur,onPaste:this.onPaste,style:r,"aria-autocomplete":"list"})),Object(u.a)("div",{className:"autosuggest-textarea__suggestions "+(c||a.isEmpty()?"":"autosuggest-textarea__suggestions--visible")},void 0,a.map(this.renderSuggestion)))},e}(S.a);Object(d.a)(F,"propTypes",{value:O.a.string,suggestions:f.a.list,disabled:O.a.bool,placeholder:O.a.string,onSuggestionSelected:O.a.func.isRequired,onSuggestionsClearRequested:O.a.func.isRequired,onSuggestionsFetchRequested:O.a.func.isRequired,onChange:O.a.func.isRequired,onKeyUp:O.a.func,onKeyDown:O.a.func,onPaste:O.a.func.isRequired,autoFocus:O.a.bool}),Object(d.a)(F,"defaultProps",{autoFocus:!0});var K,z,L,U,W,H,B,Y,X,G,J,V=Object(M.f)({add_poll:{id:"poll_button.add_poll",defaultMessage:"Add a poll"},remove_poll:{id:"poll_button.remove_poll",defaultMessage:"Remove poll"}}),$={height:null,lineHeight:"27px"},Q=Object(M.g)(T=function(o){function e(){for(var e,t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];return e=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(e),"handleClick",function(){e.props.onClick()}),e}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.intl,a=e.active,n=e.unavailable,o=e.disabled;return n?null:Object(u.a)("div",{className:"compose-form__poll-button"},void 0,Object(u.a)(C.a,{icon:"tasks",title:t.formatMessage(a?V.remove_poll:V.add_poll),disabled:o,onClick:this.handleClick,className:"compose-form__poll-button-icon "+(a?"active":""),size:18,inverted:!0,style:$}))},e}(p.a.PureComponent))||T,Z=Object(s.connect)(function(e){return{unavailable:e.getIn(["compose","is_uploading"])||0<e.getIn(["compose","media_attachments"]).size,active:null!==e.getIn(["compose","poll"])}},function(a){return{onClick:function(){a(function(e,t){t().getIn(["compose","poll"])?a(Object(v.db)()):a(Object(v.K)())})}}})(Q),ee=Object(M.f)({upload:{id:"upload_button.label",defaultMessage:"Add media (JPEG, PNG, GIF, WebM, MP4, MOV)"}}),te={height:null,lineHeight:"27px"},ae=Object(s.connect)(function(){return function(e){return{acceptContentTypes:e.getIn(["media_attachments","accept_content_types"])}}})(K=Object(M.g)((L=z=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"handleChange",function(e){0<e.target.files.length&&t.props.onSelectFile(e.target.files)}),Object(d.a)(Object(c.a)(t),"handleClick",function(){t.fileElement.click()}),Object(d.a)(Object(c.a)(t),"setRef",function(e){t.fileElement=e}),t}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.intl,a=e.resetFileKey,n=e.unavailable,o=e.disabled,i=e.acceptContentTypes;return n?null:Object(u.a)("div",{className:"compose-form__upload-button"},void 0,Object(u.a)(C.a,{icon:"camera",title:t.formatMessage(ee.upload),disabled:o,onClick:this.handleClick,className:"compose-form__upload-button-icon",size:18,inverted:!0,style:te}),Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,t.formatMessage(ee.upload)),p.a.createElement("input",{key:a,ref:this.setRef,type:"file",multiple:!0,accept:i.toArray().join(","),onChange:this.handleChange,disabled:o,style:{display:"none"}})))},e}(S.a),Object(d.a)(z,"propTypes",{disabled:O.a.bool,unavailable:O.a.bool,onSelectFile:O.a.func.isRequired,style:O.a.object,resetFileKey:O.a.number,acceptContentTypes:f.a.listOf(O.a.string).isRequired,intl:O.a.object.isRequired}),K=L))||K)||K,ne=Object(s.connect)(function(e){return{disabled:e.getIn(["compose","is_uploading"])||3<e.getIn(["compose","media_attachments"]).size||e.getIn(["compose","media_attachments"]).some(function(e){return"video"===e.get("type")}),unavailable:null!==e.getIn(["compose","poll"]),resetFileKey:e.getIn(["compose","resetFileKey"])}},function(t){return{onSelectFile:function(e){t(Object(v.lb)(e))}}})(ae),oe=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"handleClick",function(e){e.preventDefault(),t.props.onClick()}),t}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.label,a=e.title,n=e.active,o=e.ariaControls;return Object(u.a)("button",{title:a,"aria-label":a,className:"text-icon-button "+(n?"active":""),"aria-expanded":n,onClick:this.handleClick,"aria-controls":o},void 0,t)},e}(p.a.PureComponent),ie=Object(M.f)({marked:{id:"compose_form.spoiler.marked",defaultMessage:"Text is hidden behind warning"},unmarked:{id:"compose_form.spoiler.unmarked",defaultMessage:"Text is not hidden"}}),se=Object(M.g)(Object(s.connect)(function(e,t){return{label:"CW",title:t.intl.formatMessage(e.getIn(["compose","spoiler"])?ie.marked:ie.unmarked),active:e.getIn(["compose","spoiler"]),ariaControls:"cw-spoiler-input"}},function(e){return{onClick:function(){e(Object(v.Q)())}}})(oe)),ce=a(17),re=a(245),le=a.n(re),ue=a(89),de=a(44),pe=a.n(de),be=a(77),ge=a.n(be),he=a(30),me=Object(M.f)({public_short:{id:"privacy.public.short",defaultMessage:"Public"},public_long:{id:"privacy.public.long",defaultMessage:"Post to public timelines"},unlisted_short:{id:"privacy.unlisted.short",defaultMessage:"Unlisted"},unlisted_long:{id:"privacy.unlisted.long",defaultMessage:"Do not show in public timelines"},private_short:{id:"privacy.private.short",defaultMessage:"Followers-only"},private_long:{id:"privacy.private.long",defaultMessage:"Post to followers only"},direct_short:{id:"privacy.direct.short",defaultMessage:"Direct"},direct_long:{id:"privacy.direct.long",defaultMessage:"Post to mentioned users only"},change_privacy:{id:"privacy.change",defaultMessage:"Adjust status privacy"}}),fe=!!ge.a.hasSupport&&{passive:!0},je=function(n){function e(){for(var i,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return i=n.call.apply(n,[this].concat(t))||this,Object(d.a)(Object(c.a)(i),"state",{mounted:!1}),Object(d.a)(Object(c.a)(i),"handleDocumentClick",function(e){i.node&&!i.node.contains(e.target)&&i.props.onClose()}),Object(d.a)(Object(c.a)(i),"handleKeyDown",function(e){var t,a=i.props.items,n=e.currentTarget.getAttribute("data-index"),o=a.findIndex(function(e){return e.value===n});switch(e.key){case"Escape":i.props.onClose();break;case"Enter":i.handleClick(e);break;case"ArrowDown":(t=i.node.childNodes[o+1])&&(t.focus(),i.props.onChange(t.getAttribute("data-index")));break;case"ArrowUp":(t=i.node.childNodes[o-1])&&(t.focus(),i.props.onChange(t.getAttribute("data-index")));break;case"Home":(t=i.node.firstChild)&&(t.focus(),i.props.onChange(t.getAttribute("data-index")));break;case"End":(t=i.node.lastChild)&&(t.focus(),i.props.onChange(t.getAttribute("data-index")))}}),Object(d.a)(Object(c.a)(i),"handleClick",function(e){var t=e.currentTarget.getAttribute("data-index");e.preventDefault(),i.props.onClose(),i.props.onChange(t)}),Object(d.a)(Object(c.a)(i),"setRef",function(e){i.node=e}),Object(d.a)(Object(c.a)(i),"setFocusRef",function(e){i.focusedItem=e}),i}Object(r.a)(e,n);var t=e.prototype;return t.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,fe),this.focusedItem&&this.focusedItem.focus(),this.setState({mounted:!0})},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,fe)},t.render=function(){var o=this,i=this.state.mounted,e=this.props,s=e.style,c=e.items,r=e.placement,l=e.value;return Object(u.a)(ue.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:pe()(1,{damping:35,stiffness:400}),scaleX:pe()(1,{damping:35,stiffness:400}),scaleY:pe()(1,{damping:35,stiffness:400})}},void 0,function(e){var t=e.opacity,a=e.scaleX,n=e.scaleY;return p.a.createElement("div",{className:"privacy-dropdown__dropdown "+r,style:Object(ce.a)({},s,{opacity:t,transform:i?"scale("+a+", "+n+")":null}),role:"listbox",ref:o.setRef},c.map(function(e){return p.a.createElement("div",{role:"option",tabIndex:"0",key:e.value,"data-index":e.value,onKeyDown:o.handleKeyDown,onClick:o.handleClick,className:A()("privacy-dropdown__option",{active:e.value===l}),"aria-selected":e.value===l,ref:e.value===l?o.setFocusRef:null},Object(u.a)("div",{className:"privacy-dropdown__option__icon"},void 0,Object(u.a)(he.a,{id:e.icon,fixedWidth:!0})),Object(u.a)("div",{className:"privacy-dropdown__option__content"},void 0,Object(u.a)("strong",{},void 0,e.text),e.meta))}))})},e}(p.a.PureComponent),Oe=Object(M.g)(U=function(o){function e(){for(var n,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return n=o.call.apply(o,[this].concat(t))||this,Object(d.a)(Object(c.a)(n),"state",{open:!1,placement:"bottom"}),Object(d.a)(Object(c.a)(n),"handleToggle",function(e){var t=e.target;if(n.props.isUserTouching())n.state.open?n.props.onModalClose():n.props.onModalOpen({actions:n.options.map(function(e){return Object(ce.a)({},e,{active:e.value===n.props.value})}),onClick:n.handleModalActionClick});else{var a=t.getBoundingClientRect().top;n.setState({placement:2*a<innerHeight?"bottom":"top"}),n.setState({open:!n.state.open})}}),Object(d.a)(Object(c.a)(n),"handleModalActionClick",function(e){e.preventDefault();var t=n.options[e.currentTarget.getAttribute("data-index")].value;n.props.onModalClose(),n.props.onChange(t)}),Object(d.a)(Object(c.a)(n),"handleKeyDown",function(e){switch(e.key){case"Escape":n.handleClose()}}),Object(d.a)(Object(c.a)(n),"handleClose",function(){n.setState({open:!1})}),Object(d.a)(Object(c.a)(n),"handleChange",function(e){n.props.onChange(e)}),n}Object(r.a)(e,o);var t=e.prototype;return t.componentWillMount=function(){var e=this.props.intl.formatMessage;this.options=[{icon:"globe",value:"public",text:e(me.public_short),meta:e(me.public_long)},{icon:"unlock",value:"unlisted",text:e(me.unlisted_short),meta:e(me.unlisted_long)},{icon:"lock",value:"private",text:e(me.private_short),meta:e(me.private_long)},{icon:"envelope",value:"direct",text:e(me.direct_short),meta:e(me.direct_long)}]},t.render=function(){var e=this.props,t=e.value,a=e.intl,n=this.state,o=n.open,i=n.placement,s=this.options.find(function(e){return e.value===t});return Object(u.a)("div",{className:A()("privacy-dropdown",i,{active:o}),onKeyDown:this.handleKeyDown},void 0,Object(u.a)("div",{className:A()("privacy-dropdown__value",{active:0===this.options.indexOf(s)})},void 0,Object(u.a)(C.a,{className:"privacy-dropdown__value-icon",icon:s.icon,title:a.formatMessage(me.change_privacy),size:18,expanded:o,active:o,inverted:!0,onClick:this.handleToggle,style:{height:null,lineHeight:"27px"}})),Object(u.a)(le.a,{show:o,placement:i,target:this},void 0,Object(u.a)(je,{items:this.options,value:t,onClose:this.handleClose,onChange:this.handleChange,placement:i})))},e}(p.a.PureComponent))||U,ve=a(57),_e=a(225),ye=Object(s.connect)(function(e){return{isModalOpen:"ACTIONS"===e.get("modal").modalType,value:e.getIn(["compose","privacy"])}},function(t){return{onChange:function(e){t(Object(v.R)(e))},isUserTouching:_e.c,onModalOpen:function(e){return t(Object(ve.d)("ACTIONS",e))},onModalClose:function(){return t(Object(ve.c)())}}})(Oe),Ce=Object(M.f)({marked:{id:"compose_form.sensitive.marked",defaultMessage:"Media is marked as sensitive"},unmarked:{id:"compose_form.sensitive.unmarked",defaultMessage:"Media is not marked as sensitive"}}),ke=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this.props,o=e.visible,i=e.active,s=e.disabled,c=e.onClick,r=e.intl;return Object(u.a)(ue.a,{defaultStyle:{scale:.87},style:{scale:pe()(o?1:.87,{stiffness:200,damping:3})}},void 0,function(e){var t=e.scale,a=i?"eye-slash":"eye",n=A()("compose-form__sensitive-button",{"compose-form__sensitive-button--visible":o});return Object(u.a)("div",{className:n,style:{transform:"scale("+t+")"}},void 0,Object(u.a)(C.a,{className:"compose-form__sensitive-button__icon",title:r.formatMessage(i?Ce.marked:Ce.unmarked),icon:a,onClick:c,size:18,active:i,disabled:s,style:{lineHeight:null,height:null},inverted:!0}))})},t}(p.a.PureComponent),Me=Object(s.connect)(function(e){return{visible:0<e.getIn(["compose","media_attachments"]).size,active:e.getIn(["compose","sensitive"]),disabled:e.getIn(["compose","spoiler"])}},function(e){return{onClick:function(){e(Object(v.O)())}}})(Object(M.g)(ke)),Se=a(650),we=a(69),xe=a(61),Ne=a(4),Ie=a(238),De=["+1","grinning","kissing_heart","heart_eyes","laughing","stuck_out_tongue_winking_eye","sweat_smile","joy","yum","disappointed","thinking_face","weary","sob","sunglasses","heart","ok_hand"],Te=Object(xe.a)([function(e){return e.getIn(["settings","frequentlyUsedEmojis"],Object(Ne.Map)())}],function(a){var t=a.keySeq().sort(function(e,t){return a.get(e)-a.get(t)}).reverse().slice(0,16).toArray();if(t.length<De.length){var e=De.filter(function(e){return!t.includes(e)});t=t.concat(e.slice(0,De.length-t.length))}return t}),Pe=Object(xe.a)([function(e){return e.get("custom_emojis")}],function(e){return e.filter(function(e){return e.get("visible_in_picker")}).sort(function(e,t){var a=e.get("shortcode").toLowerCase(),n=t.get("shortcode").toLowerCase();return a<n?-1:n<a?1:0})}),Re=Object(s.connect)(function(e){return{custom_emojis:Pe(e),skinTone:e.getIn(["settings","skinTone"]),frequentlyUsedEmojis:Te(e)}},function(t,e){var a=e.onPickEmoji;return{onSkinTone:function(e){t(Object(we.c)(["skinTone"],e))},onPickEmoji:function(e){t(Object(Ie.b)(e)),a&&a(e)}}})(Se.a),Ee=Object(M.f)({option_placeholder:{id:"compose_form.poll.option_placeholder",defaultMessage:"Choice {number}"},add_option:{id:"compose_form.poll.add_option",defaultMessage:"Add a choice"},remove_option:{id:"compose_form.poll.remove_option",defaultMessage:"Remove this choice"},poll_duration:{id:"compose_form.poll.duration",defaultMessage:"Poll duration"},minutes:{id:"intervals.full.minutes",defaultMessage:"{number, plural, one {# minute} other {# minutes}}"},hours:{id:"intervals.full.hours",defaultMessage:"{number, plural, one {# hour} other {# hours}}"},days:{id:"intervals.full.days",defaultMessage:"{number, plural, one {# day} other {# days}}"}}),qe=Object(M.g)(W=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"handleOptionTitleChange",function(e){t.props.onChange(t.props.index,e.target.value)}),Object(d.a)(Object(c.a)(t),"handleOptionRemove",function(){t.props.onRemove(t.props.index)}),t}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.isPollMultiple,a=e.title,n=e.index,o=e.intl;return Object(u.a)("li",{},void 0,Object(u.a)("label",{className:"poll__text editable"},void 0,Object(u.a)("span",{className:A()("poll__input",{checkbox:t})}),Object(u.a)("input",{type:"text",placeholder:o.formatMessage(Ee.option_placeholder,{number:n+1}),maxLength:25,value:a,onChange:this.handleOptionTitleChange})),Object(u.a)("div",{className:"poll__cancel"},void 0,Object(u.a)(C.a,{disabled:n<=1,title:o.formatMessage(Ee.remove_option),icon:"times",onClick:this.handleOptionRemove})))},e}(p.a.PureComponent))||W,Ae=Object(M.g)((Y=B=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"handleAddOption",function(){t.props.onAddOption("")}),Object(d.a)(Object(c.a)(t),"handleSelectDuration",function(e){t.props.onChangeSettings(e.target.value,t.props.isMultiple)}),t}return Object(r.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.options,a=e.expiresIn,n=e.isMultiple,o=e.onChangeOption,i=e.onRemoveOption,s=e.intl;return t?Object(u.a)("div",{className:"compose-form__poll-wrapper"},void 0,Object(u.a)("ul",{},void 0,t.map(function(e,t){return Object(u.a)(qe,{title:e,index:t,onChange:o,onRemove:i,isPollMultiple:n},t)})),Object(u.a)("div",{className:"poll__footer"},void 0,t.size<4&&Object(u.a)("button",{className:"button button-secondary",onClick:this.handleAddOption},void 0,Object(u.a)(he.a,{id:"plus"})," ",p.a.createElement(M.b,Ee.add_option)),Object(u.a)("select",{value:a,onChange:this.handleSelectDuration},void 0,Object(u.a)("option",{value:300},void 0,s.formatMessage(Ee.minutes,{number:5})),Object(u.a)("option",{value:1800},void 0,s.formatMessage(Ee.minutes,{number:30})),Object(u.a)("option",{value:3600},void 0,s.formatMessage(Ee.hours,{number:1})),Object(u.a)("option",{value:21600},void 0,s.formatMessage(Ee.hours,{number:6})),Object(u.a)("option",{value:86400},void 0,s.formatMessage(Ee.days,{number:1})),Object(u.a)("option",{value:259200},void 0,s.formatMessage(Ee.days,{number:3})),Object(u.a)("option",{value:604800},void 0,s.formatMessage(Ee.days,{number:7}))))):null},e}(S.a),Object(d.a)(B,"propTypes",{options:f.a.list,expiresIn:O.a.number,isMultiple:O.a.bool,onChangeOption:O.a.func.isRequired,onAddOption:O.a.func.isRequired,onRemoveOption:O.a.func.isRequired,onChangeSettings:O.a.func.isRequired,intl:O.a.object.isRequired}),H=Y))||H,Fe=Object(s.connect)(function(e){return{options:e.getIn(["compose","poll","options"]),expiresIn:e.getIn(["compose","poll","expires_in"]),isMultiple:e.getIn(["compose","poll","multiple"])}},function(a){return{onAddOption:function(e){a(Object(v.L)(e))},onRemoveOption:function(e){a(Object(v.eb)(e))},onChangeOption:function(e,t){a(Object(v.T)(e,t))},onChangeSettings:function(e,t){a(Object(v.U)(e,t))}}})(Ae),Ke=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.active,a=e.progress;return t?Object(u.a)("div",{className:"upload-progress"},void 0,Object(u.a)("div",{className:"upload-progress__icon"},void 0,Object(u.a)(he.a,{id:"upload"})),Object(u.a)("div",{className:"upload-progress__message"},void 0,Object(u.a)(M.b,{id:"upload_progress.label",defaultMessage:"Uploading..."}),Object(u.a)("div",{className:"upload-progress__backdrop"},void 0,Object(u.a)(ue.a,{defaultStyle:{width:0},style:{width:pe()(a)}},void 0,function(e){var t=e.width;return Object(u.a)("div",{className:"upload-progress__tracker",style:{width:t+"%"}})})))):null},t}(p.a.PureComponent),ze=Object(s.connect)(function(e){return{active:e.getIn(["compose","is_uploading"]),progress:e.getIn(["compose","progress"])}})(Ke),Le=Object(M.f)({description:{id:"upload_form.description",defaultMessage:"Describe for the visually impaired"}}),Ue=Object(M.g)((J=G=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(c.a)(t),"state",{hovered:!1,focused:!1,dirtyDescription:null}),Object(d.a)(Object(c.a)(t),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&t.handleSubmit()}),Object(d.a)(Object(c.a)(t),"handleSubmit",function(){t.handleInputBlur(),t.props.onSubmit(t.context.router.history)}),Object(d.a)(Object(c.a)(t),"handleUndoClick",function(e){e.stopPropagation(),t.props.onUndo(t.props.media.get("id"))}),Object(d.a)(Object(c.a)(t),"handleFocalPointClick",function(e){e.stopPropagation(),t.props.onOpenFocalPoint(t.props.media.get("id"))}),Object(d.a)(Object(c.a)(t),"handleInputChange",function(e){t.setState({dirtyDescription:e.target.value})}),Object(d.a)(Object(c.a)(t),"handleMouseEnter",function(){t.setState({hovered:!0})}),Object(d.a)(Object(c.a)(t),"handleMouseLeave",function(){t.setState({hovered:!1})}),Object(d.a)(Object(c.a)(t),"handleInputFocus",function(){t.setState({focused:!0})}),Object(d.a)(Object(c.a)(t),"handleClick",function(){t.setState({focused:!0})}),Object(d.a)(Object(c.a)(t),"handleInputBlur",function(){var e=t.state.dirtyDescription;t.setState({focused:!1,dirtyDescription:null}),null!==e&&t.props.onDescriptionChange(t.props.media.get("id"),e)}),t}return Object(r.a)(e,o),e.prototype.render=function(){var a=this,e=this.props,n=e.intl,o=e.media,i=this.state.hovered||this.state.focused,s=this.state.dirtyDescription||""!==this.state.dirtyDescription&&o.get("description")||"",t=o.getIn(["meta","focus","x"]),c=o.getIn(["meta","focus","y"]),r=100*(t/2+.5),l=100*(c/-2+.5);return Object(u.a)("div",{className:"compose-form__upload",tabIndex:"0",onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onClick:this.handleClick,role:"button"},void 0,Object(u.a)(ue.a,{defaultStyle:{scale:.8},style:{scale:pe()(1,{stiffness:180,damping:12})}},void 0,function(e){var t=e.scale;return Object(u.a)("div",{className:"compose-form__upload-thumbnail",style:{transform:"scale("+t+")",backgroundImage:"url("+o.get("preview_url")+")",backgroundPosition:r+"% "+l+"%"}},void 0,Object(u.a)("div",{className:A()("compose-form__upload__actions",{active:i})},void 0,Object(u.a)("button",{className:"icon-button",onClick:a.handleUndoClick},void 0,Object(u.a)(he.a,{id:"times"})," ",Object(u.a)(M.b,{id:"upload_form.undo",defaultMessage:"Delete"})),"image"===o.get("type")&&Object(u.a)("button",{className:"icon-button",onClick:a.handleFocalPointClick},void 0,Object(u.a)(he.a,{id:"crosshairs"})," ",Object(u.a)(M.b,{id:"upload_form.focus",defaultMessage:"Crop"}))),Object(u.a)("div",{className:A()("compose-form__upload-description",{active:i})},void 0,Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,n.formatMessage(Le.description)),Object(u.a)("textarea",{placeholder:n.formatMessage(Le.description),value:s,maxLength:420,onFocus:a.handleInputFocus,onChange:a.handleInputChange,onBlur:a.handleInputBlur,onKeyDown:a.handleKeyDown}))))}))},e}(S.a),Object(d.a)(G,"contextTypes",{router:O.a.object}),Object(d.a)(G,"propTypes",{media:f.a.map.isRequired,intl:O.a.object.isRequired,onUndo:O.a.func.isRequired,onDescriptionChange:O.a.func.isRequired,onOpenFocalPoint:O.a.func.isRequired,onSubmit:O.a.func.isRequired}),X=J))||X,We=Object(s.connect)(function(e,t){var a=t.id;return{media:e.getIn(["compose","media_attachments"]).find(function(e){return e.get("id")===a})}},function(a){return{onUndo:function(e){a(Object(v.jb)(e))},onDescriptionChange:function(e,t){a(Object(v.V)(e,{description:t}))},onOpenFocalPoint:function(e){a(Object(ve.d)("FOCAL_POINT",{id:e}))},onSubmit:function(e){a(Object(v.ib)(e))}}})(Ue),He=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this.props.mediaIds;return Object(u.a)("div",{className:"compose-form__upload-wrapper"},void 0,Object(u.a)(ze,{}),Object(u.a)("div",{className:"compose-form__uploads-wrapper"},void 0,e.map(function(e){return Object(u.a)(We,{id:e},e)})))},t}(S.a);Object(d.a)(He,"propTypes",{mediaIds:f.a.list.isRequired});var Be,Ye,Xe,Ge=Object(s.connect)(function(e){return{mediaIds:e.getIn(["compose","media_attachments"]).map(function(e){return e.get("id")})}})(He),Je=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var o=this.props.message;return Object(u.a)(ue.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:pe()(1,{damping:35,stiffness:400}),scaleX:pe()(1,{damping:35,stiffness:400}),scaleY:pe()(1,{damping:35,stiffness:400})}},void 0,function(e){var t=e.opacity,a=e.scaleX,n=e.scaleY;return Object(u.a)("div",{className:"compose-form__warning",style:{opacity:t,transform:"scale("+a+", "+n+")"}},void 0,o)})},t}(p.a.PureComponent),Ve=a(23),$e=/(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i,Qe=Object(s.connect)(function(e){return{needsLockWarning:"private"===e.getIn(["compose","privacy"])&&!e.getIn(["accounts",Ve.k,"locked"]),hashtagWarning:"public"!==e.getIn(["compose","privacy"])&&$e.test(e.getIn(["compose","text"])),directMessageWarning:"direct"===e.getIn(["compose","privacy"])}})(function(e){var t=e.needsLockWarning,a=e.hashtagWarning,n=e.directMessageWarning;if(t)return Object(u.a)(Je,{message:Object(u.a)(M.b,{id:"compose_form.lock_disclaimer",defaultMessage:"Your account is not {locked}. Anyone can follow you to view your follower-only posts.",values:{locked:Object(u.a)("a",{href:"/user-settings"},void 0,Object(u.a)(M.b,{id:"compose_form.lock_disclaimer.lock",defaultMessage:"locked"}))}})});if(a)return Object(u.a)(Je,{message:Object(u.a)(M.b,{id:"compose_form.hashtag_warning",defaultMessage:"This toot won't be listed under any hashtag as it is unlisted. Only public toots can be searched by hashtag."})});if(n){var o=Object(u.a)("span",{},void 0,Object(u.a)(M.b,{id:"compose_form.direct_message_warning",defaultMessage:"This toot will only be sent to all the mentioned users."})," ",Object(u.a)("a",{href:"/terms",target:"_blank"},void 0,Object(u.a)(M.b,{id:"compose_form.direct_message_warning_learn_more",defaultMessage:"Learn more"})));return Object(u.a)(Je,{message:o})}return null}),Ze=Object(M.f)({placeholder:{id:"compose_form.placeholder",defaultMessage:"What is on your mind?"},spoiler_placeholder:{id:"compose_form.spoiler_placeholder",defaultMessage:"Write your warning here"},publish:{id:"compose_form.publish",defaultMessage:"Toot"},publishLoud:{id:"compose_form.publish_loud",defaultMessage:"{publish}!"}}),et=Object(M.g)((Xe=Ye=function(n){function e(){for(var s,e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return s=n.call.apply(n,[this].concat(t))||this,Object(d.a)(Object(c.a)(s),"handleChange",function(e){s.props.onChange(e.target.value)}),Object(d.a)(Object(c.a)(s),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&s.handleSubmit()}),Object(d.a)(Object(c.a)(s),"handleSubmit",function(){s.props.text!==s.autosuggestTextarea.textarea.value&&s.props.onChange(s.autosuggestTextarea.textarea.value);var e=s.props,t=e.is_submitting,a=e.is_changing_upload,n=e.is_uploading,o=e.anyMedia,i=[s.props.spoiler_text,s.props.text].join("");t||n||a||Object(b.length)(i)>Ve.j||0!==i.length&&0===i.trim().length&&!o||s.props.onSubmit(s.context.router?s.context.router.history:null)}),Object(d.a)(Object(c.a)(s),"onSuggestionsClearRequested",function(){s.props.onClearSuggestions()}),Object(d.a)(Object(c.a)(s),"onSuggestionsFetchRequested",function(e){s.props.onFetchSuggestions(e)}),Object(d.a)(Object(c.a)(s),"onSuggestionSelected",function(e,t,a){s.props.onSuggestionSelected(e,t,a)}),Object(d.a)(Object(c.a)(s),"handleChangeSpoilerText",function(e){s.props.onChangeSpoilerText(e.target.value)}),Object(d.a)(Object(c.a)(s),"setAutosuggestTextarea",function(e){s.autosuggestTextarea=e}),Object(d.a)(Object(c.a)(s),"setSpoilerText",function(e){s.spoilerText=e}),Object(d.a)(Object(c.a)(s),"handleEmojiPick",function(e){var t=s.props.text,a=s.autosuggestTextarea.textarea.selectionStart,n=e.custom&&0<a&&!"><…    \u2028\u2029\t\n\v\f\r".includes(t[a-1]);s.props.onPickEmoji(a,e,n)}),s}Object(r.a)(e,n);var t=e.prototype;return t.componentDidUpdate=function(e){var t,a;this.props.focusDate!==e.focusDate?(this.props.preselectDate!==e.preselectDate?(t=this.props.text.length,a=this.props.text.search(/\s/)+1):"number"==typeof this.props.caretPosition?(a=this.props.caretPosition,t=this.props.caretPosition):a=t=this.props.text.length,this.autosuggestTextarea.textarea.setSelectionRange(a,t),this.autosuggestTextarea.textarea.focus()):e.is_submitting&&!this.props.is_submitting?this.autosuggestTextarea.textarea.focus():this.props.spoiler!==e.spoiler&&(this.props.spoiler?this.spoilerText.focus():this.autosuggestTextarea.textarea.focus())},t.render=function(){var e=this.props,t=e.intl,a=e.onPaste,n=e.showSearch,o=e.anyMedia,i=this.props.is_submitting,s=[this.props.spoiler_text,this.props.text].join(""),c=i||this.props.is_uploading||this.props.is_changing_upload||Object(b.length)(s)>Ve.j||0!==s.length&&0===s.trim().length&&!o,r="";return r="private"===this.props.privacy||"direct"===this.props.privacy?Object(u.a)("span",{className:"compose-form__publish-private"},void 0,Object(u.a)(he.a,{id:"lock"})," ",t.formatMessage(Ze.publish)):"unlisted"!==this.props.privacy?t.formatMessage(Ze.publishLoud,{publish:t.formatMessage(Ze.publish)}):t.formatMessage(Ze.publish),Object(u.a)("div",{className:"compose-form"},void 0,Object(u.a)(Qe,{}),Object(u.a)(I,{}),Object(u.a)("div",{className:"spoiler-input "+(this.props.spoiler?"spoiler-input--visible":"")},void 0,Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,t.formatMessage(Ze.spoiler_placeholder)),p.a.createElement("input",{placeholder:t.formatMessage(Ze.spoiler_placeholder),value:this.props.spoiler_text,onChange:this.handleChangeSpoilerText,onKeyDown:this.handleKeyDown,tabIndex:this.props.spoiler?0:-1,type:"text",className:"spoiler-input__input",id:"cw-spoiler-input",ref:this.setSpoilerText}))),Object(u.a)("div",{className:"compose-form__autosuggest-wrapper"},void 0,p.a.createElement(F,{ref:this.setAutosuggestTextarea,placeholder:t.formatMessage(Ze.placeholder),disabled:i,value:this.props.text,onChange:this.handleChange,suggestions:this.props.suggestions,onKeyDown:this.handleKeyDown,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSuggestionSelected,onPaste:a,autoFocus:!n&&!Object(_e.b)(window.innerWidth)}),Object(u.a)(Re,{onPickEmoji:this.handleEmojiPick})),Object(u.a)("div",{className:"compose-form__modifiers"},void 0,Object(u.a)(Ge,{}),Object(u.a)(Fe,{})),Object(u.a)("div",{className:"compose-form__buttons-wrapper"},void 0,Object(u.a)("div",{className:"compose-form__buttons"},void 0,Object(u.a)(ne,{}),Object(u.a)(Z,{}),Object(u.a)(ye,{}),Object(u.a)(Me,{}),Object(u.a)(se,{})),Object(u.a)("div",{className:"character-counter__wrapper"},void 0,Object(u.a)(g,{max:Ve.j,text:s}))),Object(u.a)("div",{className:"compose-form__publish"},void 0,Object(u.a)("div",{className:"compose-form__publish-button-wrapper"},void 0,Object(u.a)(h.a,{text:r,onClick:this.handleSubmit,disabled:c,block:!0}))))},e}(S.a),Object(d.a)(Ye,"contextTypes",{router:O.a.object}),Object(d.a)(Ye,"propTypes",{intl:O.a.object.isRequired,text:O.a.string.isRequired,suggestion_token:O.a.string,suggestions:f.a.list,spoiler:O.a.bool,privacy:O.a.string,spoiler_text:O.a.string,focusDate:O.a.instanceOf(Date),caretPosition:O.a.number,preselectDate:O.a.instanceOf(Date),is_submitting:O.a.bool,is_changing_upload:O.a.bool,is_uploading:O.a.bool,onChange:O.a.func.isRequired,onSubmit:O.a.func.isRequired,onClearSuggestions:O.a.func.isRequired,onFetchSuggestions:O.a.func.isRequired,onSuggestionSelected:O.a.func.isRequired,onChangeSpoilerText:O.a.func.isRequired,onPaste:O.a.func.isRequired,onPickEmoji:O.a.func.isRequired,showSearch:O.a.bool,anyMedia:O.a.bool}),Object(d.a)(Ye,"defaultProps",{showSearch:!1}),Be=Xe))||Be;t.a=Object(s.connect)(function(e){return{text:e.getIn(["compose","text"]),suggestion_token:e.getIn(["compose","suggestion_token"]),suggestions:e.getIn(["compose","suggestions"]),spoiler:e.getIn(["compose","spoiler"]),spoiler_text:e.getIn(["compose","spoiler_text"]),privacy:e.getIn(["compose","privacy"]),focusDate:e.getIn(["compose","focusDate"]),caretPosition:e.getIn(["compose","caretPosition"]),preselectDate:e.getIn(["compose","preselectDate"]),is_submitting:e.getIn(["compose","is_submitting"]),is_changing_upload:e.getIn(["compose","is_changing_upload"]),is_uploading:e.getIn(["compose","is_uploading"]),showSearch:e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]),anyMedia:0<e.getIn(["compose","media_attachments"]).size}},function(n){return{onChange:function(e){n(Object(v.N)(e))},onSubmit:function(e){n(Object(v.ib)(e))},onClearSuggestions:function(){n(Object(v.W)())},onFetchSuggestions:function(e){n(Object(v.Y)(e))},onSuggestionSelected:function(e,t,a){n(Object(v.hb)(e,t,a))},onChangeSpoilerText:function(e){n(Object(v.P)(e))},onPaste:function(e){n(Object(v.lb)(e))},onPickEmoji:function(e,t,a){n(Object(v.ab)(e,t,a))}}})(et)},691:function(e,t,a){"use strict";a.r(t);var n,o,i,s,c,l=a(0),r=a(3),u=a(7),d=a(1),p=a(2),b=a.n(p),g=a(688),h=a(24),m=a(989),f=a(23),j=Object(h.connect)(function(e){return{account:e.getIn(["accounts",f.k])}})(m.a),O=a(21),v=a(358),_=a(6),y=a(234),C=a(17),k=a(245),M=a.n(k),S=a(89),w=a(44),x=a.n(w),N=a(30),I=Object(_.f)({placeholder:{id:"search.placeholder",defaultMessage:"Search"}}),D=function(e){function t(){return e.apply(this,arguments)||this}return Object(u.a)(t,e),t.prototype.render=function(){var e=this.props.style,o=f.n?Object(l.a)(_.b,{id:"search_popout.tips.full_text",defaultMessage:"Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags."}):Object(l.a)(_.b,{id:"search_popout.tips.text",defaultMessage:"Simple text returns matching display names, usernames and hashtags"});return Object(l.a)("div",{style:Object(C.a)({},e,{position:"absolute",width:315})},void 0,Object(l.a)(S.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:x()(1,{damping:35,stiffness:400}),scaleX:x()(1,{damping:35,stiffness:400}),scaleY:x()(1,{damping:35,stiffness:400})}},void 0,function(e){var t=e.opacity,a=e.scaleX,n=e.scaleY;return Object(l.a)("div",{className:"search-popout",style:{opacity:t,transform:"scale("+a+", "+n+")"}},void 0,Object(l.a)("h4",{},void 0,Object(l.a)(_.b,{id:"search_popout.search_format",defaultMessage:"Advanced search format"})),Object(l.a)("ul",{},void 0,Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"#example")," ",Object(l.a)(_.b,{id:"search_popout.tips.hashtag",defaultMessage:"hashtag"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"@username@domain")," ",Object(l.a)(_.b,{id:"search_popout.tips.user",defaultMessage:"user"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"URL")," ",Object(l.a)(_.b,{id:"search_popout.tips.user",defaultMessage:"user"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"URL")," ",Object(l.a)(_.b,{id:"search_popout.tips.status",defaultMessage:"status"}))),o)}))},t}(b.a.PureComponent),T=Object(_.g)(n=function(o){function e(){for(var t,e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];return t=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"state",{expanded:!1}),Object(d.a)(Object(r.a)(t),"handleChange",function(e){t.props.onChange(e.target.value)}),Object(d.a)(Object(r.a)(t),"handleClear",function(e){e.preventDefault(),(0<t.props.value.length||t.props.submitted)&&t.props.onClear()}),Object(d.a)(Object(r.a)(t),"handleKeyDown",function(e){"Enter"===e.key?(e.preventDefault(),t.props.onSubmit()):"Escape"===e.key&&document.querySelector(".ui").parentElement.focus()}),Object(d.a)(Object(r.a)(t),"handleFocus",function(){t.setState({expanded:!0}),t.props.onShow()}),Object(d.a)(Object(r.a)(t),"handleBlur",function(){t.setState({expanded:!1})}),t}Object(u.a)(e,o);var t=e.prototype;return t.noop=function(){},t.render=function(){var e=this.props,t=e.intl,a=e.value,n=e.submitted,o=this.state.expanded,i=0<a.length||n;return Object(l.a)("div",{className:"search"},void 0,Object(l.a)("label",{},void 0,Object(l.a)("span",{style:{display:"none"}},void 0,t.formatMessage(I.placeholder)),Object(l.a)("input",{className:"search__input",type:"text",placeholder:t.formatMessage(I.placeholder),value:a,onChange:this.handleChange,onKeyUp:this.handleKeyDown,onFocus:this.handleFocus,onBlur:this.handleBlur})),Object(l.a)("div",{role:"button",tabIndex:"0",className:"search__icon",onClick:this.handleClear},void 0,Object(l.a)(N.a,{id:"search",className:i?"":"active"}),Object(l.a)(N.a,{id:"times-circle",className:i?"active":"","aria-label":t.formatMessage(I.placeholder)})),Object(l.a)(M.a,{show:o&&!i,placement:"bottom",target:this},void 0,Object(l.a)(D,{})))},e}(b.a.PureComponent))||n,P=Object(h.connect)(function(e){return{value:e.getIn(["search","value"]),submitted:e.getIn(["search","submitted"])}},function(t){return{onChange:function(e){t(Object(y.e)(e))},onClear:function(){t(Object(y.f)())},onSubmit:function(){t(Object(y.h)())},onShow:function(){t(Object(y.g)())}}})(T),R=a(5),E=a.n(R),q=a(27),A=a.n(q),F=a(891),K=a(897),z=a(25),L=a(962),U=a(378),W=a(980),H=function(e){var t=e.hashtag;return Object(l.a)("div",{className:"trends__item"},void 0,Object(l.a)("div",{className:"trends__item__name"},void 0,Object(l.a)(U.a,{href:t.get("url"),to:"/timelines/tag/"+t.get("name")},void 0,"#",Object(l.a)("span",{},void 0,t.get("name"))),Object(l.a)(_.b,{id:"trends.count_by_accounts",defaultMessage:"{count} {rawCount, plural, one {person} other {people}} talking",values:{rawCount:t.getIn(["history",0,"accounts"]),count:Object(l.a)("strong",{},void 0,Object(W.a)(t.getIn(["history",0,"accounts"])))}})),Object(l.a)("div",{className:"trends__item__current"},void 0,Object(W.a)(t.getIn(["history",0,"uses"]))),Object(l.a)("div",{className:"trends__item__sparkline"},void 0,Object(l.a)(L.Sparklines,{width:50,height:28,data:t.get("history")&&t.get("history").reverse().map(function(e){return e.get("uses")}).toArray()},void 0,Object(l.a)(L.SparklinesCurve,{style:{fill:"none"}}))))},B=Object(_.f)({dismissSuggestion:{id:"suggestions.dismiss",defaultMessage:"Dismiss suggestion"}}),Y=Object(_.g)((s=i=function(e){function t(){return e.apply(this,arguments)||this}Object(u.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){this.props.fetchSuggestions()},a.render=function(){var e,t,a,n=this.props,o=n.intl,i=n.results,s=n.suggestions,c=n.dismissSuggestion;if(i.isEmpty()&&!s.isEmpty())return Object(l.a)("div",{className:"search-results"},void 0,Object(l.a)("div",{className:"trends"},void 0,Object(l.a)("div",{className:"trends__header"},void 0,Object(l.a)(N.a,{id:"user-plus",fixedWidth:!0}),Object(l.a)(_.b,{id:"suggestions.header",defaultMessage:"You might be interested in…"})),s&&s.map(function(e){return Object(l.a)(F.a,{id:e,actionIcon:"times",actionTitle:o.formatMessage(B.dismissSuggestion),onActionClick:c},e)})));var r=0;return i.get("accounts")&&0<i.get("accounts").size&&(r+=i.get("accounts").size,e=Object(l.a)("div",{className:"search-results__section"},void 0,Object(l.a)("h5",{},void 0,Object(l.a)(N.a,{id:"users",fixedWidth:!0}),Object(l.a)(_.b,{id:"search_results.accounts",defaultMessage:"People"})),i.get("accounts").map(function(e){return Object(l.a)(F.a,{id:e},e)}))),i.get("statuses")&&0<i.get("statuses").size&&(r+=i.get("statuses").size,t=Object(l.a)("div",{className:"search-results__section"},void 0,Object(l.a)("h5",{},void 0,Object(l.a)(N.a,{id:"quote-right",fixedWidth:!0}),Object(l.a)(_.b,{id:"search_results.statuses",defaultMessage:"Toots"})),i.get("statuses").map(function(e){return Object(l.a)(K.a,{id:e},e)}))),i.get("hashtags")&&0<i.get("hashtags").size&&(r+=i.get("hashtags").size,a=Object(l.a)("div",{className:"search-results__section"},void 0,Object(l.a)("h5",{},void 0,Object(l.a)(N.a,{id:"hashtag",fixedWidth:!0}),Object(l.a)(_.b,{id:"search_results.hashtags",defaultMessage:"Hashtags"})),i.get("hashtags").map(function(e){return Object(l.a)(H,{hashtag:e},e.get("name"))}))),Object(l.a)("div",{className:"search-results"},void 0,Object(l.a)("div",{className:"search-results__header"},void 0,Object(l.a)(N.a,{id:"search",fixedWidth:!0}),Object(l.a)(_.b,{id:"search_results.total",defaultMessage:"{count, number} {count, plural, one {result} other {results}}",values:{count:r}})),e,t,a)},t}(z.a),Object(d.a)(i,"propTypes",{results:A.a.map.isRequired,suggestions:A.a.list.isRequired,fetchSuggestions:E.a.func.isRequired,dismissSuggestion:E.a.func.isRequired,intl:E.a.object.isRequired}),o=s))||o,X=a(235),G=Object(h.connect)(function(e){return{results:e.getIn(["search","results"]),suggestions:e.getIn(["suggestions","items"])}},function(t){return{fetchSuggestions:function(){return t(Object(X.f)())},dismissSuggestion:function(e){return t(Object(X.e)(e.get("id")))}}})(Y);a.d(t,"default",function(){return V});var J=Object(_.f)({start:{id:"getting_started.heading",defaultMessage:"Getting started"},home_timeline:{id:"tabs_bar.home",defaultMessage:"Home"},notifications:{id:"tabs_bar.notifications",defaultMessage:"Notifications"},public:{id:"navigation_bar.public_timeline",defaultMessage:"Federated timeline"},community:{id:"navigation_bar.community_timeline",defaultMessage:"Local timeline"},preferences:{id:"navigation_bar.preferences",defaultMessage:"Preferences"},logout:{id:"navigation_bar.logout",defaultMessage:"Logout"},compose:{id:"navigation_bar.compose",defaultMessage:"Compose new toot"}}),V=Object(h.connect)(function(e,t){return{columns:e.getIn(["settings","columns"]),showSearch:t.multiColumn?e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]):t.isSearchPage}})(c=Object(_.g)(c=function(o){function e(){for(var e,t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];return e=o.call.apply(o,[this].concat(a))||this,Object(d.a)(Object(r.a)(e),"onFocus",function(){e.props.dispatch(Object(O.S)(!0))}),Object(d.a)(Object(r.a)(e),"onBlur",function(){e.props.dispatch(Object(O.S)(!1))}),e}Object(u.a)(e,o);var t=e.prototype;return t.componentDidMount=function(){this.props.isSearchPage||this.props.dispatch(Object(O.cb)())},t.componentWillUnmount=function(){this.props.isSearchPage||this.props.dispatch(Object(O.kb)())},t.render=function(){var e=this.props,t=e.multiColumn,a=e.showSearch,n=e.isSearchPage,o=e.intl,i="";if(t){var s=this.props.columns;i=Object(l.a)("nav",{className:"drawer__header"},void 0,Object(l.a)(v.a,{to:"/getting-started",className:"drawer__tab",title:o.formatMessage(J.start),"aria-label":o.formatMessage(J.start)},void 0,Object(l.a)(N.a,{id:"bars",fixedWidth:!0})),!s.some(function(e){return"HOME"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/home",className:"drawer__tab",title:o.formatMessage(J.home_timeline),"aria-label":o.formatMessage(J.home_timeline)},void 0,Object(l.a)(N.a,{id:"home",fixedWidth:!0})),!s.some(function(e){return"NOTIFICATIONS"===e.get("id")})&&Object(l.a)(v.a,{to:"/notifications",className:"drawer__tab",title:o.formatMessage(J.notifications),"aria-label":o.formatMessage(J.notifications)},void 0,Object(l.a)(N.a,{id:"bell",fixedWidth:!0})),!s.some(function(e){return"COMMUNITY"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/public/local",className:"drawer__tab",title:o.formatMessage(J.community),"aria-label":o.formatMessage(J.community)},void 0,Object(l.a)(N.a,{id:"users",fixedWidth:!0})),!s.some(function(e){return"PUBLIC"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/public",className:"drawer__tab",title:o.formatMessage(J.public),"aria-label":o.formatMessage(J.public)},void 0,Object(l.a)(N.a,{id:"globe",fixedWidth:!0})),Object(l.a)("a",{href:"/user-settings",className:"drawer__tab",title:o.formatMessage(J.preferences),"aria-label":o.formatMessage(J.preferences)},void 0,Object(l.a)(N.a,{id:"cog",fixedWidth:!0})),Object(l.a)("a",{href:"/auth/sign_out",className:"drawer__tab","data-method":"delete",title:o.formatMessage(J.logout),"aria-label":o.formatMessage(J.logout)},void 0,Object(l.a)(N.a,{id:"sign-out",fixedWidth:!0})))}return Object(l.a)("div",{className:"drawer",role:"region","aria-label":o.formatMessage(J.compose)},void 0,i,(t||n)&&Object(l.a)(P,{}),Object(l.a)("div",{className:"drawer__pager"},void 0,!n&&Object(l.a)("div",{className:"drawer__inner",onFocus:this.onFocus},void 0,Object(l.a)(j,{onClose:this.onBlur}),Object(l.a)(g.a,{})),Object(l.a)(S.a,{defaultStyle:{x:n?0:-100},style:{x:x()(a||n?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return Object(l.a)("div",{className:"drawer__inner darker",style:{transform:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,Object(l.a)(G,{}))})))},e}(b.a.PureComponent))||c)||c}}]);
//# sourceMappingURL=compose.js.map