UNPKG

@kablamo/react-transcript-editor

Version:

A React component to make transcribing audio and video easier and faster.

1,259 lines (986 loc) 54.5 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 38); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { module.exports = require("react"); /***/ }), /***/ 1: /***/ (function(module, exports) { module.exports = require("prop-types"); /***/ }), /***/ 10: /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}; var memoize = function (fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }; var isOldIE = memoize(function () { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 return window && document && document.all && !window.atob; }); var getTarget = function (target, parent) { if (parent){ return parent.querySelector(target); } return document.querySelector(target); }; var getElement = (function (fn) { var memo = {}; return function(target, parent) { // If passing function in options, then use it for resolve "head" element. // Useful for Shadow Root style i.e // { // insertInto: function () { return document.querySelector("#foo").shadowRoot } // } if (typeof target === 'function') { return target(); } if (typeof memo[target] === "undefined") { var styleTarget = getTarget.call(this, target, parent); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch(e) { styleTarget = null; } } memo[target] = styleTarget; } return memo[target] }; })(); var singleton = null; var singletonCounter = 0; var stylesInsertedAtTop = []; var fixUrls = __webpack_require__(16); module.exports = function(list, options) { if (typeof DEBUG !== "undefined" && DEBUG) { if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; options.attrs = typeof options.attrs === "object" ? options.attrs : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE(); // By default, add <style> tags to the <head> element if (!options.insertInto) options.insertInto = "head"; // By default, add <style> tags to the bottom of the target if (!options.insertAt) options.insertAt = "bottom"; var styles = listToStyles(list, options); addStylesToDom(styles, options); return function update (newList) { var mayRemove = []; for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList, options); addStylesToDom(newStyles, options); } for (var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; }; function addStylesToDom (styles, options) { for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles (list, options) { var styles = []; var newStyles = {}; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement (options, style) { var target = getElement(options.insertInto) if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); } var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; if (options.insertAt === "top") { if (!lastStyleElementInsertedAtTop) { target.insertBefore(style, target.firstChild); } else if (lastStyleElementInsertedAtTop.nextSibling) { target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); } else { target.appendChild(style); } stylesInsertedAtTop.push(style); } else if (options.insertAt === "bottom") { target.appendChild(style); } else if (typeof options.insertAt === "object" && options.insertAt.before) { var nextSibling = getElement(options.insertAt.before, target); target.insertBefore(style, nextSibling); } else { throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); } } function removeStyleElement (style) { if (style.parentNode === null) return false; style.parentNode.removeChild(style); var idx = stylesInsertedAtTop.indexOf(style); if(idx >= 0) { stylesInsertedAtTop.splice(idx, 1); } } function createStyleElement (options) { var style = document.createElement("style"); if(options.attrs.type === undefined) { options.attrs.type = "text/css"; } if(options.attrs.nonce === undefined) { var nonce = getNonce(); if (nonce) { options.attrs.nonce = nonce; } } addAttrs(style, options.attrs); insertStyleElement(options, style); return style; } function createLinkElement (options) { var link = document.createElement("link"); if(options.attrs.type === undefined) { options.attrs.type = "text/css"; } options.attrs.rel = "stylesheet"; addAttrs(link, options.attrs); insertStyleElement(options, link); return link; } function addAttrs (el, attrs) { Object.keys(attrs).forEach(function (key) { el.setAttribute(key, attrs[key]); }); } function getNonce() { if (false) {} return __webpack_require__.nc; } function addStyle (obj, options) { var style, update, remove, result; // If a transform function was defined, run it on the css if (options.transform && obj.css) { result = typeof options.transform === 'function' ? options.transform(obj.css) : options.transform.default(obj.css); if (result) { // If transform returns a value, use that instead of the original css. // This allows running runtime transformations on the css. obj.css = result; } else { // If the transform function returns a falsy value, don't add this css. // This allows conditional loading of css return function() { // noop }; } } if (options.singleton) { var styleIndex = singletonCounter++; style = singleton || (singleton = createStyleElement(options)); update = applyToSingletonTag.bind(null, style, styleIndex, false); remove = applyToSingletonTag.bind(null, style, styleIndex, true); } else if ( obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function" ) { style = createLinkElement(options); update = updateLink.bind(null, style, options); remove = function () { removeStyleElement(style); if(style.href) URL.revokeObjectURL(style.href); }; } else { style = createStyleElement(options); update = applyToTag.bind(null, style); remove = function () { removeStyleElement(style); }; } update(obj); return function updateStyle (newObj) { if (newObj) { if ( newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap ) { return; } update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag (style, index, remove, obj) { var css = remove ? "" : obj.css; if (style.styleSheet) { style.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = style.childNodes; if (childNodes[index]) style.removeChild(childNodes[index]); if (childNodes.length) { style.insertBefore(cssNode, childNodes[index]); } else { style.appendChild(cssNode); } } } function applyToTag (style, obj) { var css = obj.css; var media = obj.media; if(media) { style.setAttribute("media", media) } if(style.styleSheet) { style.styleSheet.cssText = css; } else { while(style.firstChild) { style.removeChild(style.firstChild); } style.appendChild(document.createTextNode(css)); } } function updateLink (link, options, obj) { var css = obj.css; var sourceMap = obj.sourceMap; /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled and there is no publicPath defined then lets turn convertToAbsoluteUrls on by default. Otherwise default to the convertToAbsoluteUrls option directly */ var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; if (options.convertToAbsoluteUrls || autoFixUrls) { css = fixUrls(css); } if (sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = link.href; link.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }), /***/ 16: /***/ (function(module, exports) { /** * When source maps are enabled, `style-loader` uses a link element with a data-uri to * embed the css on the page. This breaks all relative urls because now they are relative to a * bundle instead of the current page. * * One solution is to only use full urls, but that may be impossible. * * Instead, this function "fixes" the relative urls to be absolute according to the current page location. * * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. * */ module.exports = function (css) { // get current location var location = typeof window !== "undefined" && window.location; if (!location) { throw new Error("fixUrls requires window.location"); } // blank or null? if (!css || typeof css !== "string") { return css; } var baseUrl = location.protocol + "//" + location.host; var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); // convert each url(...) /* This regular expression is just a way to recursively match brackets within a string. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens ( = Start a capturing group (?: = Start a non-capturing group [^)(] = Match anything that isn't a parentheses | = OR \( = Match a start parentheses (?: = Start another non-capturing groups [^)(]+ = Match anything that isn't a parentheses | = OR \( = Match a start parentheses [^)(]* = Match anything that isn't a parentheses \) = Match a end parentheses ) = End Group *\) = Match anything and then a close parens ) = Close non-capturing group * = Match anything ) = Close capturing group \) = Match a close parens /gi = Get all matches, not the first. Be case insensitive. */ var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { // strip quotes (if they exist) var unquotedOrigUrl = origUrl .trim() .replace(/^"(.*)"$/, function(o, $1){ return $1; }) .replace(/^'(.*)'$/, function(o, $1){ return $1; }); // already a full url? no change if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { return fullMatch; } // convert the url to a full url var newUrl; if (unquotedOrigUrl.indexOf("//") === 0) { //TODO: should we add protocol? newUrl = unquotedOrigUrl; } else if (unquotedOrigUrl.indexOf("/") === 0) { // path should be relative to the base url newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' } else { // path should be relative to current directory newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' } // send back the fixed url(...) return "url(" + JSON.stringify(newUrl) + ")"; }); // send back the fixed css return fixedCss; }; /***/ }), /***/ 20: /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(51); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(10)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ 25: /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(50); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(10)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = require("@fortawesome/react-fontawesome"); /***/ }), /***/ 38: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: external "react" var external_react_ = __webpack_require__(0); var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_); // EXTERNAL MODULE: external "prop-types" var external_prop_types_ = __webpack_require__(1); var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_); // EXTERNAL MODULE: external "@fortawesome/react-fontawesome" var react_fontawesome_ = __webpack_require__(3); // EXTERNAL MODULE: external "@fortawesome/free-solid-svg-icons" var free_solid_svg_icons_ = __webpack_require__(4); // EXTERNAL MODULE: ./packages/components/settings/Toggle/index.module.css var index_module = __webpack_require__(25); var index_module_default = /*#__PURE__*/__webpack_require__.n(index_module); // CONCATENATED MODULE: ./packages/components/settings/Toggle/index.js function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Toggle_Toggle = /*#__PURE__*/ function (_React$Component) { _inherits(Toggle, _React$Component); function Toggle() { _classCallCheck(this, Toggle); return _possibleConstructorReturn(this, _getPrototypeOf(Toggle).apply(this, arguments)); } _createClass(Toggle, [{ key: "render", value: function render() { return external_react_default.a.createElement("div", { className: index_module_default.a.switchContainer }, external_react_default.a.createElement("label", { className: index_module_default.a.switch }, external_react_default.a.createElement("input", { type: "checkbox", defaultChecked: this.props.defaultValue, onChange: this.props.handleToggle }), external_react_default.a.createElement("span", { className: index_module_default.a.slider }))); } }]); return Toggle; }(external_react_default.a.Component); Toggle_Toggle.propTypes = { handleToggle: external_prop_types_default.a.func, label: external_prop_types_default.a.string, defaultValue: external_prop_types_default.a.bool }; /* harmony default export */ var settings_Toggle = (Toggle_Toggle); // EXTERNAL MODULE: ./packages/components/settings/TimecodeOffset/index.module.css var TimecodeOffset_index_module = __webpack_require__(20); var TimecodeOffset_index_module_default = /*#__PURE__*/__webpack_require__.n(TimecodeOffset_index_module); // EXTERNAL MODULE: ./packages/util/timecode-converter/index.js + 3 modules var timecode_converter = __webpack_require__(5); // CONCATENATED MODULE: ./packages/components/settings/TimecodeOffset/index.js function TimecodeOffset_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { TimecodeOffset_typeof = function _typeof(obj) { return typeof obj; }; } else { TimecodeOffset_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return TimecodeOffset_typeof(obj); } function TimecodeOffset_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function TimecodeOffset_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function TimecodeOffset_createClass(Constructor, protoProps, staticProps) { if (protoProps) TimecodeOffset_defineProperties(Constructor.prototype, protoProps); if (staticProps) TimecodeOffset_defineProperties(Constructor, staticProps); return Constructor; } function TimecodeOffset_possibleConstructorReturn(self, call) { if (call && (TimecodeOffset_typeof(call) === "object" || typeof call === "function")) { return call; } return TimecodeOffset_assertThisInitialized(self); } function TimecodeOffset_getPrototypeOf(o) { TimecodeOffset_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TimecodeOffset_getPrototypeOf(o); } function TimecodeOffset_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function TimecodeOffset_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) TimecodeOffset_setPrototypeOf(subClass, superClass); } function TimecodeOffset_setPrototypeOf(o, p) { TimecodeOffset_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TimecodeOffset_setPrototypeOf(o, p); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var TimecodeOffset_TimecodeOffset = /*#__PURE__*/ function (_React$Component) { TimecodeOffset_inherits(TimecodeOffset, _React$Component); function TimecodeOffset(props) { var _this; TimecodeOffset_classCallCheck(this, TimecodeOffset); _this = TimecodeOffset_possibleConstructorReturn(this, TimecodeOffset_getPrototypeOf(TimecodeOffset).call(this, props)); _defineProperty(TimecodeOffset_assertThisInitialized(_this), "handleChange", function (e) { _this.setState({ timecodeOffset: e.target.value }); }); _defineProperty(TimecodeOffset_assertThisInitialized(_this), "resetTimecodeOffset", function () { var resetTimecodeOffsetValue = 0; if (_this.props.handleAnalyticsEvents !== undefined) { _this.props.handleAnalyticsEvents({ category: 'TimecodeOffset', action: 'resetTimecodeOffset', name: 'resetTimecodeOffset', value: 0 }); } _this.setState({ timecodeOffset: Object(timecode_converter["secondsToTimecode"])(resetTimecodeOffsetValue) }, function () { _this.props.handleSetTimecodeOffset(resetTimecodeOffsetValue); }); }); _defineProperty(TimecodeOffset_assertThisInitialized(_this), "setTimecodeOffset", function () { if (_this.props.handleAnalyticsEvents !== undefined) { _this.props.handleAnalyticsEvents({ category: 'TimecodeOffset', action: 'setTimecodeOffset', name: 'setTimecodeOffset', value: _this.state.timecodeOffset }); } var newCurrentTimeInSeconds = _this.state.timecodeOffset; if (typeof newCurrentTimeInSeconds === 'string' && newCurrentTimeInSeconds.includes(':') && !newCurrentTimeInSeconds.includes('NaN')) { newCurrentTimeInSeconds = Object(timecode_converter["timecodeToSeconds"])(newCurrentTimeInSeconds); } _this.props.handleSetTimecodeOffset(newCurrentTimeInSeconds); }); _this.state = { timecodeOffset: Object(timecode_converter["secondsToTimecode"])(_this.props.timecodeOffset) }; return _this; } TimecodeOffset_createClass(TimecodeOffset, [{ key: "render", value: function render() { return external_react_default.a.createElement("div", { className: TimecodeOffset_index_module_default.a.offsetContainer }, external_react_default.a.createElement("input", { className: TimecodeOffset_index_module_default.a.inputBox, type: "text", value: this.state.timecodeOffset, onChange: this.handleChange, name: "lname" }), external_react_default.a.createElement("span", { className: TimecodeOffset_index_module_default.a.button, onClick: this.resetTimecodeOffset }, external_react_default.a.createElement("u", null, "Reset")), external_react_default.a.createElement("span", null, " | "), external_react_default.a.createElement("span", { className: TimecodeOffset_index_module_default.a.button, onClick: this.setTimecodeOffset }, external_react_default.a.createElement("u", null, "Save"))); } }]); return TimecodeOffset; }(external_react_default.a.Component); TimecodeOffset_TimecodeOffset.propTypes = { handleSetTimecodeOffset: external_prop_types_default.a.func, onChange: external_prop_types_default.a.func, timecodeOffset: external_prop_types_default.a.number, handleAnalyticsEvents: external_prop_types_default.a.func }; /* harmony default export */ var settings_TimecodeOffset = (TimecodeOffset_TimecodeOffset); // EXTERNAL MODULE: ./packages/components/settings/index.module.css var settings_index_module = __webpack_require__(8); var settings_index_module_default = /*#__PURE__*/__webpack_require__.n(settings_index_module); // CONCATENATED MODULE: ./packages/components/settings/index.js function settings_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { settings_typeof = function _typeof(obj) { return typeof obj; }; } else { settings_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return settings_typeof(obj); } function settings_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function settings_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function settings_createClass(Constructor, protoProps, staticProps) { if (protoProps) settings_defineProperties(Constructor.prototype, protoProps); if (staticProps) settings_defineProperties(Constructor, staticProps); return Constructor; } function settings_possibleConstructorReturn(self, call) { if (call && (settings_typeof(call) === "object" || typeof call === "function")) { return call; } return settings_assertThisInitialized(self); } function settings_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function settings_getPrototypeOf(o) { settings_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return settings_getPrototypeOf(o); } function settings_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) settings_setPrototypeOf(subClass, superClass); } function settings_setPrototypeOf(o, p) { settings_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return settings_setPrototypeOf(o, p); } var settings_Settings = /*#__PURE__*/ function (_React$Component) { settings_inherits(Settings, _React$Component); function Settings() { settings_classCallCheck(this, Settings); return settings_possibleConstructorReturn(this, settings_getPrototypeOf(Settings).apply(this, arguments)); } settings_createClass(Settings, [{ key: "render", value: function render() { return external_react_default.a.createElement("div", { className: settings_index_module_default.a.settings }, external_react_default.a.createElement("h2", { className: settings_index_module_default.a.header }, "Settings Panel"), external_react_default.a.createElement("div", { className: settings_index_module_default.a.closeButton, onClick: this.props.handleSettingsToggle }, external_react_default.a.createElement(react_fontawesome_["FontAwesomeIcon"], { icon: free_solid_svg_icons_["faWindowClose"] })), external_react_default.a.createElement("div", { className: settings_index_module_default.a.controlsContainer }, external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Pause While Typing"), external_react_default.a.createElement(settings_Toggle, { defaultValue: this.props.defaultValuePauseWhileTyping, label: 'Pause while typing', handleToggle: this.props.handlePauseWhileTyping })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Scroll Sync"), external_react_default.a.createElement(settings_Toggle, { defaultValue: this.props.defaultValueScrollSync, label: 'ScrollSync', handleToggle: this.props.handleIsScrollIntoViewChange })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Rollback Interval (sec)"), external_react_default.a.createElement("input", { className: settings_index_module_default.a.rollbackValue, type: "number", step: "1", max: "60", min: "1", value: this.props.defaultRollBackValueInSeconds, onChange: this.props.handleRollBackValueInSeconds, name: "lname" })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Show Timecodes"), external_react_default.a.createElement(settings_Toggle, { defaultValue: this.props.showTimecodes, label: 'Hide Timecodes', handleToggle: this.props.handleShowTimecodes })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Show Speaker Labels"), external_react_default.a.createElement(settings_Toggle, { defaultValue: this.props.showSpeakers, label: 'Hide Speaker Labels', handleToggle: this.props.handleShowSpeakers })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.label }, "Display Preview"), external_react_default.a.createElement(settings_Toggle, { defaultValue: this.props.previewIsDisplayed, label: 'Display Preview', handleToggle: this.props.handlePreviewIsDisplayed })), external_react_default.a.createElement("section", { className: settings_index_module_default.a.settingElement }, external_react_default.a.createElement("div", { className: settings_index_module_default.a.timecodeLabel }, "Timecode Offset \u2139"), external_react_default.a.createElement(settings_TimecodeOffset, { timecodeOffset: this.props.timecodeOffset, handleSetTimecodeOffset: this.props.handleSetTimecodeOffset, handleAnalyticsEvents: this.props.handleAnalyticsEvents })))); } }]); return Settings; }(external_react_default.a.Component); settings_Settings.propTypes = { showTimecodes: external_prop_types_default.a.bool, showSpeakers: external_prop_types_default.a.bool, timecodeOffset: external_prop_types_default.a.number, handleShowTimecodes: external_prop_types_default.a.func, handleShowSpeakers: external_prop_types_default.a.func, handleSetTimecodeOffset: external_prop_types_default.a.func, handleSettingsToggle: external_prop_types_default.a.func, handlePauseWhileTyping: external_prop_types_default.a.func, handleIsScrollIntoViewChange: external_prop_types_default.a.func, handleRollBackValueInSeconds: external_prop_types_default.a.func, defaultValueScrollSync: external_prop_types_default.a.bool, defaultValuePauseWhileTyping: external_prop_types_default.a.bool, defaultRollBackValueInSeconds: external_prop_types_default.a.number, previewIsDisplayed: external_prop_types_default.a.bool, handlePreviewIsDisplayed: external_prop_types_default.a.func, // previewViewWidth: PropTypes.string, handleChangePreviewViewWidth: external_prop_types_default.a.func, handleAnalyticsEvents: external_prop_types_default.a.func }; /* harmony default export */ var settings = __webpack_exports__["default"] = (settings_Settings); /***/ }), /***/ 4: /***/ (function(module, exports) { module.exports = require("@fortawesome/free-solid-svg-icons"); /***/ }), /***/ 5: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "secondsToTimecode", function() { return /* reexport */ src_secondsToTimecode; }); __webpack_require__.d(__webpack_exports__, "timecodeToSeconds", function() { return /* binding */ timecode_converter_timecodeToSeconds; }); __webpack_require__.d(__webpack_exports__, "shortTimecode", function() { return /* binding */ timecode_converter_shortTimecode; }); // CONCATENATED MODULE: ./packages/util/timecode-converter/src/secondsToTimecode.js /** * Raised in this comment https://github.com/bbc/react-transcript-editor/pull/9 * abstracted from https://github.com/bbc/newslabs-cdn/blob/master/js/20-bbcnpf.utils.js * In broadcast VIDEO, timecode is NOT hh:mm:ss:ms, it's hh:mm:ss:ff where ff is frames, * dependent on the framerate of the media concerned. * `hh:mm:ss:ff` */ /** * Helper function * Rounds to the 14milliseconds boundaries * Time in video can only "exist in" 14milliseconds boundaries. * This makes it possible for the HTML5 player to be frame accurate. * @param {*} seconds * @param {*} fps */ var normalisePlayerTime = function normalisePlayerTime(seconds, fps) { return Number((1.0 / fps * Math.floor(Number((fps * seconds).toPrecision(12)))).toFixed(2)); }; /* * @param {*} seconds * @param {*} fps */ var secondsToTimecode = function secondsToTimecode(seconds, framePerSeconds) { // written for PAL non-drop timecode var fps = 25; if (framePerSeconds !== undefined) { fps = framePerSeconds; } var normalisedSeconds = normalisePlayerTime(seconds, fps); var wholeSeconds = Math.floor(normalisedSeconds); var frames = ((normalisedSeconds - wholeSeconds) * fps).toFixed(2); // prepends zero - example pads 3 to 03 function _padZero(n) { if (n < 10) return "0".concat(parseInt(n)); return parseInt(n); } return "".concat(_padZero(wholeSeconds / 60 / 60 % 60), ":").concat(_padZero(wholeSeconds / 60 % 60), ":").concat(_padZero(wholeSeconds % 60), ":").concat(_padZero(frames)); }; /* harmony default export */ var src_secondsToTimecode = (secondsToTimecode); // CONCATENATED MODULE: ./packages/util/timecode-converter/src/timecodeToSeconds.js /** * Helperf unction * @param {*} tc * @param {*} fps */ var timecodeToFrames = function timecodeToFrames(tc, fps) { // TODO make 29.97 fps drop-frame aware - works for 25 only. var s = tc.split(':'); var frames = parseInt(s[3]); frames += parseInt(s[2]) * fps; frames += parseInt(s[1]) * (fps * 60); frames += parseInt(s[0]) * (fps * 60 * 60); return frames; }; /** * Convert broadcast timecodes to seconds * @param {*} tc - `hh:mm:ss:ff` * @param {*} framePerSeconds - defaults to 25 if not provided */ var timecodeToSecondsHelper = function timecodeToSecondsHelper(tc, framePerSeconds) { var fps = 25; if (framePerSeconds !== undefined) { fps = framePerSeconds; } var frames = timecodeToFrames(tc, fps); return Number(Number(frames / fps).toFixed(2)); }; /* harmony default export */ var src_timecodeToSeconds = (timecodeToSecondsHelper); // CONCATENATED MODULE: ./packages/util/timecode-converter/src/padTimeToTimecode.js var countColon = function countColon(timecode) { return timecode.split(':').length; }; var includesFullStop = function includesFullStop(timecode) { return timecode.includes('.'); }; var isOneDigit = function isOneDigit(str) { return str.length === 1; }; var padTimeToTimecode = function padTimeToTimecode(time) { if (typeof time === 'string') { switch (countColon(time)) { case 4: // is already in timecode format // hh:mm:ss:ff return time; case 2: // m:ss if (isOneDigit(time.split(':')[0])) { return "00:0".concat(time, ":00"); } return "00:".concat(time, ":00"); case 3: // hh:mm:ss return "".concat(time, ":00"); default: // mm.ss if (includesFullStop(time)) { // m.ss if (isOneDigit(time.split('.')[0])) { return "00:0".concat(time.split('.')[0], ":").concat(time.split('.')[1], ":00"); } return "00:".concat(time.replace('.', ':'), ":00"); } // if just int, then it's seconds // s if (isOneDigit(time)) { return "00:00:0".concat(time, ":00"); } return "00:00:".concat(time, ":00"); } // edge case if it's number return a number coz cannot refactor // TODO: might need to refactor and move this elsewhere } else { return time; } }; /* harmony default export */ var src_padTimeToTimecode = (padTimeToTimecode); // CONCATENATED MODULE: ./packages/util/timecode-converter/index.js /** * Wrapping around "time stamps" and timecode conversion modules * To provide more support for variety of formats. */ /** * @param {*} time * Can take as input timecodes in the following formats * - hh:mm:ss:ff * - mm:ss * - m:ss * - ss - seconds --> if it's already in seconds then it just returns seconds * - hh:mm:ff * @todo could be refactored with some helper functions for clarity */ var timecode_converter_timecodeToSeconds = function timecodeToSeconds(time) { if (typeof time === 'string') { var resultPadded = src_padTimeToTimecode(time); var resultConverted = src_timecodeToSeconds(resultPadded); return resultConverted; } // assuming it receive timecode as seconds as string '600' return parseFloat(time); }; var timecode_converter_shortTimecode = function shortTimecode(time) { var timecode = src_secondsToTimecode(time); return timecode.slice(0, -3); }; /***/ }), /***/ 50: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(9)(true); // Module exports.push([module.i, "._2-P6QQvz0q7t4vMg5cIO6c{display:inline-block;position:relative;width:48px;display:inline-block;vertical-align:middle;margin-right:1em}._2WP1leuv4W5kNYP7UQDlkW{position:relative;display:inline-block;width:48px;height:28px}._2WP1leuv4W5kNYP7UQDlkW input{opacity:0;width:0;height:0}._2QDovDj-z5vJ3frE_1kn3B{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s}._2QDovDj-z5vJ3frE_1kn3B:before{position:absolute;content:'';height:20px;width:20px;left:4px;bottom:4px;background-color:white;-webkit-transition:0.4s;transition:0.4s}input:checked+._2QDovDj-z5vJ3frE_1kn3B{background-color:#a0372d}input:focus+._2QDovDj-z5vJ3frE_1kn3B{box-shadow:0 0 1px #a0372d}input:checked+._2QDovDj-z5vJ3frE_1kn3B:before{-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px)}\n", "",{"version":3,"sources":["/home/nhardy/git/react-transcript-editor/packages/components/settings/Toggle/index.module.css","/home/nhardy/git/react-transcript-editor/packages/config/style-guide/colours.scss"],"names":[],"mappings":"AAEA,yBACE,oBAAqB,CACrB,iBAAkB,CAClB,UAAW,CACX,oBAAqB,CACrB,qBAAsB,CACtB,gBAAiB,CAClB,yBAGC,iBAAkB,CAClB,oBAAqB,CACrB,UAAW,CACX,WAAY,CACb,+BAGC,SAAU,CACV,OAAQ,CACR,QAAS,CACV,yBAGC,iBAAkB,CAClB,cAAe,CACf,KAAM,CACN,MAAO,CACP,OAAQ,CACR,QAAS,CACT,qBAAsB,CACtB,uBAAwB,CACxB,eAAgB,CACjB,gCAGC,iBAAkB,CAClB,UAAW,CACX,WAAY,CACZ,UAAW,CACX,QAAS,CACT,UAAW,CACX,sBAAuB,CACvB,uBAAwB,CACxB,eAAgB,CACjB,uCAGC,wBCjDsB,CDkDvB,qCAGC,0BCrDsB,CDsDvB,8CAGC,kCAAmC,CACnC,8BAA+B,CAC/B,0BAA2B","file":"index.module.css","sourcesContent":["@import '../../../config/style-guide/colours.scss';\n\n.switchContainer {\n display: inline-block;\n position: relative;\n width: 48px;\n display: inline-block;\n vertical-align: middle;\n margin-right: 1em;\n}\n\n.switch {\n position: relative;\n display: inline-block;\n width: 48px;\n height: 28px;\n}\n\n.switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n}\n\n.slider:before {\n position: absolute;\n content: '';\n height: 20px;\n width: 20px;\n left: 4px;\n bottom: 4px;\n background-color: white;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n}\n\ninput:checked + .slider {\n background-color: $color-labs-red;\n}\n\ninput:focus + .slider {\n box-shadow: 0 0 1px $color-labs-red;\n}\n\ninput:checked + .slider:before {\n -webkit-transform: translateX(20px);\n -ms-transform: translateX(20px);\n transform: translateX(20px);\n}\n","$color-labs-red: #a0372d !default;\n$color-darkest-grey: #282828 !default;\n$color-dark-grey: #4a4a4a !default;\n$color-mid-grey: #696969 !default;\n$color-light-grey: #767676 !default;\n$color-lightest-grey: #f2f2f2 !default;\n$color-subt-green: #69e3c2 !default;\n$color-light-shilo: #E2A9A2 !default;\n"]}]); // Exports exports.locals = { "switchContainer": "_2-P6QQvz0q7t4vMg5cIO6c", "switch": "_2WP1leuv4W5kNYP7UQDlkW", "slider": "_2QDovDj-z5vJ3frE_1kn3B" }; /***/ }), /***/ 51: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(9)(true); // Module exports.push([module.i, "._3v2Jpfelf2BQwv2rwSQ9H4{display:inline-block}._1yZJUMpXRbrtQjcJlQmDM7{height:2em;width:96px;box-sizing:border-box;border:none;text-align:center;font-weight:bold;margin-right:16px;vertical-align:middle}._2S-_LOJWPdwwh1bZgSffh0{font-weight:lighter;font-size:0.8em;cursor:pointer}\n", "",{"version":3,"sources":["/home/nhardy/git/react-transcript-editor/packages/components/settings/TimecodeOffset/index.module.css"],"names":[],"mappings":"AAAA,yBACE,oBAAqB,CACtB,yBAGC,UAAW,CACX,UAAW,CACX,qBAAsB,CACtB,WAAY,CACZ,iBAAkB,CAClB,gBAAiB,CACjB,iBAAkB,CAClB,qBAAsB,CACvB,yBAGC,mBAAoB,CACpB,eAAgB,CAChB,cAAe","file":"index.module.css","sourcesContent":[".offsetContainer {\n display: inline-block;\n}\n\n.inputBox {\n height: 2em;\n width: 96px;\n box-sizing: border-box;\n border: none;\n text-align: center;\n font-weight: bold;\n margin-right: 16px;\n vertical-align: middle;\n}\n\n.button {\n font-weight: lighter;\n font-size: 0.8em;\n cursor: pointer;\n}\n"]}]); // Exports exports.locals = { "offsetContainer": "_3v2Jpfelf2BQwv2rwSQ9H4", "inputBox": "_1yZJUMpXRbrtQjcJlQmDM7", "button": "_2S-_LOJWPdwwh1bZgSffh0" }; /***/ }), /***/ 52: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(9)(true); // Module exports.push([module.i, ".JdHo9EaV61lkPYVOnY9Tr{position:absolute;left:0;right:0;margin:0 auto;width:30%;min-width:300px;min-height:300px;text-align:center;vertical-align:middle;color:white;background:#4a4a4a;padding:1em;font-weight:lighter;z-index:2}._3oFivHVg381f86Dvq_VKeL{margin-top:0;margin-bottom:1em}._2tvYaCv7psYHm_P5wedE4r{position:absolute;top:0;right:0;padding:1em;cursor:pointer}.fIfMHUdGQjz3vMdIEi8Jv{display:flex;flex-direction:column;align-content:flex-start;align-items:center;margin:0 auto}.RR5OSS1kiw_iws7Cl06lo{text-align:left;align-self:auto;margin-bottom:0.5em}._3g3SAU451awMxG-h9hkJB{display:inline-block;min-width:200px;width:200px}._3_RdkO-v0sVmSoXjTWPLAM{height:2em;width:48px;box-sizing:border-box;border:none;text-align:center;font-weight:bold;margin-right:16px;vertical-align:middle}._1jFCVDNuZCVANMQ1tPvi2L{display:block;text-align:center}\n", "",{"version":3,"sources":["/home/nhardy/git/react-transcript-editor/packages/components/settings/index.module.css"],"names":[],"mappings":"AAAA,uBACE,iBAAkB,CAClB,MAAO,CACP,OAAQ,CACR,aAAc,CACd,SAAU,CACV,eAAgB,CAChB,gBAAiB,CACjB,iBAAkB,CAClB,qBAAsB,CACtB,WAAY,CACZ,kBAAmB,CACnB,WAAY,CACZ,mBAAoB,CACpB,SAAU,CACX,yBAGC,YAAa,CACb,iBAAkB,CACnB,yBAGC,iBAAkB,CAClB,KAAM,CACN,OAAQ,CACR,WAAY,CACZ,cAAe,CAChB,uBAGC,YAAa,CACb,qBAAsB,CACtB,wBAAyB,CACzB,kBAAmB,CACnB,aAAc,CACf,uBAGC,eAAgB,CAChB,eAAgB,CAChB,mBAAoB,CACrB,wBAGC,oBAAqB,CACrB,eAAgB,CAChB,WAAY,CACb,yBAGC,UAAW,CACX,UAAW,CACX,qBAAsB,CACtB,WAAY,CACZ,iBAAkB,CAClB,gBAAi