webpackJsonp([11],{1058:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(927),o=i.a.createClass({displayName:"AudioFile",render:function(){return i.a.createElement("audio",this.props.mediaProps)}});t.a=r.i(n.a)(o)},1059:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(747),o=r(91),s=r(740),c=r(46),d=function(e){var t=e.item;return c.a.useMobileLayout()?null:i.a.createElement(s.a,null,i.a.createElement(s.b,{label:t.downloaded?"Downloaded":"Opened",text:o.a.formatRelativeTime(t.time_finished)}))};t.a=r.i(n.a)(d)},1060:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=function(e){var t=(e.item,e.url);return i.a.createElement("img",{src:t})};t.a=n},1061:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(65),o=r(10),s=r(134),c=r(118),d=r(737),l=i.a.createClass({displayName:"TextFile",componentWillMount:function(){"downloaded"===this.props.item.state.id&&this.fetchText(this.props.item)},componentWillReceiveProps:function(e){if("downloaded"===e.item.state.id){var t=e.item.id!==this.props.item.id;t&&this.setState(this.getInitialState()),(t||"downloaded"!==this.props.item.state.id)&&this.fetchText(e.item)}},getInitialState:function(){return{text:null,error:null}},fetchText:function(e){o.a.get(s.a.SESSION_URL+"/"+e.id+"/text").then(this.onTextReceive)["catch"](this.onTextFailed)},onTextFailed:function(e){this.setState({error:e.message})},onTextReceive:function(e){this.setState({text:e.text})},render:function(){var e=this.props.item.state;return"downloaded"!==e.id||this.state.text?i.a.createElement("pre",null,i.a.createElement(d.a,{text:this.state.text})):this.state.error?i.a.createElement(c.a,{title:"Failed to fetch content",description:this.state.error}):i.a.createElement(n.a,{text:"Preparing view"})}});t.a=l},1062:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(927),o=i.a.createClass({displayName:"VideoFile",render:function(){return i.a.createElement("video",this.props.mediaProps)}});t.a=r.i(n.a)(o)},773:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(14),o=r(65),s=r(118),c=r(27),d=r(1058),l=r(1060),u=r(1061),p=r(1062),m=r(739),f=r(1059),h=function(e){if(e.text)return u.a;switch(e.type.content_type){case"audio":return d.a;case"picture":return l.a;case"video":return p.a}return null},E=function(e){return getBasePath()+"view/"+e+"?auth="+c.a.token},v=i.a.createClass({displayName:"FileSession",render:function(){var e=this.props.session;if("downloaded"!==e.state.id)return"download_failed"===e.state.id?i.a.createElement(s.a,{icon:n.a.ERROR,title:"Download failed",description:e.state.str}):i.a.createElement(o.a,{text:e.state.str});var t=h(e),r=void 0;return r=t?i.a.createElement(t,{item:e,url:E(e.tth),type:e.mime_type,extension:e.type.str}):"Unsupported format",i.a.createElement("div",{className:"file-session "+e.type.str+" "+e.type.content_type},i.a.createElement("div",{className:"file-content"},r),i.a.createElement(f.a,{item:e}))}});t["default"]=r.i(m.a)(v)},927:function(e,t,r){"use strict";var a=r(0),i=r.n(a),n=r(20),o=r.n(n),s=r(301),c=r.n(s),d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},l=function(e){switch(e.target.error.code){case e.target.error.MEDIA_ERR_NETWORK:return"A network error caused the media download to fail";case e.target.error.MEDIA_ERR_DECODE:return"The media playback was aborted due to a corruption problem or because the media used features your browser did not support";case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:return"The media could not be loaded, either because the file was not found, network failed or because the format is not supported by your browser";default:return"An unknown media error occurred"}};t.a=function(e){var t=i.a.createClass({displayName:"MediaFileDecorator",getInitialState:function(){return{error:null}},componentWillUpdate:function(e,t){e.item!==this.props.item&&this.state.error&&this.setState({error:null})},componentDidUpdate:function(e,t){e.item!==this.props.item&&this.refs.media&&o.a.findDOMNode(this.refs.media).load()},onMediaError:function(e){this.setState({error:l(e)})},render:function(){var t=this.props.item;if(this.state.error)return i.a.createElement("div",null,this.state.error);var r=c.a.duration(c()().diff(c.a.unix(t.time_finished))),a=r.asMinutes()<=1,n={onError:this.onMediaError,autoPlay:a,controls:!0,src:this.props.url};return i.a.createElement(e,d({ref:"media"},this.props,{mediaProps:n}))}});return t}}});
//# sourceMappingURL=file-children.chunk.js.map