spee.ch/index.js
2018-03-12 20:31:13 -07:00

2 lines
No EOL
166 KiB
JavaScript

module.exports=function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=45)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-redux")},function(e,t){e.exports=require("winston")},function(e,t,n){"use strict";function a(){var e=this;this.analytics={googleId:"default"},this.assetDefaults={title:"Spee.ch",thumbnail:"https://spee.ch/assets/img/video_thumb_default.png",description:"Open-source, decentralized image and video sharing."},this.auth={sessionKey:"default"},this.details={title:"Spee.h Dev1",host:"https://dev1.spee.ch",description:"Open-source, decentralized image and video sharing."},this.publishing={additionalClaimAddresses:[],disabled:!1,primaryClaimAddress:"default",thumbnailChannel:"default",thumbnailChannelId:"default",uploadDirectory:"/home/lbry/Uploads"},this.configure=function(t){if(!t)return console.log("No site config received.");var n=t.analytics,a=t.publishing,r=t.details,l=t.assetDefaults,o=t.auth;e.analytics=n,e.publishing=a,e.details=r,e.assetDefaults=l,e.auth=o}}e.exports=new a},function(e,t){e.exports=require("react-router-dom")},function(e,t,n){"use strict";function a(e){return{type:h.FILE_SELECTED,data:e}}function r(){return{type:h.FILE_CLEAR}}function l(e,t){return{type:h.METADATA_UPDATE,data:{name:e,value:t}}}function o(e){return{type:h.CLAIM_UPDATE,data:e}}function i(e){return{type:h.SET_PUBLISH_IN_CHANNEL,channel:e}}function u(e,t){return{type:h.PUBLISH_STATUS_UPDATE,data:{status:e,message:t}}}function s(e,t){return{type:h.ERROR_UPDATE,data:{name:e,value:t}}}function c(e){return{type:h.SELECTED_CHANNEL_UPDATE,data:e}}function f(e){return{type:h.TOGGLE_METADATA_INPUTS,data:e}}function d(e){return{type:h.THUMBNAIL_NEW,data:e}}function p(e){return{type:h.PUBLISH_START,data:{history:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectFile=a,t.clearFile=r,t.updateMetadata=l,t.updateClaim=o,t.setPublishInChannel=i,t.updatePublishStatus=u,t.updateError=s,t.updateSelectedChannel=c,t.toggleMetadataInputs=f,t.onNewThumbnail=d,t.startPublish=p;var m=n(33),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(m)},function(e,t,n){"use strict";var a=n(65),r=n(2);console.log("exporting sequelize models");var l=n(23),o=l.database,i=l.username,u=l.password,s={},c=new a(o,i,u,{host:"localhost",dialect:"mysql",dialectOptions:{decimalNumbers:!0},logging:!1,pool:{max:5,min:0,idle:1e4,acquire:1e4}});c.authenticate().then(function(){r.info("Sequelize has established mysql connection successfully.")}).catch(function(e){r.error("Sequelize was unable to connect to the database:",e)});var f=n(66),d=n(67),p=n(68),m=n(69),h=n(70),g=n(71);s.Certificate=c.import("Certificate",f),s.Channel=c.import("Channel",d),s.Claim=c.import("Claim",p),s.File=c.import("File",m),s.Request=c.import("Request",h),s.User=c.import("User",g),Object.keys(s).forEach(function(e){s[e].associate&&(r.info("Associating model:",e),s[e].associate(s))}),s.sequelize=c,s.Sequelize=a,s.upsert=function(e,t,n,a){return e.findOne({where:n}).then(function(n){return n?(r.debug("updating record in db."+a),n.update(t)):(r.debug("creating record in db."+a),e.create(t))}).catch(function(e){throw r.error(a+".upsert error",e),e})},e.exports=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(19),l=n(91),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=n(5),u=function(e){var t=e.channel;return{channelName:t.loggedInChannel.name,channelShortId:t.loggedInChannel.shortId,channelLongId:t.loggedInChannel.longId}},s=function(e){return{onChannelLogin:function(t,n,a){e((0,r.updateLoggedInChannel)(t,n,a)),e((0,i.updateSelectedChannel)(t))},onChannelLogout:function(){e((0,r.updateLoggedInChannel)(null,null,null))}}};t.default=(0,a.connect)(u,s)(o.default)},function(e,t,n){"use strict";function a(e){return{type:b.HANDLE_SHOW_URI,data:e}}function r(e){return{type:b.REQUEST_ERROR,data:e}}function l(e,t){var n=v.CHANNEL,a="cr#"+e+"#"+t;return{type:b.CHANNEL_REQUEST_NEW,data:{requestType:n,requestId:a,channelName:e,channelId:t}}}function o(e,t,n,a,r){var l=r?v.ASSET_LITE:v.ASSET_DETAILS,o="ar#"+e+"#"+t+"#"+n+"#"+a;return{type:b.ASSET_REQUEST_NEW,data:{requestType:l,requestId:o,name:e,modifier:{id:t,channel:{name:n,id:a}}}}}function i(e,t){return{type:b.REQUEST_UPDATE,data:{requestType:e,requestId:t}}}function u(e,t,n){return{type:b.REQUEST_LIST_ADD,data:{id:e,error:t,key:n}}}function s(e,t,n,a,r,l){return{type:b.ASSET_ADD,data:{id:e,error:t,name:n,claimId:a,shortId:r,claimData:l}}}function c(e,t,n,a,r){return{type:b.CHANNEL_ADD,data:{id:e,name:t,shortId:n,longId:a,claimsData:r}}}function f(e,t,n,a){return{type:b.CHANNEL_CLAIMS_UPDATE_ASYNC,data:{channelKey:e,name:t,longId:n,page:a}}}function d(e,t){return{type:b.CHANNEL_CLAIMS_UPDATE_SUCCESS,data:{channelListId:e,claimsData:t}}}function p(e,t){return{type:b.FILE_REQUESTED,data:{name:e,claimId:t}}}function m(e){return{type:b.FILE_AVAILABILITY_UPDATE,data:e}}function h(e){return{type:b.DISPLAY_ASSET_ERROR,data:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.onHandleShowPageUri=a,t.onRequestError=r,t.onNewChannelRequest=l,t.onNewAssetRequest=o,t.onRequestUpdate=i,t.addRequestToRequestList=u,t.addAssetToAssetList=s,t.addNewChannelToChannelList=c,t.onUpdateChannelClaims=f,t.updateChannelClaims=d,t.fileRequested=p,t.updateFileAvailability=m,t.updateDisplayAssetError=h;var g=n(12),b=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(g),v=n(42)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(14),f=a(c),d=n(10),p=a(d),m=n(88),h=n(89),g=n(90),b=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props,t=e.pageTitle,n=e.asset,a=e.channel,r=e.pageUri;t=(0,m.createPageTitle)(t);var l=(0,h.createMetaTags)(n,a),o=(0,g.createCanonicalLink)(n,a,r);return s.default.createElement(f.default,{title:t,meta:l,link:[{rel:"canonical",href:o}]})}}]),t}(s.default.Component);b.propTypes={pageTitle:p.default.string,pageUri:p.default.string,channel:p.default.object,asset:p.default.object},t.default=b},function(e,t){e.exports=require("prop-types")},function(e,t,n){"use strict";function a(e){return 204===e.status||205===e.status?null:e.json()}function r(e,t){if(e.status>=200&&e.status<300)return t;var n=new Error(t.message);throw n.response=e,n}function l(e,t){return fetch(e,t).then(function(e){return Promise.all([e,a(e)])}).then(function(e){var t=o(e,2);return r(t[0],t[1])})}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=l,n(94)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.HANDLE_SHOW_URI="HANDLE_SHOW_URI",t.REQUEST_ERROR="REQUEST_ERROR",t.REQUEST_UPDATE="REQUEST_UPDATE",t.ASSET_REQUEST_NEW="ASSET_REQUEST_NEW",t.CHANNEL_REQUEST_NEW="CHANNEL_REQUEST_NEW",t.REQUEST_LIST_ADD="REQUEST_LIST_ADD",t.ASSET_ADD="ASSET_ADD",t.CHANNEL_ADD="CHANNEL_ADD",t.CHANNEL_CLAIMS_UPDATE_ASYNC="CHANNEL_CLAIMS_UPDATE_ASYNC",t.CHANNEL_CLAIMS_UPDATE_SUCCESS="CHANNEL_CLAIMS_UPDATE_SUCCESS",t.FILE_REQUESTED="FILE_REQUESTED",t.FILE_AVAILABILITY_UPDATE="FILE_AVAILABILITY_UPDATE",t.DISPLAY_ASSET_ERROR="DISPLAY_ASSET_ERROR"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.selectAsset=function(e){var t=e.requestList[e.request.id],n=t.key;return e.assetList[n]},t.selectShowState=function(e){return e.show}},function(e,t){e.exports=require("react-helmet")},function(e,t){e.exports=require("redux-saga/effects")},function(e,t,n){"use strict";var a=n(62),r=n(2),l=n(63),o=l.api,i=o.apiHost,u=o.apiPort,s="http://"+i+":"+u,c=n(17),f=c.chooseGaLbrynetPublishLabel,d=c.sendGATimingEvent,p=function(e,t,n){var a=e.data;if(r.debug("lbry api data:",a),a.result)return a.result.error?(r.debug("Lbrynet api error:",a.result.error),void n(new Error(a.result.error))):void t(a.result);n(JSON.stringify(a))};e.exports={publishClaim:function(e){r.debug('lbryApi >> Publishing claim to "'+e.name+'"');var t=Date.now();return new Promise(function(n,r){a.post(s,{method:"publish",params:e}).then(function(a){d("lbrynet","publish",f(e),t,Date.now()),p(a,n,r)}).catch(function(e){r(e)})})},getClaim:function(e){r.debug('lbryApi >> Getting Claim for "'+e+'"');var t=Date.now();return new Promise(function(n,r){a.post(s,{method:"get",params:{uri:e,timeout:20}}).then(function(e){d("lbrynet","getClaim","GET",t,Date.now()),p(e,n,r)}).catch(function(e){r(e)})})},getClaimList:function(e){r.debug('lbryApi >> Getting claim_list for "'+e+'"');var t=Date.now();return new Promise(function(n,r){a.post(s,{method:"claim_list",params:{name:e}}).then(function(e){d("lbrynet","getClaimList","CLAIM_LIST",t,Date.now()),p(e,n,r)}).catch(function(e){r(e)})})},resolveUri:function(e){r.debug('lbryApi >> Resolving URI for "'+e+'"');var t=Date.now();return new Promise(function(n,r){a.post(s,{method:"resolve",params:{uri:e}}).then(function(a){var l=a.data;d("lbrynet","resolveUri","RESOLVE",t,Date.now()),l.result[e].error?r(l.result[e].error):n(l.result[e])}).catch(function(e){r(e)})})},getDownloadDirectory:function(){r.debug("lbryApi >> Retrieving the download directory path from lbry daemon...");var e=Date.now();return new Promise(function(t,n){a.post(s,{method:"settings_get"}).then(function(n){var a=n.data;if(d("lbrynet","getDownloadDirectory","SETTINGS_GET",e,Date.now()),!a.result)return new Error("Successfully connected to lbry daemon, but unable to retrieve the download directory.");t(a.result.download_directory)}).catch(function(e){r.error("Lbrynet Error:",e),t("/home/lbry/Downloads/")})})},createChannel:function(e){r.debug("lbryApi >> Creating channel for "+e+"...");var t=Date.now();return new Promise(function(n,r){a.post(s,{method:"channel_new",params:{channel_name:e,amount:.1}}).then(function(e){d("lbrynet","createChannel","CHANNEL_NEW",t,Date.now()),p(e,n,r)}).catch(function(e){r(e)})})}}},function(e,t,n){"use strict";function a(e,t,n){return{eventCategory:"client requests",eventAction:"serve request",eventLabel:n,ipOverride:t,userAgentOverride:e["user-agent"]}}function r(e,t,n,a,r){return{userTimingCategory:e,userTimingVariableName:t,userTimingTime:r-a,userTimingLabel:n}}function l(e,t){var n=e.replace(/\./g,"-");u(c,n,{strictCidFormat:!1,https:!0}).event(t,function(e){e&&i.error("Google Analytics Event Error >>",e)})}function o(e,t){u(c,e,{strictCidFormat:!1,https:!0}).timing(t,function(e){e&&i.error("Google Analytics Event Error >>",e),i.debug("Timing event successfully sent to google analytics")})}var i=n(2),u=n(64),s=n(3),c=s.analytics.googleId,f=s.details.title;e.exports={sendGAServeEvent:function(e,t,n){l(t,a(e,t,n))},sendGATimingEvent:function(e,t,n,a,l){var i=r(e,t,n,a,l);o(f,i)},chooseGaLbrynetPublishLabel:function(e){var t=e.channel_name,n=e.channel_id;return t||n?"PUBLISH_IN_CHANNEL_CLAIM":"PUBLISH_ANONYMOUS_CLAIM"}}},function(e,t){e.exports=require("redux")},function(e,t,n){"use strict";function a(e,t,n){return{type:l.CHANNEL_UPDATE,data:{name:e,shortId:t,longId:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.updateLoggedInChannel=a;var r=n(35),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(r)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(10),f=a(c),d=n(116),p=a(d),m=n(117),h=a(m),g=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={bars:[],index:0,incrementer:1},n.createBars=n.createBars.bind(n),n.startProgressBar=n.startProgressBar.bind(n),n.updateProgressBar=n.updateProgressBar.bind(n),n.stopProgressBar=n.stopProgressBar.bind(n),n}return o(t,e),i(t,[{key:"componentDidMount",value:function(){this.createBars(),this.startProgressBar()}},{key:"componentWillUnmount",value:function(){this.stopProgressBar()}},{key:"createBars",value:function(){for(var e=[],t=0;t<=this.props.size;t++)e.push({isActive:!1});this.setState({bars:e})}},{key:"startProgressBar",value:function(){this.updateInterval=setInterval(this.updateProgressBar.bind(this),300)}},{key:"updateProgressBar",value:function(){var e=this.state.index,t=this.state.incrementer,n=this.state.bars;(e<0||e>this.props.size)&&(t*=-1,e+=t),n[e].isActive=t>0,e+=t,this.setState({bars:n,incrementer:t,index:e})}},{key:"stopProgressBar",value:function(){clearInterval(this.updateInterval)}},{key:"render",value:function(){return s.default.createElement("div",null,this.state.bars.map(function(e,t){return e.isActive?s.default.createElement(p.default,{key:t}):s.default.createElement(h.default,{key:t})}))}}]),t}(s.default.Component);g.propTypes={size:f.default.number.isRequired},t.default=g},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(10),f=a(c),d=n(7),p=a(d),m=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props.error;return s.default.createElement("div",null,s.default.createElement(p.default,null),s.default.createElement("div",{className:"row row--padded"},s.default.createElement("p",null,e)))}}]),t}(s.default.Component);m.propTypes={error:f.default.string.isRequired},t.default=m},function(e,t){e.exports=require("passport")},function(e,t,n){"use strict";function a(){var e=this;this.database="default",this.username="default",this.password="default",this.configure=function(t){if(!t)return console.log("No MySQL config received.");var n=t.database,a=t.username,r=t.password;e.database=n,e.username=a,e.password=r}}e.exports=new a},function(e,t,n){"use strict";function a(){var e=this;this.slackWebHook="default",this.slackErrorChannel="default",this.slackInfoChannel="default",this.configure=function(t){if(!t)return console.log("No slack config received.");var n=t.slackWebHook,a=t.slackErrorChannel,r=t.slackInfoChannel;e.slackWebHook=n,e.slackErrorChannel=a,e.slackInfoChannel=r}}e.exports=new a},function(e,t){e.exports=require("passport-local")},function(e,t,n){"use strict";e.exports={returnShortId:function(e,t){var n=void 0,a=t.substring(0,1),r=0;if((n=e.findIndex(function(e){return e.claimId===t}))<0)throw new Error("claim id not found in claims list");for(var l=e.slice(0,n);l.length>0;)r+=1,a=t.substring(0,r),l=l.filter(function(e){return e.claimId&&e.claimId.substring(0,r)===a});return a}}},function(e,t,n){"use strict";var a=n(2),r=n(78),l=n(3),o=l.details,i=l.publishing;e.exports={parsePublishApiRequestBody:function(e){var t=e.name,n=e.nsfw,a=e.license,r=e.title,l=e.description,o=e.thumbnail;if(!t)throw new Error("no name field found in request");if(/[^A-Za-z0-9,-]/.exec(t))throw new Error('The claim name you provided is not allowed. Only the following characters are allowed: A-Z, a-z, 0-9, and "-"');return n="true"===n,a=a||null,r=r||null,l=l||null,o=o||null,{name:t,nsfw:n,license:a,title:r,description:l,thumbnail:o}},parsePublishApiRequestFiles:function(t){var n=t.file,a=t.thumbnail;if(!n)throw new Error("no file with key of [file] found in request");if(!n.path)throw new Error("no file path found");if(!n.type)throw new Error("no file type found");if(!n.size)throw new Error("no file type found");if(/'/.test(n.name))throw new Error("apostrophes are not allowed in the file name");return e.exports.validateFileTypeAndSize(n),{fileName:n.name,filePath:n.path,fileType:n.type,thumbnailFileName:a?a.name:null,thumbnailFilePath:a?a.path:null,thumbnailFileType:a?a.type:null}},validateFileTypeAndSize:function(e){switch(e.type){case"image/jpeg":case"image/jpg":case"image/png":if(e.size>1e7)throw a.debug("publish > file validation > .jpeg/.jpg/.png was too big"),new Error("Sorry, images are limited to 10 megabytes.");break;case"image/gif":if(e.size>5e7)throw a.debug("publish > file validation > .gif was too big"),new Error("Sorry, .gifs are limited to 50 megabytes.");break;case"video/mp4":if(e.size>5e7)throw a.debug("publish > file validation > .mp4 was too big"),new Error("Sorry, videos are limited to 50 megabytes.");break;default:throw a.debug("publish > file validation > unrecognized file type"),new Error("The "+e.type+" content type is not supported. Only, .jpeg, .png, .gif, and .mp4 files are currently supported.")}return e},createBasicPublishParams:function(e,t,n,r,l,u,s){a.debug("Creating Publish Parameters"),null!==n&&""!==n.trim()||(n=t),null!==r&&""!==r.trim()||(r=""),null!==l&&""!==l.trim()||(l=" ");var c={name:t,file_path:e,bid:.01,metadata:{description:r,title:n,author:o.title,language:"en",license:l,nsfw:u},claim_address:i.primaryClaimAddress};return s&&(c.metadata.thumbnail=s),c},createThumbnailPublishParams:function(e,t,n,r){if(e)return a.debug("Creating Thumbnail Publish Parameters"),{name:t+"-thumb",file_path:e,bid:.01,metadata:{title:t+" thumbnail",description:"a thumbnail for "+t,author:o.title,language:"en",license:n,nsfw:r},claim_address:i.primaryClaimAddress,channel_name:i.thumbnailChannel,channel_id:i.thumbnailChannelId}},deleteTemporaryFile:function(e){r.unlink(e,function(t){if(t)throw a.error("error deleting temporary file "+e),t;a.debug("successfully deleted "+e)})},addGetResultsToFileData:function(e,t){return e.fileName=t.file_name,e.filePath=t.download_path,e},createFileData:function(e){var t=e.name,n=e.claimId,a=e.outpoint,r=e.height,l=e.address,o=e.nsfw;return{name:t,claimId:n,outpoint:a,height:r,address:l,fileName:"",filePath:"",fileType:e.contentType,nsfw:o}}}},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(2);e.exports={handleErrorResponse:function(t,n,l,o){r.error("Error on "+t,e.exports.useObjectPropertiesIfNoKeys(l));var i=e.exports.returnErrorMessageAndStatus(l),u=a(i,2),s=u[0],c=u[1];o.status(s).json(e.exports.createErrorResponsePayload(s,c))},returnErrorMessageAndStatus:function(e){var t=void 0,n=void 0;return"ECONNREFUSED"===e.code?(t=503,n="Connection refused. The daemon may not be running."):(t=400,n=e.message?e.message:e),[t,n]},useObjectPropertiesIfNoKeys:function(e){if(0===Object.keys(e).length){var t={};return Object.getOwnPropertyNames(e).forEach(function(n){t[n]=e[n]}),t}return e},createErrorResponsePayload:function(e,t){return{status:e,success:!1,message:t}}}},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(6),l=n(2),o=n(80),i=o.returnPaginatedChannelClaims;e.exports={getClaimId:function(t,n,a,r){return t?e.exports.getClaimIdByChannel(t,n,a):e.exports.getClaimIdByClaim(a,r)},getClaimIdByClaim:function(e,t){return l.debug("getClaimIdByClaim("+e+", "+t+")"),new Promise(function(n,a){r.Claim.getLongClaimId(e,t).then(function(e){e||n("NO_CLAIM"),n(e)}).catch(function(e){a(e)})})},getClaimIdByChannel:function(e,t,n){return l.debug("getClaimIdByChannel("+e+", "+t+", "+n+")"),new Promise(function(l,o){r.Certificate.getLongChannelId(e,t).then(function(e){return e?Promise.all([e,r.Claim.getClaimIdByLongChannelId(e,n)]):[null,null]}).then(function(e){var t=a(e,2),n=t[0],r=t[1];return n?r?void l(r):l("NO_CLAIM"):l("NO_CHANNEL")}).catch(function(e){o(e)})})},getChannelData:function(e,t,n){return new Promise(function(n,l){r.Certificate.getLongChannelId(e,t).then(function(t){return t?Promise.all([t,r.Certificate.getShortChannelIdFromLongChannelId(t,e)]):[null,null,null]}).then(function(t){var r=a(t,2),l=r[0],o=r[1];if(!l)return n("NO_CHANNEL");n({channelName:e,longChannelClaimId:l,shortChannelClaimId:o})}).catch(function(e){l(e)})})},getChannelClaims:function(e,t,n){return new Promise(function(l,o){r.Certificate.getLongChannelId(e,t).then(function(e){return e?Promise.all([e,r.Claim.getAllChannelClaims(e)]):[null,null,null]}).then(function(t){var r=a(t,2),o=r[0],u=r[1];if(!o)return l("NO_CHANNEL");var s=i(e,o,u,n);l(s)}).catch(function(e){o(e)})})},getLocalFileRecord:function(e,t){return r.File.findOne({where:{claimId:e,name:t}}).then(function(e){return e?e.dataValues:"NO_FILE"})}}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(0),l=a(r),o=n(31),i=n(18),u=n(32),s=a(u),c=n(1),f=n(4),d=n(37),p=a(d),m=n(38),h=a(m),g=n(44),b=a(g),v=n(14),y=a(v);e.exports=function(e,t){var n={},a=(0,i.createStore)(s.default),r=(0,o.renderToString)(l.default.createElement(c.Provider,{store:a},l.default.createElement(f.StaticRouter,{location:e.url,context:n},l.default.createElement(p.default,null,l.default.createElement(h.default,null))))),u=y.default.renderStatic();if(n.url)return t.redirect(301,n.url);var d=a.getState();t.send((0,b.default)(u,r,d))}},function(e,t){e.exports=require("react-dom/server")},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(18),l=n(82),o=a(l),i=n(83),u=a(i),s=n(84),c=a(s),f=n(85),d=a(f);t.default=(0,r.combineReducers)({channel:u.default,publish:o.default,show:c.default,site:d.default})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FILE_SELECTED="FILE_SELECTED",t.FILE_CLEAR="FILE_CLEAR",t.METADATA_UPDATE="METADATA_UPDATE",t.CLAIM_UPDATE="CLAIM_UPDATE",t.SET_PUBLISH_IN_CHANNEL="SET_PUBLISH_IN_CHANNEL",t.PUBLISH_STATUS_UPDATE="PUBLISH_STATUS_UPDATE",t.ERROR_UPDATE="ERROR_UPDATE",t.SELECTED_CHANNEL_UPDATE="SELECTED_CHANNEL_UPDATE",t.TOGGLE_METADATA_INPUTS="TOGGLE_METADATA_INPUTS",t.THUMBNAIL_NEW="THUMBNAIL_NEW",t.PUBLISH_START="PUBLISH_START"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LOGIN="Existing",t.CREATE="New"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CHANNEL_UPDATE="CHANNEL_UPDATE"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LOCAL_CHECK="LOCAL_CHECK",t.UNAVAILABLE="UNAVAILABLE",t.ERROR="ERROR",t.AVAILABLE="AVAILABLE"},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(86),f=a(c),d=n(4),p=n(3),m=p.analytics;f.default.initialize(m);var h=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"componentDidMount",value:function(){this.sendPageView(this.props.history.location),this.props.history.listen(this.sendPageView)}},{key:"sendPageView",value:function(e){f.default.set({page:e.pathname}),f.default.pageview(e.pathname)}},{key:"render",value:function(){return this.props.children}}]),t}(s.default.Component);t.default=(0,d.withRouter)(h)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=a(r),o=n(4),i=n(87),u=a(i),s=n(121),c=a(s),f=n(122),d=a(f),p=n(124),m=a(p),h=n(140),g=a(h),b=function(){return l.default.createElement(o.Switch,null,l.default.createElement(o.Route,{exact:!0,path:"/",component:u.default}),l.default.createElement(o.Route,{exact:!0,path:"/about",component:c.default}),l.default.createElement(o.Route,{exact:!0,path:"/login",component:d.default}),l.default.createElement(o.Route,{exact:!0,path:"/:identifier/:claim",component:m.default}),l.default.createElement(o.Route,{exact:!0,path:"/:claim",component:m.default}),l.default.createElement(o.Route,{component:g.default}))};t.default=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(97),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.publish;return{file:t.file,thumbnail:t.thumbnail,fileError:t.error.file}},u=function(e){return{selectFile:function(t){e((0,r.selectFile)(t))},setFileError:function(t){e((0,r.clearFile)()),e((0,r.updateError)("file",t))}}};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(19),l=n(114),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=n(5),u=function(e){return{onChannelLogin:function(t,n,a){e((0,r.updateLoggedInChannel)(t,n,a)),e((0,i.updateSelectedChannel)(t))}}};t.default=(0,a.connect)(null,u)(o.default)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(19),l=n(115),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=n(5),u=function(e){return{onChannelLogin:function(t,n,a){e((0,r.updateLoggedInChannel)(t,n,a)),e((0,i.updateSelectedChannel)(t))}}};t.default=(0,a.connect)(null,u)(o.default)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CHANNEL="CHANNEL",t.ASSET_LITE="ASSET_LITE",t.ASSET_DETAILS="ASSET_DETAILS"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(128),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(8),i=n(13),u=function(e){var t=e.show;return{error:t.displayAsset.error,status:t.displayAsset.status,asset:(0,i.selectAsset)(t)}},s=function(e){return{onFileRequest:function(t,n){e((0,o.fileRequested)(t,n))}}};t.default=(0,a.connect)(u,s)(l.default)},function(e,t,n){"use strict";e.exports=function(e,t,n){return'\n <!DOCTYPE html>\n <html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n \x3c!--helmet--\x3e\n '+e.title.toString()+"\n "+e.meta.toString()+"\n "+e.link.toString()+'\n \x3c!--style sheets--\x3e\n <link rel="stylesheet" href="/assets/css/reset.css" type="text/css">\n <link rel="stylesheet" href="/assets/css/general.css" type="text/css">\n <link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">\n \x3c!--google font--\x3e\n <link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">\n </head>\n <body id="main-body">\n <div class="row row--tall flex-container--column">\n <div id="react-app" class="row row--tall flex-container--column">'+t+"</div>\n </div>\n <script>\n window.__PRELOADED_STATE__ = "+JSON.stringify(n).replace(/</g,"\\<")+'\n <\/script>\n <script src="/bundle/bundle.js"><\/script>\n </body>\n </html>\n '}},function(e,t,n){n(46),n(47),e.exports=n(48)},function(e,t){e.exports=require("babel-polyfill")},function(e,t){e.exports=require("whatwg-fetch")},function(e,t,n){"use strict";function a(e){var t=this,a=e.mysqlConfig,c=e.siteConfig,b=e.slackConfig;this.PORT=3e3,this.start=function(){t.configureConfigFiles(),t.configureLogging(),t.configureApp(),t.configureServer(),t.startServer()},this.configureConfigFiles=function(){n(23).configure(a),n(3).configure(c),n(24).configure(b)},this.configureLogging=function(){n(57)(g),n(59)(g)},this.configureApp=function(){var e=r();e.enable("trust proxy"),e.use(u()),e.use(r.static(__dirname+"/public")),e.use(l.json()),e.use(l.urlencoded({extended:!0})),e.use(function(e,t,n){g.verbose("Request on "+e.originalUrl+" from "+e.ip),n()}),s.serializeUser(d),s.deserializeUser(p);var a=n(61),h=n(73);s.use("local-signup",a),s.use("local-login",h),e.use(m({name:"session",keys:[c.auth.sessionKey],maxAge:864e5})),e.use(s.initialize()),e.use(s.session());var b=o.create({defaultLayout:"embed",handlebars:i});e.engine("handlebars",b.engine),e.set("view engine","handlebars"),e.use(f),n(74)(e),n(75)(e),n(81)(e),n(141)(e),n(152)(e),t.app=e},this.configureServer=function(){t.server=h.Server(t.app)},this.startServer=function(){n(6).sequelize.sync().then(function(){t.server.listen(t.PORT,function(){g.info("Server is listening on PORT "+t.PORT)})}).catch(function(e){g.error("Startup Error:",e)})}}var r=n(49),l=n(50),o=n(51),i=n(52),u=n(53),s=n(22),c=n(54),f=c.populateLocalsDotUser,d=c.serializeSpeechUser,p=c.deserializeSpeechUser,m=n(55),h=n(56),g=n(2);e.exports=a},function(e,t){e.exports=require("express")},function(e,t){e.exports=require("body-parser")},function(e,t){e.exports=require("express-handlebars")},function(e,t){e.exports=require("handlebars")},function(e,t){e.exports=require("helmet")},function(e,t,n){"use strict";var a=n(2);e.exports={populateLocalsDotUser:function(e,t,n){e.user&&(a.debug("populating res.locals.user"),t.locals.user={id:e.user.id,userName:e.user.userName,channelName:e.user.channelName,channelClaimId:e.user.channelClaimId,shortChannelId:e.user.shortChannelId}),n()},serializeSpeechUser:function(e,t){a.debug("serializing user"),t(null,e)},deserializeSpeechUser:function(e,t){a.debug("deserializing user"),t(null,e)}}},function(e,t){e.exports=require("cookie-session")},function(e,t){e.exports=require("http")},function(e,t,n){"use strict";var a=n(58),r=a.logLevel;e.exports=function(e){e.configure({transports:[new e.transports.Console({level:r,timestamp:!1,colorize:!0,prettyPrint:!0,handleExceptions:!0,humanReadableUnhandledException:!0})]}),e.error("Level 0"),e.warn("Level 1"),e.info("Level 2"),e.verbose("Level 3"),e.debug("Level 4"),e.silly("Level 5")}},function(e,t,n){"use strict";var a={logLevel:"debug"};e.exports=a},function(e,t,n){"use strict";var a=n(60).SlackWebHook,r=n(24);e.exports=function(e){var t=r.slackWebHook,n=r.slackErrorChannel,l=r.slackInfoChannel;t?(n&&e.add(a,{name:"slack-errors-transport",level:"warn",webhookUrl:t,channel:n,username:"spee.ch",iconEmoji:":face_with_head_bandage:"}),l&&e.add(a,{name:"slack-info-transport",level:"info",webhookUrl:t,channel:l,username:"spee.ch",iconEmoji:":nerd_face:"}),e.error('Slack "error" logging is online.'),e.info('Slack "info" logging is online.')):e.warn("Slack logging is not enabled because no slackWebHook config var provided.")}},function(e,t){e.exports=require("winston-slack-webhook")},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(25).Strategy,l=n(16),o=n(2),i=n(6);e.exports=new r({usernameField:"username",passwordField:"password"},function(e,t,n){o.verbose("new channel signup request. user: "+e+" pass: "+t+" .");var r={};return l.createChannel("@"+e).then(function(n){var a={userName:e,password:t};o.verbose("userData >",a);var r={channelName:"@"+e,channelClaimId:n.claim_id};o.verbose("channelData >",r);var l={claimId:n.claim_id,name:"@"+e};return o.verbose("certificateData >",l),Promise.all([i.User.create(a),i.Channel.create(r),i.Certificate.create(l)])}).then(function(e){var t=a(e,3),n=t[0],l=t[1],i=t[2];return o.verbose("user and certificate successfully created"),r.id=n.id,r.userName=n.userName,r.channelName=l.channelName,r.channelClaimId=l.channelClaimId,Promise.all([i.setChannel(l),l.setUser(n)])}).then(function(){return o.verbose("user and certificate successfully associated"),i.Certificate.getShortChannelIdFromLongChannelId(r.channelClaimId,r.channelName)}).then(function(e){return r.shortChannelId=e,n(null,r)}).catch(function(e){return o.error("signup error",e),n(e)})})},function(e,t){e.exports=require("axios")},function(e,t,n){"use strict";var a={api:{apiHost:"localhost",apiPort:"5279"}};e.exports=a},function(e,t){e.exports=require("universal-analytics")},function(e,t){e.exports=require("sequelize")},function(e,t,n){"use strict";var a=n(2),r=n(26),l=r.returnShortId;e.exports=function(e,t){var n=t.STRING,r=t.BOOLEAN,o=t.INTEGER,i=t.TEXT,u=t.DECIMAL,s=e.define("Certificate",{address:{type:n,default:null},amount:{type:u(19,8),default:null},claimId:{type:n,default:null},claimSequence:{type:o,default:null},decodedClaim:{type:r,default:null},depth:{type:o,default:null},effectiveAmount:{type:u(19,8),default:null},hasSignature:{type:r,default:null},height:{type:o,default:null},hex:{type:i("long"),default:null},name:{type:n,default:null},nout:{type:o,default:null},txid:{type:n,default:null},validAtHeight:{type:o,default:null},outpoint:{type:n,default:null},valueVersion:{type:n,default:null},claimType:{type:n,default:null},certificateVersion:{type:n,default:null},keyType:{type:n,default:null},publicKey:{type:i("long"),default:null}},{freezeTableName:!0});return s.associate=function(e){s.belongsTo(e.Channel,{foreignKey:{allowNull:!0}})},s.getShortChannelIdFromLongChannelId=function(e,t){var n=this;return a.debug("getShortChannelIdFromLongChannelId "+t+":"+e),new Promise(function(a,r){n.findAll({where:{name:t},order:[["height","ASC"]]}).then(function(t){switch(t.length){case 0:throw new Error("No channel(s) found with that channel name");default:return a(l(t,e))}}).catch(function(e){r(e)})})},s.getLongChannelIdFromShortChannelId=function(e,t){var n=this;return a.debug("getLongChannelIdFromShortChannelId("+e+", "+t+")"),new Promise(function(a,r){n.findAll({where:{name:e,claimId:{$like:t+"%"}},order:[["height","ASC"]]}).then(function(e){switch(e.length){case 0:return a(null);default:return a(e[0].claimId)}}).catch(function(e){r(e)})})},s.getLongChannelIdFromChannelName=function(e){var t=this;return a.debug("getLongChannelIdFromChannelName("+e+")"),new Promise(function(n,a){t.findAll({where:{name:e},order:[["effectiveAmount","DESC"],["height","ASC"]]}).then(function(e){switch(e.length){case 0:return n(null);default:return n(e[0].claimId)}}).catch(function(e){a(e)})})},s.validateLongChannelId=function(e,t){var n=this;return a.debug("validateLongChannelId("+e+", "+t+")"),new Promise(function(a,r){n.findOne({where:{name:e,claimId:t}}).then(function(e){if(!e)return a(null);a(t)}).catch(function(e){r(e)})})},s.getLongChannelId=function(e,t){return a.debug("getLongChannelId("+e+", "+t+")"),t&&40===t.length?this.validateLongChannelId(e,t):t&&t.length<40?this.getLongChannelIdFromShortChannelId(e,t):this.getLongChannelIdFromChannelName(e)},s}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.STRING,a=e.define("Channel",{channelName:{type:n,allowNull:!1},channelClaimId:{type:n,allowNull:!1}},{freezeTableName:!0});return a.associate=function(e){a.belongsTo(e.User),a.hasOne(e.Certificate)},a}},function(e,t,n){"use strict";function a(e){switch(e){case"image/jpeg":case"image/jpg":return"jpeg";case"image/png":return"png";case"image/gif":return"gif";case"video/mp4":return"mp4";default:return o.debug("setting unknown file type as file extension jpeg"),"jpeg"}}function r(e,t){return""===e?t:e}function l(e){return e.thumbnail=r(e.thumbnail,c),e.fileExt=a(e.contentType),e.host=f,e}var o=n(2),i=n(26),u=i.returnShortId,s=n(3),c=s.assetDefaults.thumbnail,f=s.details.host;e.exports=function(e,t){var n=t.STRING,i=t.BOOLEAN,s=t.INTEGER,f=t.TEXT,d=t.DECIMAL,p=e.define("Claim",{address:{type:n,default:null},amount:{type:d(19,8),default:null},claimId:{type:n,default:null},claimSequence:{type:s,default:null},decodedClaim:{type:i,default:null},depth:{type:s,default:null},effectiveAmount:{type:d(19,8),default:null},hasSignature:{type:i,default:null},height:{type:s,default:null},hex:{type:f("long"),default:null},name:{type:n,default:null},nout:{type:s,default:null},txid:{type:n,default:null},validAtHeight:{type:s,default:null},outpoint:{type:n,default:null},claimType:{type:n,default:null},certificateId:{type:n,default:null},author:{type:n,default:null},description:{type:f("long"),default:null},language:{type:n,default:null},license:{type:n,default:null},licenseUrl:{type:n,default:null},nsfw:{type:i,default:null},preview:{type:n,default:null},thumbnail:{type:n,default:null},title:{type:n,default:null},metadataVersion:{type:n,default:null},contentType:{type:n,default:null},source:{type:n,default:null},sourceType:{type:n,default:null},sourceVersion:{type:n,default:null},streamVersion:{type:n,default:null},valueVersion:{type:n,default:null},channelName:{type:n,allowNull:!0,default:null}},{freezeTableName:!0});return p.associate=function(e){p.belongsTo(e.File,{foreignKey:{allowNull:!0}})},p.getShortClaimIdFromLongClaimId=function(e,t){var n=this;return o.debug("Claim.getShortClaimIdFromLongClaimId for "+t+"#"+e),new Promise(function(a,r){n.findAll({where:{name:t},order:[["height","ASC"]]}).then(function(t){switch(t.length){case 0:throw new Error("No claim(s) found with that claim name");default:a(u(t,e))}}).catch(function(e){r(e)})})},p.getAllChannelClaims=function(e){var t=this;return o.debug("Claim.getAllChannelClaims for "+e),new Promise(function(n,l){t.findAll({where:{certificateId:e},order:[["height","ASC"]],raw:!0}).then(function(e){switch(e.length){case 0:return n(null);default:return e.forEach(function(e){return e.fileExt=a(e.contentType),e.thumbnail=r(e.thumbnail,c),e}),n(e)}}).catch(function(e){l(e)})})},p.getClaimIdByLongChannelId=function(e,t){var n=this;return o.debug("finding claim id for claim "+t+" from channel "+e),new Promise(function(a,r){n.findAll({where:{name:t,certificateId:e},order:[["id","ASC"]]}).then(function(n){switch(n.length){case 0:return a(null);case 1:return a(n[0].claimId);default:return o.error(n.length+' records found for "'+t+'" in channel "'+e+'"'),a(n[0].claimId)}}).catch(function(e){r(e)})})},p.getLongClaimIdFromShortClaimId=function(e,t){var n=this;return new Promise(function(a,r){n.findAll({where:{name:e,claimId:{$like:t+"%"}},order:[["height","ASC"]]}).then(function(e){switch(e.length){case 0:return a(null);default:return a(e[0].claimId)}}).catch(function(e){r(e)})})},p.getTopFreeClaimIdByClaimName=function(e){var t=this;return new Promise(function(n,a){t.findAll({where:{name:e},order:[["effectiveAmount","DESC"],["height","ASC"]]}).then(function(e){switch(o.debug("length of result",e.length),e.length){case 0:return n(null);default:return n(e[0].dataValues.claimId)}}).catch(function(e){a(e)})})},p.validateLongClaimId=function(e,t){var n=this;return new Promise(function(a,r){n.findOne({where:{name:e,claimId:t}}).then(function(e){if(!e)return a(null);a(t)}).catch(function(e){r(e)})})},p.getLongClaimId=function(e,t){return o.debug("getLongClaimId("+e+", "+t+")"),t&&40===t.length?this.validateLongClaimId(e,t):t&&t.length<40?this.getLongClaimIdFromShortClaimId(e,t):this.getTopFreeClaimIdByClaimName(e)},p.resolveClaim=function(e,t){var n=this;return o.debug("Claim.resolveClaim: "+e+" "+t),new Promise(function(a,r){n.findAll({where:{name:e,claimId:t}}).then(function(n){switch(o.debug("claims found on resolve:",n.length),n.length){case 0:return a(null);case 1:return a(l(n[0].dataValues));default:return o.error("more than one entry matches that name ("+e+") and claimID ("+t+")"),a(l(n[0].dataValues))}}).catch(function(e){r(e)})})},p}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.STRING,a=t.BOOLEAN,r=t.INTEGER,l=e.define("File",{name:{type:n,allowNull:!1},claimId:{type:n,allowNull:!1},address:{type:n,allowNull:!1},outpoint:{type:n,allowNull:!1},height:{type:r,allowNull:!1,default:0},fileName:{type:n,allowNull:!1},filePath:{type:n,allowNull:!1},fileType:{type:n},nsfw:{type:a,allowNull:!1,defaultValue:!1},trendingEligible:{type:a,allowNull:!1,defaultValue:!0}},{freezeTableName:!0});return l.associate=function(e){l.hasMany(e.Request),l.hasOne(e.Claim)},l.getRecentClaims=function(){return this.findAll({where:{nsfw:!1,trendingEligible:!0},order:[["createdAt","DESC"]],limit:25})},l}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.STRING,a=(t.BOOLEAN,t.TEXT),r=e.define("Request",{action:{type:n,allowNull:!1},url:{type:n,allowNull:!1},ipAddress:{type:n,allowNull:!0},result:{type:a("long"),allowNull:!0,default:null}},{freezeTableName:!0});return r.associate=function(e){r.belongsTo(e.File,{foreignKey:{allowNull:!0}})},r}},function(e,t,n){"use strict";var a=n(72),r=n(2);e.exports=function(e,t){var n=t.STRING,l=e.define("User",{userName:{type:n,allowNull:!1},password:{type:n,allowNull:!1}},{freezeTableName:!0});return l.associate=function(e){l.hasOne(e.Channel)},l.prototype.comparePassword=function(e){return a.compare(e,this.password)},l.prototype.changePassword=function(e){var t=this;return new Promise(function(n,l){a.genSalt(function(o,i){if(o)return r.error("salt error",o),void l(o);a.hash(e,i,function(e,a){if(e)return r.error("hash error",e),void l(e);t.update({password:a}).then(function(){n()}).catch(function(e){l(e)})})})})},l.hook("beforeCreate",function(e,t){return r.debug("User.beforeCreate hook..."),new Promise(function(t,n){a.genSalt(function(l,o){if(l)return r.error("salt error",l),void n(l);a.hash(e.password,o,function(a,l){if(a)return r.error("hash error",a),void n(a);e.password=l,t()})})})}),l}},function(e,t){e.exports=require("bcrypt")},function(e,t,n){"use strict";var a=n(25).Strategy,r=n(2),l=n(6),o=function(e){return new Promise(function(t,n){var a={};a.id=e.id,a.userName=e.userName,e.getChannel().then(function(e){var t=e.channelName,n=e.channelClaimId;return a.channelName=t,a.channelClaimId=n,l.Certificate.getShortChannelIdFromLongChannelId(n,t)}).then(function(e){a.shortChannelId=e,t(a)}).catch(function(e){n(e)})})};e.exports=new a({usernameField:"username",passwordField:"password"},function(e,t,n){return l.User.findOne({where:{userName:e}}).then(function(e){return e?e.comparePassword(t).then(function(t){return t?(r.debug("Password was a match, returning User"),o(e).then(function(e){return n(null,e)}).catch(function(e){return e})):(r.debug("incorrect password"),n(null,!1,{message:"Incorrect username or password"}))}).catch(function(e){return e}):(r.debug("no user found"),n(null,!1,{message:"Incorrect username or password"}))}).catch(function(e){return n(e)})})},function(e,t,n){"use strict";var a=n(2),r=n(22);e.exports=function(e){e.post("/signup",r.authenticate("local-signup"),function(e,t){a.verbose("successful signup for "+e.user.channelName),t.status(200).json({success:!0,channelName:e.user.channelName,channelClaimId:e.user.channelClaimId,shortChannelId:e.user.shortChannelId})}),e.post("/login",function(e,t,n){r.authenticate("local-login",function(r,l,o){return a.debug("info:",o),r?n(r):l?(a.debug("successful login"),void e.logIn(l,function(a){return a?n(a):t.status(200).json({success:!0,channelName:e.user.channelName,channelClaimId:e.user.channelClaimId,shortChannelId:e.user.shortChannelId})})):t.status(400).json({success:!1,message:o.message})})(e,t,n)}),e.get("/logout",function(e,t){e.logout(),t.status(200).json({success:!0,message:"you successfully logged out"})}),e.get("/user",function(e,t){e.user?t.status(200).json({success:!0,data:e.user}):t.status(401).json({success:!1,message:"user is not logged in"})})}},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(2),l=n(76),o=n(3),i=o.publishing.uploadDirectory,u=o.details.host,s=l({uploadDir:i}),c=n(6),f=n(77),d=f.claimNameIsAvailable,p=f.checkChannelAvailability,m=f.publish,h=n(16),g=h.getClaimList,b=h.resolveUri,v=h.getClaim,y=n(27),E=y.addGetResultsToFileData,w=y.createBasicPublishParams,_=y.createThumbnailPublishParams,C=y.parsePublishApiRequestBody,N=y.parsePublishApiRequestFiles,I=y.createFileData,O=n(28),P=n(17),S=P.sendGATimingEvent,A=n(79),T=A.authenticateUser,j=n(29),L=j.getChannelData,x=j.getChannelClaims,k=j.getClaimId;e.exports=function(e){e.get("/api/channel/availability/:name",function(e,t){var n=e.ip,a=e.originalUrl,r=e.params;p(r.name).then(function(e){!0===e?t.status(200).json(!0):t.status(200).json(!1)}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/channel/short-id/:longId/:name",function(e,t){var n=e.ip,a=e.originalUrl,r=e.params;c.Certificate.getShortChannelIdFromLongChannelId(r.longId,r.name).then(function(e){t.status(200).json(e)}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/channel/data/:channelName/:channelClaimId",function(e,t){var n=e.ip,a=e.originalUrl,r=(e.body,e.params),l=r.channelName,o=r.channelClaimId;"none"===o&&(o=null),L(l,o,0).then(function(e){if("NO_CHANNEL"===e)return t.status(404).json({success:!1,message:"No matching channel was found"});t.status(200).json({success:!0,data:e})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/channel/claims/:channelName/:channelClaimId/:page",function(e,t){var n=e.ip,a=e.originalUrl,r=(e.body,e.params),l=r.channelName,o=r.channelClaimId;"none"===o&&(o=null);var i=r.page;x(l,o,i).then(function(e){if("NO_CHANNEL"===e)return t.status(404).json({success:!1,message:"No matching channel was found"});t.status(200).json({success:!0,data:e})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/claim/list/:name",function(e,t){var n=e.ip,a=e.originalUrl,r=e.params;g(r.name).then(function(e){t.status(200).json(e)}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/claim/get/:name/:claimId",function(e,t){var n=e.ip,r=e.originalUrl,l=e.params,o=l.name,i=l.claimId;c.Claim.resolveClaim(o,i).then(function(e){if(!e)throw new Error("No matching uri found in Claim table");var t=I(e);return Promise.all([t,v(o+"#"+i)])}).then(function(e){var t=a(e,2),n=t[0],r=t[1];return n=E(n,r),Promise.all([c.upsert(c.File,n,{name:o,claimId:i},"File"),r])}).then(function(e){var n=a(e,2),r=(n[0],n[1]),l=r.message,o=r.completed;t.status(200).json({success:!0,message:l,completed:o})}).catch(function(e){O.handleErrorResponse(r,n,e,t)})}),e.get("/api/claim/availability/:name",function(e,t){var n=e.ip,a=e.originalUrl,r=e.params;d(r.name).then(function(e){t.status(200).json(e)}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/claim/resolve/:name/:claimId",function(e,t){var n=(e.headers,e.ip),a=e.originalUrl,r=e.params;b(r.name+"#"+r.claimId).then(function(e){t.status(200).json(e)}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.post("/api/claim/publish",s,function(e,t){var n=e.body,l=e.files,o=(e.headers,e.ip),i=e.originalUrl,s=e.user;r.debug("api/claim/publish req.body:",n),r.debug("api/claim/publish req.files:",l);var c=void 0,f=void 0,p=void 0,h=void 0,g=void 0,b=void 0,v=void 0,y=void 0,E=void 0,I=void 0,P=void 0,A=void 0,j=void 0,L=void 0,x=void 0,k=void 0;y=Date.now();try{var R=C(n);I=R.name,P=R.nsfw,E=R.license,k=R.title,h=R.description,A=R.thumbnail;var M=N(l);g=M.fileName,b=M.filePath,v=M.fileType,j=M.thumbnailFileName,L=M.thumbnailFilePath,x=M.thumbnailFileType,c=n.channelName,f=n.channelId,p=n.channelPassword}catch(e){return t.status(400).json({success:!1,message:e.message})}Promise.all([T(c,f,p,s),d(I),w(b,I,k,h,E,P,A),_(L,I,E,P)]).then(function(e){var t=a(e,4),n=t[0],r=n.channelName,l=n.channelClaimId,o=(t[1],t[2]),i=t[3];return r&&l&&(o.channel_name=r,o.channel_id=l),i&&m(i,j,x),m(o,g,v)}).then(function(e){t.status(200).json({success:!0,message:"publish completed successfully",data:{name:I,claimId:e.claim_id,url:u+"/"+e.claim_id+"/"+I,lbryTx:e}}),S("end-to-end","publish",v,y,Date.now())}).catch(function(e){O.handleErrorResponse(i,o,e,t)})}),e.get("/api/claim/short-id/:longId/:name",function(e,t){var n=e.ip,a=e.originalUrl,r=(e.body,e.params);c.Claim.getShortClaimIdFromLongClaimId(r.longId,r.name).then(function(e){t.status(200).json({success:!0,data:e})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.post("/api/claim/long-id",function(e,t){var n=e.ip,a=e.originalUrl,l=e.body;e.params;r.debug("body:",l);var o=l.channelName,i=l.channelClaimId,u=l.claimName,s=l.claimId;k(o,i,u,s).then(function(e){return"NO_CHANNEL"===e?t.status(404).json({success:!1,message:"No matching channel could be found"}):"NO_CLAIM"===e?t.status(404).json({success:!1,message:"No matching claim id could be found"}):void t.status(200).json({success:!0,data:e})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/claim/data/:claimName/:claimId",function(e,t){var n=e.ip,a=e.originalUrl,r=(e.body,e.params),l=r.claimName,o=r.claimId;"none"===o&&(o=null),c.Claim.resolveClaim(l,o).then(function(e){if(!e)return t.status(404).json({success:!1,message:"No claim could be found"});t.status(200).json({success:!0,data:e})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})}),e.get("/api/file/availability/:name/:claimId",function(e,t){var n=e.ip,a=e.originalUrl,r=e.params,l=r.name,o=r.claimId;c.File.findOne({where:{name:l,claimId:o}}).then(function(e){if(e)return t.status(200).json({success:!0,data:!0});t.status(200).json({success:!0,data:!1})}).catch(function(e){O.handleErrorResponse(a,n,e,t)})})}},function(e,t){e.exports=require("connect-multiparty")},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(2),l=n(6),o=n(16),i=n(27),u=n(3),s=u.publishing.primaryClaimAddress;e.exports={publish:function(e,t,n){return new Promise(function(u,s){var c=void 0,f=void 0,d=void 0;return o.publishClaim(e).then(function(n){return r.info("Successfully published "+e.name+" "+t,n),c=n,e.channel_name?(r.debug("this claim was published in channel: "+e.channel_name),l.Channel.findOne({where:{channelName:e.channel_name}})):(r.debug("this claim was not published in a channel"),null)}).then(function(e){f=null,d=null,e&&(f=e.channelClaimId,d=e.channelName),r.debug("certificateId: "+f)}).then(function(){var a={name:e.name,claimId:c.claim_id,title:e.metadata.title,description:e.metadata.description,address:e.claim_address,outpoint:c.txid+":"+c.nout,height:0,fileName:t,filePath:e.file_path,fileType:n,nsfw:e.metadata.nsfw},r={name:e.name,claimId:c.claim_id,title:e.metadata.title,description:e.metadata.description,address:e.claim_address,thumbnail:e.metadata.thumbnail,outpoint:c.txid+":"+c.nout,height:0,contentType:n,nsfw:e.metadata.nsfw,amount:e.bid,certificateId:f,channelName:d},o={name:e.name,claimId:c.claim_id};return Promise.all([l.upsert(l.File,a,o,"File"),l.upsert(l.Claim,r,o,"Claim")])}).then(function(e){var t=a(e,2),n=t[0],l=t[1];return r.debug("File and Claim records successfully created"),Promise.all([n.setClaim(l),l.setFile(n)])}).then(function(){r.debug("File and Claim records successfully associated"),u(c)}).catch(function(t){r.error("PUBLISH ERROR",t),i.deleteTemporaryFile(e.file_path),s(t)})})},claimNameIsAvailable:function(e){return l.File.findAll({where:{name:e}}).then(function(t){if(t.length>=1){if(t.filter(function(e){return e.address===s}).length>=1)throw new Error("That claim is already in use");return e}return e})},checkChannelAvailability:function(e){return new Promise(function(t,n){l.Channel.findAll({where:{channelName:e}}).then(function(e){if(e.length>=1)return t(!1);t(!0)}).catch(function(e){n(e)})})}}},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";var a=n(6),r=n(2);e.exports={authenticateUser:function(t,n,a,r){if(!t&&!n)return{channelName:null,channelClaimId:null};if(r){if(t&&t!==r.channelName)throw new Error("the provided channel name does not match user credentials");if(n&&n!==r.channelClaimId)throw new Error("the provided channel id does not match user credentials");return{channelName:r.channelName,channelClaimId:r.channelClaimId}}if(!a)throw new Error("no channel password provided");return e.exports.authenticateChannelCredentials(t,n,a)},authenticateChannelCredentials:function(e,t,n){return new Promise(function(l,o){var i=void 0,u={};e&&(u.channelName=e),t&&(u.channelClaimId=t),a.Channel.findOne({where:u}).then(function(e){if(!e)throw r.debug("no channel found"),new Error("Authentication failed, you do not have access to that channel");return i=e.get(),r.debug("channel data:",i),a.User.findOne({where:{userName:i.channelName.substring(1)}})}).then(function(e){if(!e)throw r.debug("no user found"),new Error("Authentication failed, you do not have access to that channel");return e.comparePassword(n)}).then(function(e){if(!e)throw r.debug("incorrect password"),new Error("Authentication failed, you do not have access to that channel");r.debug("...password was a match..."),l(i)}).catch(function(e){o(e)})})}}},function(e,t,n){"use strict";e.exports={returnPaginatedChannelClaims:function(t,n,a,r){var l=e.exports.determineTotalPages(a),o=e.exports.getPageFromQuery(r);return{channelName:t,longChannelClaimId:n,claims:e.exports.extractPageFromClaims(a,o),previousPage:e.exports.determinePreviousPage(o),currentPage:o,nextPage:e.exports.determineNextPage(l,o),totalPages:l,totalResults:e.exports.determineTotalClaims(a)}},getPageFromQuery:function(e){return e?parseInt(e):1},extractPageFromClaims:function(e,t){if(!e)return[];var n=12*(t-1),a=n+12;return e.slice(n,a)},determineTotalPages:function(e){if(e){var t=e.length;if(t<12)return 1;var n=Math.floor(t/12);return 0===t%12?n:n+1}return 0},determinePreviousPage:function(e){return 1===e?null:e-1},determineNextPage:function(e,t){return t===e?null:t+1},determineTotalClaims:function(e){return e?e.length:0}}},function(e,t,n){"use strict";var a=n(3),r=a.details,l=n(30);e.exports=function(e){e.get("/",function(e,t){l(e,t)}),e.get("/login",function(e,t){l(e,t)}),e.get("/about",function(e,t){l(e,t)}),e.get("/trending",function(e,t){t.status(301).redirect("/popular")}),e.get("/popular",function(e,t){l(e,t)}),e.get("/new",function(e,t){l(e,t)}),e.get("/embed/:claimId/:name",function(e,t){var n=e.params,a=n.claimId,l=n.name;t.status(200).render("embed",{layout:"embed",host:r,claimId:a,name:l})})}},function(e,t,n){"use strict";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments[1];switch(t.type){case l.FILE_SELECTED:return Object.assign({},i,{file:t.data});case l.FILE_CLEAR:return i;case l.METADATA_UPDATE:return Object.assign({},e,{metadata:Object.assign({},e.metadata,a({},t.data.name,t.data.value))});case l.CLAIM_UPDATE:return Object.assign({},e,{claim:t.data});case l.SET_PUBLISH_IN_CHANNEL:return Object.assign({},e,{publishInChannel:t.channel});case l.PUBLISH_STATUS_UPDATE:return Object.assign({},e,{status:t.data});case l.ERROR_UPDATE:return Object.assign({},e,{error:Object.assign({},e.error,a({},t.data.name,t.data.value))});case l.SELECTED_CHANNEL_UPDATE:return Object.assign({},e,{selectedChannel:t.data});case l.TOGGLE_METADATA_INPUTS:return Object.assign({},e,{showMetadataInputs:t.data});case l.THUMBNAIL_NEW:return Object.assign({},e,{thumbnail:t.data});default:return e}};var r=n(33),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(r),o=n(34),i={publishInChannel:!1,selectedChannel:o.LOGIN,showMetadataInputs:!1,status:{status:null,message:null},error:{file:null,url:null,channel:null,publishSubmit:null},file:null,claim:"",metadata:{title:"",description:"",license:"",nsfw:!1},thumbnail:null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments[1];switch(t.type){case r.CHANNEL_UPDATE:return Object.assign({},e,{loggedInChannel:t.data});default:return e}};var a=n(35),r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a),l={loggedInChannel:{name:null,shortId:null,longId:null}}},function(e,t,n){"use strict";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments[1];switch(t.type){case l.REQUEST_ERROR:return Object.assign({},e,{request:Object.assign({},e.request,{error:t.data})});case l.REQUEST_UPDATE:return Object.assign({},e,{request:Object.assign({},e.request,{type:t.data.requestType,id:t.data.requestId})});case l.REQUEST_LIST_ADD:return Object.assign({},e,{requestList:Object.assign({},e.requestList,a({},t.data.id,{error:t.data.error,key:t.data.key}))});case l.ASSET_ADD:return Object.assign({},e,{assetList:Object.assign({},e.assetList,a({},t.data.id,{error:t.data.error,name:t.data.name,claimId:t.data.claimId,shortId:t.data.shortId,claimData:t.data.claimData}))});case l.CHANNEL_ADD:return Object.assign({},e,{channelList:Object.assign({},e.channelList,a({},t.data.id,{name:t.data.name,longId:t.data.longId,shortId:t.data.shortId,claimsData:t.data.claimsData}))});case l.CHANNEL_CLAIMS_UPDATE_SUCCESS:return Object.assign({},e,{channelList:Object.assign({},e.channelList,a({},t.data.channelListId,Object.assign({},e.channelList[t.data.channelListId],{claimsData:t.data.claimsData})))});case l.FILE_AVAILABILITY_UPDATE:return Object.assign({},e,{displayAsset:Object.assign({},e.displayAsset,{status:t.data})});case l.DISPLAY_ASSET_ERROR:return Object.assign({},e,{displayAsset:Object.assign({},e.displayAsset,{error:t.data,status:o.ERROR})});default:return e}};var r=n(12),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(r),o=n(36),i={request:{error:null,type:null,id:null},requestList:{},channelList:{},assetList:{},displayAsset:{error:null,status:o.LOCAL_CHECK}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;return arguments[1].type,e};var a=n(3),r=a.details.host,l={host:r}},function(e,t){e.exports=require("react-ga")},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(9),f=a(c),d=n(7),p=a(d),m=n(95),h=a(m),g=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){return s.default.createElement("div",{className:"row row--tall flex-container--column"},s.default.createElement(f.default,null),s.default.createElement(p.default,null),s.default.createElement("div",{className:"row row--tall row--padded flex-container--column"},s.default.createElement(h.default,null)))}}]),t}(s.default.Component);t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),r=a.details.title;t.createPageTitle=function(e){return e?r+" - "+e:""+r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),r=a.details,l=r.title,o=r.host,i=r.description,u=a.assetDefaults,s=u.thumbnail,c=u.description,f=function(e){if(e){switch(e.substring(e.lastIndexOf("."))){case"jpeg":case"jpg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"mp4":return"video/mp4";default:return"image/jpeg"}}return""},d=function(){return[{property:"og:title",content:l},{property:"og:url",content:o},{property:"og:site_name",content:l},{property:"og:description",content:i},{property:"twitter:site",content:"@spee_ch"},{property:"twitter:card",content:"summary"}]},p=function(e){var t=e.name,n=e.longId;return[{property:"og:title",content:t+" on "+l},{property:"og:url",content:o+"/"+t+":"+n},{property:"og:site_name",content:l},{property:"og:description",content:t+", a channel on "+l},{property:"twitter:site",content:"@spee_ch"},{property:"twitter:card",content:"summary"}]},m=function(e){var t=e.claimData,n=t.contentType,a=o+"/"+t.claimId+"/"+t.name,r=o+"/"+t.claimId+"/"+t.name,i=o+"/"+t.claimId+"/"+t.name+"."+t.fileExt,u=t.title||t.name,d=t.description||c,p=f(t.thumbnail),m=t.thumbnail||s,h=[{property:"og:title",content:u},{property:"og:url",content:r},{property:"og:site_name",content:l},{property:"og:description",content:d},{property:"og:image:width",content:600},{property:"og:image:height",content:315},{property:"twitter:site",content:"@spee_ch"}];return"video/mp4"===n||"video/webm"===n?(h.push({property:"og:video",content:i}),h.push({property:"og:video:secure_url",content:i}),h.push({property:"og:video:type",content:n}),h.push({property:"og:image",content:m}),h.push({property:"og:image:type",content:p}),h.push({property:"og:type",content:"video"}),h.push({property:"twitter:card",content:"player"}),h.push({property:"twitter:player",content:a}),h.push({property:"twitter:player:width",content:600}),h.push({property:"twitter:text:player_width",content:600}),h.push({property:"twitter:player:height",content:337}),h.push({property:"twitter:player:stream",content:i}),h.push({property:"twitter:player:stream:content_type",content:n})):(h.push({property:"og:image",content:i}),h.push({property:"og:image:type",content:n}),h.push({property:"og:type",content:"article"}),h.push({property:"twitter:card",content:"summary_large_image"})),h};t.createMetaTags=function(e,t){return e?m(e):t?p(t):d()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),r=a.details.host,l=function(e){return e?r+"/"+e:""+r},o=function(e){var t=void 0,n=void 0,a=void 0,l=void 0;if(e.claimData){var o=e.claimData;t=o.channelName,n=o.certificateId,a=o.name,l=o.claimId}return t?r+"/"+t+":"+n+"/"+a:r+"/"+l+"/"+a},i=function(e){var t=e.name,n=e.longId;return r+"/"+t+":"+n};t.createCanonicalLink=function(e,t,n){return e?o(e):t?i(t):n?l(n):l()}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(4),f=n(92),d=a(f),p=n(93),m=a(p),h=n(11),g=a(h),b=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.checkForLoggedInUser=n.checkForLoggedInUser.bind(n),n.logoutUser=n.logoutUser.bind(n),n.handleSelection=n.handleSelection.bind(n),n}return o(t,e),i(t,[{key:"componentDidMount",value:function(){this.checkForLoggedInUser()}},{key:"checkForLoggedInUser",value:function(){var e=this,t={credentials:"include"};(0,g.default)("/user",t).then(function(t){var n=t.data;e.props.onChannelLogin(n.channelName,n.shortChannelId,n.channelClaimId)}).catch(function(e){console.log("/user error:",e.message)})}},{key:"logoutUser",value:function(){var e=this,t={credentials:"include"};(0,g.default)("/logout",t).then(function(){e.props.onChannelLogout()}).catch(function(e){console.log("/logout error",e.message)})}},{key:"handleSelection",value:function(e){switch(e.target.selectedOptions[0].value){case"LOGOUT":this.logoutUser();break;case"VIEW":this.props.history.push("/"+this.props.channelName+":"+this.props.channelLongId)}}},{key:"render",value:function(){return s.default.createElement("div",{className:"row row--wide nav-bar"},s.default.createElement("div",{className:"row row--padded row--short flex-container--row flex-container--space-between-center"},s.default.createElement(d.default,null),s.default.createElement("div",{className:"nav-bar--center"},s.default.createElement("span",{className:"nav-bar-tagline"},"Open-source, decentralized image and video sharing.")),s.default.createElement("div",{className:"nav-bar--right"},s.default.createElement(c.NavLink,{className:"nav-bar-link link--nav",activeClassName:"link--nav-active",to:"/",exact:!0},"Publish"),s.default.createElement(c.NavLink,{className:"nav-bar-link link--nav",activeClassName:"link--nav-active",to:"/about"},"About"),this.props.channelName?s.default.createElement(m.default,{channelName:this.props.channelName,handleSelection:this.handleSelection,defaultSelection:this.props.channelName,VIEW:"VIEW",LOGOUT:"LOGOUT"}):s.default.createElement(c.NavLink,{id:"nav-bar-login-link",className:"nav-bar-link link--nav",activeClassName:"link--nav-active",to:"/login"},"Channel"))))}}]),t}(s.default.Component);t.default=(0,c.withRouter)(b)},function(e,t,n){"use strict";function a(){return l.default.createElement("svg",{version:"1.1",id:"Layer_1",x:"0px",y:"0px",height:"24px",viewBox:"0 0 80 31",enableBackground:"new 0 0 80 31",className:"nav-bar-logo"},l.default.createElement(o.Link,{to:"/"},l.default.createElement("title",null,"Logo"),l.default.createElement("desc",null,"Spee.ch logo"),l.default.createElement("g",{id:"About"},l.default.createElement("g",{id:"Publish-Form-V2-_x28_filled_x29_",transform:"translate(-42.000000, -23.000000)"},l.default.createElement("g",{id:"Group-17",transform:"translate(42.000000, 22.000000)"},l.default.createElement("text",{transform:"matrix(1 0 0 1 0 20)",fontSize:"25",fontFamily:"Roboto"},"Spee<h"),l.default.createElement("g",{id:"Group-16",transform:"translate(0.000000, 30.000000)"},l.default.createElement("path",{id:"Line-8",fill:"none",stroke:"#09F911",strokeWidth:"1",strokeLinecap:"square",d:"M0.5,1.5h15"}),l.default.createElement("path",{id:"Line-8-Copy",fill:"none",stroke:"#029D74",strokeWidth:"1",strokeLinecap:"square",d:"M16.5,1.5h15"}),l.default.createElement("path",{id:"Line-8-Copy-2",fill:"none",stroke:"#E35BD8",strokeWidth:"1",strokeLinecap:"square",d:"M32.5,1.5h15"}),l.default.createElement("path",{id:"Line-8-Copy-3",fill:"none",stroke:"#4156C5",strokeWidth:"1",strokeLinecap:"square",d:"M48.5,1.5h15"}),l.default.createElement("path",{id:"Line-8-Copy-4",fill:"none",stroke:"#635688",strokeWidth:"1",strokeLinecap:"square",d:"M64.5,1.5h15"})))))))}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(4);t.default=a},function(e,t,n){"use strict";function a(e){var t=e.channelName,n=e.handleSelection,a=e.defaultSelection,r=e.VIEW,o=e.LOGOUT;return l.default.createElement("select",{type:"text",id:"nav-bar-channel-select",className:"select select--arrow link--nav",onChange:n,value:a},l.default.createElement("option",{id:"nav-bar-channel-select-channel-option"},t),l.default.createElement("option",{value:r},"View"),l.default.createElement("option",{value:o},"Logout"))}Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),l=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=a},function(e,t){e.exports=require("cross-fetch/polyfill")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(96),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=function(e){var t=e.publish;return{file:t.file,status:t.status.status}};t.default=(0,a.connect)(o,null)(l.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(39),f=a(c),d=n(100),p=a(d),m=n(118),h=a(m),g=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){return this.props.file?this.props.status?s.default.createElement(h.default,null):s.default.createElement(p.default,null):s.default.createElement(f.default,null)}}]),t}(s.default.Component);t.default=g},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(98),f=n(99),d=a(f),p=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={dragOver:!1,mouseOver:!1,dimPreview:!1},n.handleDrop=n.handleDrop.bind(n),n.handleDragOver=n.handleDragOver.bind(n),n.handleDragEnd=n.handleDragEnd.bind(n),n.handleDragEnter=n.handleDragEnter.bind(n),n.handleDragLeave=n.handleDragLeave.bind(n),n.handleMouseEnter=n.handleMouseEnter.bind(n),n.handleMouseLeave=n.handleMouseLeave.bind(n),n.handleClick=n.handleClick.bind(n),n.handleFileInput=n.handleFileInput.bind(n),n.chooseFile=n.chooseFile.bind(n),n}return o(t,e),i(t,[{key:"handleDrop",value:function(e){e.preventDefault(),this.setState({dragOver:!1});var t=e.dataTransfer;if(t.items&&"file"===t.items[0].kind){var n=t.items[0].getAsFile();this.chooseFile(n)}}},{key:"handleDragOver",value:function(e){e.preventDefault()}},{key:"handleDragEnd",value:function(e){var t=e.dataTransfer;if(t.items)for(var n=0;n<t.items.length;n++)t.items.remove(n);else e.dataTransfer.clearData()}},{key:"handleDragEnter",value:function(){this.setState({dragOver:!0,dimPreview:!0})}},{key:"handleDragLeave",value:function(){this.setState({dragOver:!1,dimPreview:!1})}},{key:"handleMouseEnter",value:function(){this.setState({mouseOver:!0,dimPreview:!0})}},{key:"handleMouseLeave",value:function(){this.setState({mouseOver:!1,dimPreview:!1})}},{key:"handleClick",value:function(e){e.preventDefault(),document.getElementById("file_input").click()}},{key:"handleFileInput",value:function(e){e.preventDefault();var t=e.target.files;this.chooseFile(t[0])}},{key:"chooseFile",value:function(e){if(e){try{(0,c.validateFile)(e)}catch(e){return this.props.setFileError(e.message)}this.props.selectFile(e)}}},{key:"render",value:function(){return s.default.createElement("div",{className:"row row--tall flex-container--column"},s.default.createElement("form",null,s.default.createElement("input",{className:"input-file",type:"file",id:"file_input",name:"file_input",accept:"video/*,image/*",onChange:this.handleFileInput,encType:"multipart/form-data"})),s.default.createElement("div",{id:"preview-dropzone",className:"row row--padded row--tall dropzone"+(this.state.dragOver?" dropzone--drag-over":""),onDrop:this.handleDrop,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onClick:this.handleClick},this.props.file?s.default.createElement("div",null,s.default.createElement(d.default,{dimPreview:this.state.dimPreview,file:this.props.file,thumbnail:this.props.thumbnail}),s.default.createElement("div",{id:"dropzone-text-holder",className:"flex-container--column flex-container--center-center"},this.state.dragOver?s.default.createElement("div",{id:"dropzone-dragover"},s.default.createElement("p",{className:"blue"},"Drop it.")):null,this.state.mouseOver?s.default.createElement("div",{id:"dropzone-instructions"},s.default.createElement("p",{className:"info-message-placeholder info-message--failure",id:"input-error-file-selection"},this.props.fileError),s.default.createElement("p",null,"Drag & drop image or video here to publish"),s.default.createElement("p",{className:"fine-print"},"OR"),s.default.createElement("p",{className:"blue--underlined"},"CHOOSE FILE")):null)):s.default.createElement("div",{id:"dropzone-text-holder",className:"flex-container--column flex-container--center-center"},this.state.dragOver?s.default.createElement("div",{id:"dropzone-dragover"},s.default.createElement("p",{className:"blue"},"Drop it.")):s.default.createElement("div",{id:"dropzone-instructions"},s.default.createElement("p",{className:"info-message-placeholder info-message--failure",id:"input-error-file-selection"},this.props.fileError),s.default.createElement("p",null,"Drag & drop image or video here to publish"),s.default.createElement("p",{className:"fine-print"},"OR"),s.default.createElement("p",{className:"blue--underlined"},"CHOOSE FILE")))))}}]),t}(s.default.Component);t.default=p},function(e,t,n){"use strict";e.exports={validateFile:function(e){if(!e)throw new Error("no file provided");if(/'/.test(e.name))throw new Error("apostrophes are not allowed in the file name");switch(e.type){case"image/jpeg":case"image/jpg":case"image/png":if(e.size>1e7)throw new Error("Sorry, images are limited to 10 megabytes.");break;case"image/gif":if(e.size>5e7)throw new Error("Sorry, GIFs are limited to 50 megabytes.");break;case"video/mp4":if(e.size>5e7)throw new Error("Sorry, videos are limited to 50 megabytes.");break;default:throw new Error(e.type+" is not a supported file type. Only, .jpeg, .png, .gif, and .mp4 files are currently supported.")}}}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(10),f=a(c),d=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={imgSource:"",defaultThumbnail:"/assets/img/video_thumb_default.png"},n}return o(t,e),i(t,[{key:"componentDidMount",value:function(){this.setPreviewImageSource(this.props.file)}},{key:"componentWillReceiveProps",value:function(e){e.file!==this.props.file&&this.setPreviewImageSource(e.file),e.thumbnail!==this.props.thumbnail&&(e.thumbnail?this.setPreviewImageSourceFromFile(e.thumbnail):this.setState({imgSource:this.state.defaultThumbnail}))}},{key:"setPreviewImageSourceFromFile",value:function(e){var t=this,n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){t.setState({imgSource:n.result})}}},{key:"setPreviewImageSource",value:function(e){"video/mp4"!==e.type?this.setPreviewImageSourceFromFile(e):(this.props.thumbnail&&this.setPreviewImageSourceFromFile(this.props.thumbnail),this.setState({imgSource:this.state.defaultThumbnail}))}},{key:"render",value:function(){return s.default.createElement("img",{id:"dropzone-preview",src:this.state.imgSource,className:this.props.dimPreview?"dim":"",alt:"publish preview"})}}]),t}(s.default.Component);d.propTypes={dimPreview:f.default.bool.isRequired,file:f.default.object.isRequired,thumbnail:f.default.object},t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(101),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){e.channel;return{file:e.publish.file}},u={clearFile:r.clearFile,startPublish:r.startPublish};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(4),f=n(39),d=a(f),p=n(102),m=a(p),h=n(104),g=a(h),b=n(107),v=a(b),y=n(109),E=a(y),w=n(112),_=a(w),C=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onPublishSubmit=n.onPublishSubmit.bind(n),n}return o(t,e),i(t,[{key:"onPublishSubmit",value:function(){this.props.startPublish(this.props.history)}},{key:"render",value:function(){return s.default.createElement("div",{className:"row row--no-bottom"},s.default.createElement("div",{className:"column column--10"},s.default.createElement(m.default,null)),s.default.createElement("div",{className:"column column--5 column--sml-10"},s.default.createElement("div",{className:"row row--padded"},s.default.createElement(d.default,null))),s.default.createElement("div",{className:"column column--5 column--sml-10 align-content-top"},s.default.createElement("div",{id:"publish-active-area",className:"row row--padded"},s.default.createElement("div",{className:"row row--padded row--no-top row--wide"},s.default.createElement(g.default,null)),s.default.createElement("div",{className:"row row--padded row--no-top row--wide"},s.default.createElement(_.default,null)),"video/mp4"===this.props.file.type&&s.default.createElement("div",{className:"row row--padded row--no-top row--wide "},s.default.createElement(v.default,null)),s.default.createElement("div",{className:"row row--padded row--no-top row--no-bottom row--wide"},s.default.createElement(E.default,null)),s.default.createElement("div",{className:"row row--wide align-content-center"},s.default.createElement("button",{id:"publish-submit",className:"button--primary button--large",onClick:this.onPublishSubmit},"Publish")),s.default.createElement("div",{className:"row row--padded row--no-bottom align-content-center"},s.default.createElement("button",{className:"button--cancel",onClick:this.props.clearFile},"Cancel")),s.default.createElement("div",{className:"row row--short align-content-center"},s.default.createElement("p",{className:"fine-print"},"By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. ",s.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://lbry.io/learn"},"Read more."))))))}}]),t}(s.default.Component);t.default=(0,c.withRouter)(C)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(103),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){return{title:e.publish.metadata.title}},u=function(e){return{onMetadataChange:function(t,n){e((0,r.updateMetadata)(t,n))}}};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 l(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 o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(0),u=function(e){return e&&e.__esModule?e:{default:e}}(i),s=function(e){function t(e){a(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleInput=n.handleInput.bind(n),n}return l(t,e),o(t,[{key:"handleInput",value:function(e){var t=e.target.name,n=e.target.value;this.props.onMetadataChange(t,n)}},{key:"render",value:function(){return u.default.createElement("input",{type:"text",id:"publish-title",className:"input-text text--large input-text--full-width",name:"title",placeholder:"Give your post a title...",onChange:this.handleInput,value:this.props.title})}}]),t}(u.default.Component);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),r=n(1),l=n(105),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.channel,n=e.publish;return{loggedInChannelName:t.loggedInChannel.name,loggedInChannelShortId:t.loggedInChannel.shortId,fileName:n.file.name,publishInChannel:n.publishInChannel,selectedChannel:n.selectedChannel,claim:n.claim,urlError:n.error.url}},u=function(e){return{onClaimChange:function(t){e((0,a.updateClaim)(t)),e((0,a.updateError)("publishSubmit",null))},onUrlError:function(t){e((0,a.updateError)("url",t))}}};t.default=(0,r.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(11),f=a(c),d=n(106),p=a(d),m=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleInput=n.handleInput.bind(n),n}return o(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.claim,n=e.fileName;t||this.setClaimName(n)}},{key:"componentWillReceiveProps",value:function(e){var t=e.claim,n=e.fileName;if(n!==this.props.fileName)return this.setClaimName(n);t!==this.props.claim&&this.validateClaim(t)}},{key:"handleInput",value:function(e){var t=e.target.value;t=this.cleanseInput(t),this.props.onClaimChange(t)}},{key:"cleanseInput",value:function(e){return e=e.replace(/\s+/g,"-"),e=e.replace(/[^A-Za-z0-9-]/g,"")}},{key:"setClaimName",value:function(e){var t=e.substring(0,e.lastIndexOf(".")),n=this.cleanseInput(t);this.props.onClaimChange(n)}},{key:"validateClaim",value:function(e){var t=this;if(!e)return this.props.onUrlError("Enter a url above");(0,f.default)("/api/claim/availability/"+e).then(function(){t.props.onUrlError(null)}).catch(function(e){t.props.onUrlError(e.message)})}},{key:"render",value:function(){var e=this.props,t=e.claim,n=e.loggedInChannelName,a=e.loggedInChannelShortId,r=e.publishInChannel,l=e.selectedChannel,o=e.urlError;return s.default.createElement("div",{className:"column column--10 column--sml-10"},s.default.createElement("div",{className:"input-text--primary span--relative"},s.default.createElement("span",{className:"url-text--secondary"},"spee.ch / "),s.default.createElement(p.default,{publishInChannel:r,selectedChannel:l,loggedInChannelName:n,loggedInChannelShortId:a}),s.default.createElement("input",{type:"text",id:"claim-name-input",className:"input-text",name:"claim",placeholder:"your-url-here",onChange:this.handleInput,value:t}),t&&!o&&s.default.createElement("span",{id:"input-success-claim-name",className:"info-message--success span--absolute"},"✓"),o&&s.default.createElement("span",{id:"input-success-channel-name",className:"info-message--failure span--absolute"},"✖")),s.default.createElement("div",null,o?s.default.createElement("p",{id:"input-error-claim-name",className:"info-message--failure"},o):s.default.createElement("p",{className:"info-message"},"Choose a custom url")))}}]),t}(s.default.Component);t.default=m},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=e.publishInChannel,n=e.selectedChannel,a=e.loggedInChannelName,r=e.loggedInChannelShortId;return t?n===a?o.default.createElement("span",{id:"url-channel",className:"url-text--secondary"},a,":",r," /"):o.default.createElement("span",{id:"url-channel-placeholder",className:"url-text--secondary tooltip"},"@channel",o.default.createElement("span",{className:"tooltip-text"},"Select a channel below")," /"):o.default.createElement("span",{id:"url-no-channel-placeholder",className:"url-text--secondary tooltip"},"xyz",o.default.createElement("span",{className:"tooltip-text"},"This will be a random id")," /")}Object.defineProperty(t,"__esModule",{value:!0});var l=n(0),o=a(l),i=n(10),u=a(i);r.propTypes={publishInChannel:u.default.bool.isRequired,loggedInChannelName:u.default.string,loggedInChannelShortId:u.default.string},t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(108),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){return{file:e.publish.file}},u={onNewThumbnail:r.onNewThumbnail};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 l(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)}function o(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],a=new Uint8Array(t.length),r=0;r<t.length;r++)a[r]=t.charCodeAt(r);return new Blob([a],{type:n})}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(u),c=function(e){function t(e){a(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={videoSource:null,error:null,sliderMinRange:1,sliderMaxRange:null,sliderValue:null},n.handleVideoLoadedData=n.handleVideoLoadedData.bind(n),n.handleSliderChange=n.handleSliderChange.bind(n),n.createThumbnail=n.createThumbnail.bind(n),n}return l(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this.props.file;this.setVideoSource(e)}},{key:"componentWillReceiveProps",value:function(e){if(e.file&&e.file!==this.props.file){var t=e.file;this.setVideoSource(t)}}},{key:"setVideoSource",value:function(e){var t=this,n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){var e=n.result,a=o(e),r=URL.createObjectURL(a);t.setState({videoSource:r})}}},{key:"handleVideoLoadedData",value:function(e){var t=e.target.duration,n=Math.floor(t/60),a=Math.floor(t%60);this.setState({sliderMaxRange:100*t,sliderValue:100*t/2,totalMinutes:n,totalSeconds:a}),document.getElementById("video-thumb-player").currentTime=t/2}},{key:"handleSliderChange",value:function(e){var t=parseInt(e.target.value);this.setState({sliderValue:t}),document.getElementById("video-thumb-player").currentTime=t/100}},{key:"createThumbnail",value:function(){var e=document.getElementById("video-thumb-player"),t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height);var n=t.toDataURL(),a=o(n),r=new File([a],"thumbnail.png",{type:"image/png"});r&&this.props.onNewThumbnail(r)}},{key:"render",value:function(){var e=this.state,t=e.error,n=e.videoSource,a=e.sliderMinRange,r=e.sliderMaxRange,l=e.sliderValue,o=e.totalMinutes,i=e.totalSeconds;return s.default.createElement("div",null,s.default.createElement("label",{className:"label"},"Thumbnail:"),s.default.createElement("video",{id:"video-thumb-player",preload:"metadata",muted:!0,style:{display:"none"},playsInline:!0,onLoadedData:this.handleVideoLoadedData,src:n,onSeeked:this.createThumbnail}),l?s.default.createElement("div",null,s.default.createElement("div",{className:"flex-container--row flex-container--space-between-center",style:{width:"100%"}},s.default.createElement("span",{className:"info-message"},"0'00\""),s.default.createElement("span",{className:"info-message"},o,"'",i,'"')),s.default.createElement("div",null,s.default.createElement("input",{type:"range",min:a,max:r,value:l,className:"slider",onChange:this.handleSliderChange}))):s.default.createElement("p",{className:"info-message"},"loading... "),t?s.default.createElement("p",{className:"info-message--failure"},t):s.default.createElement("p",{className:"info-message"},"Use slider to set thumbnail"))}}]),t}(s.default.Component);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(110),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.publish;return{showMetadataInputs:t.showMetadataInputs,description:t.metadata.description,license:t.metadata.license,nsfw:t.metadata.nsfw}},u=function(e){return{onMetadataChange:function(t,n){e((0,r.updateMetadata)(t,n))},onToggleMetadataInputs:function(t){e((0,r.toggleMetadataInputs)(t))}}};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(111),f=a(c),d=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.toggleShowInputs=n.toggleShowInputs.bind(n),n.handleInput=n.handleInput.bind(n),n.handleSelect=n.handleSelect.bind(n),n}return o(t,e),i(t,[{key:"toggleShowInputs",value:function(){this.props.onToggleMetadataInputs(!this.props.showMetadataInputs)}},{key:"handleInput",value:function(e){var t=e.target,n="checkbox"===t.type?t.checked:t.value,a=t.name;this.props.onMetadataChange(a,n)}},{key:"handleSelect",value:function(e){var t=e.target.name,n=e.target.selectedOptions[0].value;this.props.onMetadataChange(t,n)}},{key:"render",value:function(){return s.default.createElement("div",{id:"publish-details",className:"row row--padded row--no-top row--wide"},this.props.showMetadataInputs&&s.default.createElement("div",null,s.default.createElement("div",{className:"row row--no-top"},s.default.createElement("div",{className:"column column--3 column--med-10 align-content-top"},s.default.createElement("label",{htmlFor:"publish-license",className:"label"},"Description:")),s.default.createElement("div",{className:"column column--7 column--sml-10"},s.default.createElement(f.default,{id:"publish-description",className:"textarea textarea--primary textarea--full-width",rows:1,maxLength:2e3,style:{maxHeight:200},name:"description",placeholder:"Optional description",value:this.props.description,onChange:this.handleInput}))),s.default.createElement("div",{className:"row row--no-top"},s.default.createElement("div",{className:"column column--3 column--med-10"},s.default.createElement("label",{htmlFor:"publish-license",className:"label"},"License:")),s.default.createElement("div",{className:"column column--7 column--sml-10"},s.default.createElement("select",{type:"text",name:"license",id:"publish-license",className:"select select--primary",onChange:this.handleSelect},s.default.createElement("option",{value:" "},"Unspecified"),s.default.createElement("option",{value:"Public Domain"},"Public Domain"),s.default.createElement("option",{value:"Creative Commons"},"Creative Commons")))),s.default.createElement("div",{className:"row row--no-top"},s.default.createElement("div",{className:"column column--3"},s.default.createElement("label",{htmlFor:"publish-nsfw",className:"label"},"Mature:")),s.default.createElement("div",{className:"column column--7"},s.default.createElement("input",{className:"input-checkbox",type:"checkbox",id:"publish-nsfw",name:"nsfw",value:this.props.nsfw,onChange:this.handleInput})))),s.default.createElement("button",{className:"button--secondary",onClick:this.toggleShowInputs},this.props.showMetadataInputs?"less":"more"))}}]),t}(s.default.Component);t.default=d},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),c=n(0),f=a(c),d=n(10),p=a(d),m=function(e){function t(e){l(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._handleChange=n._handleChange.bind(n),n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.adjustTextarea({})}},{key:"_handleChange",value:function(e){var t=this.props.onChange;t&&t(e),this.adjustTextarea(e)}},{key:"adjustTextarea",value:function(e){var t=e.target,n=void 0===t?this.el:t;n.style.height=0,n.style.height=n.scrollHeight+"px"}},{key:"render",value:function(){var e=this,t=r(this.props,[]);return f.default.createElement("textarea",u({},t,{ref:function(t){return e.el=t},onChange:this._handleChange}))}}]),t}(c.Component);m.propTypes={onChange:p.default.func},t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(113),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.channel,n=e.publish;return{loggedInChannelName:t.loggedInChannel.name,publishInChannel:n.publishInChannel,selectedChannel:n.selectedChannel,channelError:n.error.channel}},u=function(e){return{onPublishInChannelChange:function(t){e((0,r.updateError)("channel",null)),e((0,r.setPublishInChannel)(t))},onChannelSelect:function(t){e((0,r.updateError)("channel",null)),e((0,r.updateSelectedChannel)(t))}}};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(40),f=a(c),d=n(41),p=a(d),m=n(34),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(m),g=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.toggleAnonymousPublish=n.toggleAnonymousPublish.bind(n),n.handleSelection=n.handleSelection.bind(n),n}return o(t,e),i(t,[{key:"toggleAnonymousPublish",value:function(e){"anonymous"===e.target.value?this.props.onPublishInChannelChange(!1):this.props.onPublishInChannelChange(!0)}},{key:"handleSelection",value:function(e){var t=e.target.selectedOptions[0].value;this.props.onChannelSelect(t)}},{key:"render",value:function(){return s.default.createElement("div",null,s.default.createElement("form",null,s.default.createElement("div",{className:"column column--3 column--med-10"},s.default.createElement("input",{type:"radio",name:"anonymous-or-channel",id:"anonymous-radio",className:"input-radio",value:"anonymous",checked:!this.props.publishInChannel,onChange:this.toggleAnonymousPublish}),s.default.createElement("label",{className:"label label--pointer",htmlFor:"anonymous-radio"},"Anonymous")),s.default.createElement("div",{className:"column column--7 column--med-10"},s.default.createElement("input",{type:"radio",name:"anonymous-or-channel",id:"channel-radio",className:"input-radio",value:"in a channel",checked:this.props.publishInChannel,onChange:this.toggleAnonymousPublish}),s.default.createElement("label",{className:"label label--pointer",htmlFor:"channel-radio"},"In a channel")),this.props.channelError?s.default.createElement("p",{className:"info-message--failure"},this.props.channelError):s.default.createElement("p",{className:"info-message"},"Publish anonymously or in a channel")),this.props.publishInChannel&&s.default.createElement("div",null,s.default.createElement("div",{className:"column column--3"},s.default.createElement("label",{className:"label",htmlFor:"channel-name-select"},"Channel:")),s.default.createElement("div",{className:"column column--7"},s.default.createElement("select",{type:"text",id:"channel-name-select",className:"select select--arrow",value:this.props.selectedChannel,onChange:this.handleSelection},this.props.loggedInChannelName&&s.default.createElement("option",{value:this.props.loggedInChannelName,id:"publish-channel-select-channel-option"},this.props.loggedInChannelName),s.default.createElement("option",{value:h.LOGIN},"Existing"),s.default.createElement("option",{value:h.CREATE},"New"))),this.props.selectedChannel===h.LOGIN&&s.default.createElement(f.default,null),this.props.selectedChannel===h.CREATE&&s.default.createElement(p.default,null)))}}]),t}(s.default.Component);t.default=g},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),c=a(s),f=n(11),d=a(f),p=function(e){function t(e){l(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={error:null,name:"",password:""},n.handleInput=n.handleInput.bind(n),n.loginToChannel=n.loginToChannel.bind(n),n}return i(t,e),u(t,[{key:"handleInput",value:function(e){var t=e.target.name,n=e.target.value;this.setState(r({},t,n))}},{key:"loginToChannel",value:function(e){var t=this;e.preventDefault();var n={method:"POST",body:JSON.stringify({username:this.state.name,password:this.state.password}),headers:new Headers({"Content-Type":"application/json"}),credentials:"include"};(0,d.default)("login",n).then(function(e){var n=e.success,a=e.channelName,r=e.shortChannelId,l=e.channelClaimId,o=e.message;n?t.props.onChannelLogin(a,r,l):t.setState({error:o})}).catch(function(e){e.message?t.setState({error:e.message}):t.setState({error:e})})}},{key:"render",value:function(){return c.default.createElement("form",{id:"channel-login-form"},c.default.createElement("div",{className:"row row--wide row--short"},c.default.createElement("div",{className:"column column--3 column--sml-10"},c.default.createElement("label",{className:"label",htmlFor:"channel-login-name-input"},"Name:")),c.default.createElement("div",{className:"column column--6 column--sml-10"},c.default.createElement("div",{className:"input-text--primary flex-container--row flex-container--left-bottom"},c.default.createElement("span",null,"@"),c.default.createElement("input",{type:"text",id:"channel-login-name-input",className:"input-text",name:"name",placeholder:"Your Channel Name",value:this.state.channelName,onChange:this.handleInput})))),c.default.createElement("div",{className:"row row--wide row--short"},c.default.createElement("div",{className:"column column--3 column--sml-10"},c.default.createElement("label",{className:"label",htmlFor:"channel-login-password-input"},"Password:")),c.default.createElement("div",{className:"column column--6 column--sml-10"},c.default.createElement("div",{className:"input-text--primary"},c.default.createElement("input",{type:"password",id:"channel-login-password-input",name:"password",className:"input-text",placeholder:"",value:this.state.channelPassword,onChange:this.handleInput})))),this.state.error?c.default.createElement("p",{className:"info-message--failure"},this.state.error):c.default.createElement("p",{className:"info-message"},"Enter the name and password for your channel"),c.default.createElement("div",{className:"row row--wide"},c.default.createElement("button",{className:"button--primary",onClick:this.loginToChannel},"Authenticate")))}}]),t}(c.default.Component);t.default=p},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),c=a(s),f=n(20),d=a(f),p=n(11),m=a(p),h=function(e){function t(e){l(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={error:null,channel:"",password:"",status:null},n.handleChannelInput=n.handleChannelInput.bind(n),n.handleInput=n.handleInput.bind(n),n.createChannel=n.createChannel.bind(n),n}return i(t,e),u(t,[{key:"cleanseChannelInput",value:function(e){return e=e.replace(/\s+/g,"-"),e=e.replace(/[^A-Za-z0-9-]/g,"")}},{key:"handleChannelInput",value:function(e){var t=e.target.value;t=this.cleanseChannelInput(t),this.setState({channel:t}),t?this.updateIsChannelAvailable(t):this.setState({error:"Please enter a channel name"})}},{key:"handleInput",value:function(e){var t=e.target.name,n=e.target.value;this.setState(r({},t,n))}},{key:"updateIsChannelAvailable",value:function(e){var t=this,n="@"+e;(0,m.default)("/api/channel/availability/"+n).then(function(e){e?t.setState({error:null}):t.setState({error:"That channel has already been claimed"})}).catch(function(e){t.setState({error:e.message})})}},{key:"checkIsChannelAvailable",value:function(e){var t="@"+e;return new Promise(function(e,n){(0,m.default)("/api/channel/availability/"+t).then(function(t){if(!t)return n(new Error("That channel has already been claimed"));e()}).catch(function(e){n(e)})})}},{key:"checkIsPasswordProvided",value:function(){var e=this.state.password;return new Promise(function(t,n){if(!e||e.length<1)return n(new Error("Please provide a password"));t()})}},{key:"makePublishChannelRequest",value:function(e,t){var n={method:"POST",body:JSON.stringify({username:e,password:t}),headers:new Headers({"Content-Type":"application/json"}),credentials:"include"};return new Promise(function(e,t){(0,m.default)("/signup",n).then(function(t){return e(t)}).catch(function(e){t(new Error("Unfortunately, we encountered an error while creating your channel. Please let us know in Discord! "+e.message))})})}},{key:"createChannel",value:function(e){var t=this;e.preventDefault(),this.checkIsPasswordProvided().then(function(){return t.checkIsChannelAvailable(t.state.channel,t.state.password)}).then(function(){return t.setState({status:"We are publishing your new channel. Sit tight..."}),t.makePublishChannelRequest(t.state.channel,t.state.password)}).then(function(e){t.setState({status:null}),t.props.onChannelLogin(e.channelName,e.shortChannelId,e.channelClaimId)}).catch(function(e){t.setState({error:e.message,status:null})})}},{key:"render",value:function(){return c.default.createElement("div",null,this.state.status?c.default.createElement("div",null,c.default.createElement("p",{className:"fine-print"},this.state.status),c.default.createElement(d.default,{size:12})):c.default.createElement("form",{id:"publish-channel-form"},c.default.createElement("div",{className:"row row--wide row--short"},c.default.createElement("div",{className:"column column--3 column--sml-10"},c.default.createElement("label",{className:"label",htmlFor:"new-channel-name"},"Name:")),c.default.createElement("div",{className:"column column--6 column--sml-10"},c.default.createElement("div",{className:"input-text--primary flex-container--row flex-container--left-bottom span--relative"},c.default.createElement("span",null,"@"),c.default.createElement("input",{type:"text",name:"channel",id:"new-channel-name",className:"input-text",placeholder:"exampleChannelName",value:this.state.channel,onChange:this.handleChannelInput}),this.state.channel&&!this.state.error&&c.default.createElement("span",{id:"input-success-channel-name",className:"info-message--success span--absolute"},"✓"),this.state.error&&c.default.createElement("span",{id:"input-success-channel-name",className:"info-message--failure span--absolute"},"✖")))),c.default.createElement("div",{className:"row row--wide row--short"},c.default.createElement("div",{className:"column column--3 column--sml-10"},c.default.createElement("label",{className:"label",htmlFor:"new-channel-password"},"Password:")),c.default.createElement("div",{className:"column column--6 column--sml-10"},c.default.createElement("div",{className:"input-text--primary"},c.default.createElement("input",{type:"password",name:"password",id:"new-channel-password",className:"input-text",placeholder:"",value:this.state.password,onChange:this.handleInput})))),this.state.error?c.default.createElement("p",{className:"info-message--failure"},this.state.error):c.default.createElement("p",{className:"info-message"},"Choose a name and password for your channel"),c.default.createElement("div",{className:"row row--wide"},c.default.createElement("button",{className:"button--primary",onClick:this.createChannel},"Create Channel"))))}}]),t}(c.default.Component);t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(a),l=function(){return r.default.createElement("span",{className:"progress-bar progress-bar--active"},"| ")};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(a),l=function(){return r.default.createElement("span",{className:"progress-bar progress-bar--inactive"},"| ")};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(5),l=n(119),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.publish;return{status:t.status.status,message:t.status.message}},u={clearFile:r.clearFile};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(20),f=a(c),d=n(120),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(d),m=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props,t=e.status,n=e.message,a=e.clearFile;return s.default.createElement("div",{className:"row row--tall flex-container--column flex-container--center-center"},t===p.LOAD_START&&s.default.createElement("div",{className:"row align-content-center"},s.default.createElement("p",null,"File is loading to server"),s.default.createElement("p",{className:"blue"},"0%")),t===p.LOADING&&s.default.createElement("div",null,s.default.createElement("div",{className:"row align-content-center"},s.default.createElement("p",null,"File is loading to server"),s.default.createElement("p",{className:"blue"},n))),t===p.PUBLISHING&&s.default.createElement("div",{className:"row align-content-center"},s.default.createElement("p",null,"Upload complete. Your file is now being published on the blockchain..."),s.default.createElement(f.default,{size:12}),s.default.createElement("p",null,"Curious what magic is happening here? ",s.default.createElement("a",{className:"link--primary",target:"blank",href:"https://lbry.io/faq/what-is-lbry"},"Learn more."))),t===p.SUCCESS&&s.default.createElement("div",{className:"row align-content-center"},s.default.createElement("p",null,"Your publish is complete! You are being redirected to it now."),s.default.createElement("p",null,"If you are not automatically redirected, ",s.default.createElement("a",{className:"link--primary",target:"_blank",href:n},"click here."))),t===p.FAILED&&s.default.createElement("div",{className:"row align-content-center"},s.default.createElement("p",null,"Something went wrong..."),s.default.createElement("p",null,s.default.createElement("strong",null,n)),s.default.createElement("p",null,"For help, post the above error text in the #speech channel on the ",s.default.createElement("a",{className:"link--primary",href:"https://discord.gg/YjYbwhS",target:"_blank"},"lbry discord")),s.default.createElement("button",{className:"button--secondary",onClick:a},"Reset")))}}]),t}(s.default.Component);t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LOAD_START="LOAD_START",t.LOADING="LOADING",t.PUBLISHING="PUBLISHING",t.SUCCESS="SUCCESS",t.FAILED="FAILED"},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(7),f=a(c),d=n(9),p=a(d),m=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){return s.default.createElement("div",null,s.default.createElement(p.default,{pageTitle:"About",pageUri:"about"}),s.default.createElement(f.default,null),s.default.createElement("div",{className:"row row--padded"},s.default.createElement("div",{className:"column column--5 column--med-10 align-content-top"},s.default.createElement("div",{className:"column column--8 column--med-10"},s.default.createElement("p",{className:"pull-quote"},"Spee.ch is an open-source project. Please contribute to the existing site, or fork it and make your own."),s.default.createElement("p",null,s.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://twitter.com/spee_ch"},"TWITTER")),s.default.createElement("p",null,s.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://github.com/lbryio/spee.ch"},"GITHUB")),s.default.createElement("p",null,s.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://discord.gg/YjYbwhS"},"DISCORD CHANNEL")),s.default.createElement("p",null,s.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://github.com/lbryio/spee.ch/blob/master/README.md"},"DOCUMENTATION")))),s.default.createElement("div",{className:"column column--5 column--med-10 align-content-top"},s.default.createElement("div",{className:"column column--8 column--med-10"},s.default.createElement("p",null,"Spee.ch is a media-hosting site that reads from and publishes content to the ",s.default.createElement("a",{className:"link--primary",href:"https://lbry.io"},"LBRY")," blockchain."),s.default.createElement("p",null,"Spee.ch is a hosting service, but with the added benefit that it stores your content on a decentralized network of computers -- the LBRY network. This means that your images are stored in multiple locations without a single point of failure."),s.default.createElement("h3",null,"Contribute"),s.default.createElement("p",null,"If you have an idea for your own spee.ch-like site on top of LBRY, fork our ",s.default.createElement("a",{className:"link--primary",href:"https://github.com/lbryio/spee.ch"},"github repo")," and go to town!"),s.default.createElement("p",null,"If you want to improve spee.ch, join our ",s.default.createElement("a",{className:"link--primary",href:"https://discord.gg/YjYbwhS"},"discord channel")," or solve one of our ",s.default.createElement("a",{className:"link--primary",href:"https://github.com/lbryio/spee.ch/issues"},"github issues"),".")))))}}]),t}(s.default.Component);t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(123),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=function(e){return{loggedInChannelName:e.channel.loggedInChannel.name}};t.default=(0,a.connect)(o,null)(l.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(4),f=n(9),d=a(f),p=n(7),m=a(p),h=n(40),g=a(h),b=n(41),v=a(b),y=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"componentWillReceiveProps",value:function(e){e.loggedInChannelName!==this.props.loggedInChannelName&&this.props.history.push("/")}},{key:"render",value:function(){return s.default.createElement("div",null,s.default.createElement(d.default,{pageTitle:"Login",pageUri:"login"}),s.default.createElement(m.default,null),s.default.createElement("div",{className:"row row--padded"},s.default.createElement("div",{className:"column column--5 column--med-10 align-content-top"},s.default.createElement("div",{className:"column column--8 column--med-10"},s.default.createElement("p",null,"Channels allow you to publish and group content under an identity. You can create a channel for yourself, or share one with like-minded friends. You can create 1 channel, or 100, so whether you're ",s.default.createElement("a",{className:"link--primary",target:"_blank",href:"/@catalonia2017:43dcf47163caa21d8404d9fe9b30f78ef3e146a8"},"documenting important events"),", or making a public repository for ",s.default.createElement("a",{className:"link--primary",target:"_blank",href:"/@catGifs"},"cat gifs")," (password: '1234'), try creating a channel for it!"))),s.default.createElement("div",{className:"column column--5 column--med-10 align-content-top"},s.default.createElement("div",{className:"column column--8 column--med-10"},s.default.createElement("h3",{className:"h3--no-bottom"},"Log in to an existing channel:"),s.default.createElement(g.default,null),s.default.createElement("h3",{className:"h3--no-bottom"},"Create a brand new channel:"),s.default.createElement(v.default,null)))))}}]),t}(s.default.Component);t.default=(0,c.withRouter)(y)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(8),l=n(125),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.show;return{error:t.request.error,requestType:t.request.type}},u={onHandleShowPageUri:r.onHandleShowPageUri};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(21),f=a(c),d=n(126),p=a(d),m=n(129),h=a(m),g=n(135),b=a(g),v=n(42),y=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"componentDidMount",value:function(){this.props.onHandleShowPageUri(this.props.match.params)}},{key:"componentWillReceiveProps",value:function(e){e.match.params!==this.props.match.params&&this.props.onHandleShowPageUri(e.match.params)}},{key:"render",value:function(){var e=this.props,t=e.error,n=e.requestType;if(t)return s.default.createElement(f.default,{error:t});switch(n){case v.CHANNEL:return s.default.createElement(b.default,null);case v.ASSET_LITE:return s.default.createElement(p.default,null);case v.ASSET_DETAILS:return s.default.createElement(h.default,null);default:return s.default.createElement("p",null,"loading...")}}}]),t}(s.default.Component);t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(127),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=function(e){var t=e.show,n=t.request.id,a=void 0,r=t.requestList[n]||null,l=t.assetList;if(r&&l){a=l[r.key]||null}return{asset:a}};t.default=(0,a.connect)(o,null)(l.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(9),f=a(c),d=n(4),p=n(43),m=a(p),h=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props.asset;if(e){var t=e.claimData,n=t.name,a=t.claimId;return s.default.createElement("div",{className:"row row--tall flex-container--column flex-container--center-center show-lite-container"},s.default.createElement(f.default,{pageTitle:n,asset:e}),s.default.createElement(m.default,null),s.default.createElement(d.Link,{id:"asset-boilerpate",className:"link--primary fine-print",to:"/"+a+"/"+n},"hosted via Spee.ch"))}return s.default.createElement("div",{className:"row row--tall row--padded flex-container--column flex-container--center-center"},s.default.createElement("p",null,"loading asset data..."))}}]),t}(s.default.Component);t.default=h},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(20),f=a(c),d=n(36),p=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this.props.asset.claimData,t=e.name,n=e.claimId;this.props.onFileRequest(t,n)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.error,a=e.asset.claimData,r=a.name,l=a.claimId,o=a.contentType,i=a.fileExt,u=a.thumbnail;return s.default.createElement("div",{id:"asset-display-component"},t===d.LOCAL_CHECK&&s.default.createElement("div",null,s.default.createElement("p",null,"Checking to see if Spee.ch has your asset locally...")),t===d.UNAVAILABLE&&s.default.createElement("div",null,s.default.createElement("p",null,"Sit tight, we're searching the LBRY blockchain for your asset!"),s.default.createElement(f.default,{size:12}),s.default.createElement("p",null,"Curious what magic is happening here? ",s.default.createElement("a",{className:"link--primary",target:"blank",href:"https://lbry.io/faq/what-is-lbry"},"Learn more."))),t===d.ERROR&&s.default.createElement("div",null,s.default.createElement("p",null,"Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the below error message in the ",s.default.createElement("a",{className:"link--primary",href:"https://discord.gg/YjYbwhS",target:"_blank"},"LBRY discord"),"."),s.default.createElement("i",null,s.default.createElement("p",{id:"error-message"},n))),t===d.AVAILABLE&&function(){switch(o){case"image/jpeg":case"image/jpg":case"image/png":case"image/gif":return s.default.createElement("img",{className:"asset",src:"/"+l+"/"+r+"."+i,alt:r});case"video/mp4":return s.default.createElement("video",{className:"asset video",controls:!0,poster:u},s.default.createElement("source",{src:"/"+l+"/"+r+"."+i}),s.default.createElement("p",null,"Your browser does not support the ",s.default.createElement("code",null,"video")," element."));default:return s.default.createElement("p",null,"Unsupported file type")}}())}}]),t}(s.default.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(130),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=function(e){var t=e.show,n=t.request.id,a=void 0,r=t.requestList[n]||null,l=t.assetList;if(r&&l){a=l[r.key]||null}return{asset:a}};t.default=(0,a.connect)(o,null)(l.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(9),f=a(c),d=n(7),p=a(d),m=n(21),h=a(m),g=n(131),b=a(g),v=n(43),y=a(v),E=n(133),w=a(E),_=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props.asset;if(e){var t=e.claimData.name;return s.default.createElement("div",null,s.default.createElement(f.default,{pageTitle:t+" - details",asset:e}),s.default.createElement(p.default,null),s.default.createElement("div",{className:"row row--tall row--padded"},s.default.createElement("div",{className:"column column--10"},s.default.createElement(b.default,null)),s.default.createElement("div",{className:"column column--5 column--sml-10 align-content-top"},s.default.createElement("div",{className:"row row--padded show-details-container"},s.default.createElement(y.default,null))),s.default.createElement("div",{className:"column column--5 column--sml-10 align-content-top"},s.default.createElement("div",{className:"row row--padded"},s.default.createElement(w.default,null)))),"}")}return s.default.createElement(h.default,{error:"loading asset data..."})}}]),t}(s.default.Component);t.default=_},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(132),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(13),i=function(e){var t=e.show;return{title:(0,o.selectAsset)(t).claimData.title}};t.default=(0,a.connect)(i,null)(l.default)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(a),l=function(e){var t=e.title;return r.default.createElement("div",null,r.default.createElement("span",{className:"text--large"},t))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(134),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(13),i=function(e){var t=e.show;return{asset:(0,o.selectAsset)(t)}};t.default=(0,a.connect)(i,null)(l.default)},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 l(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 o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(0),u=function(e){return e&&e.__esModule?e:{default:e}}(i),s=n(4),c=function(e){function t(e){a(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.copyToClipboard=n.copyToClipboard.bind(n),n}return l(t,e),o(t,[{key:"copyToClipboard",value:function(e){var t=e.target.dataset.elementtocopy;document.getElementById(t).select();try{document.execCommand("copy")}catch(e){this.setState({error:"Oops, unable to copy"})}}},{key:"render",value:function(){var e=this.props.asset,t=e.shortId,n=e.claimData,a=n.channelName,r=n.certificateId,l=n.description,o=n.name,i=n.claimId,c=n.fileExt,f=n.contentType,d=n.thumbnail,p=n.host;return u.default.createElement("div",null,a&&u.default.createElement("div",{className:"row row--padded row--wide row--no-top"},u.default.createElement("div",{className:"column column--2 column--med-10"},u.default.createElement("span",{className:"text"},"Channel:")),u.default.createElement("div",{className:"column column--8 column--med-10"},u.default.createElement("span",{className:"text"},u.default.createElement(s.Link,{to:"/"+a+":"+r},a)))),l&&u.default.createElement("div",{className:"row row--padded row--wide row--no-top"},u.default.createElement("span",{className:"text"},l)),u.default.createElement("div",{id:"show-share-buttons"},u.default.createElement("div",{className:"row row--padded row--wide row--no-top"},u.default.createElement("div",{className:"column column--2 column--med-10"},u.default.createElement("span",{className:"text"},"Share:")),u.default.createElement("div",{className:"column column--8 column--med-10"},u.default.createElement("div",{className:"row row--short row--wide flex-container--row flex-container--space-between-bottom flex-container--wrap"},u.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://twitter.com/intent/tweet?text="+p+"/"+t+"/"+o},"twitter"),u.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://www.facebook.com/sharer/sharer.php?u="+p+"/"+t+"/"+o},"facebook"),u.default.createElement("a",{className:"link--primary",target:"_blank",href:"http://tumblr.com/widgets/share/tool?canonicalUrl="+p+"/"+t+"/"+o},"tumblr"),u.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://www.reddit.com/submit?url="+p+"/"+t+"/"+o+"&title="+o},"reddit"))))),u.default.createElement("div",{className:"row row--padded row--wide row--no-top"},u.default.createElement("div",{id:"show-short-link"},u.default.createElement("div",{className:"column column--2 column--med-10"},u.default.createElement("span",{className:"text"},"Link:")),u.default.createElement("div",{className:"column column--8 column--med-10"},u.default.createElement("div",{className:"row row--short row--wide"},u.default.createElement("div",{className:"column column--7"},u.default.createElement("div",{className:"input-error",id:"input-error-copy-short-link",hidden:"true"},"error here"),u.default.createElement("input",{type:"text",id:"short-link",className:"input-disabled input-text--full-width",readOnly:!0,spellCheck:"false",value:p+"/"+t+"/"+o+"."+c,onClick:this.select})),u.default.createElement("div",{className:"column column--1"}),u.default.createElement("div",{className:"column column--2"},u.default.createElement("button",{className:"button--primary button--wide","data-elementtocopy":"short-link",onClick:this.copyToClipboard},"copy"))))),u.default.createElement("div",{id:"show-embed-code"},u.default.createElement("div",{className:"column column--2 column--med-10"},u.default.createElement("span",{className:"text"},"Embed:")),u.default.createElement("div",{className:"column column--8 column--med-10"},u.default.createElement("div",{className:"row row--short row--wide"},u.default.createElement("div",{className:"column column--7"},u.default.createElement("div",{className:"input-error",id:"input-error-copy-embed-text",hidden:"true"},"error here"),"video/mp4"===f?u.default.createElement("input",{type:"text",id:"embed-text",className:"input-disabled input-text--full-width",readOnly:!0,onClick:this.select,spellCheck:"false",value:'<video width="100%" controls poster="'+d+'" src="'+p+"/"+i+"/"+o+"."+c+'"/></video>'}):u.default.createElement("input",{type:"text",id:"embed-text",className:"input-disabled input-text--full-width",readOnly:!0,onClick:this.select,spellCheck:"false",value:'<img src="'+p+"/"+i+"/"+o+"."+c+'"/>'})),u.default.createElement("div",{className:"column column--1"}),u.default.createElement("div",{className:"column column--2"},u.default.createElement("button",{className:"button--primary button--wide","data-elementtocopy":"embed-text",onClick:this.copyToClipboard},"copy")))))),u.default.createElement("div",{className:"flex-container--row flex-container--space-between-bottom"},u.default.createElement(s.Link,{className:"link--primary",to:"/"+t+"/"+o+"."+c},u.default.createElement("span",{className:"text"},"Direct Link")),u.default.createElement("a",{className:"link--primary",href:p+"/"+i+"/"+o+"."+c,download:o},"Download"),u.default.createElement("a",{className:"link--primary",target:"_blank",href:"https://lbry.io/dmca"},"Report")))}}]),t}(u.default.Component);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(136),l=function(e){return e&&e.__esModule?e:{default:e}}(r),o=function(e){var t=e.show,n=t.request.id,a=t.requestList[n]||null,r=void 0;if(a){var l=a.key;r=t.channelList[l]||null}return{channel:r}};t.default=(0,a.connect)(o,null)(l.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(9),f=a(c),d=n(21),p=a(d),m=n(7),h=a(m),g=n(137),b=a(g),v=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){var e=this.props.channel;if(e){var t=e.name,n=e.longId,a=e.shortId;return s.default.createElement("div",null,s.default.createElement(f.default,{pageTitle:t,channel:e}),s.default.createElement(h.default,null),s.default.createElement("div",{className:"row row--tall row--padded"},s.default.createElement("div",{className:"column column--10"},s.default.createElement("h2",null,"channel name: ",t),s.default.createElement("p",{className:"fine-print"},"full channel id: ",n),s.default.createElement("p",{className:"fine-print"},"short channel id: ",a)),s.default.createElement("div",{className:"column column--10"},s.default.createElement(b.default,null))))}return s.default.createElement(p.default,{error:"loading channel data..."})}}]),t}(s.default.Component);t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),r=n(8),l=n(138),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=function(e){var t=e.show,n=t.requestList[t.request.id],a=n.key;return{channelKey:a,channel:t.channelList[a]||null}},u={onUpdateChannelClaims:r.onUpdateChannelClaims};t.default=(0,a.connect)(i,u)(o.default)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(139),f=a(c),d=function(e){function t(e){r(this,t);var n=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.showNextResultsPage=n.showNextResultsPage.bind(n),n.showPreviousResultsPage=n.showPreviousResultsPage.bind(n),n}return o(t,e),i(t,[{key:"showPreviousResultsPage",value:function(){var e=this.props.channel.claimsData.currentPage,t=parseInt(e)-1;this.showNewPage(t)}},{key:"showNextResultsPage",value:function(){var e=this.props.channel.claimsData.currentPage,t=parseInt(e)+1;this.showNewPage(t)}},{key:"showNewPage",value:function(e){var t=this.props,n=t.channelKey,a=t.channel,r=a.name,l=a.longId;this.props.onUpdateChannelClaims(n,r,l,e)}},{key:"render",value:function(){var e=this.props.channel.claimsData,t=e.claims,n=e.currentPage,a=e.totalPages;return s.default.createElement("div",{className:"row row--tall"},t.length>0?s.default.createElement("div",null,t.map(function(e,t){return s.default.createElement(f.default,{claimData:e,key:e.name+"-"+t})}),s.default.createElement("div",null,n>1&&s.default.createElement("button",{className:"button--secondary",onClick:this.showPreviousResultsPage},"Previous Page"),n<a&&s.default.createElement("button",{className:"button--secondary",onClick:this.showNextResultsPage},"Next Page"))):s.default.createElement("p",null,"There are no claims in this channel"))}}]),t}(s.default.Component);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(a),l=n(4),o=n(3),i=o.assetDefaults.thumbnail,u=function(e){var t=e.claimData,n=t.name,a=t.claimId,o=t.fileExt,u=t.contentType,s=t.thumbnail,c=a+"/"+n+"."+o,f="/"+a+"/"+n;return r.default.createElement("div",{className:"asset-holder"},r.default.createElement(l.Link,{to:f},function(){switch(u){case"image/jpeg":case"image/jpg":case"image/png":case"image/gif":return r.default.createElement("img",{className:"asset-preview",src:c,alt:n});case"video/mp4":return r.default.createElement("img",{className:"asset-preview video",src:s||i,alt:n});default:return r.default.createElement("p",null,"unsupported file type")}}()))};t.default=u},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 o(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 i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),s=a(u),c=n(7),f=a(c),d=n(14),p=a(d),m=n(3),h=m.details,g=h.title,b=h.host,v=function(e){function t(){return r(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),i(t,[{key:"render",value:function(){return s.default.createElement("div",null,s.default.createElement(p.default,null,s.default.createElement("title",null,g," - 404"),s.default.createElement("link",{rel:"canonical",href:b+"/404"})),s.default.createElement(f.default,null),s.default.createElement("div",{className:"row row--padded"},s.default.createElement("h2",null,"404"),s.default.createElement("p",null,"That page does not exist")))}}]),t}(s.default.Component);t.default=v},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(17),l=r.sendGAServeEvent,o=n(142),i=o.determineResponseType,u=o.flipClaimNameAndIdForBackwardsCompatibility,s=o.logRequestData,c=o.getClaimIdAndServeAsset,f=n(143),d=n(144);e.exports=function(e){e.get("/:identifier/:claim",function(e,t){var n=e.headers,r=e.ip,o=e.originalUrl,p=e.params,m=void 0;try{m=f.parseModifier(p.claim).hasFileExtension}catch(e){return t.status(400).json({success:!1,message:e.message})}var h=i(m,n);if("SERVE"!==h)return d(e,t);l(n,r,o);var g=void 0;try{g=f.parseClaim(p.claim).claimName}catch(e){return t.status(400).json({success:!1,message:e.message})}var b=void 0,v=void 0,y=void 0,E=void 0;try{var w=f.parseIdentifier(p.identifier);b=w.isChannel,v=w.channelName,y=w.channelClaimId,E=w.claimId}catch(e){return t.status(400).json({success:!1,message:e.message})}if(!b){var _=u(E,g),C=a(_,2);E=C[0],g=C[1]}s(h,g,v,E),c(v,y,g,E,o,r,t)}),e.get("/:claim",function(e,t){var n=e.headers,a=e.ip,r=e.originalUrl,o=e.params,u=void 0;try{u=f.parseModifier(o.claim).hasFileExtension}catch(e){return t.status(400).json({success:!1,message:e.message})}var p=i(u,n);if("SERVE"!==p)return d(e,t);l(n,a,r);var m=void 0;try{m=f.parseClaim(o.claim).claimName}catch(e){return t.status(400).json({success:!1,message:e.message})}s(p,m,null,null),c(null,null,m,null,r,a,t)})}},function(e,t,n){"use strict";function a(e){var t=e.accept;return t&&t.match(/text\/html/)}function r(e){return e["user-agent"]&&e["user-agent"].match(/Mozilla/)}function l(e){var t=e.accept,n=e.range,a=t&&t.match(/image\/.*/)&&!t.match(/text\/html/)&&!t.match(/text\/\*/),r=t&&n;return a||r}function o(e){return 40===e.length&&!/[^A-Za-z0-9]/g.test(e)}function i(e){return 1===e.length}function u(e){return o(e)||i(e)}function s(e,t,n){return p(e,t).then(function(a){if(a===g)return n.status(307).redirect("/api/claim/get/"+t+"/"+e);var r=a.filePath,l=a.fileType;c.verbose("serving file: "+r);var o={headers:{"X-Content-Type-Options":"nosniff","Content-Type":l||"image/jpeg"}};n.status(200).sendFile(r,o)}).catch(function(e){throw e})}var c=n(2),f=n(29),d=f.getClaimId,p=f.getLocalFileRecord,m=n(28),h=m.handleErrorResponse,g="NO_FILE";e.exports={getClaimIdAndServeAsset:function(e,t,n,a,r,l,o){d(e,t,n,a).then(function(e){return"NO_CLAIM"===e?o.status(404).json({success:!1,message:"no claim id could be found"}):"NO_CHANNEL"===e?o.status(404).json({success:!1,message:"no channel id could be found"}):void s(e,n,o)}).catch(function(e){h(r,l,e,o)})},determineResponseType:function(e,t){var n=void 0;return e?(n="SERVE",a(t)&&(n="SHOW")):(n="SHOW",l(t)&&r(t)&&(c.debug("Show request came from browser but wants an image/video. Changing response to serve..."),n="SERVE")),n},flipClaimNameAndIdForBackwardsCompatibility:function(e,t){if(u(t)&&!u(e)){var n=t;t=e,e=n}return[e,t]},logRequestData:function(e,t,n,a){c.debug("responseType ===",e),c.debug("claim name === ",t),c.debug("channel name ===",n),c.debug("claim id ===",a)}}},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=n(2);e.exports={REGEXP_INVALID_CLAIM:/[^A-Za-z0-9-]/g,REGEXP_INVALID_CHANNEL:/[^A-Za-z0-9-@]/g,REGEXP_ADDRESS:/^b(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/,CHANNEL_CHAR:"@",parseIdentifier:function(t){r.debug("parsing identifier:",t);var n=new RegExp("([^:$#/]*)([:$#]?)([^/]*)"),l=n.exec(t).map(function(e){return e||null}),o=a(l,4),i=o[0],u=o[1],s=o[2],c=o[3];if(r.debug(i+", "+u+", "+s+", "+c),!u)throw new Error('Check your url. No channel name provided before "'+s+'"');var f=u.startsWith(e.exports.CHANNEL_CHAR),d=f?u:null,p=void 0;if(f){if(!d)throw new Error("No channel name after @.");var m=d.match(e.exports.REGEXP_INVALID_CHANNEL);if(m)throw new Error("Invalid characters in channel name: "+m.join(", ")+".")}else p=u;var h=void 0;if(s){if(!c)throw new Error('No modifier provided after separator "'+s+'"');if(":"!==s)throw new Error('The "'+s+'" modifier is not currently supported');h=c}return{isChannel:f,channelName:d,channelClaimId:h,claimId:p}},parseClaim:function(t){r.debug("parsing name:",t);var n=new RegExp("([^:$#/.]*)([:$#.]?)([^/]*)"),l=n.exec(t).map(function(e){return e||null}),o=a(l,4),i=o[0],u=o[1],s=o[2],c=o[3];if(r.debug(i+", "+u+", "+s+", "+c),!u)throw new Error("No claim name provided before .");var f=u.match(e.exports.REGEXP_INVALID_CLAIM);if(f)throw new Error("Invalid characters in claim name: "+f.join(", ")+".");if(s){if(!c)throw new Error("No file extension provided after separator "+s+".");if("."!==s)throw new Error("The "+s+" modifier is not supported in the claim name")}return{claimName:u}},parseModifier:function(e){r.debug("parsing modifier:",e);var t=new RegExp("([^:$#/.]*)([:$#.]?)([^/]*)"),n=t.exec(e).map(function(e){return e||null}),l=a(n,4),o=l[0],i=l[1],u=l[2],s=l[3];r.debug(o+", "+i+", "+u+", "+s);var c=!1;return u&&(c=!0),{hasFileExtension:c}}}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(0),l=a(r),o=n(31),i=n(18),u=n(32),s=a(u),c=n(1),f=n(4),d=n(37),p=a(d),m=n(38),h=a(m),g=n(44),b=a(g),v=n(145),y=a(v),E=n(15),w=n(146),_=n(8),C=n(14),N=a(C),I=function(e,t){return regeneratorRuntime.mark(function n(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,E.call)(e,t);case 2:case"end":return n.stop()}},n,this)})};e.exports=function(e,t){var n={},a=(0,y.default)(),r=(0,i.applyMiddleware)(a),u=(0,i.createStore)(s.default,r),d=(0,_.onHandleShowPageUri)(e.params),m=I(w.handleShowPageUri,d);a.run(m).done.then(function(){var a=(0,o.renderToString)(l.default.createElement(c.Provider,{store:u},l.default.createElement(f.StaticRouter,{location:e.url,context:n},l.default.createElement(p.default,null,l.default.createElement(h.default,null))))),r=N.default.renderStatic();if(n.url)return t.redirect(301,n.url);var i=u.getState();t.send((0,b.default)(r,a,i))})}},function(e,t){e.exports=require("redux-saga")},function(e,t,n){"use strict";function a(e,t){var n,a,r,l,o,u,s,d;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:n=void 0,a=void 0,r=void 0,l=void 0,o=void 0,u=void 0,p.prev=1,s=m.default.parseIdentifier(e),n=s.isChannel,a=s.channelName,r=s.channelClaimId,l=s.claimId,d=m.default.parseClaim(t),o=d.claimName,u=d.extension,p.next=17;break;case 12:return p.prev=12,p.t0=p.catch(1),p.next=16,(0,i.put)((0,c.onRequestError)(p.t0.message));case 16:return p.abrupt("return",p.sent);case 17:if(!n){p.next=21;break}return p.next=20,(0,i.call)(f.newAssetRequest,(0,c.onNewAssetRequest)(o,null,a,r,u));case 20:return p.abrupt("return",p.sent);case 21:return p.next=24,(0,i.call)(f.newAssetRequest,(0,c.onNewAssetRequest)(o,l,null,null,u));case 24:case"end":return p.stop()}},h,this,[[1,12]])}function r(e){var t,n,a,r,l,o,u;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:t=void 0,n=void 0,a=void 0,s.prev=1,r=m.default.parseIdentifier(e),t=r.isChannel,n=r.channelName,a=r.channelClaimId,s.next=13;break;case 8:return s.prev=8,s.t0=s.catch(1),s.next=12,(0,i.put)((0,c.onRequestError)(s.t0.message));case 12:return s.abrupt("return",s.sent);case 13:if(!t){s.next=17;break}return s.next=16,(0,i.call)(d.newChannelRequest,(0,c.onNewChannelRequest)(n,a));case 16:return s.abrupt("return",s.sent);case 17:l=void 0,o=void 0,s.prev=18,u=m.default.parseClaim(e),l=u.claimName,o=u.extension,s.next=29;break;case 24:return s.prev=24,s.t1=s.catch(18),s.next=28,(0,i.put)((0,c.onRequestError)(s.t1.message));case 28:return s.abrupt("return",s.sent);case 29:return s.next=31,(0,i.call)(f.newAssetRequest,(0,c.onNewAssetRequest)(l,null,null,null,o));case 31:case"end":return s.stop()}},g,this,[[1,8],[18,24]])}function l(e){var t,n,l;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(t=e.data,n=t.identifier,l=t.claim,!n){o.next=5;break}return o.next=4,(0,i.call)(a,n,l);case 4:return o.abrupt("return",o.sent);case 5:return o.next=7,(0,i.call)(r,l);case 7:case"end":return o.stop()}},b,this)}function o(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,i.takeLatest)(s.HANDLE_SHOW_URI,l);case 2:case"end":return e.stop()}},v,this)}Object.defineProperty(t,"__esModule",{value:!0}),t.handleShowPageUri=l,t.watchHandleShowPageUri=o;var i=n(15),u=n(12),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(u),c=n(8),f=n(147),d=n(149),p=n(151),m=function(e){return e&&e.__esModule?e:{default:e}}(p),h=regeneratorRuntime.mark(a),g=regeneratorRuntime.mark(r),b=regeneratorRuntime.mark(l),v=regeneratorRuntime.mark(o)},function(e,t,n){"use strict";function a(e){var t,n,a,r,o,i,d,p,m,h,g,b,v;return regeneratorRuntime.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return t=e.data,n=t.requestType,a=t.requestId,r=t.name,o=t.modifier,f.next=3,(0,l.put)((0,u.onRequestUpdate)(n,a));case 3:return f.next=5,(0,l.select)(c.selectShowState);case 5:if(i=f.sent,!i.requestList[a]){f.next=8;break}return f.abrupt("return",null);case 8:return d=void 0,f.prev=9,f.next=12,(0,l.call)(s.getLongClaimId,r,o);case 12:p=f.sent,d=p.data,f.next=21;break;case 16:return f.prev=16,f.t0=f.catch(9),f.next=20,(0,l.put)((0,u.onRequestError)(f.t0.message));case 20:return f.abrupt("return",f.sent);case 21:return m="a#"+r+"#"+d,f.next=24,(0,l.put)((0,u.addRequestToRequestList)(a,null,m));case 24:if(!i.assetList[m]){f.next=26;break}return f.abrupt("return",null);case 26:return h=void 0,f.prev=27,f.next=30,(0,l.call)(s.getShortId,r,d);case 30:g=f.sent,h=g.data,f.next=39;break;case 34:return f.prev=34,f.t1=f.catch(27),f.next=38,(0,l.put)((0,u.onRequestError)(f.t1.message));case 38:return f.abrupt("return",f.sent);case 39:return b=void 0,f.prev=40,f.next=43,(0,l.call)(s.getClaimData,r,d);case 43:v=f.sent,b=v.data,f.next=52;break;case 47:return f.prev=47,f.t2=f.catch(40),f.next=51,(0,l.put)((0,u.onRequestError)(f.t2.message));case 51:return f.abrupt("return",f.sent);case 52:return f.next=54,(0,l.put)((0,u.addAssetToAssetList)(m,null,r,d,h,b));case 54:return f.next=56,(0,l.put)((0,u.onRequestError)(null));case 56:case"end":return f.stop()}},f,this,[[9,16],[27,34],[40,47]])}function r(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.takeLatest)(i.ASSET_REQUEST_NEW,a);case 2:case"end":return e.stop()}},d,this)}Object.defineProperty(t,"__esModule",{value:!0}),t.newAssetRequest=a,t.watchNewAssetRequest=r;var l=n(15),o=n(12),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(o),u=n(8),s=n(148),c=n(13),f=regeneratorRuntime.mark(a),d=regeneratorRuntime.mark(r)},function(e,t,n){"use strict";function a(e,t){var n={};t&&(t.id?n.claimId=t.id:(n.channelName=t.channel.name,n.channelClaimId=t.channel.id)),n.claimName=e;var a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},r=s+"/api/claim/long-id";return(0,i.default)(r,a)}function r(e,t){var n=s+"/api/claim/short-id/"+t+"/"+e;return(0,i.default)(n)}function l(e,t){var n=s+"/api/claim/data/"+e+"/"+t;return(0,i.default)(n)}Object.defineProperty(t,"__esModule",{value:!0}),t.getLongClaimId=a,t.getShortId=r,t.getClaimData=l;var o=n(11),i=function(e){return e&&e.__esModule?e:{default:e}}(o),u=n(3),s=u.details.host},function(e,t,n){"use strict";function a(e){var t,n,a,r,l,o,u,s,m,h,g,b,v;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return t=e.data,n=t.requestType,a=t.requestId,r=t.channelName,l=t.channelId,p.next=3,(0,i.put)((0,c.onRequestUpdate)(n,a));case 3:return p.next=5,(0,i.select)(d.selectShowState);case 5:if(o=p.sent,!o.requestList[a]){p.next=8;break}return p.abrupt("return",null);case 8:return u=void 0,s=void 0,p.prev=9,p.next=12,(0,i.call)(f.getChannelData,r,l);case 12:m=p.sent,h=m.data,u=h.longChannelClaimId,s=h.shortChannelClaimId,p.next=23;break;case 18:return p.prev=18,p.t0=p.catch(9),p.next=22,(0,i.put)((0,c.onRequestError)(p.t0.message));case 22:return p.abrupt("return",p.sent);case 23:return g="c#"+r+"#"+u,p.next=26,(0,i.put)((0,c.addRequestToRequestList)(a,null,g));case 26:if(!o.channelList[g]){p.next=28;break}return p.abrupt("return",null);case 28:return b=void 0,p.prev=29,p.next=32,(0,i.call)(f.getChannelClaims,r,u,1);case 32:v=p.sent,b=v.data,p.next=41;break;case 36:return p.prev=36,p.t1=p.catch(29),p.next=40,(0,i.put)((0,c.onRequestError)(p.t1.message));case 40:return p.abrupt("return",p.sent);case 41:return p.next=43,(0,i.put)((0,c.addNewChannelToChannelList)(g,r,s,u,b));case 43:return p.next=45,(0,i.put)((0,c.onRequestError)(null));case 45:case"end":return p.stop()}},p,this,[[9,18],[29,36]])}function r(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,i.takeLatest)(s.CHANNEL_REQUEST_NEW,a);case 2:case"end":return e.stop()}},m,this)}function l(e){var t,n,a,r,l,o,u;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return t=e.data,n=t.channelKey,a=t.name,r=t.longId,l=t.page,o=void 0,s.prev=2,s.next=5,(0,i.call)(f.getChannelClaims,a,r,l);case 5:u=s.sent,o=u.data,s.next=14;break;case 9:return s.prev=9,s.t0=s.catch(2),s.next=13,(0,i.put)((0,c.onRequestError)(s.t0.message));case 13:return s.abrupt("return",s.sent);case 14:return s.next=16,(0,i.put)((0,c.updateChannelClaims)(n,o));case 16:case"end":return s.stop()}},h,this,[[2,9]])}function o(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,i.takeLatest)(s.CHANNEL_CLAIMS_UPDATE_ASYNC,l);case 2:case"end":return e.stop()}},g,this)}Object.defineProperty(t,"__esModule",{value:!0}),t.newChannelRequest=a,t.watchNewChannelRequest=r,t.watchUpdateChannelClaims=o;var i=n(15),u=n(12),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(u),c=n(8),f=n(150),d=n(13),p=regeneratorRuntime.mark(a),m=regeneratorRuntime.mark(r),h=regeneratorRuntime.mark(l),g=regeneratorRuntime.mark(o)},function(e,t,n){"use strict";function a(e,t){t||(t="none");var n=u+"/api/channel/data/"+e+"/"+t;return(0,o.default)(n)}function r(e,t,n){n||(n=1);var a=u+"/api/channel/claims/"+e+"/"+t+"/"+n;return(0,o.default)(a)}Object.defineProperty(t,"__esModule",{value:!0}),t.getChannelData=a,t.getChannelClaims=r;var l=n(11),o=function(e){return e&&e.__esModule?e:{default:e}}(l),i=n(3),u=i.details.host},function(e,t,n){"use strict";var a=function(){function e(e,t){var n=[],a=!0,r=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(a=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);a=!0);}catch(e){r=!0,l=e}finally{try{!a&&i.return&&i.return()}finally{if(r)throw l}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.exports={REGEXP_INVALID_CLAIM:/[^A-Za-z0-9-]/g,REGEXP_INVALID_CHANNEL:/[^A-Za-z0-9-@]/g,REGEXP_ADDRESS:/^b(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/,CHANNEL_CHAR:"@",parseIdentifier:function(t){var n=new RegExp("([^:$#/]*)([:$#]?)([^/]*)"),r=n.exec(t).map(function(e){return e||null}),l=a(r,4),o=(l[0],l[1]),i=l[2],u=l[3];if(!o)throw new Error('Check your URL. No channel name provided before "'+i+'"');var s=o.startsWith(e.exports.CHANNEL_CHAR),c=s?o:null,f=void 0;if(s){if(!c)throw new Error('Check your URL. No channel name after "@".');var d=c.match(e.exports.REGEXP_INVALID_CHANNEL);if(d)throw new Error('Check your URL. Invalid characters in channel name: "'+d.join(", ")+'".')}else f=o;var p=void 0;if(i){if(!u)throw new Error('Check your URL. No modifier provided after separator "'+i+'"');if(":"!==i)throw new Error('Check your URL. The "'+i+'" modifier is not currently supported');p=u}return{isChannel:s,channelName:c,channelClaimId:p||null,claimId:f||null}},parseClaim:function(t){var n=new RegExp("([^:$#/.]*)([:$#.]?)([^/]*)"),r=n.exec(t).map(function(e){return e||null}),l=a(r,4),o=(l[0],l[1]),i=l[2],u=l[3];if(!o)throw new Error('Check your URL. No claim name provided before "."');var s=o.match(e.exports.REGEXP_INVALID_CLAIM);if(s)throw new Error('Check your URL. Invalid characters in claim name: "'+s.join(", ")+'".');if(i){if(!u)throw new Error('Check your URL. No file extension provided after separator "'+i+'".');if("."!==i)throw new Error('Check your URL. The "'+i+'" separator is not supported in the claim name.')}return{claimName:o,extension:u||null}}}},function(e,t,n){"use strict";var a=n(30);e.exports=function(e){e.use("*",function(e,t){a(e,t)})}}]);
//# sourceMappingURL=index.js.map