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

2 lines
No EOL
54 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],{660:function(e,l,u){"use strict";(function(e){u.d(l,"a",function(){return r});var n=u(1),a=u(7),t=u(3),o=u.n(t),s=u(91),i=u.n(s),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=i.a[t.native]||i.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(57))},661:function(e,I,T){"use strict";(function(e){T.d(I,"a",function(){return D});var t,a,n,o,l,s,d=T(1),i=T(7),c=T(0),r=T(2),u=T(3),p=T.n(u),b=T(6),g=T(48),h=T(171),m=T.n(h),f=T(12),j=T.n(f),O=T(63),v=T.n(O),_=T(73),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"}}),k=e.env.CDN_HOST||"",C=function(){return k+"/emoji/sheet_10.png"},S=!!v.a.hasSupport&&{passive:!0},M=["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(c.a)(Object(c.a)(t)),"handleClick",function(e){t.props.onSelect(1*e.currentTarget.getAttribute("data-index"))}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"setRef",function(e){t.node=e}),t}Object(i.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,S)},t.removeListeners=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,S)},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)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:1,backgroundImageFn:C})),Object(d.a)("button",{onClick:this.handleClick,"data-index":2},void 0,Object(d.a)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:2,backgroundImageFn:C})),Object(d.a)("button",{onClick:this.handleClick,"data-index":3},void 0,Object(d.a)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:3,backgroundImageFn:C})),Object(d.a)("button",{onClick:this.handleClick,"data-index":4},void 0,Object(d.a)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:4,backgroundImageFn:C})),Object(d.a)("button",{onClick:this.handleClick,"data-index":5},void 0,Object(d.a)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:5,backgroundImageFn:C})),Object(d.a)("button",{onClick:this.handleClick,"data-index":6},void 0,Object(d.a)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:6,backgroundImageFn:C})))},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(c.a)(Object(c.a)(t)),"handleClick",function(){t.props.active?t.props.onClose():t.props.onOpen()}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleSelect",function(e){t.props.onChange(e),t.props.onClose()}),t}return Object(i.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)(s,{emoji:"fist",set:"twitter",size:22,sheetSize:32,skin:a,onClick:this.handleClick,backgroundImageFn:C}),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(c.a)(Object(c.a)(t)),"state",{modifierOpen:!1,placement:null}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleDocumentClick",function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"setRef",function(e){t.node=e}),Object(r.a)(Object(c.a)(Object(c.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(c.a)(Object(c.a)(t)),"handleClick",function(e){e.native||(e.native=e.colons),t.props.onClose(),t.props.onPick(e)}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleModifierOpen",function(){t.setState({modifierOpen:!0})}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleModifierClose",function(){t.setState({modifierOpen:!1})}),Object(r.a)(Object(c.a)(Object(c.a)(t)),"handleModifierChange",function(e){t.props.onSkinTone(e)}),t}Object(i.a)(e,o);var t=e.prototype;return t.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,S)},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,S)},t.render=function(){var e=this.props,t=e.loading,a=e.style,n=e.intl,o=e.custom_emojis,s=e.skinTone,i=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:M,recent:i,skin:s,showPreview:!1,backgroundImageFn:C,autoFocus:!0,emojiTooltip:!0}),Object(d.a)(x,{active:r,modifier:s,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,D=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(c.a)(Object(c.a)(n)),"state",{active:!1,loading:!1}),Object(r.a)(Object(c.a)(Object(c.a)(n)),"setRef",function(e){n.dropdown=e}),Object(r.a)(Object(c.a)(Object(c.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,s=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(c.a)(Object(c.a)(n)),"onHideDropdown",function(){n.setState({active:!1})}),Object(r.a)(Object(c.a)(Object(c.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(c.a)(Object(c.a)(n)),"handleKeyDown",function(e){"Escape"===e.key&&n.onHideDropdown()}),Object(r.a)(Object(c.a)(Object(c.a)(n)),"setTargetRef",function(e){n.target=e}),Object(r.a)(Object(c.a)(Object(c.a)(n)),"findTarget",function(){return n.target}),n}return Object(i.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.intl,a=e.onPickEmoji,n=e.onSkinTone,o=e.skinTone,s=e.frequentlyUsedEmojis,i=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:i,"aria-label":i,"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:k+"/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:s})))},e}(p.a.PureComponent))||o}).call(this,T(57))},700:function(e,t,a){"use strict";var n,o,s,i=a(20),u=a(1),c=a(7),r=a(0),d=a(2),l=a(3),p=a.n(l),b=a(292),g=function(e){function t(){return e.apply(this,arguments)||this}Object(c.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(181),m=a(26),f=a.n(m),j=a(5),O=a.n(j),v=a(23),_=a(156),y=a(142),k=a(66),C=a(143),S=a(6),M=a(24),w=a(295),x=Object(S.f)({cancel:{id:"reply_indicator.cancel",defaultMessage:"Cancel"}}),N=Object(S.g)((s=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(r.a)(Object(r.a)(t)),"handleClick",function(){t.props.onCancel()}),Object(d.a)(Object(r.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(c.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)(k.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)(C.a,{account:t.get("account")}))),Object(u.a)("div",{className:"reply-indicator__content",style:o,dangerouslySetInnerHTML:n}))},e}(M.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=s))||n,D=Object(i.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.E)())}}})(N),I=function(e){function t(){return e.apply(this,arguments)||this}return Object(c.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)(C.a,{account:e}))},t}(M.a);Object(d.a)(I,"propTypes",{account:f.a.map.isRequired});var T,P,R,E=Object(i.connect)(function(){var n=Object(_.d)();return function(e,t){var a=t.id;return{account:n(e,a)}}})(I),F=a(660),q=a(526),A=a(12),K=a.n(A),L=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(r.a)(Object(r.a)(l)),"state",{suggestionsHidden:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(d.a)(Object(r.a)(Object(r.a)(l)),"onChange",function(e){var t,a,n,o,s,i=(t=e.target.value,a=e.target.selectionStart,o=t.slice(0,a).search(/\S+$/),s=t.slice(a).search(/\s/),!(n=s<0?t.slice(o):t.slice(o,s+a))||n.trim().length<3||-1===["@",":","#"].indexOf(n[0])?[null,null]:0<(n=n.trim().toLowerCase()).length?[o+1,n]:[null,null]),c=i[0],r=i[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(r.a)(Object(r.a)(l)),"onKeyDown",function(e){var t=l.props,a=t.suggestions,n=t.disabled,o=l.state,s=o.selectedSuggestion,i=o.suggestionsHidden;if(n)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===a.size||i?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),l.setState({suggestionsHidden:!0}));break;case"ArrowDown":0<a.size&&!i&&(e.preventDefault(),l.setState({selectedSuggestion:Math.min(s+1,a.size-1)}));break;case"ArrowUp":0<a.size&&!i&&(e.preventDefault(),l.setState({selectedSuggestion:Math.max(s-1,0)}));break;case"Enter":case"Tab":null!==l.state.lastToken&&0<a.size&&!i&&(e.preventDefault(),e.stopPropagation(),l.props.onSuggestionSelected(l.state.tokenStart,l.state.lastToken,a.get(s)))}!e.defaultPrevented&&l.props.onKeyDown&&l.props.onKeyDown(e)}}),Object(d.a)(Object(r.a)(Object(r.a)(l)),"onBlur",function(){l.setState({suggestionsHidden:!0})}),Object(d.a)(Object(r.a)(Object(r.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(r.a)(Object(r.a)(l)),"setTextarea",function(e){l.textarea=e}),Object(d.a)(Object(r.a)(Object(r.a)(l)),"onPaste",function(e){e.clipboardData&&1===e.clipboardData.files.length&&(l.props.onPaste(e.clipboardData.files),e.preventDefault())}),Object(d.a)(Object(r.a)(Object(r.a)(l)),"renderSuggestion",function(e,t){var a,n,o=l.state.selectedSuggestion;return n="object"==typeof e?(a=Object(u.a)(F.a,{emoji:e}),e.id):"#"===e[0]?a=e:(a=Object(u.a)(E,{id:e}),e),Object(u.a)("div",{role:"button",tabIndex:"0","data-index":t,className:K()("autosuggest-textarea__suggestions__item",{selected:t===o}),onMouseDown:l.onSuggestionClick},n,a)}),l}Object(c.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,s=e.onKeyUp,i=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)(q.a,{inputRef:this.setTextarea,className:"autosuggest-textarea__textarea",disabled:n,placeholder:o,autoFocus:i,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:s,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}(M.a);Object(d.a)(L,"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)(L,"defaultProps",{autoFocus:!0});var z,W,U,H,B=Object(S.f)({upload:{id:"upload_button.label",defaultMessage:"Add media (JPEG, PNG, GIF, WebM, MP4, MOV)"}}),Y={height:null,lineHeight:"27px"},X=Object(i.connect)(function(){return function(e){return{acceptContentTypes:e.getIn(["media_attachments","accept_content_types"])}}})(T=Object(S.g)((R=P=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)(Object(r.a)(t)),"handleChange",function(e){0<e.target.files.length&&t.props.onSelectFile(e.target.files)}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleClick",function(){t.fileElement.click()}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"setRef",function(e){t.fileElement=e}),t}return Object(c.a)(e,o),e.prototype.render=function(){var e=this.props,t=e.intl,a=e.resetFileKey,n=e.disabled,o=e.acceptContentTypes;return Object(u.a)("div",{className:"compose-form__upload-button"},void 0,Object(u.a)(k.a,{icon:"camera",title:t.formatMessage(B.upload),disabled:n,onClick:this.handleClick,className:"compose-form__upload-button-icon",size:18,inverted:!0,style:Y}),Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,t.formatMessage(B.upload)),p.a.createElement("input",{key:a,ref:this.setRef,type:"file",multiple:!0,accept:o.toArray().join(","),onChange:this.handleChange,disabled:n,style:{display:"none"}})))},e}(M.a),Object(d.a)(P,"propTypes",{disabled: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}),T=R))||T)||T,G=Object(i.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")}),resetFileKey:e.getIn(["compose","resetFileKey"])}},function(t){return{onSelectFile:function(e){t(Object(v.Z)(e))}}})(X),J=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)(Object(r.a)(t)),"handleClick",function(e){e.preventDefault(),t.props.onClick()}),t}return Object(c.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),Z=Object(S.f)({marked:{id:"compose_form.spoiler.marked",defaultMessage:"Text is hidden behind warning"},unmarked:{id:"compose_form.spoiler.unmarked",defaultMessage:"Text is not hidden"}}),V=Object(S.g)(Object(i.connect)(function(e,t){return{label:"CW",title:t.intl.formatMessage(e.getIn(["compose","spoiler"])?Z.marked:Z.unmarked),active:e.getIn(["compose","spoiler"]),ariaControls:"cw-spoiler-input"}},function(e){return{onClick:function(){e(Object(v.I)())}}})(J)),$=a(21),Q=a(171),ee=a.n(Q),te=a(141),ae=a(46),ne=a.n(ae),oe=a(63),se=a.n(oe),ie=a(33),ce=Object(S.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"}}),re=!!se.a.hasSupport&&{passive:!0},le=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(r.a)(Object(r.a)(s)),"state",{mounted:!1}),Object(d.a)(Object(r.a)(Object(r.a)(s)),"handleDocumentClick",function(e){s.node&&!s.node.contains(e.target)&&s.props.onClose()}),Object(d.a)(Object(r.a)(Object(r.a)(s)),"handleKeyDown",function(e){var t,a=s.props.items,n=e.currentTarget.getAttribute("data-index"),o=a.findIndex(function(e){return e.value===n});switch(e.key){case"Escape":s.props.onClose();break;case"Enter":s.handleClick(e);break;case"ArrowDown":(t=s.node.childNodes[o+1])&&(t.focus(),s.props.onChange(t.getAttribute("data-index")));break;case"ArrowUp":(t=s.node.childNodes[o-1])&&(t.focus(),s.props.onChange(t.getAttribute("data-index")));break;case"Home":(t=s.node.firstChild)&&(t.focus(),s.props.onChange(t.getAttribute("data-index")));break;case"End":(t=s.node.lastChild)&&(t.focus(),s.props.onChange(t.getAttribute("data-index")))}}),Object(d.a)(Object(r.a)(Object(r.a)(s)),"handleClick",function(e){var t=e.currentTarget.getAttribute("data-index");e.preventDefault(),s.props.onClose(),s.props.onChange(t)}),Object(d.a)(Object(r.a)(Object(r.a)(s)),"setRef",function(e){s.node=e}),Object(d.a)(Object(r.a)(Object(r.a)(s)),"setFocusRef",function(e){s.focusedItem=e}),s}Object(c.a)(e,n);var t=e.prototype;return t.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,re),this.focusedItem&&this.focusedItem.focus(),this.setState({mounted:!0})},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,re)},t.render=function(){var o=this,s=this.state.mounted,e=this.props,i=e.style,c=e.items,r=e.placement,l=e.value;return Object(u.a)(te.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:ne()(1,{damping:35,stiffness:400}),scaleX:ne()(1,{damping:35,stiffness:400}),scaleY:ne()(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($.a)({},i,{opacity:t,transform:s?"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:K()("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)(ie.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),ue=Object(S.g)(z=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(r.a)(Object(r.a)(n)),"state",{open:!1,placement:"bottom"}),Object(d.a)(Object(r.a)(Object(r.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($.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(r.a)(Object(r.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(r.a)(Object(r.a)(n)),"handleKeyDown",function(e){switch(e.key){case"Escape":n.handleClose()}}),Object(d.a)(Object(r.a)(Object(r.a)(n)),"handleClose",function(){n.setState({open:!1})}),Object(d.a)(Object(r.a)(Object(r.a)(n)),"handleChange",function(e){n.props.onChange(e)}),n}Object(c.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(ce.public_short),meta:e(ce.public_long)},{icon:"unlock",value:"unlisted",text:e(ce.unlisted_short),meta:e(ce.unlisted_long)},{icon:"lock",value:"private",text:e(ce.private_short),meta:e(ce.private_long)},{icon:"envelope",value:"direct",text:e(ce.direct_short),meta:e(ce.direct_long)}]},t.render=function(){var e=this.props,t=e.value,a=e.intl,n=this.state,o=n.open,s=n.placement,i=this.options.find(function(e){return e.value===t});return Object(u.a)("div",{className:K()("privacy-dropdown",s,{active:o}),onKeyDown:this.handleKeyDown},void 0,Object(u.a)("div",{className:K()("privacy-dropdown__value",{active:0===this.options.indexOf(i)})},void 0,Object(u.a)(k.a,{className:"privacy-dropdown__value-icon",icon:i.icon,title:a.formatMessage(ce.change_privacy),size:18,expanded:o,active:o,inverted:!0,onClick:this.handleToggle,style:{height:null,lineHeight:"27px"}})),Object(u.a)(ee.a,{show:o,placement:s,target:this},void 0,Object(u.a)(le,{items:this.options,value:t,onClose:this.handleClose,onChange:this.handleChange,placement:s})))},e}(p.a.PureComponent))||z,de=a(50),pe=a(180),be=Object(i.connect)(function(e){return{isModalOpen:"ACTIONS"===e.get("modal").modalType,value:e.getIn(["compose","privacy"])}},function(t){return{onChange:function(e){t(Object(v.J)(e))},isUserTouching:pe.c,onModalOpen:function(e){return t(Object(de.d)("ACTIONS",e))},onModalClose:function(){return t(Object(de.c)())}}})(ue),ge=Object(S.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"}}),he=function(e){function t(){return e.apply(this,arguments)||this}return Object(c.a)(t,e),t.prototype.render=function(){var e=this.props,o=e.visible,s=e.active,i=e.disabled,c=e.onClick,r=e.intl;return Object(u.a)(te.a,{defaultStyle:{scale:.87},style:{scale:ne()(o?1:.87,{stiffness:200,damping:3})}},void 0,function(e){var t=e.scale,a=s?"eye-slash":"eye",n=K()("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)(k.a,{className:"compose-form__sensitive-button__icon",title:r.formatMessage(s?ge.marked:ge.unmarked),icon:a,onClick:c,size:18,active:s,disabled:i,style:{lineHeight:null,height:null},inverted:!0}))})},t}(p.a.PureComponent),me=Object(i.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.G)())}}})(Object(S.g)(he)),fe=a(661),je=a(86),Oe=a(60),ve=a(4),_e=a(219),ye=["+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"],ke=Object(Oe.a)([function(e){return e.getIn(["settings","frequentlyUsedEmojis"],Object(ve.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<ye.length){var e=ye.filter(function(e){return!t.includes(e)});t=t.concat(e.slice(0,ye.length-t.length))}return t}),Ce=Object(Oe.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})}),Se=Object(i.connect)(function(e){return{custom_emojis:Ce(e),skinTone:e.getIn(["settings","skinTone"]),frequentlyUsedEmojis:ke(e)}},function(t,e){var a=e.onPickEmoji;return{onSkinTone:function(e){t(Object(je.c)(["skinTone"],e))},onPickEmoji:function(e){t(Object(_e.b)(e)),a&&a(e)}}})(fe.a),Me=function(e){function t(){return e.apply(this,arguments)||this}return Object(c.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)(ie.a,{id:"upload"})),Object(u.a)("div",{className:"upload-progress__message"},void 0,Object(u.a)(S.b,{id:"upload_progress.label",defaultMessage:"Uploading..."}),Object(u.a)("div",{className:"upload-progress__backdrop"},void 0,Object(u.a)(te.a,{defaultStyle:{width:0},style:{width:ne()(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),we=Object(i.connect)(function(e){return{active:e.getIn(["compose","is_uploading"]),progress:e.getIn(["compose","progress"])}})(Me),xe=Object(S.f)({description:{id:"upload_form.description",defaultMessage:"Describe for the visually impaired"}}),Ne=Object(S.g)((H=U=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)(Object(r.a)(t)),"state",{hovered:!1,focused:!1,dirtyDescription:null}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&t.handleSubmit()}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleSubmit",function(){t.handleInputBlur(),t.props.onSubmit(t.context.router.history)}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleUndoClick",function(e){e.stopPropagation(),t.props.onUndo(t.props.media.get("id"))}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleFocalPointClick",function(e){e.stopPropagation(),t.props.onOpenFocalPoint(t.props.media.get("id"))}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleInputChange",function(e){t.setState({dirtyDescription:e.target.value})}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleMouseEnter",function(){t.setState({hovered:!0})}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleMouseLeave",function(){t.setState({hovered:!1})}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleInputFocus",function(){t.setState({focused:!0})}),Object(d.a)(Object(r.a)(Object(r.a)(t)),"handleClick",function(){t.setState({focused:!0})}),Object(d.a)(Object(r.a)(Object(r.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(c.a)(e,o),e.prototype.render=function(){var a=this,e=this.props,n=e.intl,o=e.media,s=this.state.hovered||this.state.focused,i=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)(te.a,{defaultStyle:{scale:.8},style:{scale:ne()(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:K()("compose-form__upload__actions",{active:s})},void 0,Object(u.a)("button",{className:"icon-button",onClick:a.handleUndoClick},void 0,Object(u.a)(ie.a,{id:"times"})," ",Object(u.a)(S.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)(ie.a,{id:"crosshairs"})," ",Object(u.a)(S.b,{id:"upload_form.focus",defaultMessage:"Crop"}))),Object(u.a)("div",{className:K()("compose-form__upload-description",{active:s})},void 0,Object(u.a)("label",{},void 0,Object(u.a)("span",{style:{display:"none"}},void 0,n.formatMessage(xe.description)),Object(u.a)("textarea",{placeholder:n.formatMessage(xe.description),value:i,maxLength:420,onFocus:a.handleInputFocus,onChange:a.handleInputChange,onBlur:a.handleInputBlur,onKeyDown:a.handleKeyDown}))))}))},e}(M.a),Object(d.a)(U,"contextTypes",{router:O.a.object}),Object(d.a)(U,"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}),W=H))||W,De=Object(i.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.X)(e))},onDescriptionChange:function(e,t){a(Object(v.L)(e,{description:t}))},onOpenFocalPoint:function(e){a(Object(de.d)("FOCAL_POINT",{id:e}))},onSubmit:function(e){a(Object(v.W)(e))}}})(Ne),Ie=function(e){function t(){return e.apply(this,arguments)||this}return Object(c.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)(we,{}),Object(u.a)("div",{className:"compose-form__uploads-wrapper"},void 0,e.map(function(e){return Object(u.a)(De,{id:e},e)})))},t}(M.a);Object(d.a)(Ie,"propTypes",{mediaIds:f.a.list.isRequired});var Te,Pe,Re,Ee=Object(i.connect)(function(e){return{mediaIds:e.getIn(["compose","media_attachments"]).map(function(e){return e.get("id")})}})(Ie),Fe=function(e){function t(){return e.apply(this,arguments)||this}return Object(c.a)(t,e),t.prototype.render=function(){var o=this.props.message;return Object(u.a)(te.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:ne()(1,{damping:35,stiffness:400}),scaleX:ne()(1,{damping:35,stiffness:400}),scaleY:ne()(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),qe=a(22),Ae=/(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i,Ke=Object(i.connect)(function(e){return{needsLockWarning:"private"===e.getIn(["compose","privacy"])&&!e.getIn(["accounts",qe.k,"locked"]),hashtagWarning:"public"!==e.getIn(["compose","privacy"])&&Ae.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)(Fe,{message:Object(u.a)(S.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)(S.b,{id:"compose_form.lock_disclaimer.lock",defaultMessage:"locked"}))}})});if(a)return Object(u.a)(Fe,{message:Object(u.a)(S.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)(S.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)(S.b,{id:"compose_form.direct_message_warning_learn_more",defaultMessage:"Learn more"})));return Object(u.a)(Fe,{message:o})}return null}),Le=Object(S.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}!"}}),ze=Object(S.g)((Re=Pe=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(r.a)(Object(r.a)(i)),"handleChange",function(e){i.props.onChange(e.target.value)}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"handleKeyDown",function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&i.handleSubmit()}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"handleSubmit",function(){i.props.text!==i.autosuggestTextarea.textarea.value&&i.props.onChange(i.autosuggestTextarea.textarea.value);var e=i.props,t=e.is_submitting,a=e.is_changing_upload,n=e.is_uploading,o=e.anyMedia,s=[i.props.spoiler_text,i.props.text].join("");t||n||a||Object(b.length)(s)>qe.j||0!==s.length&&0===s.trim().length&&!o||i.props.onSubmit(i.context.router?i.context.router.history:null)}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"onSuggestionsClearRequested",function(){i.props.onClearSuggestions()}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"onSuggestionsFetchRequested",function(e){i.props.onFetchSuggestions(e)}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"onSuggestionSelected",function(e,t,a){i.props.onSuggestionSelected(e,t,a)}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"handleChangeSpoilerText",function(e){i.props.onChangeSpoilerText(e.target.value)}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"setAutosuggestTextarea",function(e){i.autosuggestTextarea=e}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"setSpoilerText",function(e){i.spoilerText=e}),Object(d.a)(Object(r.a)(Object(r.a)(i)),"handleEmojiPick",function(e){var t=i.props.text,a=i.autosuggestTextarea.textarea.selectionStart,n=e.custom&&0<a&&!"><…    \u2028\u2029\t\n\v\f\r".includes(t[a-1]);i.props.onPickEmoji(a,e,n)}),i}Object(c.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,s=this.props.is_submitting,i=[this.props.spoiler_text,this.props.text].join(""),c=s||this.props.is_uploading||this.props.is_changing_upload||Object(b.length)(i)>qe.j||0!==i.length&&0===i.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)(ie.a,{id:"lock"})," ",t.formatMessage(Le.publish)):"unlisted"!==this.props.privacy?t.formatMessage(Le.publishLoud,{publish:t.formatMessage(Le.publish)}):t.formatMessage(Le.publish),Object(u.a)("div",{className:"compose-form"},void 0,Object(u.a)(Ke,{}),Object(u.a)(D,{}),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(Le.spoiler_placeholder)),p.a.createElement("input",{placeholder:t.formatMessage(Le.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(L,{ref:this.setAutosuggestTextarea,placeholder:t.formatMessage(Le.placeholder),disabled:s,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(pe.b)(window.innerWidth)}),Object(u.a)(Se,{onPickEmoji:this.handleEmojiPick})),Object(u.a)("div",{className:"compose-form__modifiers"},void 0,Object(u.a)(Ee,{})),Object(u.a)("div",{className:"compose-form__buttons-wrapper"},void 0,Object(u.a)("div",{className:"compose-form__buttons"},void 0,Object(u.a)(G,{}),Object(u.a)(be,{}),Object(u.a)(me,{}),Object(u.a)(V,{})),Object(u.a)("div",{className:"character-counter__wrapper"},void 0,Object(u.a)(g,{max:qe.j,text:i}))),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}(M.a),Object(d.a)(Pe,"contextTypes",{router:O.a.object}),Object(d.a)(Pe,"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)(Pe,"defaultProps",{showSearch:!1}),Te=Re))||Te;t.a=Object(i.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.F)(e))},onSubmit:function(e){n(Object(v.W)(e))},onClearSuggestions:function(){n(Object(v.M)())},onFetchSuggestions:function(e){n(Object(v.O)(e))},onSuggestionSelected:function(e,t,a){n(Object(v.V)(e,t,a))},onChangeSpoilerText:function(e){n(Object(v.H)(e))},onPaste:function(e){n(Object(v.Z)(e))},onPickEmoji:function(e,t,a){n(Object(v.Q)(e,t,a))}}})(ze)},703:function(e,t,a){"use strict";a.r(t);var n,o,s,i,c,l=a(1),r=a(7),u=a(0),d=a(2),p=a(3),b=a.n(p),g=a(700),h=a(20),m=a(981),f=a(22),j=Object(h.connect)(function(e){return{account:e.getIn(["accounts",f.k])}})(m.a),O=a(23),v=a(391),_=a(6),y=a(216),k=a(21),C=a(171),S=a.n(C),M=a(141),w=a(46),x=a.n(w),N=a(33),D=Object(_.f)({placeholder:{id:"search.placeholder",defaultMessage:"Search"}}),I=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.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(k.a)({},e,{position:"absolute",width:315})},void 0,Object(l.a)(M.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(u.a)(Object(u.a)(t)),"state",{expanded:!1}),Object(d.a)(Object(u.a)(Object(u.a)(t)),"handleChange",function(e){t.props.onChange(e.target.value)}),Object(d.a)(Object(u.a)(Object(u.a)(t)),"handleClear",function(e){e.preventDefault(),(0<t.props.value.length||t.props.submitted)&&t.props.onClear()}),Object(d.a)(Object(u.a)(Object(u.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(u.a)(Object(u.a)(t)),"handleFocus",function(){t.setState({expanded:!0}),t.props.onShow()}),Object(d.a)(Object(u.a)(Object(u.a)(t)),"handleBlur",function(){t.setState({expanded:!1})}),t}Object(r.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,s=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(D.placeholder)),Object(l.a)("input",{className:"search__input",type:"text",placeholder:t.formatMessage(D.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:s?"":"active"}),Object(l.a)(N.a,{id:"times-circle",className:s?"active":"","aria-label":t.formatMessage(D.placeholder)})),Object(l.a)(S.a,{show:o&&!s,placement:"bottom",target:this},void 0,Object(l.a)(I,{})))},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),F=a(26),q=a.n(F),A=a(896),K=a(632),L=a(24),z=a(958),W=a(408),U=a(974),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)(W.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(U.a)(t.getIn(["history",0,"accounts"])))}})),Object(l.a)("div",{className:"trends__item__current"},void 0,Object(U.a)(t.getIn(["history",0,"uses"]))),Object(l.a)("div",{className:"trends__item__sparkline"},void 0,Object(l.a)(z.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)(z.SparklinesCurve,{style:{fill:"none"}}))))},B=Object(_.f)({dismissSuggestion:{id:"suggestions.dismiss",defaultMessage:"Dismiss suggestion"}}),Y=Object(_.g)((i=s=function(e){function t(){return e.apply(this,arguments)||this}Object(r.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,s=n.results,i=n.suggestions,c=n.dismissSuggestion;if(s.isEmpty()&&!i.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…"})),i&&i.map(function(e){return Object(l.a)(A.a,{id:e,actionIcon:"times",actionTitle:o.formatMessage(B.dismissSuggestion),onActionClick:c},e)})));var r=0;return s.get("accounts")&&0<s.get("accounts").size&&(r+=s.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"})),s.get("accounts").map(function(e){return Object(l.a)(A.a,{id:e},e)}))),s.get("statuses")&&0<s.get("statuses").size&&(r+=s.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"})),s.get("statuses").map(function(e){return Object(l.a)(K.a,{id:e},e)}))),s.get("hashtags")&&0<s.get("hashtags").size&&(r+=s.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"})),s.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}(L.a),Object(d.a)(s,"propTypes",{results:q.a.map.isRequired,suggestions:q.a.list.isRequired,fetchSuggestions:E.a.func.isRequired,dismissSuggestion:E.a.func.isRequired,intl:E.a.object.isRequired}),o=i))||o,X=a(217),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 Z});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"}}),Z=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(u.a)(Object(u.a)(e)),"onFocus",function(){e.props.dispatch(Object(O.K)(!0))}),Object(d.a)(Object(u.a)(Object(u.a)(e)),"onBlur",function(){e.props.dispatch(Object(O.K)(!1))}),e}Object(r.a)(e,o);var t=e.prototype;return t.componentDidMount=function(){this.props.isSearchPage||this.props.dispatch(Object(O.S)())},t.componentWillUnmount=function(){this.props.isSearchPage||this.props.dispatch(Object(O.Y)())},t.render=function(){var e=this.props,t=e.multiColumn,a=e.showSearch,n=e.isSearchPage,o=e.intl,s="";if(t){var i=this.props.columns;s=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})),!i.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})),!i.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})),!i.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})),!i.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,s,(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)(M.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