pleroma/priv/static/packs/features/compose.js
2020-01-22 16:00:23 +01:00

2 lines
No EOL
56 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([[18],{391:function(e,t,o){"use strict";(function(e){o.d(t,"a",function(){return u});var n=o(0),a=o(7),s=o(3),i=o.n(s),c=o(79),r=o.n(c),l=e.env.CDN_HOST||"",u=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 o=r.a[t.native]||r.a[t.native.replace(/\uFE0F$/,"")];if(!o)return null;e=l+"/emoji/"+o.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}(i.a.PureComponent)}).call(this,o(46))},573:function(e,t,o){"use strict";(function(e){o.d(t,"a",function(){return N});var n,a,s,i,c,r,l=o(0),u=o(2),d=o(7),p=o(1),g=o(3),b=o.n(g),m=o(6),f=o(41),h=o(113),j=o.n(h),O=o(10),v=o.n(O),y=o(64),_=o.n(y),C=o(52),k=Object(m.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"}}),S=e.env.CDN_HOST||"",M=function(){return S+"/emoji/sheet_10.png"},w=!!_.a.hasSupport&&{passive:!0},x=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(p.a)(Object(u.a)(t),"handleClick",function(e){t.props.onSelect(1*e.currentTarget.getAttribute("data-index"))}),Object(p.a)(Object(u.a)(t),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(p.a)(Object(u.a)(t),"setRef",function(e){t.node=e}),t}Object(d.a)(t,e);var o=t.prototype;return o.componentWillReceiveProps=function(e){e.active?this.attachListeners():this.removeListeners()},o.componentWillUnmount=function(){this.removeListeners()},o.attachListeners=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,w)},o.removeListeners=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,w)},o.render=function(){var e=this.props.active;return b.a.createElement("div",{className:"emoji-picker-dropdown__modifiers__menu",style:{display:e?"block":"none"},ref:this.setRef},Object(l.a)("button",{onClick:this.handleClick,"data-index":1},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:1,backgroundImageFn:M})),Object(l.a)("button",{onClick:this.handleClick,"data-index":2},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:2,backgroundImageFn:M})),Object(l.a)("button",{onClick:this.handleClick,"data-index":3},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:3,backgroundImageFn:M})),Object(l.a)("button",{onClick:this.handleClick,"data-index":4},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:4,backgroundImageFn:M})),Object(l.a)("button",{onClick:this.handleClick,"data-index":5},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:5,backgroundImageFn:M})),Object(l.a)("button",{onClick:this.handleClick,"data-index":6},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:6,backgroundImageFn:M})))},t}(b.a.PureComponent),T=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(p.a)(Object(u.a)(t),"handleClick",function(){t.props.active?t.props.onClose():t.props.onOpen()}),Object(p.a)(Object(u.a)(t),"handleSelect",function(e){t.props.onChange(e),t.props.onClose()}),t}return Object(d.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.active,o=e.modifier;return Object(l.a)("div",{className:"emoji-picker-dropdown__modifiers"},void 0,Object(l.a)(r,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:o,onClick:this.handleClick,backgroundImageFn:M}),Object(l.a)(x,{active:t,onSelect:this.handleSelect,onClose:this.props.onClose}))},t}(b.a.PureComponent),D=Object(m.g)((s=a=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(p.a)(Object(u.a)(t),"state",{modifierOpen:!1,placement:null}),Object(p.a)(Object(u.a)(t),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(p.a)(Object(u.a)(t),"setRef",function(e){t.node=e}),Object(p.a)(Object(u.a)(t),"getI18n",function(){var e=t.props.intl;return{search:e.formatMessage(k.emoji_search),notfound:e.formatMessage(k.emoji_not_found),categories:{search:e.formatMessage(k.search_results),recent:e.formatMessage(k.recent),people:e.formatMessage(k.people),nature:e.formatMessage(k.nature),foods:e.formatMessage(k.food),activity:e.formatMessage(k.activity),places:e.formatMessage(k.travel),objects:e.formatMessage(k.objects),symbols:e.formatMessage(k.symbols),flags:e.formatMessage(k.flags),custom:e.formatMessage(k.custom)}}}),Object(p.a)(Object(u.a)(t),"handleClick",function(e){e.native||(e.native=e.colons),t.props.onClose(),t.props.onPick(e)}),Object(p.a)(Object(u.a)(t),"handleModifierOpen",function(){t.setState({modifierOpen:!0})}),Object(p.a)(Object(u.a)(t),"handleModifierClose",function(){t.setState({modifierOpen:!1})}),Object(p.a)(Object(u.a)(t),"handleModifierChange",function(e){t.props.onSkinTone(e)}),t}Object(d.a)(t,e);var o=t.prototype;return o.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,w)},o.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,w)},o.render=function(){var e=this.props,t=e.loading,o=e.style,n=e.intl,a=e.custom_emojis,s=e.skinTone,i=e.frequentlyUsedEmojis;if(t)return Object(l.a)("div",{style:{width:299}});var r=n.formatMessage(k.emoji),u=this.state.modifierOpen,d=["recent","people","nature","foods","activity","places","objects","symbols","flags"];return d.splice.apply(d,[1,0].concat(Array.from(Object(C.categoriesFromEmojis)(a)).sort())),b.a.createElement("div",{className:v()("emoji-picker-dropdown__menu",{selecting:u}),style:o,ref:this.setRef},Object(l.a)(c,{perLine:8,emojiSize:22,sheetSize:32,custom:Object(C.buildCustomEmojis)(a),color:"",emoji:"",set:"twitter",title:r,i18n:this.getI18n(),onClick:this.handleClick,include:d,recent:i,skin:s,showPreview:!1,backgroundImageFn:M,autoFocus:!0,emojiTooltip:!0}),Object(l.a)(T,{active:u,modifier:s,onOpen:this.handleModifierOpen,onClose:this.handleModifierClose,onChange:this.handleModifierChange}))},t}(b.a.PureComponent),Object(p.a)(a,"defaultProps",{style:{},loading:!0,frequentlyUsedEmojis:[]}),n=s))||n,N=Object(m.g)(i=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(p.a)(Object(u.a)(t),"state",{active:!1,loading:!1}),Object(p.a)(Object(u.a)(t),"setRef",function(e){t.dropdown=e}),Object(p.a)(Object(u.a)(t),"onShowDropdown",function(e){var o=e.target;t.setState({active:!0}),c||(t.setState({loading:!0}),Object(f.l)().then(function(e){c=e.Picker,r=e.Emoji,t.setState({loading:!1})}).catch(function(){t.setState({loading:!1})}));var n=o.getBoundingClientRect().top;t.setState({placement:2*n<innerHeight?"bottom":"top"})}),Object(p.a)(Object(u.a)(t),"onHideDropdown",function(){t.setState({active:!1})}),Object(p.a)(Object(u.a)(t),"onToggle",function(e){t.state.loading||e.key&&"Enter"!==e.key||(t.state.active?t.onHideDropdown():t.onShowDropdown(e))}),Object(p.a)(Object(u.a)(t),"handleKeyDown",function(e){"Escape"===e.key&&t.onHideDropdown()}),Object(p.a)(Object(u.a)(t),"setTargetRef",function(e){t.target=e}),Object(p.a)(Object(u.a)(t),"findTarget",function(){return t.target}),t}return Object(d.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.intl,o=e.onPickEmoji,n=e.onSkinTone,a=e.skinTone,s=e.frequentlyUsedEmojis,i=t.formatMessage(k.emoji),c=this.state,r=c.active,u=c.loading,d=c.placement;return Object(l.a)("div",{className:"emoji-picker-dropdown",onKeyDown:this.handleKeyDown},void 0,b.a.createElement("div",{ref:this.setTargetRef,className:"emoji-button",title:i,"aria-label":i,"aria-expanded":r,role:"button",onClick:this.onToggle,onKeyDown:this.onToggle,tabIndex:0},Object(l.a)("img",{className:v()("emojione",{"pulse-loading":r&&u}),alt:"🙂",src:S+"/emoji/1f602.svg"})),Object(l.a)(j.a,{show:r,placement:d,target:this.findTarget},void 0,Object(l.a)(D,{custom_emojis:this.props.custom_emojis,loading:u,onClose:this.onHideDropdown,onPick:o,onSkinTone:n,skinTone:a,frequentlyUsedEmojis:s})))},t}(b.a.PureComponent))||i}).call(this,o(46))},574:function(e,t,o){"use strict";var n,a,s,i=o(12),c=o(0),r=o(2),l=o(7),u=o(1),d=o(3),p=o.n(d),g=o(308),b=o(101),m=o(18),f=o.n(m),h=o(5),j=o.n(h),O=o(21),v=o(204),y=o(107),_=o(51),C=o(116),k=o(6),S=o(19),M=o(214),w=o(276),x=Object(k.f)({cancel:{id:"reply_indicator.cancel",defaultMessage:"Cancel"}}),T=Object(k.g)((s=a=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleClick",function(){t.props.onCancel()}),Object(u.a)(Object(r.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(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.status,o=e.intl;if(!t)return null;var n={__html:t.get("contentHtml")},a={direction:Object(M.a)(t.get("search_index"))?"rtl":"ltr"};return Object(c.a)("div",{className:"reply-indicator"},void 0,Object(c.a)("div",{className:"reply-indicator__header"},void 0,Object(c.a)("div",{className:"reply-indicator__cancel"},void 0,Object(c.a)(_.a,{title:o.formatMessage(x.cancel),icon:"times",onClick:this.handleClick,inverted:!0})),Object(c.a)("a",{href:t.getIn(["account","url"]),onClick:this.handleAccountClick,className:"reply-indicator__display-name"},void 0,Object(c.a)("div",{className:"reply-indicator__display-avatar"},void 0,Object(c.a)(y.a,{account:t.get("account"),size:24})),Object(c.a)(C.a,{account:t.get("account")}))),Object(c.a)("div",{className:"reply-indicator__content",style:a,dangerouslySetInnerHTML:n}),t.get("media_attachments").size>0&&Object(c.a)(w.a,{compact:!0,media:t.get("media_attachments")}))},t}(S.a),Object(u.a)(a,"contextTypes",{router:j.a.object}),Object(u.a)(a,"propTypes",{status:f.a.map,onCancel:j.a.func.isRequired,intl:j.a.object.isRequired}),n=s))||n,D=Object(i.connect)(function(){var e=Object(v.f)();return function(t){return{status:e(t,{id:t.getIn(["compose","in_reply_to"])})}}},function(e){return{onCancel:function(){e(Object(O.M)())}}})(T),N=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props.account;return Object(c.a)("div",{className:"autosuggest-account",title:e.get("acct")},void 0,Object(c.a)("div",{className:"autosuggest-account-icon"},void 0,Object(c.a)(y.a,{account:e,size:18})),Object(c.a)(C.a,{account:e}))},t}(S.a);Object(u.a)(N,"propTypes",{account:f.a.map.isRequired});var I=Object(i.connect)(function(){var e=Object(v.d)();return function(t,o){var n=o.id;return{account:e(t,n)}}})(N),R=o(391),P=o(408),F=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props.tag,t=e.history&&Object(P.a)(e.history.reduce(function(e,t){return e+1*t.uses},0));return Object(c.a)("div",{className:"autosuggest-hashtag"},void 0,Object(c.a)("div",{className:"autosuggest-hashtag__name"},void 0,"#",Object(c.a)("strong",{},void 0,e.name)),void 0!==e.history&&Object(c.a)("div",{className:"autosuggest-hashtag__uses"},void 0,Object(c.a)(k.b,{id:"autosuggest_hashtag.per_week",defaultMessage:"{count} per week",values:{count:t}})))},t}(p.a.PureComponent),E=o(145),q=o(10),A=o.n(q),K=function(e,t){var o,n=e.slice(0,t).search(/\S+$/),a=e.slice(t).search(/\s/);return!(o=a<0?e.slice(n):e.slice(n,a+t))||o.trim().length<3||-1===["@",":","#"].indexOf(o[0])?[null,null]:(o=o.trim().toLowerCase()).length>0?[n+1,o]:[null,null]},L=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"state",{suggestionsHidden:!0,focused:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(u.a)(Object(r.a)(t),"onChange",function(e){var o=K(e.target.value,e.target.selectionStart),n=o[0],a=o[1];null!==a&&t.state.lastToken!==a?(t.setState({lastToken:a,selectedSuggestion:0,tokenStart:n}),t.props.onSuggestionsFetchRequested(a)):null===a&&(t.setState({lastToken:null}),t.props.onSuggestionsClearRequested()),t.props.onChange(e)}),Object(u.a)(Object(r.a)(t),"onKeyDown",function(e){var o=t.props,n=o.suggestions,a=o.disabled,s=t.state,i=s.selectedSuggestion,c=s.suggestionsHidden;if(a)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===n.size||c?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),t.setState({suggestionsHidden:!0}));break;case"ArrowDown":n.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.min(i+1,n.size-1)}));break;case"ArrowUp":n.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.max(i-1,0)}));break;case"Enter":case"Tab":null!==t.state.lastToken&&n.size>0&&!c&&(e.preventDefault(),e.stopPropagation(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,n.get(i)))}!e.defaultPrevented&&t.props.onKeyDown&&t.props.onKeyDown(e)}}),Object(u.a)(Object(r.a)(t),"onBlur",function(){t.setState({suggestionsHidden:!0,focused:!1})}),Object(u.a)(Object(r.a)(t),"onFocus",function(e){t.setState({focused:!0}),t.props.onFocus&&t.props.onFocus(e)}),Object(u.a)(Object(r.a)(t),"onSuggestionClick",function(e){var o=t.props.suggestions.get(e.currentTarget.getAttribute("data-index"));e.preventDefault(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,o),t.textarea.focus()}),Object(u.a)(Object(r.a)(t),"setTextarea",function(e){t.textarea=e}),Object(u.a)(Object(r.a)(t),"onPaste",function(e){e.clipboardData&&1===e.clipboardData.files.length&&(t.props.onPaste(e.clipboardData.files),e.preventDefault())}),Object(u.a)(Object(r.a)(t),"renderSuggestion",function(e,o){var n,a,s=t.state.selectedSuggestion;return"emoji"===e.type?(n=Object(c.a)(R.a,{emoji:e}),a=e.id):"hashtag"===e.type?(n=Object(c.a)(F,{tag:e}),a=e.name):"account"===e.type&&(n=Object(c.a)(I,{id:e.id}),a=e.id),Object(c.a)("div",{role:"button",tabIndex:"0","data-index":o,className:A()("autosuggest-textarea__suggestions__item",{selected:o===s}),onMouseDown:t.onSuggestionClick},a,n)}),t}Object(l.a)(t,e);var o=t.prototype;return o.componentWillReceiveProps=function(e){e.suggestions!==this.props.suggestions&&e.suggestions.size>0&&this.state.suggestionsHidden&&this.state.focused&&this.setState({suggestionsHidden:!1})},o.render=function(){var e=this.props,t=e.value,o=e.suggestions,n=e.disabled,a=e.placeholder,s=e.onKeyUp,i=e.autoFocus,r=e.children,l=this.state.suggestionsHidden,u={direction:"ltr"};return Object(M.a)(t)&&(u.direction="rtl"),[Object(c.a)("div",{className:"compose-form__autosuggest-wrapper"},"autosuggest-wrapper",Object(c.a)("div",{className:"autosuggest-textarea"},void 0,Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,a),Object(c.a)(E.a,{inputRef:this.setTextarea,className:"autosuggest-textarea__textarea",disabled:n,placeholder:a,autoFocus:i,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:s,onFocus:this.onFocus,onBlur:this.onBlur,onPaste:this.onPaste,style:u,"aria-autocomplete":"list"}))),r),Object(c.a)("div",{className:"autosuggest-textarea__suggestions-wrapper"},"suggestions-wrapper",Object(c.a)("div",{className:"autosuggest-textarea__suggestions "+(l||o.isEmpty()?"":"autosuggest-textarea__suggestions--visible")},void 0,o.map(this.renderSuggestion)))]},t}(S.a);Object(u.a)(L,"propTypes",{value:j.a.string,suggestions:f.a.list,disabled:j.a.bool,placeholder:j.a.string,onSuggestionSelected:j.a.func.isRequired,onSuggestionsClearRequested:j.a.func.isRequired,onSuggestionsFetchRequested:j.a.func.isRequired,onChange:j.a.func.isRequired,onKeyUp:j.a.func,onKeyDown:j.a.func,onPaste:j.a.func.isRequired,autoFocus:j.a.bool}),Object(u.a)(L,"defaultProps",{autoFocus:!0});var U,z=o(4),W=function(e,t,o){var n,a=e.slice(0,t).search(/\S+$/),s=e.slice(t).search(/\s/);return!(n=s<0?e.slice(a):e.slice(a,s+t))||n.trim().length<3||-1===o.indexOf(n[0])?[null,null]:(n=n.trim().toLowerCase()).length>0?[a+1,n]:[null,null]},H=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"state",{suggestionsHidden:!0,focused:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(u.a)(Object(r.a)(t),"onChange",function(e){var o=W(e.target.value,e.target.selectionStart,t.props.searchTokens),n=o[0],a=o[1];null!==a&&t.state.lastToken!==a?(t.setState({lastToken:a,selectedSuggestion:0,tokenStart:n}),t.props.onSuggestionsFetchRequested(a)):null===a&&(t.setState({lastToken:null}),t.props.onSuggestionsClearRequested()),t.props.onChange(e)}),Object(u.a)(Object(r.a)(t),"onKeyDown",function(e){var o=t.props,n=o.suggestions,a=o.disabled,s=t.state,i=s.selectedSuggestion,c=s.suggestionsHidden;if(a)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===n.size||c?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),t.setState({suggestionsHidden:!0}));break;case"ArrowDown":n.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.min(i+1,n.size-1)}));break;case"ArrowUp":n.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.max(i-1,0)}));break;case"Enter":case"Tab":null!==t.state.lastToken&&n.size>0&&!c&&(e.preventDefault(),e.stopPropagation(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,n.get(i)))}!e.defaultPrevented&&t.props.onKeyDown&&t.props.onKeyDown(e)}}),Object(u.a)(Object(r.a)(t),"onBlur",function(){t.setState({suggestionsHidden:!0,focused:!1})}),Object(u.a)(Object(r.a)(t),"onFocus",function(){t.setState({focused:!0})}),Object(u.a)(Object(r.a)(t),"onSuggestionClick",function(e){var o=t.props.suggestions.get(e.currentTarget.getAttribute("data-index"));e.preventDefault(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,o),t.input.focus()}),Object(u.a)(Object(r.a)(t),"setInput",function(e){t.input=e}),Object(u.a)(Object(r.a)(t),"renderSuggestion",function(e,o){var n,a,s=t.state.selectedSuggestion;return"emoji"===e.type?(n=Object(c.a)(R.a,{emoji:e}),a=e.id):"hashtag"===e.type?(n=Object(c.a)(F,{tag:e}),a=e.name):"account"===e.type&&(n=Object(c.a)(I,{id:e.id}),a=e.id),Object(c.a)("div",{role:"button",tabIndex:"0","data-index":o,className:A()("autosuggest-textarea__suggestions__item",{selected:o===s}),onMouseDown:t.onSuggestionClick},a,n)}),t}Object(l.a)(t,e);var o=t.prototype;return o.componentWillReceiveProps=function(e){e.suggestions!==this.props.suggestions&&e.suggestions.size>0&&this.state.suggestionsHidden&&this.state.focused&&this.setState({suggestionsHidden:!1})},o.render=function(){var e=this.props,t=e.value,o=e.suggestions,n=e.disabled,a=e.placeholder,s=e.onKeyUp,i=e.autoFocus,r=e.className,l=e.id,u=e.maxLength,d=this.state.suggestionsHidden,g={direction:"ltr"};return Object(M.a)(t)&&(g.direction="rtl"),Object(c.a)("div",{className:"autosuggest-input"},void 0,Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,a),p.a.createElement("input",{type:"text",ref:this.setInput,disabled:n,placeholder:a,autoFocus:i,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:s,onFocus:this.onFocus,onBlur:this.onBlur,style:g,"aria-autocomplete":"list",id:l,className:r,maxLength:u})),Object(c.a)("div",{className:"autosuggest-textarea__suggestions "+(d||o.isEmpty()?"":"autosuggest-textarea__suggestions--visible")},void 0,o.map(this.renderSuggestion)))},t}(S.a);Object(u.a)(H,"propTypes",{value:j.a.string,suggestions:f.a.list,disabled:j.a.bool,placeholder:j.a.string,onSuggestionSelected:j.a.func.isRequired,onSuggestionsClearRequested:j.a.func.isRequired,onSuggestionsFetchRequested:j.a.func.isRequired,onChange:j.a.func.isRequired,onKeyUp:j.a.func,onKeyDown:j.a.func,autoFocus:j.a.bool,className:j.a.string,id:j.a.string,searchTokens:j.a.arrayOf(j.a.string),maxLength:j.a.number}),Object(u.a)(H,"defaultProps",{autoFocus:!0,searchTokens:Object(z.List)(["@",":","#"])});var B,G,Y,X,V,J,Z,$,Q=Object(k.f)({add_poll:{id:"poll_button.add_poll",defaultMessage:"Add a poll"},remove_poll:{id:"poll_button.remove_poll",defaultMessage:"Remove poll"}}),ee={height:null,lineHeight:"27px"},te=Object(k.g)(U=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleClick",function(){t.props.onClick()}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.intl,o=e.active,n=e.unavailable,a=e.disabled;return n?null:Object(c.a)("div",{className:"compose-form__poll-button"},void 0,Object(c.a)(_.a,{icon:"tasks",title:t.formatMessage(o?Q.remove_poll:Q.add_poll),disabled:a,onClick:this.handleClick,className:"compose-form__poll-button-icon "+(o?"active":""),size:18,inverted:!0,style:ee}))},t}(p.a.PureComponent))||U,oe=Object(i.connect)(function(e){return{unavailable:e.getIn(["compose","is_uploading"])||e.getIn(["compose","media_attachments"]).size>0,active:null!==e.getIn(["compose","poll"])}},function(e){return{onClick:function(){e(function(t,o){o().getIn(["compose","poll"])?e(Object(O.eb)()):e(Object(O.K)())})}}})(te),ne=Object(k.f)({upload:{id:"upload_button.label",defaultMessage:"Add media ({formats})"}}),ae={height:null,lineHeight:"27px"},se=Object(i.connect)(function(){return function(e){return{acceptContentTypes:e.getIn(["media_attachments","accept_content_types"])}}})(B=Object(k.g)((Y=G=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleChange",function(e){e.target.files.length>0&&t.props.onSelectFile(e.target.files)}),Object(u.a)(Object(r.a)(t),"handleClick",function(){t.fileElement.click()}),Object(u.a)(Object(r.a)(t),"setRef",function(e){t.fileElement=e}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.intl,o=e.resetFileKey,n=e.unavailable,a=e.disabled;e.acceptContentTypes;return n?null:Object(c.a)("div",{className:"compose-form__upload-button"},void 0,Object(c.a)(_.a,{icon:"paperclip",title:t.formatMessage(ne.upload,{formats:"JPEG, PNG, GIF, WebM, MP4, MOV, OGG, WAV, MP3, FLAC"}),disabled:a,onClick:this.handleClick,className:"compose-form__upload-button-icon",size:18,inverted:!0,style:ae}),Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,t.formatMessage(ne.upload,{formats:"JPEG, PNG, GIF, WebM, MP4, MOV, OGG, WAV, MP3, FLAC"})),p.a.createElement("input",{key:o,ref:this.setRef,type:"file",multiple:!0,onChange:this.handleChange,disabled:a,style:{display:"none"}})))},t}(S.a),Object(u.a)(G,"propTypes",{disabled:j.a.bool,unavailable:j.a.bool,onSelectFile:j.a.func.isRequired,style:j.a.object,resetFileKey:j.a.number,acceptContentTypes:f.a.listOf(j.a.string).isRequired,intl:j.a.object.isRequired}),B=Y))||B)||B,ie=Object(i.connect)(function(e){return{disabled:e.getIn(["compose","is_uploading"])||e.getIn(["compose","media_attachments"]).size>3||e.getIn(["compose","media_attachments"]).some(function(e){return["video","audio"].includes(e.get("type"))}),unavailable:null!==e.getIn(["compose","poll"]),resetFileKey:e.getIn(["compose","resetFileKey"])}},function(e){return{onSelectFile:function(t){e(Object(O.mb)(t))}}})(se),ce={height:null,lineHeight:"27px",width:"23.14285722px"},re=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleClick",function(e){e.preventDefault(),t.props.onClick()}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.label,o=e.title,n=e.active,a=e.ariaControls;return Object(c.a)("button",{title:o,"aria-label":o,className:"text-icon-button "+(n?"active":""),"aria-expanded":n,onClick:this.handleClick,"aria-controls":a,style:ce},void 0,t)},t}(p.a.PureComponent),le=Object(k.f)({marked:{id:"compose_form.spoiler.marked",defaultMessage:"Text is hidden behind warning"},unmarked:{id:"compose_form.spoiler.unmarked",defaultMessage:"Text is not hidden"}}),ue=Object(k.g)(Object(i.connect)(function(e,t){return{label:"CW",title:t.intl.formatMessage(e.getIn(["compose","spoiler"])?le.marked:le.unmarked),active:e.getIn(["compose","spoiler"]),ariaControls:"cw-spoiler-input"}},function(e){return{onClick:function(){e(Object(O.Q)())}}})(re)),de=o(13),pe=o(113),ge=o.n(pe),be=o(88),me=o(34),fe=o.n(me),he=o(64),je=o.n(he),Oe=o(27),ve=Object(k.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"}}),ye=!!je.a.hasSupport&&{passive:!0},_e=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"state",{mounted:!1}),Object(u.a)(Object(r.a)(t),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(u.a)(Object(r.a)(t),"handleKeyDown",function(e){var o,n=t.props.items,a=e.currentTarget.getAttribute("data-index"),s=n.findIndex(function(e){return e.value===a});switch(e.key){case"Escape":t.props.onClose();break;case"Enter":t.handleClick(e);break;case"ArrowDown":(o=t.node.childNodes[s+1])&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"ArrowUp":(o=t.node.childNodes[s-1])&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"Tab":(o=e.shiftKey?t.node.childNodes[s-1]||t.node.lastChild:t.node.childNodes[s+1]||t.node.firstChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")),e.preventDefault(),e.stopPropagation());break;case"Home":(o=t.node.firstChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"End":(o=t.node.lastChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")))}}),Object(u.a)(Object(r.a)(t),"handleClick",function(e){var o=e.currentTarget.getAttribute("data-index");e.preventDefault(),t.props.onClose(),t.props.onChange(o)}),Object(u.a)(Object(r.a)(t),"setRef",function(e){t.node=e}),Object(u.a)(Object(r.a)(t),"setFocusRef",function(e){t.focusedItem=e}),t}Object(l.a)(t,e);var o=t.prototype;return o.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,ye),this.focusedItem&&this.focusedItem.focus(),this.setState({mounted:!0})},o.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,ye)},o.render=function(){var e=this,t=this.state.mounted,o=this.props,n=o.style,a=o.items,s=o.placement,i=o.value;return Object(c.a)(be.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:fe()(1,{damping:35,stiffness:400}),scaleX:fe()(1,{damping:35,stiffness:400}),scaleY:fe()(1,{damping:35,stiffness:400})}},void 0,function(o){var r=o.opacity,l=o.scaleX,u=o.scaleY;return p.a.createElement("div",{className:"privacy-dropdown__dropdown "+s,style:Object(de.default)({},n,{opacity:r,transform:t?"scale("+l+", "+u+")":null,zIndex:2}),role:"listbox",ref:e.setRef},a.map(function(t){return p.a.createElement("div",{role:"option",tabIndex:"0",key:t.value,"data-index":t.value,onKeyDown:e.handleKeyDown,onClick:e.handleClick,className:A()("privacy-dropdown__option",{active:t.value===i}),"aria-selected":t.value===i,ref:t.value===i?e.setFocusRef:null},Object(c.a)("div",{className:"privacy-dropdown__option__icon"},void 0,Object(c.a)(Oe.a,{id:t.icon,fixedWidth:!0})),Object(c.a)("div",{className:"privacy-dropdown__option__content"},void 0,Object(c.a)("strong",{},void 0,t.text),t.meta))}))})},t}(p.a.PureComponent),Ce=Object(k.g)(X=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"state",{open:!1,placement:"bottom"}),Object(u.a)(Object(r.a)(t),"handleToggle",function(e){var o=e.target;if(t.props.isUserTouching())t.state.open?t.props.onModalClose():t.props.onModalOpen({actions:t.options.map(function(e){return Object(de.default)({},e,{active:e.value===t.props.value})}),onClick:t.handleModalActionClick});else{var n=o.getBoundingClientRect().top;t.state.open&&t.activeElement&&t.activeElement.focus(),t.setState({placement:2*n<innerHeight?"bottom":"top"}),t.setState({open:!t.state.open})}}),Object(u.a)(Object(r.a)(t),"handleModalActionClick",function(e){e.preventDefault();var o=t.options[e.currentTarget.getAttribute("data-index")].value;t.props.onModalClose(),t.props.onChange(o)}),Object(u.a)(Object(r.a)(t),"handleKeyDown",function(e){switch(e.key){case"Escape":t.handleClose()}}),Object(u.a)(Object(r.a)(t),"handleMouseDown",function(){t.state.open||(t.activeElement=document.activeElement)}),Object(u.a)(Object(r.a)(t),"handleButtonKeyDown",function(e){switch(e.key){case" ":case"Enter":t.handleMouseDown()}}),Object(u.a)(Object(r.a)(t),"handleClose",function(){t.state.open&&t.activeElement&&t.activeElement.focus(),t.setState({open:!1})}),Object(u.a)(Object(r.a)(t),"handleChange",function(e){t.props.onChange(e)}),t}Object(l.a)(t,e);var o=t.prototype;return o.componentWillMount=function(){var e=this.props.intl.formatMessage;this.options=[{icon:"globe",value:"public",text:e(ve.public_short),meta:e(ve.public_long)},{icon:"unlock",value:"unlisted",text:e(ve.unlisted_short),meta:e(ve.unlisted_long)},{icon:"lock",value:"private",text:e(ve.private_short),meta:e(ve.private_long)},{icon:"envelope",value:"direct",text:e(ve.direct_short),meta:e(ve.direct_long)}]},o.render=function(){var e=this.props,t=e.value,o=e.intl,n=this.state,a=n.open,s=n.placement,i=this.options.find(function(e){return e.value===t});return Object(c.a)("div",{className:A()("privacy-dropdown",s,{active:a}),onKeyDown:this.handleKeyDown},void 0,Object(c.a)("div",{className:A()("privacy-dropdown__value",{active:this.options.indexOf(i)===("bottom"===s?0:this.options.length-1)})},void 0,Object(c.a)(_.a,{className:"privacy-dropdown__value-icon",icon:i.icon,title:o.formatMessage(ve.change_privacy),size:18,expanded:a,active:a,inverted:!0,onClick:this.handleToggle,onMouseDown:this.handleMouseDown,onKeyDown:this.handleButtonKeyDown,style:{height:null,lineHeight:"27px"}})),Object(c.a)(ge.a,{show:a,placement:s,target:this},void 0,Object(c.a)(_e,{items:this.options,value:t,onClose:this.handleClose,onChange:this.handleChange,placement:s})))},t}(p.a.PureComponent))||X,ke=o(47),Se=o(114),Me=Object(i.connect)(function(e){return{isModalOpen:"ACTIONS"===e.get("modal").modalType,value:e.getIn(["compose","privacy"])}},function(e){return{onChange:function(t){e(Object(O.R)(t))},isUserTouching:Se.c,onModalOpen:function(t){return e(Object(ke.d)("ACTIONS",t))},onModalClose:function(){return e(Object(ke.c)())}}})(Ce),we=o(573),xe=o(72),Te=o(53),De=o(225),Ne=["+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"],Ie=Object(Te.a)([function(e){return e.getIn(["settings","frequentlyUsedEmojis"],Object(z.Map)())}],function(e){var t=e.keySeq().sort(function(t,o){return e.get(t)-e.get(o)}).reverse().slice(0,16).toArray();if(t.length<Ne.length){var o=Ne.filter(function(e){return!t.includes(e)});t=t.concat(o.slice(0,Ne.length-t.length))}return t}),Re=Object(Te.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 o=e.get("shortcode").toLowerCase(),n=t.get("shortcode").toLowerCase();return o<n?-1:o>n?1:0})}),Pe=Object(i.connect)(function(e){return{custom_emojis:Re(e),skinTone:e.getIn(["settings","skinTone"]),frequentlyUsedEmojis:Ie(e)}},function(e,t){var o=t.onPickEmoji;return{onSkinTone:function(t){e(Object(xe.c)(["skinTone"],t))},onPickEmoji:function(t){e(Object(De.b)(t)),o&&o(t)}}})(we.a),Fe=o(22),Ee=o(31),qe=Object(k.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}}"}}),Ae=Object(k.g)(V=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleOptionTitleChange",function(e){t.props.onChange(t.props.index,e.target.value)}),Object(u.a)(Object(r.a)(t),"handleOptionRemove",function(){t.props.onRemove(t.props.index)}),Object(u.a)(Object(r.a)(t),"handleToggleMultiple",function(e){t.props.onToggleMultiple(),e.preventDefault(),e.stopPropagation()}),Object(u.a)(Object(r.a)(t),"onSuggestionsClearRequested",function(){t.props.onClearSuggestions()}),Object(u.a)(Object(r.a)(t),"onSuggestionsFetchRequested",function(e){t.props.onFetchSuggestions(e)}),Object(u.a)(Object(r.a)(t),"onSuggestionSelected",function(e,o,n){t.props.onSuggestionSelected(e,o,n,["poll","options",t.props.index])}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.isPollMultiple,o=e.title,n=e.index,a=e.intl;return Object(c.a)("li",{},void 0,Object(c.a)("label",{className:"poll__text editable"},void 0,Object(c.a)("span",{className:A()("poll__input",{checkbox:t}),onClick:this.handleToggleMultiple,role:"button",tabIndex:"0"}),Object(c.a)(H,{placeholder:a.formatMessage(qe.option_placeholder,{number:n+1}),maxLength:25,value:o,onChange:this.handleOptionTitleChange,suggestions:this.props.suggestions,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSuggestionSelected,searchTokens:[":"]})),Object(c.a)("div",{className:"poll__cancel"},void 0,Object(c.a)(_.a,{disabled:n<=1,title:a.formatMessage(qe.remove_option),icon:"times",onClick:this.handleOptionRemove})))},t}(p.a.PureComponent))||V,Ke=Object(k.g)(($=Z=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleAddOption",function(){t.props.onAddOption("")}),Object(u.a)(Object(r.a)(t),"handleSelectDuration",function(e){t.props.onChangeSettings(e.target.value,t.props.isMultiple)}),Object(u.a)(Object(r.a)(t),"handleToggleMultiple",function(){t.props.onChangeSettings(t.props.expiresIn,!t.props.isMultiple)}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this,t=this.props,o=t.options,n=t.expiresIn,a=t.isMultiple,s=t.onChangeOption,i=t.onRemoveOption,r=t.intl,l=Object(Ee.default)(t,["options","expiresIn","isMultiple","onChangeOption","onRemoveOption","intl"]);return o?Object(c.a)("div",{className:"compose-form__poll-wrapper"},void 0,Object(c.a)("ul",{},void 0,o.map(function(t,o){return p.a.createElement(Ae,Object(Fe.a)({title:t,key:o,index:o,onChange:s,onRemove:i,isPollMultiple:a,onToggleMultiple:e.handleToggleMultiple},l))})),Object(c.a)("div",{className:"poll__footer"},void 0,o.size<4&&Object(c.a)("button",{className:"button button-secondary",onClick:this.handleAddOption},void 0,Object(c.a)(Oe.a,{id:"plus"})," ",p.a.createElement(k.b,qe.add_option)),Object(c.a)("select",{value:n,onChange:this.handleSelectDuration},void 0,Object(c.a)("option",{value:300},void 0,r.formatMessage(qe.minutes,{number:5})),Object(c.a)("option",{value:1800},void 0,r.formatMessage(qe.minutes,{number:30})),Object(c.a)("option",{value:3600},void 0,r.formatMessage(qe.hours,{number:1})),Object(c.a)("option",{value:21600},void 0,r.formatMessage(qe.hours,{number:6})),Object(c.a)("option",{value:86400},void 0,r.formatMessage(qe.days,{number:1})),Object(c.a)("option",{value:259200},void 0,r.formatMessage(qe.days,{number:3})),Object(c.a)("option",{value:604800},void 0,r.formatMessage(qe.days,{number:7}))))):null},t}(S.a),Object(u.a)(Z,"propTypes",{options:f.a.list,expiresIn:j.a.number,isMultiple:j.a.bool,onChangeOption:j.a.func.isRequired,onAddOption:j.a.func.isRequired,onRemoveOption:j.a.func.isRequired,onChangeSettings:j.a.func.isRequired,suggestions:f.a.list,onClearSuggestions:j.a.func.isRequired,onFetchSuggestions:j.a.func.isRequired,onSuggestionSelected:j.a.func.isRequired,intl:j.a.object.isRequired}),J=$))||J,Le=Object(i.connect)(function(e){return{suggestions:e.getIn(["compose","suggestions"]),options:e.getIn(["compose","poll","options"]),expiresIn:e.getIn(["compose","poll","expires_in"]),isMultiple:e.getIn(["compose","poll","multiple"])}},function(e){return{onAddOption:function(t){e(Object(O.L)(t))},onRemoveOption:function(t){e(Object(O.fb)(t))},onChangeOption:function(t,o){e(Object(O.T)(t,o))},onChangeSettings:function(t,o){e(Object(O.U)(t,o))},onClearSuggestions:function(){e(Object(O.W)())},onFetchSuggestions:function(t){e(Object(O.Z)(t))},onSuggestionSelected:function(t,o,n,a){e(Object(O.ib)(t,o,n,a))}}})(Ke),Ue=o(307),ze=Object(i.connect)(function(e){return{active:e.getIn(["compose","is_uploading"]),progress:e.getIn(["compose","progress"])}})(Ue.a),We=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleUndoClick",function(e){e.stopPropagation(),t.props.onUndo(t.props.media.get("id"))}),Object(u.a)(Object(r.a)(t),"handleFocalPointClick",function(e){e.stopPropagation(),t.props.onOpenFocalPoint(t.props.media.get("id"))}),t}return Object(l.a)(t,e),t.prototype.render=function(){var e=this,t=this.props.media,o=t.getIn(["meta","focus","x"]),n=t.getIn(["meta","focus","y"]),a=100*(o/2+.5),s=100*(n/-2+.5);return Object(c.a)("div",{className:"compose-form__upload",tabIndex:"0",role:"button"},void 0,Object(c.a)(be.a,{defaultStyle:{scale:.8},style:{scale:fe()(1,{stiffness:180,damping:12})}},void 0,function(o){var n=o.scale;return Object(c.a)("div",{className:"compose-form__upload-thumbnail",style:{transform:"scale("+n+")",backgroundImage:"url("+t.get("preview_url")+")",backgroundPosition:a+"% "+s+"%"}},void 0,Object(c.a)("div",{className:A()("compose-form__upload__actions",{active:!0})},void 0,Object(c.a)("button",{className:"icon-button",onClick:e.handleUndoClick},void 0,Object(c.a)(Oe.a,{id:"times"})," ",Object(c.a)(k.b,{id:"upload_form.undo",defaultMessage:"Delete"})),Object(c.a)("button",{className:"icon-button",onClick:e.handleFocalPointClick},void 0,Object(c.a)(Oe.a,{id:"pencil"})," ",Object(c.a)(k.b,{id:"upload_form.edit",defaultMessage:"Edit"}))))}))},t}(S.a);Object(u.a)(We,"contextTypes",{router:j.a.object}),Object(u.a)(We,"propTypes",{media:f.a.map.isRequired,onUndo:j.a.func.isRequired,onOpenFocalPoint:j.a.func.isRequired});var He=Object(i.connect)(function(e,t){var o=t.id;return{media:e.getIn(["compose","media_attachments"]).find(function(e){return e.get("id")===o})}},function(e){return{onUndo:function(t){e(Object(O.kb)(t))},onOpenFocalPoint:function(t){e(Object(ke.d)("FOCAL_POINT",{id:t}))},onSubmit:function(t){e(Object(O.jb)(t))}}})(We),Be=Object(k.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"}}),Ge=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.active,o=e.disabled,n=e.onClick,a=e.intl;return Object(c.a)("div",{className:"compose-form__sensitive-button"},void 0,Object(c.a)("label",{className:A()("icon-button",{active:t}),title:a.formatMessage(t?Be.marked:Be.unmarked)},void 0,Object(c.a)("input",{name:"mark-sensitive",type:"checkbox",checked:t,onChange:n,disabled:o}),Object(c.a)("span",{className:A()("checkbox",{active:t})}),Object(c.a)(k.b,{id:"compose_form.sensitive.hide",defaultMessage:"Mark media as sensitive"})))},t}(p.a.PureComponent),Ye=Object(i.connect)(function(e){return{active:e.getIn(["compose","sensitive"]),disabled:e.getIn(["compose","spoiler"])}},function(e){return{onClick:function(){e(Object(O.O)())}}})(Object(k.g)(Ge)),Xe=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props.mediaIds;return Object(c.a)("div",{className:"compose-form__upload-wrapper"},void 0,Object(c.a)(ze,{icon:"upload",message:Object(c.a)(k.b,{id:"upload_progress.label",defaultMessage:"Uploading…"})}),Object(c.a)("div",{className:"compose-form__uploads-wrapper"},void 0,e.map(function(e){return Object(c.a)(He,{id:e},e)})),!e.isEmpty()&&Object(c.a)(Ye,{}))},t}(S.a);Object(u.a)(Xe,"propTypes",{mediaIds:f.a.list.isRequired});var Ve,Je,Ze,$e=Object(i.connect)(function(e){return{mediaIds:e.getIn(["compose","media_attachments"]).map(function(e){return e.get("id")})}})(Xe),Qe=function(e){function t(){return e.apply(this,arguments)||this}return Object(l.a)(t,e),t.prototype.render=function(){var e=this.props.message;return Object(c.a)(be.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:fe()(1,{damping:35,stiffness:400}),scaleX:fe()(1,{damping:35,stiffness:400}),scaleY:fe()(1,{damping:35,stiffness:400})}},void 0,function(t){var o=t.opacity,n=t.scaleX,a=t.scaleY;return Object(c.a)("div",{className:"compose-form__warning",style:{opacity:o,transform:"scale("+n+", "+a+")"}},void 0,e)})},t}(p.a.PureComponent),et=o(20),tt=/(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i,ot=Object(i.connect)(function(e){return{needsLockWarning:"private"===e.getIn(["compose","privacy"])&&!e.getIn(["accounts",et.m,"locked"]),hashtagWarning:"public"!==e.getIn(["compose","privacy"])&&tt.test(e.getIn(["compose","text"])),directMessageWarning:"direct"===e.getIn(["compose","privacy"])}})(function(e){var t=e.needsLockWarning,o=e.hashtagWarning,n=e.directMessageWarning;if(t)return Object(c.a)(Qe,{message:Object(c.a)(k.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(c.a)("a",{href:"/user-settings"},void 0,Object(c.a)(k.b,{id:"compose_form.lock_disclaimer.lock",defaultMessage:"locked"}))}})});if(o)return Object(c.a)(Qe,{message:Object(c.a)(k.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 a=Object(c.a)("span",{},void 0,Object(c.a)(k.b,{id:"compose_form.direct_message_warning",defaultMessage:"This toot will only be sent to all the mentioned users."})," ",Object(c.a)("a",{href:"/terms",target:"_blank"},void 0,Object(c.a)(k.b,{id:"compose_form.direct_message_warning_learn_more",defaultMessage:"Learn more"})));return Object(c.a)(Qe,{message:a})}return null}),nt=o(76),at="><…    \u2028\u2029\t\n\v\f\r",st=Object(k.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}!"}}),it=Object(k.g)((Ze=Je=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(u.a)(Object(r.a)(t),"handleChange",function(e){t.props.onChange(e.target.value)}),Object(u.a)(Object(r.a)(t),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&t.handleSubmit()}),Object(u.a)(Object(r.a)(t),"handleSubmit",function(){t.props.text!==t.autosuggestTextarea.textarea.value&&t.props.onChange(t.autosuggestTextarea.textarea.value);var e=t.props,o=e.isSubmitting,n=e.isChangingUpload,a=e.isUploading,s=e.anyMedia,i=[t.props.spoilerText,t.props.text].join("");o||a||n||Object(nt.length)(i)>et.l||0!==i.length&&0===i.trim().length&&!s||t.props.onSubmit(t.context.router?t.context.router.history:null)}),Object(u.a)(Object(r.a)(t),"onSuggestionsClearRequested",function(){t.props.onClearSuggestions()}),Object(u.a)(Object(r.a)(t),"onSuggestionsFetchRequested",function(e){t.props.onFetchSuggestions(e)}),Object(u.a)(Object(r.a)(t),"onSuggestionSelected",function(e,o,n){t.props.onSuggestionSelected(e,o,n,["text"])}),Object(u.a)(Object(r.a)(t),"onSpoilerSuggestionSelected",function(e,o,n){t.props.onSuggestionSelected(e,o,n,["spoiler_text"])}),Object(u.a)(Object(r.a)(t),"handleChangeSpoilerText",function(e){t.props.onChangeSpoilerText(e.target.value)}),Object(u.a)(Object(r.a)(t),"handleFocus",function(){if(t.composeForm&&!t.props.singleColumn){var e=t.composeForm.getBoundingClientRect(),o=e.left,n=e.right;(o<0||n>(window.innerWidth||document.documentElement.clientWidth))&&t.composeForm.scrollIntoView()}}),Object(u.a)(Object(r.a)(t),"setAutosuggestTextarea",function(e){t.autosuggestTextarea=e}),Object(u.a)(Object(r.a)(t),"setSpoilerText",function(e){t.spoilerText=e}),Object(u.a)(Object(r.a)(t),"setRef",function(e){t.composeForm=e}),Object(u.a)(Object(r.a)(t),"handleEmojiPick",function(e){var o=t.props.text,n=t.autosuggestTextarea.textarea.selectionStart,a=e.custom&&n>0&&!at.includes(o[n-1]);t.props.onPickEmoji(n,e,a)}),t}Object(l.a)(t,e);var o=t.prototype;return o.componentDidUpdate=function(e){var t,o;this.props.focusDate!==e.focusDate?(this.props.preselectDate!==e.preselectDate?(t=this.props.text.length,o=this.props.text.search(/\s/)+1):"number"==typeof this.props.caretPosition?(o=this.props.caretPosition,t=this.props.caretPosition):o=t=this.props.text.length,this.autosuggestTextarea.textarea.setSelectionRange(o,t),this.autosuggestTextarea.textarea.focus()):e.isSubmitting&&!this.props.isSubmitting?this.autosuggestTextarea.textarea.focus():this.props.spoiler!==e.spoiler&&(this.props.spoiler?this.spoilerText.input.focus():this.autosuggestTextarea.textarea.focus())},o.render=function(){var e=this.props,t=e.intl,o=e.onPaste,n=e.showSearch,a=e.anyMedia,s=this.props.isSubmitting,i=[this.props.spoilerText,this.props.text].join(""),r=s||this.props.isUploading||this.props.isChangingUpload||Object(nt.length)(i)>et.l||0!==i.length&&0===i.trim().length&&!a,l="";return l="private"===this.props.privacy||"direct"===this.props.privacy?Object(c.a)("span",{className:"compose-form__publish-private"},void 0,Object(c.a)(Oe.a,{id:"lock"})," ",t.formatMessage(st.publish)):"unlisted"!==this.props.privacy?t.formatMessage(st.publishLoud,{publish:t.formatMessage(st.publish)}):t.formatMessage(st.publish),Object(c.a)("div",{className:"compose-form"},void 0,Object(c.a)(ot,{}),Object(c.a)(D,{}),p.a.createElement("div",{className:"spoiler-input "+(this.props.spoiler?"spoiler-input--visible":""),ref:this.setRef},p.a.createElement(H,{placeholder:t.formatMessage(st.spoiler_placeholder),value:this.props.spoilerText,onChange:this.handleChangeSpoilerText,onKeyDown:this.handleKeyDown,disabled:!this.props.spoiler,ref:this.setSpoilerText,suggestions:this.props.suggestions,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSpoilerSuggestionSelected,searchTokens:[":"],id:"cw-spoiler-input",className:"spoiler-input__input"})),p.a.createElement(L,{ref:this.setAutosuggestTextarea,placeholder:t.formatMessage(st.placeholder),disabled:s,value:this.props.text,onChange:this.handleChange,suggestions:this.props.suggestions,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSuggestionSelected,onPaste:o,autoFocus:!n&&!Object(Se.b)(window.innerWidth)},Object(c.a)(Pe,{onPickEmoji:this.handleEmojiPick}),Object(c.a)("div",{className:"compose-form__modifiers"},void 0,Object(c.a)($e,{}),Object(c.a)(Le,{}))),Object(c.a)("div",{className:"compose-form__buttons-wrapper"},void 0,Object(c.a)("div",{className:"compose-form__buttons"},void 0,Object(c.a)(ie,{}),Object(c.a)(oe,{}),Object(c.a)(Me,{}),Object(c.a)(ue,{})),Object(c.a)("div",{className:"character-counter__wrapper"},void 0,Object(c.a)(g.a,{max:et.l,text:i}))),Object(c.a)("div",{className:"compose-form__publish"},void 0,Object(c.a)("div",{className:"compose-form__publish-button-wrapper"},void 0,Object(c.a)(b.a,{text:l,onClick:this.handleSubmit,disabled:r,block:!0}))))},t}(S.a),Object(u.a)(Je,"contextTypes",{router:j.a.object}),Object(u.a)(Je,"propTypes",{intl:j.a.object.isRequired,text:j.a.string.isRequired,suggestions:f.a.list,spoiler:j.a.bool,privacy:j.a.string,spoilerText:j.a.string,focusDate:j.a.instanceOf(Date),caretPosition:j.a.number,preselectDate:j.a.instanceOf(Date),isSubmitting:j.a.bool,isChangingUpload:j.a.bool,isUploading:j.a.bool,onChange:j.a.func.isRequired,onSubmit:j.a.func.isRequired,onClearSuggestions:j.a.func.isRequired,onFetchSuggestions:j.a.func.isRequired,onSuggestionSelected:j.a.func.isRequired,onChangeSpoilerText:j.a.func.isRequired,onPaste:j.a.func.isRequired,onPickEmoji:j.a.func.isRequired,showSearch:j.a.bool,anyMedia:j.a.bool,singleColumn:j.a.bool}),Object(u.a)(Je,"defaultProps",{showSearch:!1}),Ve=Ze))||Ve;t.a=Object(i.connect)(function(e){return{text:e.getIn(["compose","text"]),suggestions:e.getIn(["compose","suggestions"]),spoiler:e.getIn(["compose","spoiler"]),spoilerText: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"]),isSubmitting:e.getIn(["compose","is_submitting"]),isChangingUpload:e.getIn(["compose","is_changing_upload"]),isUploading:e.getIn(["compose","is_uploading"]),showSearch:e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]),anyMedia:e.getIn(["compose","media_attachments"]).size>0}},function(e){return{onChange:function(t){e(Object(O.N)(t))},onSubmit:function(t){e(Object(O.jb)(t))},onClearSuggestions:function(){e(Object(O.W)())},onFetchSuggestions:function(t){e(Object(O.Z)(t))},onSuggestionSelected:function(t,o,n,a){e(Object(O.ib)(t,o,n,a))},onChangeSpoilerText:function(t){e(Object(O.P)(t))},onPaste:function(t){e(Object(O.mb)(t))},onPickEmoji:function(t,o,n){e(Object(O.bb)(t,o,n))}}})(it)},693:function(e,t,o){"use strict";var n=o(12),a=o(6),s=o(688),i=o(638),c=o(47),r=o(20),l=Object(a.f)({logoutMessage:{id:"confirmations.logout.message",defaultMessage:"Are you sure you want to log out?"},logoutConfirm:{id:"confirmations.logout.confirm",defaultMessage:"Log out"}});t.a=Object(a.g)(Object(n.connect)(function(e){return{account:e.getIn(["accounts",r.m])}},function(e,t){var o=t.intl;return{onLogout:function(){e(Object(c.d)("CONFIRM",{message:o.formatMessage(l.logoutMessage),confirm:o.formatMessage(l.logoutConfirm),onConfirm:function(){return Object(i.a)()}}))}}})(s.a))},719:function(e,t,o){"use strict";o.r(t),o.d(t,"default",function(){return M});var n,a=o(0),s=o(2),i=o(7),c=o(1),r=o(3),l=o.n(r),u=o(574),d=o(693),p=o(12),g=o(21),b=o(310),m=o(6),f=o(687),h=o(88),j=o(34),O=o.n(j),v=o(1097),y=o(47),_=o(20),C=o(27),k=o(638),S=Object(m.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"},logoutMessage:{id:"confirmations.logout.message",defaultMessage:"Are you sure you want to log out?"},logoutConfirm:{id:"confirmations.logout.confirm",defaultMessage:"Log out"}}),M=Object(p.connect)(function(e,t){return{columns:e.getIn(["settings","columns"]),showSearch:t.multiColumn?e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]):t.isSearchPage}})(n=Object(m.g)(n=function(e){function t(){for(var t,o=arguments.length,n=new Array(o),a=0;a<o;a++)n[a]=arguments[a];return t=e.call.apply(e,[this].concat(n))||this,Object(c.a)(Object(s.a)(t),"handleLogoutClick",function(e){var o=t.props,n=o.dispatch,a=o.intl;return e.preventDefault(),e.stopPropagation(),n(Object(y.d)("CONFIRM",{message:a.formatMessage(S.logoutMessage),confirm:a.formatMessage(S.logoutConfirm),onConfirm:function(){return Object(k.a)()}})),!1}),Object(c.a)(Object(s.a)(t),"onFocus",function(){t.props.dispatch(Object(g.S)(!0))}),Object(c.a)(Object(s.a)(t),"onBlur",function(){t.props.dispatch(Object(g.S)(!1))}),t}Object(i.a)(t,e);var o=t.prototype;return o.componentDidMount=function(){this.props.isSearchPage||this.props.dispatch(Object(g.db)())},o.componentWillUnmount=function(){this.props.isSearchPage||this.props.dispatch(Object(g.lb)())},o.render=function(){var e=this.props,t=e.multiColumn,o=e.showSearch,n=e.isSearchPage,s=e.intl,i="";if(t){var c=this.props.columns;i=Object(a.a)("nav",{className:"drawer__header"},void 0,Object(a.a)(b.a,{to:"/getting-started",className:"drawer__tab",title:s.formatMessage(S.start),"aria-label":s.formatMessage(S.start)},void 0,Object(a.a)(C.a,{id:"bars",fixedWidth:!0})),!c.some(function(e){return"HOME"===e.get("id")})&&Object(a.a)(b.a,{to:"/timelines/home",className:"drawer__tab",title:s.formatMessage(S.home_timeline),"aria-label":s.formatMessage(S.home_timeline)},void 0,Object(a.a)(C.a,{id:"home",fixedWidth:!0})),!c.some(function(e){return"NOTIFICATIONS"===e.get("id")})&&Object(a.a)(b.a,{to:"/notifications",className:"drawer__tab",title:s.formatMessage(S.notifications),"aria-label":s.formatMessage(S.notifications)},void 0,Object(a.a)(C.a,{id:"bell",fixedWidth:!0})),!c.some(function(e){return"COMMUNITY"===e.get("id")})&&Object(a.a)(b.a,{to:"/timelines/public/local",className:"drawer__tab",title:s.formatMessage(S.community),"aria-label":s.formatMessage(S.community)},void 0,Object(a.a)(C.a,{id:"users",fixedWidth:!0})),!c.some(function(e){return"PUBLIC"===e.get("id")})&&Object(a.a)(b.a,{to:"/timelines/public",className:"drawer__tab",title:s.formatMessage(S.public),"aria-label":s.formatMessage(S.public)},void 0,Object(a.a)(C.a,{id:"globe",fixedWidth:!0})),Object(a.a)("a",{href:"/user-settings",className:"drawer__tab",title:s.formatMessage(S.preferences),"aria-label":s.formatMessage(S.preferences)},void 0,Object(a.a)(C.a,{id:"cog",fixedWidth:!0})),Object(a.a)("a",{href:"/auth/sign_out",className:"drawer__tab",title:s.formatMessage(S.logout),"aria-label":s.formatMessage(S.logout),onClick:this.handleLogoutClick},void 0,Object(a.a)(C.a,{id:"sign-out",fixedWidth:!0})))}return Object(a.a)("div",{className:"drawer",role:"region","aria-label":s.formatMessage(S.compose)},void 0,i,(t||n)&&Object(a.a)(f.a,{}),Object(a.a)("div",{className:"drawer__pager"},void 0,!n&&Object(a.a)("div",{className:"drawer__inner",onFocus:this.onFocus},void 0,Object(a.a)(d.a,{onClose:this.onBlur}),Object(a.a)(u.a,{}),Object(a.a)("div",{className:"drawer__inner__mastodon"},void 0,Object(a.a)("img",{alt:"",draggable:"false",src:_.k||elephantUIPlane}))),Object(a.a)(h.a,{defaultStyle:{x:n?0:-100},style:{x:O()(o||n?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return Object(a.a)("div",{className:"drawer__inner darker",style:{transform:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,Object(a.a)(v.a,{}))})))},t}(l.a.PureComponent))||n)||n}}]);
//# sourceMappingURL=compose.js.map