honkoma/priv/static/packs/features/community_timeline.js

2 lines
27 KiB
JavaScript

webpackJsonp([9],{275:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var o,i,r=n(2),a=n.n(r),s=n(1),c=n.n(s),l=n(3),u=n.n(l),d=n(4),h=n.n(d),f=n(0),p=n.n(f),g=n(7),v=(i=o=function(e){function t(){return c()(this,t),u()(this,e.apply(this,arguments))}return h()(t,e),t.prototype.render=function(){var e=this.props,t=e.disabled,n=e.visible;return a()("button",{className:"load-more",disabled:t||!n,style:{visibility:n?"visible":"hidden"},onClick:this.props.onClick},void 0,a()(g.b,{id:"status.load_more",defaultMessage:"Load more"}))},t}(p.a.PureComponent),o.defaultProps={visible:!0},i)},277:function(e,t,n){"use strict";var o=n(2),i=n.n(o),r=n(0),a=(n.n(r),n(9)),s=n(158),c=n(67),l=n(17),u=n(68),d=n(22),h=n(69),f=n(90),p=n(157),g=n(26),v=n(7),m=n(13),b=n(33),y=Object(v.f)({deleteConfirm:{id:"confirmations.delete.confirm",defaultMessage:"Delete"},deleteMessage:{id:"confirmations.delete.message",defaultMessage:"Are you sure you want to delete this status?"},redraftConfirm:{id:"confirmations.redraft.confirm",defaultMessage:"Delete & redraft"},redraftMessage:{id:"confirmations.redraft.message",defaultMessage:"Are you sure you want to delete this status and re-draft it? You will lose all replies, boosts and favourites to it."},blockConfirm:{id:"confirmations.block.confirm",defaultMessage:"Block"}}),M=function(){var e=Object(c.e)();return function(t,n){return{status:e(t,n.id)}}},k=function(e,t){var n=t.intl;return{onReply:function(t,n){e(Object(l.T)(t,n))},onModalReblog:function(t){e(Object(u.o)(t))},onReblog:function(t,n){t.get("reblogged")?e(Object(u.r)(t)):n.shiftKey||!m.b?this.onModalReblog(t):e(Object(g.d)("BOOST",{status:t,onReblog:this.onModalReblog}))},onFavourite:function(t){e(t.get("favourited")?Object(u.p)(t):Object(u.k)(t))},onPin:function(t){e(t.get("pinned")?Object(u.q)(t):Object(u.n)(t))},onEmbed:function(t){e(Object(g.d)("EMBED",{url:t.get("url"),onError:function(t){return e(Object(b.e)(t))}}))},onDelete:function(t){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e(m.d?Object(g.d)("CONFIRM",{message:n.formatMessage(o?y.redraftMessage:y.deleteMessage),confirm:n.formatMessage(o?y.redraftConfirm:y.deleteConfirm),onConfirm:function(){return e(Object(h.g)(t.get("id"),o))}}):Object(h.g)(t.get("id"),o))},onDirect:function(t,n){e(Object(l.N)(t,n))},onMention:function(t,n){e(Object(l.R)(t,n))},onOpenMedia:function(t,n){e(Object(g.d)("MEDIA",{media:t,index:n}))},onOpenVideo:function(t,n){e(Object(g.d)("VIDEO",{media:t,time:n}))},onBlock:function(t){e(Object(g.d)("CONFIRM",{message:i()(v.b,{id:"confirmations.block.message",defaultMessage:"Are you sure you want to block {name}?",values:{name:i()("strong",{},void 0,"@",t.get("acct"))}}),confirm:n.formatMessage(y.blockConfirm),onConfirm:function(){return e(Object(d.q)(t.get("id")))}}))},onReport:function(t){e(Object(p.k)(t.get("account"),t))},onMute:function(t){e(Object(f.g)(t))},onMuteConversation:function(t){e(t.get("muted")?Object(h.l)(t.get("id")):Object(h.j)(t.get("id")))},onToggleHidden:function(t){e(t.get("hidden")?Object(h.k)(t.get("id")):Object(h.i)(t.get("id")))}}};t.a=Object(v.g)(Object(a.connect)(M,k)(s.a))},278:function(e,t,n){"use strict";n.d(t,"a",function(){return S});var o,i,r=n(2),a=n.n(r),s=n(1),c=n.n(s),l=n(3),u=n.n(l),d=n(4),h=n.n(d),f=n(93),p=n.n(f),g=n(0),v=n.n(g),m=n(156),b=n(5),y=n.n(b),M=n(279),k=n(275),O=n(284),C=n(8),I=(n.n(C),n(10)),j=n.n(I),_=n(159),S=(i=o=function(e){function t(){var n,o,i;c()(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];return n=o=u()(this,e.call.apply(e,[this].concat(a))),o.state={fullscreen:null},o.intersectionObserverWrapper=new O.a,o.handleScroll=p()(function(){if(o.node){var e=o.node,t=e.scrollTop;400>e.scrollHeight-t-e.clientHeight&&o.props.onLoadMore&&!o.props.isLoading&&o.props.onLoadMore(),t<100&&o.props.onScrollToTop?o.props.onScrollToTop():o.props.onScroll&&o.props.onScroll()}},150,{trailing:!0}),o.onFullScreenChange=function(){o.setState({fullscreen:Object(_.d)()})},o.setRef=function(e){o.node=e},o.handleLoadMore=function(e){e.preventDefault(),o.props.onLoadMore()},i=n,u()(o,i)}return h()(t,e),t.prototype.componentDidMount=function(){this.attachScrollListener(),this.attachIntersectionObserver(),Object(_.a)(this.onFullScreenChange),this.handleScroll()},t.prototype.getSnapshotBeforeUpdate=function(e){return v.a.Children.count(e.children)>0&&v.a.Children.count(e.children)<v.a.Children.count(this.props.children)&&this.getFirstChildKey(e)!==this.getFirstChildKey(this.props)&&this.node.scrollTop>0?this.node.scrollHeight-this.node.scrollTop:null},t.prototype.componentDidUpdate=function(e,t,n){if(null!==n){var o=this.node.scrollHeight-n;this.node.scrollTop!==o&&(this.node.scrollTop=o)}},t.prototype.componentWillUnmount=function(){this.detachScrollListener(),this.detachIntersectionObserver(),Object(_.b)(this.onFullScreenChange)},t.prototype.attachIntersectionObserver=function(){this.intersectionObserverWrapper.connect({root:this.node,rootMargin:"300% 0px"})},t.prototype.detachIntersectionObserver=function(){this.intersectionObserverWrapper.disconnect()},t.prototype.attachScrollListener=function(){this.node.addEventListener("scroll",this.handleScroll)},t.prototype.detachScrollListener=function(){this.node.removeEventListener("scroll",this.handleScroll)},t.prototype.getFirstChildKey=function(e){var t=e.children,n=t;return t instanceof C.List?n=t.get(0):Array.isArray(t)&&(n=t[0]),n&&n.key},t.prototype.render=function(){var e=this,t=this.props,n=t.children,o=t.scrollKey,i=t.trackScroll,r=t.shouldUpdateScroll,s=t.isLoading,c=t.hasMore,l=t.prepend,u=t.alwaysPrepend,d=t.emptyMessage,h=t.onLoadMore,f=this.state.fullscreen,p=v.a.Children.count(n),g=c&&p>0&&h?a()(k.a,{visible:!s,onClick:this.handleLoadMore}):null,b=null;return b=s||p>0||!d?v.a.createElement("div",{className:j()("scrollable",{fullscreen:f}),ref:this.setRef},a()("div",{role:"feed",className:"item-list"},void 0,l,v.a.Children.map(this.props.children,function(t,n){return a()(M.a,{id:t.key,index:n,listLength:p,intersectionObserverWrapper:e.intersectionObserverWrapper,saveHeightKey:i?e.context.router.route.location.key+":"+o:null},t.key,t)}),g)):a()("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column"}},void 0,u&&l,v.a.createElement("div",{className:"empty-column-indicator",ref:this.setRef},d)),i?a()(m.a,{scrollKey:o,shouldUpdateScroll:r},void 0,b):b},t}(g.PureComponent),o.contextTypes={router:y.a.object},o.defaultProps={trackScroll:!0},i)},279:function(e,t,n){"use strict";var o=n(9),i=n(280),r=n(94),a=function(e,t){return{cachedHeight:e.getIn(["height_cache",t.saveHeightKey,t.id])}},s=function(e){return{onHeightChange:function(t,n,o){e(Object(r.d)(t,n,o))}}};t.a=Object(o.connect)(a,s)(i.a)},280:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var o=n(1),i=n.n(o),r=n(3),a=n.n(r),s=n(4),c=n.n(s),l=n(0),u=n.n(l),d=n(281),h=n(283),f=n(8),p=(n.n(f),["id","index","listLength"]),g=["id","index","listLength","cachedHeight"],v=function(e){function t(){var n,o,r;i()(this,t);for(var s=arguments.length,c=Array(s),l=0;l<s;l++)c[l]=arguments[l];return n=o=a()(this,e.call.apply(e,[this].concat(c))),o.state={isHidden:!1},o.handleIntersection=function(e){o.entry=e,Object(d.a)(o.calculateHeight),o.setState(o.updateStateAfterIntersection)},o.updateStateAfterIntersection=function(e){return e.isIntersecting&&!o.entry.isIntersecting&&Object(d.a)(o.hideIfNotIntersecting),{isIntersecting:o.entry.isIntersecting,isHidden:!1}},o.calculateHeight=function(){var e=o.props,t=e.onHeightChange,n=e.saveHeightKey,i=e.id;o.height=Object(h.a)(o.entry).height,t&&n&&t(n,i,o.height)},o.hideIfNotIntersecting=function(){o.componentMounted&&o.setState(function(e){return{isHidden:!e.isIntersecting}})},o.handleRef=function(e){o.node=e},r=n,a()(o,r)}return c()(t,e),t.prototype.shouldComponentUpdate=function(e,t){var n=this,o=!this.state.isIntersecting&&(this.state.isHidden||this.props.cachedHeight);return!!o!=!(t.isIntersecting||!t.isHidden&&!e.cachedHeight)||!(o?g:p).every(function(t){return Object(f.is)(e[t],n.props[t])})},t.prototype.componentDidMount=function(){var e=this.props,t=e.intersectionObserverWrapper,n=e.id;t.observe(n,this.node,this.handleIntersection),this.componentMounted=!0},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.intersectionObserverWrapper,n=e.id;t.unobserve(n,this.node),this.componentMounted=!1},t.prototype.render=function(){var e=this.props,t=e.children,n=e.id,o=e.index,i=e.listLength,r=e.cachedHeight,a=this.state,s=a.isIntersecting,c=a.isHidden;return s||!c&&!r?u.a.createElement("article",{ref:this.handleRef,"aria-posinset":o,"aria-setsize":i,"data-id":n,tabIndex:"0"},t&&u.a.cloneElement(t,{hidden:!1})):u.a.createElement("article",{ref:this.handleRef,"aria-posinset":o,"aria-setsize":i,style:{height:(this.height||r)+"px",opacity:0,overflow:"hidden"},"data-id":n,tabIndex:"0"},t&&u.a.cloneElement(t,{hidden:!0}))},t}(u.a.Component)},281:function(e,t,n){"use strict";function o(e){for(;s.length&&e.timeRemaining()>0;)s.shift()();s.length?requestIdleCallback(o):c=!1}function i(e){s.push(e),c||(c=!0,requestIdleCallback(o))}var r=n(282),a=n.n(r),s=new a.a,c=!1;t.a=i},282:function(e,t,n){"use strict";function o(){this.length=0}o.prototype.push=function(e){var t={item:e};this.last?this.last=this.last.next=t:this.last=this.first=t,this.length++},o.prototype.shift=function(){var e=this.first;if(e)return this.first=e.next,--this.length||(this.last=void 0),e.item},o.prototype.slice=function(e,t){e=void 0===e?0:e,t=void 0===t?1/0:t;for(var n=[],o=0,i=this.first;i&&!(--t<0);i=i.next)++o>e&&n.push(i.item);return n},e.exports=o},283:function(e,t,n){"use strict";function o(e){if("boolean"!=typeof i){var t=e.target.getBoundingClientRect(),n=e.boundingClientRect;i=t.height!==n.height||t.top!==n.top||t.width!==n.width||t.bottom!==n.bottom||t.left!==n.left||t.right!==n.right}return i?e.target.getBoundingClientRect():e.boundingClientRect}var i=void 0;t.a=o},284:function(e,t,n){"use strict";var o=n(1),i=n.n(o),r=function(){function e(){i()(this,e),this.callbacks={},this.observerBacklog=[],this.observer=null}return e.prototype.connect=function(e){var t=this,n=function(e){e.forEach(function(e){var n=e.target.getAttribute("data-id");t.callbacks[n]&&t.callbacks[n](e)})};this.observer=new IntersectionObserver(n,e),this.observerBacklog.forEach(function(e){var n=e[0],o=e[1],i=e[2];t.observe(n,o,i)}),this.observerBacklog=null},e.prototype.observe=function(e,t,n){this.observer?(this.callbacks[e]=n,this.observer.observe(t)):this.observerBacklog.push([e,t,n])},e.prototype.unobserve=function(e,t){this.observer&&(delete this.callbacks[e],this.observer.unobserve(t))},e.prototype.disconnect=function(){this.observer&&(this.callbacks={},this.observer.disconnect(),this.observer=null)},e}();t.a=r},285:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var o,i=n(2),r=n.n(i),a=n(1),s=n.n(a),c=n(3),l=n.n(c),u=n(4),d=n.n(u),h=n(0),f=n.n(h),p=n(7),g=Object(p.f)({load_more:{id:"status.load_more",defaultMessage:"Load more"}}),v=Object(p.g)(o=function(e){function t(){var n,o,i;s()(this,t);for(var r=arguments.length,a=Array(r),c=0;c<r;c++)a[c]=arguments[c];return n=o=l()(this,e.call.apply(e,[this].concat(a))),o.handleClick=function(){o.props.onClick(o.props.maxId)},i=n,l()(o,i)}return d()(t,e),t.prototype.render=function(){var e=this.props,t=e.disabled,n=e.intl;return r()("button",{className:"load-more load-gap",disabled:t,onClick:this.handleClick,"aria-label":n.formatMessage(g.load_more)},void 0,r()("i",{className:"fa fa-ellipsis-h"}))},t}(f.a.PureComponent))||o},286:function(e,t,n){"use strict";n.d(t,"a",function(){return L});var o,i,r=n(34),a=n.n(r),s=n(2),c=n.n(s),l=n(55),u=n.n(l),d=n(1),h=n.n(d),f=n(3),p=n.n(f),g=n(4),v=n.n(g),m=n(32),b=n.n(m),y=n(0),M=n.n(y),k=n(14),O=n.n(k),C=n(5),I=n.n(C),j=n(277),_=n(12),S=n.n(_),x=n(285),T=n(278),w=n(7),L=(i=o=function(e){function t(){var n,o,i;h()(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];return n=o=p()(this,e.call.apply(e,[this].concat(a))),o.getFeaturedStatusCount=function(){return o.props.featuredStatusIds?o.props.featuredStatusIds.size:0},o.getCurrentStatusIndex=function(e,t){return t?o.props.featuredStatusIds.indexOf(e):o.props.statusIds.indexOf(e)+o.getFeaturedStatusCount()},o.handleMoveUp=function(e,t){var n=o.getCurrentStatusIndex(e,t)-1;o._selectChild(n)},o.handleMoveDown=function(e,t){var n=o.getCurrentStatusIndex(e,t)+1;o._selectChild(n)},o.handleLoadOlder=b()(function(){o.props.onLoadMore(o.props.statusIds.last())},300,{leading:!0}),o.setRef=function(e){o.node=e},i=n,p()(o,i)}return v()(t,e),t.prototype._selectChild=function(e){var t=this.node.node.querySelector("article:nth-of-type("+(e+1)+") .focusable");t&&t.focus()},t.prototype.render=function(){var e=this,t=this.props,n=t.statusIds,o=t.featuredStatusIds,i=t.onLoadMore,r=u()(t,["statusIds","featuredStatusIds","onLoadMore"]),s=r.isLoading;if(r.isPartial)return c()("div",{className:"regeneration-indicator"},void 0,c()("div",{},void 0,c()("div",{className:"regeneration-indicator__figure"}),c()("div",{className:"regeneration-indicator__label"},void 0,c()(w.b,{id:"regeneration_indicator.label",tagName:"strong",defaultMessage:"Loading…"}),c()(w.b,{id:"regeneration_indicator.sublabel",defaultMessage:"Your home feed is being prepared!"}))));var l=s||n.size>0?n.map(function(t,o){return null===t?c()(x.a,{disabled:s,maxId:o>0?n.get(o-1):null,onClick:i},"gap:"+n.get(o+1)):c()(j.a,{id:t,onMoveUp:e.handleMoveUp,onMoveDown:e.handleMoveDown},t)}):null;return l&&o&&(l=o.map(function(t){return c()(j.a,{id:t,featured:!0,onMoveUp:e.handleMoveUp,onMoveDown:e.handleMoveDown},"f-"+t)}).concat(l)),M.a.createElement(T.a,a()({},r,{onLoadMore:i&&this.handleLoadOlder,ref:this.setRef}),l)},t}(S.a),o.propTypes={scrollKey:I.a.string.isRequired,statusIds:O.a.list.isRequired,featuredStatusIds:O.a.list,onLoadMore:I.a.func,onScrollToTop:I.a.func,onScroll:I.a.func,trackScroll:I.a.bool,shouldUpdateScroll:I.a.func,isLoading:I.a.bool,isPartial:I.a.bool,hasMore:I.a.bool,prepend:I.a.node,emptyMessage:I.a.node,alwaysPrepend:I.a.bool},o.defaultProps={trackScroll:!0},i)},813:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return w});var o,i,r,a,s=n(2),c=n.n(s),l=n(1),u=n.n(l),d=n(3),h=n.n(d),f=n(4),p=n.n(f),g=n(0),v=n.n(g),m=n(9),b=n(7),y=n(5),M=n.n(y),k=n(92),O=n(71),C=n(70),I=n(19),j=n(290),_=n(994),S=n(72),x=Object(b.f)({title:{id:"column.community",defaultMessage:"Local timeline"}}),T=function(e,t){var n=t.onlyMedia,o=t.columnId,i=o,r=e.getIn(["settings","columns"]),a=r.findIndex(function(e){return e.get("uuid")===i});return{hasUnread:e.getIn(["timelines","community"+(n?":media":""),"unread"])>0,onlyMedia:o&&a>=0?r.get(a).getIn(["params","other","onlyMedia"]):e.getIn(["settings","community","other","onlyMedia"])}},w=(o=Object(m.connect)(T))(i=Object(b.g)((a=r=function(e){function t(){var n,o,i;u()(this,t);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];return n=o=h()(this,e.call.apply(e,[this].concat(a))),o.handlePin=function(){var e=o.props,t=e.columnId,n=e.dispatch,i=e.onlyMedia;n(t?Object(j.h)(t):Object(j.e)("COMMUNITY",{other:{onlyMedia:i}}))},o.handleMove=function(e){var t=o.props,n=t.columnId;(0,t.dispatch)(Object(j.g)(n,e))},o.handleHeaderClick=function(){o.column.scrollTop()},o.setRef=function(e){o.column=e},o.handleLoadMore=function(e){var t=o.props,n=t.dispatch,i=t.onlyMedia;n(Object(I.m)({maxId:e,onlyMedia:i}))},i=n,h()(o,i)}return p()(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.dispatch,n=e.onlyMedia;t(Object(I.m)({onlyMedia:n})),this.disconnect=t(Object(S.a)({onlyMedia:n}))},t.prototype.componentDidUpdate=function(e){if(e.onlyMedia!==this.props.onlyMedia){var t=this.props,n=t.dispatch,o=t.onlyMedia;this.disconnect(),n(Object(I.m)({onlyMedia:o})),this.disconnect=n(Object(S.a)({onlyMedia:o}))}},t.prototype.componentWillUnmount=function(){this.disconnect&&(this.disconnect(),this.disconnect=null)},t.prototype.render=function(){var e=this.props,t=e.intl,n=e.hasUnread,o=e.columnId,i=e.multiColumn,r=e.onlyMedia,a=!!o;return v.a.createElement(O.a,{ref:this.setRef},c()(C.a,{icon:"users",active:n,title:t.formatMessage(x.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:a,multiColumn:i},void 0,c()(_.a,{columnId:o})),c()(k.a,{trackScroll:!a,scrollKey:"community_timeline-"+o,timelineId:"community"+(r?":media":""),onLoadMore:this.handleLoadMore,emptyMessage:c()(b.b,{id:"empty_column.community",defaultMessage:"The local timeline is empty. Write something publicly to get the ball rolling!"})}))},t}(v.a.PureComponent),r.contextTypes={router:M.a.object},r.defaultProps={onlyMedia:!1},i=a))||i)||i},867:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(0),d=o(u),h=n(10),f=o(h),p=n(5),g=o(p),v=n(868),m=o(v),b=n(869),y=o(b),M=n(870),k=function(e){function t(e){r(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleClick=n.handleClick.bind(n),n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchMove=n.handleTouchMove.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.previouslyChecked=!(!e.checked&&!e.defaultChecked),n.state={checked:!(!e.checked&&!e.defaultChecked),hasFocus:!1},n}return s(t,e),l(t,[{key:"componentWillReceiveProps",value:function(e){"checked"in e&&this.setState({checked:!!e.checked})}},{key:"handleClick",value:function(e){var t=this.input;if(e.target!==t&&!this.moved)return this.previouslyChecked=t.checked,e.preventDefault(),t.focus(),void t.click();var n=this.props.hasOwnProperty("checked")?this.props.checked:t.checked;this.setState({checked:n})}},{key:"handleTouchStart",value:function(e){this.startX=(0,M.pointerCoord)(e).x,this.activated=!0}},{key:"handleTouchMove",value:function(e){if(this.activated&&(this.moved=!0,this.startX)){var t=(0,M.pointerCoord)(e).x;this.state.checked&&t+15<this.startX?(this.setState({checked:!1}),this.startX=t,this.activated=!0):t-15>this.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=t<this.startX+5)}}},{key:"handleTouchEnd",value:function(e){if(this.moved){var t=this.input;if(e.preventDefault(),this.startX){var n=(0,M.pointerCoord)(e).x;!0===this.previouslyChecked&&this.startX+4>n?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4<n&&this.previouslyChecked!==this.state.checked&&(this.setState({checked:!0}),this.previouslyChecked=this.state.checked,t.click()),this.activated=!1,this.startX=null,this.moved=!1}}}},{key:"handleFocus",value:function(e){var t=this.props.onFocus;t&&t(e),this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(e){var t=this.props.onBlur;t&&t(e),this.setState({hasFocus:!1})}},{key:"getIcon",value:function(e){var n=this.props.icons;return n?void 0===n[e]?t.defaultProps.icons[e]:n[e]:null}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=(t.icons,i(t,["className","icons"])),r=(0,f.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},n);return d.default.createElement("div",{className:r,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},d.default.createElement("div",{className:"react-toggle-track"},d.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),d.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),d.default.createElement("div",{className:"react-toggle-thumb"}),d.default.createElement("input",c({},o,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(u.PureComponent);t.default=k,k.displayName="Toggle",k.defaultProps={icons:{checked:d.default.createElement(m.default,null),unchecked:d.default.createElement(y.default,null)}},k.propTypes={checked:g.default.bool,disabled:g.default.bool,defaultChecked:g.default.bool,onChange:g.default.func,onFocus:g.default.func,onBlur:g.default.func,className:g.default.string,name:g.default.string,value:g.default.string,id:g.default.string,"aria-labelledby":g.default.string,"aria-label":g.default.string,icons:g.default.oneOfType([g.default.bool,g.default.shape({checked:g.default.node,unchecked:g.default.node})])}},868:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(){return i.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},i.default.createElement("title",null,"switch-check"),i.default.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}))}},869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(){return i.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},i.default.createElement("title",null,"switch-x"),i.default.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"}))}},870:function(e,t,n){"use strict";function o(e){if(e){var t=e.changedTouches;if(t&&t.length>0){var n=t[0];return{x:n.clientX,y:n.clientY}}var o=e.pageX;if(void 0!==o)return{x:o,y:e.pageY}}return{x:0,y:0}}Object.defineProperty(t,"__esModule",{value:!0}),t.pointerCoord=o},876:function(e,t,n){"use strict";n.d(t,"a",function(){return g});var o=n(2),i=n.n(o),r=n(1),a=n.n(r),s=n(3),c=n.n(s),l=n(4),u=n.n(l),d=n(0),h=n.n(d),f=n(867),p=n.n(f),g=function(e){function t(){var n,o,i;a()(this,t);for(var r=arguments.length,s=Array(r),l=0;l<r;l++)s[l]=arguments[l];return n=o=c()(this,e.call.apply(e,[this].concat(s))),o.onChange=function(e){var t=e.target;o.props.onChange(o.props.settingPath,t.checked)},i=n,c()(o,i)}return u()(t,e),t.prototype.render=function(){var e=this.props,t=e.prefix,n=e.settings,o=e.settingPath,r=e.label,a=e.meta,s=["setting-toggle",t].concat(o).filter(Boolean).join("-");return i()("div",{className:"setting-toggle"},void 0,i()(p.a,{id:s,checked:n.getIn(o),onChange:this.onChange,onKeyDown:this.onKeyDown}),i()("label",{htmlFor:s,className:"setting-toggle__label"},void 0,r),a&&i()("span",{className:"setting-meta__label"},void 0,a))},t}(h.a.PureComponent)},877:function(e,t,n){"use strict";n.d(t,"a",function(){return f});var o=n(2),i=n.n(o),r=n(1),a=n.n(r),s=n(3),c=n.n(s),l=n(4),u=n.n(l),d=n(0),h=n.n(d),f=function(e){function t(){var n,o,i;a()(this,t);for(var r=arguments.length,s=Array(r),l=0;l<r;l++)s[l]=arguments[l];return n=o=c()(this,e.call.apply(e,[this].concat(s))),o.handleChange=function(e){o.props.onChange(o.props.settingKey,e.target.value)},i=n,c()(o,i)}return u()(t,e),t.prototype.render=function(){var e=this.props,t=e.settings,n=e.settingKey,o=e.label;return i()("label",{},void 0,i()("span",{style:{display:"none"}},void 0,o),i()("input",{className:"setting-text",value:t.getIn(n),onChange:this.handleChange,placeholder:o}))},t}(h.a.PureComponent)},896:function(e,t,n){"use strict";n.d(t,"a",function(){return b});var o,i=n(2),r=n.n(i),a=n(1),s=n.n(a),c=n(3),l=n.n(c),u=n(4),d=n.n(u),h=n(0),f=n.n(h),p=n(7),g=n(877),v=n(876),m=Object(p.f)({filter_regex:{id:"home.column_settings.filter_regex",defaultMessage:"Filter out by regular expressions"},settings:{id:"home.settings",defaultMessage:"Column settings"}}),b=Object(p.g)(o=function(e){function t(){return s()(this,t),l()(this,e.apply(this,arguments))}return d()(t,e),t.prototype.render=function(){var e=this.props,t=e.settings,n=e.onChange,o=e.intl;return r()("div",{},void 0,r()("div",{className:"column-settings__row"},void 0,r()(v.a,{settings:t,settingPath:["other","onlyMedia"],onChange:n,label:r()(p.b,{id:"community.column_settings.media_only",defaultMessage:"Media Only"})})),r()("span",{className:"column-settings__section"},void 0,r()(p.b,{id:"home.column_settings.advanced",defaultMessage:"Advanced"})),r()("div",{className:"column-settings__row"},void 0,r()(g.a,{settings:t,settingKey:["regex","body"],onChange:n,label:o.formatMessage(m.filter_regex)})))},t}(f.a.PureComponent))||o},92:function(e,t,n){"use strict";var o=n(32),i=n.n(o),r=n(9),a=n(286),s=n(19),c=n(8),l=(n.n(c),n(95)),u=(n.n(l),n(13)),d=function(){return Object(l.createSelector)([function(e,t){var n=t.type;return e.getIn(["settings",n],Object(c.Map)())},function(e,t){var n=t.type;return e.getIn(["timelines",n,"items"],Object(c.List)())},function(e){return e.get("statuses")}],function(e,t,n){var o=e.getIn(["regex","body"],"").trim(),i=null;try{i=o&&new RegExp(o,"i")}catch(e){}return t.filter(function(t){if(null===t)return!0;var o=n.get(t),r=!0;if(!1===e.getIn(["shows","reblog"])&&(r=r&&null===o.get("reblog")),!1===e.getIn(["shows","reply"])&&(r=r&&(null===o.get("in_reply_to_id")||o.get("in_reply_to_account_id")===u.i)),r&&i&&o.get("account")!==u.i){var a=o.get("reblog")?n.getIn([o.get("reblog"),"search_index"]):o.get("search_index");r=!i.test(a)}return r})})},h=function(){var e=d();return function(t,n){var o=n.timelineId;return{statusIds:e(t,{type:o}),isLoading:t.getIn(["timelines",o,"isLoading"],!0),isPartial:t.getIn(["timelines",o,"isPartial"],!1),hasMore:t.getIn(["timelines",o,"hasMore"])}}},f=function(e,t){var n=t.timelineId;return{onScrollToTop:i()(function(){e(Object(s.s)(n,!0))},100),onScroll:i()(function(){e(Object(s.s)(n,!1))},100)}};t.a=Object(r.connect)(h,f)(a.a)},994:function(e,t,n){"use strict";var o=n(9),i=n(896),r=n(56),a=n(290),s=function(e,t){var n=t.columnId,o=n,i=e.getIn(["settings","columns"]),r=i.findIndex(function(e){return e.get("uuid")===o});return{settings:o&&r>=0?i.get(r).get("params"):e.getIn(["settings","community"])}},c=function(e,t){var n=t.columnId;return{onChange:function(t,o){e(n?Object(a.f)(n,t,o):Object(r.c)(["community"].concat(t),o))}}};t.a=Object(o.connect)(s,c)(i.a)}});
//# sourceMappingURL=community_timeline.js.map