spc-pleroma/priv/static/packs/features/compose.js

2 lines
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([[16],{658:function(e,l,u){"use strict";(function(e){u.d(l,"a",function(){return r});var n=u(1),a=u(6),t=u(3),o=u.n(t),s=u(88),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(56))},659: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(6),c=T(0),r=T(2),u=T(3),p=T.n(u),b=T(7),g=T(47),f=T(167),m=T.n(f),h=T(12),j=T.n(h),O=T(60),v=T.n(O),_=T(70),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"},w=!!v.a.hasSupport&&{passive:!0},S=["recent","custom","people","nature","foods","activity","places","objects","symbols","flags"],M=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,w)},t.removeListeners=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,w)},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)(M,{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,w)},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,w)},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:S,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(56))},698:function(e,t,a){"use strict";var n,o,s,i=a(20),u=a(1),c=a(6),r=a(0),d=a(2),l=a(3),p=a.n(l),b=a(391),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),f=a(178),m=a(26),h=a.n(m),j=a(5),O=a.n(j),v=a(22),_=a(154),y=a(140),k=a(63),C=a(141),w=a(7),S=a(24),M=a(292),x=Object(w.f)({cancel:{id:"reply_indicator.cancel",defaultMessage:"Cancel"}}),N=Object(w.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(M.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}(S.a),Object(d.a)(o,"contextTypes",{router:O.a.object}),Object(d.a)(o,"propTypes",{status:h.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}(S.a);Object(d.a)(I,"propTypes",{account:h.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(658),q=a(525),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(M.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}(S.a);Object(d.a)(L,"propTypes",{value:O.a.string,suggestions:h.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,U,H,W,B=Object(w.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(w.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:!1,accept:o.toArray().join(","),onChange:this.handleChange,disabled:n,style:{display:"none"}})))},e}(S.a),Object(d.a)(P,"propTypes",{disabled:O.a.bool,onSelectFile:O.a.func.isRequired,style:O.a.object,resetFileKey:O.a.number,acceptContentTypes:h.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(w.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(w.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(167),ee=a.n(Q),te=a(139),ae=a(45),ne=a.n(ae),oe=a(60),se=a.n(oe),ie=Object(w.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"}}),ce=!!se.a.hasSupport&&{passive:!0},re=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,ce),this.focusedItem&&this.focusedItem.focus(),this.setState({mounted:!0})},t.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,ce)},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)("i",{className:"fa fa-fw fa-"+e.icon})),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),le=Object(w.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(ie.public_short),meta:e(ie.public_long)},{icon:"unlock-alt",value:"unlisted",text:e(ie.unlisted_short),meta:e(ie.unlisted_long)},{icon:"lock",value:"private",text:e(ie.private_short),meta:e(ie.private_long)},{icon:"envelope",value:"direct",text:e(ie.direct_short),meta:e(ie.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(ie.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)(re,{items:this.options,value:t,onClose:this.handleClose,onChange:this.handleChange,placement:s})))},e}(p.a.PureComponent))||z,ue=a(49),de=a(177),pe=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:de.c,onModalOpen:function(e){return t(Object(ue.d)("ACTIONS",e))},onModalClose:function(){return t(Object(ue.c)())}}})(le),be=Object(w.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(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?be.marked:be.unmarked),icon:a,onClick:c,size:18,active:s,disabled:i,style:{lineHeight:null,height:null},inverted:!0}))})},t}(p.a.PureComponent),fe=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(w.g)(ge)),me=a(659),he=a(83),je=a(57),Oe=a(4),ve=a(216),_e=["+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"],ye=Object(je.a)([function(e){return e.getIn(["settings","frequentlyUsedEmojis"],Object(Oe.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<_e.length){var e=_e.filter(function(e){return!t.includes(e)});t=t.concat(e.slice(0,_e.length-t.length))}return t}),ke=Object(je.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})}),Ce=Object(i.connect)(function(e){return{custom_emojis:ke(e),skinTone:e.getIn(["settings","skinTone"]),frequentlyUsedEmojis:ye(e)}},function(t,e){var a=e.onPickEmoji;return{onSkinTone:function(e){t(Object(he.c)(["skinTone"],e))},onPickEmoji:function(e){t(Object(ve.b)(e)),a&&a(e)}}})(me.a),we=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)("i",{className:"fa fa-upload"})),Object(u.a)("div",{className:"upload-progress__message"},void 0,Object(u.a)(w.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),Se=Object(i.connect)(function(e){return{active:e.getIn(["compose","is_uploading"]),progress:e.getIn(["compose","progress"])}})(we),Me=Object(w.f)({description:{id:"upload_form.description",defaultMessage:"Describe for the visually impaired"}}),xe=Object(w.g)((W=H=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)("i",{className:"fa fa-times"})," ",Object(u.a)(w.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)("i",{className:"fa fa-crosshairs"})," ",Object(u.a)(w.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(Me.description)),Object(u.a)("input",{placeholder:n.formatMessage(Me.description),type:"text",value:i,maxLength:420,onFocus:a.handleInputFocus,onChange:a.handleInputChange,onBlur:a.handleInputBlur,onKeyDown:a.handleKeyDown}))))}))},e}(S.a),Object(d.a)(H,"contextTypes",{router:O.a.object}),Object(d.a)(H,"propTypes",{media:h.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}),U=W))||U,Ne=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(ue.d)("FOCAL_POINT",{id:e}))},onSubmit:function(e){a(Object(v.W)(e))}}})(xe),De=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)(Se,{}),Object(u.a)("div",{className:"compose-form__uploads-wrapper"},void 0,e.map(function(e){return Object(u.a)(Ne,{id:e},e)})))},t}(S.a);Object(d.a)(De,"propTypes",{mediaIds:h.a.list.isRequired});var Ie,Te,Pe,Re=Object(i.connect)(function(e){return{mediaIds:e.getIn(["compose","media_attachments"]).map(function(e){return e.get("id")})}})(De),Ee=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),Fe=a(23),qe=/(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i,Ae=Object(i.connect)(function(e){return{needsLockWarning:"private"===e.getIn(["compose","privacy"])&&!e.getIn(["accounts",Fe.k,"locked"]),hashtagWarning:"public"!==e.getIn(["compose","privacy"])&&qe.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)(Ee,{message:Object(u.a)(w.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)(w.b,{id:"compose_form.lock_disclaimer.lock",defaultMessage:"locked"}))}})});if(a)return Object(u.a)(Ee,{message:Object(u.a)(w.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)(w.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)(w.b,{id:"compose_form.direct_message_warning_learn_more",defaultMessage:"Learn more"})));return Object(u.a)(Ee,{message:o})}return null}),Ke=Object(w.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}!"}}),Le=Object(w.g)((Pe=Te=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)>Fe.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)>Fe.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)("i",{className:"fa fa-lock"})," ",t.formatMessage(Ke.publish)):"unlisted"!==this.props.privacy?t.formatMessage(Ke.publishLoud,{publish:t.formatMessage(Ke.publish)}):t.formatMessage(Ke.publish),Object(u.a)("div",{className:"compose-form"},void 0,Object(u.a)(Ae,{}),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(Ke.spoiler_placeholder)),p.a.createElement("input",{placeholder:t.formatMessage(Ke.spoiler_placeholder),value:this.props.spoiler_text,onChange:this.handleChangeSpoilerText,onKeyDown:this.handleKeyDown,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(Ke.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(de.b)(window.innerWidth)}),Object(u.a)(Ce,{onPickEmoji:this.handleEmojiPick})),Object(u.a)("div",{className:"compose-form__modifiers"},void 0,Object(u.a)(Re,{})),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)(pe,{}),Object(u.a)(fe,{}),Object(u.a)(V,{})),Object(u.a)("div",{className:"character-counter__wrapper"},void 0,Object(u.a)(g,{max:Fe.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)(f.a,{text:r,onClick:this.handleSubmit,disabled:c,block:!0}))))},e}(S.a),Object(d.a)(Te,"contextTypes",{router:O.a.object}),Object(d.a)(Te,"propTypes",{intl:O.a.object.isRequired,text:O.a.string.isRequired,suggestion_token:O.a.string,suggestions:h.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)(Te,"defaultProps",{showSearch:!1}),Ie=Pe))||Ie;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))}}})(Le)},701:function(e,t,a){"use strict";a.r(t);var n,o,s,i,c,l=a(1),r=a(6),u=a(0),d=a(2),p=a(3),b=a.n(p),g=a(698),f=a(20),m=a(972),h=a(23),j=Object(f.connect)(function(e){return{account:e.getIn(["accounts",h.k])}})(m.a),O=a(22),v=a(386),_=a(7),y=a(213),k=a(21),C=a(167),w=a.n(C),S=a(139),M=a(45),x=a.n(M),N=Object(_.f)({placeholder:{id:"search.placeholder",defaultMessage:"Search"}}),D=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this.props.style,o=h.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)(S.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:x()(1,{damping:35,stiffness:400}),scaleX:x()(1,{damping:35,stiffness:400}),scaleY:x()(1,{damping:35,stiffness:400})}},void 0,function(e){var t=e.opacity,a=e.scaleX,n=e.scaleY;return Object(l.a)("div",{className:"search-popout",style:{opacity:t,transform:"scale("+a+", "+n+")"}},void 0,Object(l.a)("h4",{},void 0,Object(l.a)(_.b,{id:"search_popout.search_format",defaultMessage:"Advanced search format"})),Object(l.a)("ul",{},void 0,Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"#example")," ",Object(l.a)(_.b,{id:"search_popout.tips.hashtag",defaultMessage:"hashtag"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"@username@domain")," ",Object(l.a)(_.b,{id:"search_popout.tips.user",defaultMessage:"user"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"URL")," ",Object(l.a)(_.b,{id:"search_popout.tips.user",defaultMessage:"user"})),Object(l.a)("li",{},void 0,Object(l.a)("em",{},void 0,"URL")," ",Object(l.a)(_.b,{id:"search_popout.tips.status",defaultMessage:"status"}))),o)}))},t}(b.a.PureComponent),I=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(N.placeholder)),Object(l.a)("input",{className:"search__input",type:"text",placeholder:t.formatMessage(N.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)("i",{className:"fa fa-search "+(s?"":"active")}),Object(l.a)("i",{"aria-label":t.formatMessage(N.placeholder),className:"fa fa-times-circle "+(s?"active":"")})),Object(l.a)(w.a,{show:o&&!s,placement:"bottom",target:this},void 0,Object(l.a)(D,{})))},e}(b.a.PureComponent))||n,T=Object(f.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)())}}})(I),P=a(5),R=a.n(P),E=a(26),F=a.n(E),q=a(887),A=a(631),K=a(24),L=a(949),z=a(407),U=a(965),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)(z.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)(L.Sparklines,{width:50,height:28,data:t.get("history")&&t.get("history").reverse().map(function(e){return e.get("uses")}).toArray()},void 0,Object(l.a)(L.SparklinesCurve,{style:{fill:"none"}}))))},W=Object(_.f)({dismissSuggestion:{id:"suggestions.dismiss",defaultMessage:"Dismiss suggestion"}}),B=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)("i",{className:"fa fa-user-plus fa-fw"}),Object(l.a)(_.b,{id:"suggestions.header",defaultMessage:"You might be interested in…"})),i&&i.map(function(e){return Object(l.a)(q.a,{id:e,actionIcon:"times",actionTitle:o.formatMessage(W.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)("i",{className:"fa fa-fw fa-users"}),Object(l.a)(_.b,{id:"search_results.accounts",defaultMessage:"People"})),s.get("accounts").map(function(e){return Object(l.a)(q.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)("i",{className:"fa fa-fw fa-quote-right"}),Object(l.a)(_.b,{id:"search_results.statuses",defaultMessage:"Toots"})),s.get("statuses").map(function(e){return Object(l.a)(A.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)("i",{className:"fa fa-fw fa-hashtag"}),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)("i",{className:"fa fa-search fa-fw"}),Object(l.a)(_.b,{id:"search_results.total",defaultMessage:"{count, number} {count, plural, one {result} other {results}}",values:{count:r}})),e,t,a)},t}(K.a),Object(d.a)(s,"propTypes",{results:F.a.map.isRequired,suggestions:F.a.list.isRequired,fetchSuggestions:R.a.func.isRequired,dismissSuggestion:R.a.func.isRequired,intl:R.a.object.isRequired}),o=i))||o,Y=a(214),X=Object(f.connect)(function(e){return{results:e.getIn(["search","results"]),suggestions:e.getIn(["suggestions","items"])}},function(t){return{fetchSuggestions:function(){return t(Object(Y.f)())},dismissSuggestion:function(e){return t(Object(Y.e)(e.get("id")))}}})(B);a.d(t,"default",function(){return J});var G=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"}}),J=Object(f.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(G.start),"aria-label":o.formatMessage(G.start)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-bars"})),!i.some(function(e){return"HOME"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/home",className:"drawer__tab",title:o.formatMessage(G.home_timeline),"aria-label":o.formatMessage(G.home_timeline)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-home"})),!i.some(function(e){return"NOTIFICATIONS"===e.get("id")})&&Object(l.a)(v.a,{to:"/notifications",className:"drawer__tab",title:o.formatMessage(G.notifications),"aria-label":o.formatMessage(G.notifications)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-bell"})),!i.some(function(e){return"COMMUNITY"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/public/local",className:"drawer__tab",title:o.formatMessage(G.community),"aria-label":o.formatMessage(G.community)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-users"})),!i.some(function(e){return"PUBLIC"===e.get("id")})&&Object(l.a)(v.a,{to:"/timelines/public",className:"drawer__tab",title:o.formatMessage(G.public),"aria-label":o.formatMessage(G.public)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-globe"})),Object(l.a)("a",{href:"/user-settings",className:"drawer__tab",title:o.formatMessage(G.preferences),"aria-label":o.formatMessage(G.preferences)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-cog"})),Object(l.a)("a",{href:"/auth/sign_out",className:"drawer__tab","data-method":"delete",title:o.formatMessage(G.logout),"aria-label":o.formatMessage(G.logout)},void 0,Object(l.a)("i",{role:"img",className:"fa fa-fw fa-sign-out"})))}return Object(l.a)("div",{className:"drawer",role:"region","aria-label":o.formatMessage(G.compose)},void 0,s,(t||n)&&Object(l.a)(T,{}),Object(l.a)("div",{className:"drawer__pager"},void 0,!n&&Object(l.a)("div",{className:"drawer__inner",onFocus:this.onFocus},void 0,Object(l.a)(j,{onClose:this.onBlur}),Object(l.a)(g.a,{})),Object(l.a)(S.a,{defaultStyle:{x:n?0:-100},style:{x:x()(a||n?0:-100,{stiffness:210,damping:20})}},void 0,function(e){var t=e.x;return Object(l.a)("div",{className:"drawer__inner darker",style:{transform:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,Object(l.a)(X,{}))})))},e}(b.a.PureComponent))||c)||c}}]);
//# sourceMappingURL=compose.js.map