/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ var vachak; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./scr/Player Opearations/PlayerOperations_v1.js": /*!*******************************************************!*\ !*** ./scr/Player Opearations/PlayerOperations_v1.js ***! \*******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../api */ \"./scr/api.js\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants */ \"./scr/constants.js\");\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helper */ \"./scr/helper.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || \"\" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\n\n\n// config\nvar uiConfig = _config__WEBPACK_IMPORTED_MODULE_1__.config.uiConfig;\n// Menu controls\nvar audioPlayer = document.querySelector(\".audio-player\");\nvar menuBtn = document.querySelector(\".audio-player__menu\");\nvar menuDiv = document.querySelector(\".menu__menu-options-hide\");\nvar playBtn = document.getElementById(\"play-btn-expand\");\nvar audioControlsDiv = document.querySelector(\".audio-player__audio-controls\");\nvar playBtnDiv = document.querySelector(\".audio-player__play\");\nvar closeBtn = document.querySelector(\".audio-controls__close-btn\");\nvar minimiseBtn = document.querySelector(\".audio-controls__minimise-btn\");\nvar playingGif = document.querySelector(\".audio-player__playing\");\nvar loading = document.querySelector(\".audio-player__loading\");\n\n// play speed controls\nvar playbackBtn = document.querySelector(\".playback-speed-btn\");\nvar playbackDiv = document.querySelector(\".audio-controls__playback-speed-hide\");\n\n// Volume controls\nvar volBtn = document.querySelector(\".volume-btn\");\nvar volRange = document.querySelector(\".operation__hide-volume\");\n\n// Player play and pause button\nvar audioPlayBtn = document.querySelector(\".operations__play-btn\");\nvar audioPauseBtn = document.querySelector(\".operations__pause-btn\");\n\n// audio seekbar and audio duration\nvar audioSeekbar = document.querySelector(\".audio-slider\");\nvar currentTime = document.querySelector(\".current-audio-progress\");\nvar audioEndTime = document.querySelector(\".audio-end-time\");\n\n// Audio\nvar audio = document.querySelector(\".vachak-audio\");\n\n// Audio forward/Backward btn\nvar audioRewind = document.querySelector(\".audio-revind\");\nvar audioForward = document.querySelector(\".audio-forward\");\n\n//Playback speed seekbar\nvar playbackSeekbar = document.querySelector(\".audio-playback-speed\");\n\n// Playback speed text\nvar playbackText = document.querySelector(\".playback-speed-btn\");\n\n// voice options \nvar voiceOptionDiv = document.querySelector(\".voice-option-container-selected_voice\");\nvar voiceSelectedValue = document.querySelector(\".selected_voice\");\nvar voiceOptionList = document.querySelector(\".voice-option-container_select-list\");\nvar voicePTags = document.querySelectorAll(\".voice-option-container_select-list p\");\n\n// menu arrow btn\nvar arrowDown = document.querySelectorAll(\".arrow-down\");\n\n// pitch options \nvar pitchOptionDiv = document.querySelector(\".pitch-option-container-selected_pitch\");\nvar pitchSelectedValue = document.querySelector(\".selected_pitch\");\nvar pitchOptionList = document.querySelector(\".pitch-option-container_select-list\");\nvar pitchPTags = document.querySelectorAll(\".pitch-option-container_select-list p\");\n\n// Store current time\nvar currentPlayingTime = 0;\n\n// Current playback speed\nvar currentPalybackSpeed = parseFloat(playbackSeekbar.value);\n// Event listeners\n\n//Click outside audio-player\nwindow.addEventListener(\"click\", function (e) {\n if (!document.querySelector(\".audio-player\").contains(e.target)) {\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n menuDiv.classList.remove(\"menu__menu-options\");\n }\n});\n\n// Expand player on click\nplayBtn.addEventListener(\"click\", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n playAudioBtnClick();\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n})));\nplayingGif.addEventListener(\"click\", function () {\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"flex\";\n return;\n }\n audioControlsDiv.style.display = \"block\";\n playingGif.style.display = \"none\";\n if (menuDiv.style.display === 'flex') {\n resizePlayer(451, audioPlayer.getBoundingClientRect().width, \"play\");\n } else {\n resizePlayer(0, audioPlayer.getBoundingClientRect().width, \"play\");\n }\n});\ncloseBtn.addEventListener(\"click\", function () {\n audio.pause();\n audio.currentTime = 0;\n audioControlsDiv.style.display = \"none\";\n playBtnDiv.style.display = \"flex\";\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n\n // Reset the playback speed\n\n resetPlaybackSpeed();\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playBtnDiv.style.display = \"flex\";\n playingGif.style.display = \"none\";\n return;\n }\n resizePlayer(0, 0, \"close\");\n menuDiv.classList.remove(\"menu__menu-options\");\n analyticsCounter(\"close\");\n});\nminimiseBtn.addEventListener(\"click\", function () {\n analyticsCounter(\"minimise\");\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n // playBtnDiv.style.display = \"flex\"\n playingGif.style.display = \"flex\";\n return;\n }\n audioControlsDiv.style.display = \"none\";\n if (!audio.paused) {\n playingGif.style.display = \"flex\";\n } else {\n playBtnDiv.style.display = \"flex\";\n }\n menuDiv.classList.remove(\"menu__menu-options\");\n // resizePlayer(0, 395, \"minimise\")\n if (audioControlsDiv.style.display === 'block') {\n resizePlayer(451, audioPlayer.getBoundingClientRect().width, \"minimise\");\n } else {\n resizePlayer(451, menuDiv.getBoundingClientRect().width, \"minimise\");\n }\n});\nvolBtn.addEventListener(\"click\", function () {\n volRange.classList.toggle(\"operation__show-volume\");\n analyticsCounter(\"volume\");\n});\n\n// Playback speed div expand\nplaybackBtn.addEventListener(\"click\", function () {\n playbackDiv.classList.toggle(\"audio-controls__playback-speed\");\n menuDiv.classList.remove(\"menu__menu-options\");\n if (audioControlsDiv.style.display === 'block') {\n resizePlayer(451, audioPlayer.getBoundingClientRect().width, \"menu\");\n } else {\n resizePlayer(451, menuDiv.getBoundingClientRect().width, \"menu\");\n }\n analyticsCounter(\"playback\");\n});\n\n// Toggle play and pause button\naudioPlayBtn.addEventListener(\"click\", function () {\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n});\naudioPauseBtn.addEventListener(\"click\", function () {\n audioPauseBtn.style.display = \"none\";\n audioPlayBtn.style.display = \"block\";\n});\n\n// Expand Menu\nmenuBtn.addEventListener(\"click\", function () {\n if (loading.style.display !== \"flex\") {\n menuDiv.classList.toggle(\"menu__menu-options\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n if (audioControlsDiv.style.display === 'block') {\n resizePlayer(451, audioPlayer.getBoundingClientRect().width, \"menu\");\n } else {\n resizePlayer(451, menuDiv.getBoundingClientRect().width, \"menu\");\n }\n }\n});\n\n//--------------------voice and pitch functionality--------------------//\nvoiceOptionDiv.addEventListener(\"click\", function () {\n if (pitchOptionList.classList.value.includes(\"pitch-option-container_select-list-show\")) {\n pitchOptionList.classList.toggle(\"pitch-option-container_select-list-show\");\n arrowDown[1].classList.toggle(\"arrow-down-rotate\");\n }\n voiceOptionList.classList.toggle(\"voice-option-container_select-list-show\");\n arrowDown[0].classList.toggle(\"arrow-down-rotate\");\n});\npitchOptionDiv.addEventListener(\"click\", function () {\n if (voiceOptionList.classList.value.includes(\"voice-option-container_select-list-show\")) {\n voiceOptionList.classList.toggle(\"voice-option-container_select-list-show\");\n arrowDown[0].classList.toggle(\"arrow-down-rotate\");\n }\n pitchOptionList.classList.toggle(\"pitch-option-container_select-list-show\");\n arrowDown[1].classList.toggle(\"arrow-down-rotate\");\n});\n\n// -------------------------------- Play pause Operations ---------------// \n// Main Play btn\n// playBtn.addEventListener(\"click\", () => {\n// audio.play();\n// })\n\naudioPauseBtn.addEventListener(\"click\", function () {\n audio.pause();\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playBtnDiv.style.display = \"flex\";\n playingGif.style.display = \"none\";\n return;\n }\n});\n\n// Play btn inside controller\naudioPlayBtn.addEventListener(\"click\", function () {\n audio.play();\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"flex\";\n playBtnDiv.style.display = \"none\";\n return;\n }\n});\n\n//----------------------Seekbar Operation-----------------------------//\n\naudio.addEventListener(\"loadeddata\", function () {\n audioSeekbar.max = audio.duration;\n var ds = parseInt(audio.duration % 60);\n var dm = parseInt(audio.duration / 60 % 60);\n var dh = parseInt(audio.duration / 3600);\n if (ds < 10) {\n ds = \"0\".concat(ds);\n }\n if (dm < 10) {\n dm = \"0\".concat(dm);\n }\n if (dm < 10) {\n dm = \"0\".concat(dm);\n }\n var durationString;\n if (dh > 0) {\n durationString = \"\".concat(dh, \":\").concat(dm, \":\").concat(ds);\n } else {\n durationString = \"\".concat(dm, \":\").concat(ds);\n }\n audioEndTime.innerHTML = durationString;\n});\n\n// Seekbar progress operartion\ndocument.querySelector(\".audio-slider\").oninput = function () {\n audio.currentTime = audioSeekbar.value;\n var value = (this.value - this.min) / (this.max - this.min) * 100;\n if (uiConfig && uiConfig.theme) {\n audioSeekbar.style.background = 'linear-gradient(to right, ' + uiConfig.theme + ' 0%, ' + uiConfig.theme + ' ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n } else {\n audioSeekbar.style.background = 'linear-gradient(to right, #EB5757 0%, #EB5757 ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n }\n};\naudio.addEventListener(\"timeupdate\", function () {\n currentPlayingTime = audio.currentTime;\n audioSeekbar.value = Math.floor(audio.currentTime);\n var cs = parseInt(audio.currentTime % 60);\n var cm = parseInt(audio.currentTime / 60 % 60);\n var ch = parseInt(audio.currentTime / 3600);\n if (cs < 10) {\n cs = \"0\".concat(cs);\n }\n var formattedTime;\n if (ch > 0) {\n var hs = ch < 10 ? \"0\".concat(ch) : \"\".concat(ch);\n formattedTime = \"\".concat(hs, \":\").concat(cm < 10 ? \"0\".concat(cm) : cm, \":\").concat(cs);\n } else {\n formattedTime = \"\".concat(cm, \":\").concat(cs);\n }\n currentTime.innerHTML = formattedTime;\n var seekbarValue = audioSeekbar.value;\n var min = audioSeekbar.min;\n var max = audioSeekbar.max;\n var value = (seekbarValue - min) / (max - min) * 100;\n if (uiConfig && uiConfig.theme) {\n audioSeekbar.style.background = 'linear-gradient(to right, ' + uiConfig.theme + ' 0%, ' + uiConfig.theme + ' ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n } else {\n audioSeekbar.style.background = 'linear-gradient(to right, #EB5757 0%, #EB5757 ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n }\n});\naudio.addEventListener(\"ended\", function () {\n if (audioControlsDiv.style.display === 'block') {\n audioPlayBtn.style.display = \"block\";\n audioPauseBtn.style.display = \"none\";\n audio.currentTime = 0;\n } else {\n playingGif.style.display = \"none\";\n playBtnDiv.style.display = \"flex\";\n audio.currentTime = 0;\n }\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"none\";\n playBtnDiv.style.display = \"flex\";\n return;\n }\n currentPlayingTime = 0;\n});\n\n//-----------------------------Volume Operation-------------------------//\nvolRange.addEventListener(\"input\", function () {\n audio.volume = volRange.value / 100;\n var value = (volRange.value - volRange.min) / (volRange.max - volRange.min) * 100;\n volRange.style.background = 'linear-gradient(to right, #4F4F50 20%, #4F4F50 ' + value + '%, #7F8693 ' + value + '%, #7F8693 100%)';\n analyticsCounter(\"volChanged\");\n});\n\n// -----------------------------Audio Forward/Backward operation--------//\naudioRewind.addEventListener(\"click\", function () {\n audio.currentTime = audio.currentTime - 5;\n analyticsCounter(\"skipBackward\");\n});\naudioForward.addEventListener(\"click\", function () {\n audio.currentTime = audio.currentTime + 5;\n analyticsCounter(\"skipForward\");\n});\n\n// -------------------------------Playback Operations -------------------//\n\nplaybackSeekbar.addEventListener(\"input\", function () {\n if (playbackSeekbar.value == 1) {\n document.querySelector(\".play-speed-text\").innerHTML = \"\".concat(playbackSeekbar.value, \".0x Speed\");\n playbackText.innerHTML = \"\".concat(playbackSeekbar.value, \".0x\");\n } else {\n document.querySelector(\".play-speed-text\").innerHTML = \"\".concat(playbackSeekbar.value, \"x Speed\");\n playbackText.innerHTML = \"\".concat(playbackSeekbar.value, \"x\");\n }\n audio.playbackRate = parseFloat(playbackSeekbar.value);\n currentPalybackSpeed = parseFloat(playbackSeekbar.value);\n analyticsCounter(\"playback\");\n});\n\n//-------------------------------Voice change operations -------------------//\n\nvoicePTags.forEach(function (p) {\n p.addEventListener(\"click\", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var audioIsPlaying, selectedVoice, selectedOptionPair, url;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n analyticsCounter(\"voiceChanged\");\n audioIsPlaying = !audio.paused;\n currentPlayingTime = audio.currentTime;\n selectedVoice = p.innerText;\n selectedOptionPair = \"\".concat(_constants__WEBPACK_IMPORTED_MODULE_2__.voiceMap[selectedVoice], \"_\").concat(pitchSelectedValue.innerText).concat(_config__WEBPACK_IMPORTED_MODULE_1__.config.classNameString);\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair = selectedOptionPair;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedVoice = selectedVoice;\n voiceSelectedValue.innerText = p.innerText;\n _context2.next = 10;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 10:\n url = _context2.sent;\n if (audioIsPlaying) {\n audio.pause();\n if (url && url !== \"\") {\n optionChanged(url, currentPlayingTime);\n } else {\n resetPlayer();\n playAudioBtnClick();\n }\n } else {\n resetPlayer();\n }\n case 12:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n })));\n});\n\n//--------------------------------Pitch change operations--------------------//\n\npitchPTags.forEach(function (p) {\n p.addEventListener(\"click\", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var audioIsPlaying, selectedPitch, selectedOptionPair, url;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n analyticsCounter(\"pitchChanged\");\n audioIsPlaying = !audio.paused;\n currentPlayingTime = audio.currentTime;\n selectedPitch = p.innerText;\n selectedOptionPair = \"\".concat(_constants__WEBPACK_IMPORTED_MODULE_2__.voiceMap[voiceSelectedValue.innerText], \"_\").concat(selectedPitch).concat(_config__WEBPACK_IMPORTED_MODULE_1__.config.classNameString);\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedPitch = selectedPitch;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair = selectedOptionPair;\n pitchSelectedValue.innerText = p.innerText;\n _context3.next = 10;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 10:\n url = _context3.sent;\n if (audioIsPlaying) {\n audio.pause();\n if (url && url !== \"\") {\n optionChanged(url, currentPlayingTime);\n } else {\n resetPlayer();\n playAudioBtnClick();\n }\n } else {\n resetPlayer();\n }\n case 12:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n })));\n});\nvar resetPlayer = function resetPlayer() {\n playingGif.style.display = \"none\";\n audioControlsDiv.style.display = \"none\";\n playBtnDiv.style.display = \"flex\";\n resetMenuDiv();\n};\nvar optionChanged = function optionChanged(url, currentAudioTime) {\n audio.src = url;\n audio.currentTime = currentAudioTime - 2;\n audio.playbackRate = currentPalybackSpeed;\n audio.play();\n if (playingGif.style.display == \"flex\" && !audio.paused) {\n loading.style.display = \"none\";\n } else {\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n audioControlsDiv.style.display = \"block\";\n playBtnDiv.style.display = \"none\";\n playingGif.style.display = \"none\";\n loading.style.display = \"none\";\n }\n resetMenuDiv();\n};\nvar resetMenuDiv = function resetMenuDiv() {\n menuDiv.classList.remove(\"menu__menu-options\");\n voiceOptionList.classList.remove(\"voice-option-container_select-list-show\");\n arrowDown[0].classList.remove(\"arrow-down-rotate\");\n pitchOptionList.classList.remove(\"pitch-option-container_select-list-show\");\n arrowDown[1].classList.remove(\"arrow-down-rotate\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n};\nvar playAudioBtnClick = /*#__PURE__*/function () {\n var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var url, errorObject;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n //Show loading gif\n playBtnDiv.style.display = \"none\";\n loading.style.display = \"flex\";\n\n // Hide speed and menu container\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n menuDiv.classList.remove(\"menu__menu-options\");\n\n // Check if audio is available\n _context4.next = 6;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 6:\n url = _context4.sent;\n if (!(url === \"\")) {\n _context4.next = 11;\n break;\n }\n _context4.next = 10;\n return (0,_api__WEBPACK_IMPORTED_MODULE_0__.getAudio)();\n case 10:\n url = _context4.sent;\n case 11:\n if (url.error) {\n errorObject = {\n error: url.error\n };\n console.error(errorObject);\n document.body.removeChild(document.getElementsByClassName(\"audio-player\")[0]);\n }\n audio.src = url;\n if (currentPlayingTime !== 0) {\n audio.currentTime = currentPlayingTime;\n }\n audio.playbackRate = currentPalybackSpeed;\n audio.play();\n\n // Hide Loading Gif\n loading.style.display = \"none\";\n audioControlsDiv.style.display = \"block\";\n menuDiv.classList.remove(\"menu__menu-options\");\n\n // player play and pause btn\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n analyticsCounter(\"play\");\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n _context4.next = 25;\n break;\n }\n playingGif.style.display = \"flex\";\n return _context4.abrupt(\"return\");\n case 25:\n resizePlayer(0, audioPlayer.getBoundingClientRect().width, \"play\");\n case 26:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4);\n }));\n return function playAudioBtnClick() {\n return _ref4.apply(this, arguments);\n };\n}();\nvar analyticsCounter = function analyticsCounter(event) {\n var selectedOptionPair = _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair;\n if (_constants__WEBPACK_IMPORTED_MODULE_2__.analyticData && _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData.hasOwnProperty(selectedOptionPair)) {\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[selectedOptionPair][\"\".concat(Date.now())] = event;\n } else {\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[\"\".concat(selectedOptionPair)] = {};\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[\"\".concat(selectedOptionPair)][\"\".concat(Date.now())] = event;\n }\n return;\n};\nvar resetPlaybackSpeed = function resetPlaybackSpeed() {\n document.querySelector(\".play-speed-text\").innerHTML = \"1.0x Speed\";\n playbackText.innerHTML = \"1.0x\";\n currentPalybackSpeed = 1;\n playbackSeekbar.value = 1;\n};\nwindow.addEventListener(\"beforeunload\", function () {\n (0,_api__WEBPACK_IMPORTED_MODULE_0__.sendAnalytics)();\n});\nwindow.addEventListener(\"resize\", function () {\n resizePlayer(0, 0, \"resize\");\n});\nvar resizePlayer = function resizePlayer() {\n var height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var event = arguments.length > 2 ? arguments[2] : undefined;\n // const audioPlayer = document.getElementsByClassName('audio-player');\n // Get the bounding rect of the div\n var rect = audioPlayer.getBoundingClientRect();\n\n // seperate divs list\n // 1. Main div with menu and play Icon \n // 2. Menu Div with pitch and voice options\n // 3. player controler div\n // 4. Playback speed div\n\n if (event === 'menu') {\n // Check if player controller div is block or not\n // If block then check for the width of the playe i.e (if player width > viewport width then change the left postion)\n // Check for the height of the player (If main div height + menu div height > viewport height then change the top position of player)\n } else if (event === 'play') {\n // This event will be called when use click on the play btn or the playing gif btn\n // Check if the total width of the player > viewport width\n } else if (event === 'playback') {\n // If menu div display === 'block' then return\n // else get the height of the playback div and check if height of player controller div + playback div height > viewport height\n } else if (event === 'minimise') {\n // place the player to its original position.\n }\n\n // rect.width + width of seekbar div > \n // Get the viewport height and width\n var viewportHeight = window.innerHeight;\n var viewportWidth = window.innerWidth;\n // Calculate the maximum values for top and left\n var maxTop = viewportHeight - (rect.height + 5);\n var maxLeft = viewportWidth - (rect.width + 20);\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n if (width != 0) {\n maxLeft = viewportWidth - (width + 20);\n }\n if (height != 0) {\n maxTop = viewportHeight - (rect.height + height + 5);\n }\n\n // Check if the div is going out of the viewport\n // Update the top and left position of the div\n if (event === 'play') {\n if (viewportWidth < rect.right + 20) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n } else if (event === \"menu\") {\n if (audioControlsDiv.style.display === \"block\") {\n if (viewportWidth < rect.right) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n } else if (viewportWidth < menuDiv.getBoundingClientRect().right) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n if (viewportWidth < rect.right) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n }\n if (viewportHeight < rect.bottom + height + 5) {\n audioPlayer.style.top = maxTop + 'px';\n }\n if (event === 'close' || event === \"minimise\") {\n audioPlayer.style.top = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top;\n audioPlayer.style.left = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left;\n }\n if (!menuDiv.classList.contains(\"menu__menu-options\") && audioControlsDiv.style.display !== \"block\") {\n audioPlayer.style.top = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top;\n audioPlayer.style.left = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left;\n }\n }\n if (event === \"resize\") {\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n if (viewportHeight < rect.bottom + height + 5) {\n audioPlayer.style.top = Math.max(Math.min(rect.top, maxTop), 0) + 'px';\n }\n if (viewportWidth < rect.right + width + 20) {\n audioPlayer.style.left = Math.max(Math.min(rect.left, maxLeft), 0) + 'px';\n }\n // audioPlayer.style.top = Math.max(Math.min(rect.top, maxTop), 0) + 'px';\n // audioPlayer.style.left = Math.max(Math.min(rect.left, maxLeft), 0) + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top = audioPlayer.style.top;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left = audioPlayer.style.left;\n }\n }\n};\nvar removeVachak = new CustomEvent(\"removeVachak\");\nwindow.addEventListener(\"removeVachak\", function () {\n document.body.removeChild(document.getElementsByClassName(\"audio-player\")[0]);\n (0,_helper__WEBPACK_IMPORTED_MODULE_3__.resetConfig)();\n});\nvar removeVachakEvent = function removeVachakEvent() {\n window.dispatchEvent(removeVachak);\n};\nwindow.removeVachak = removeVachakEvent;\n\n//# sourceURL=webpack://vachak/./scr/Player_Opearations/PlayerOperations_v1.js?"); /***/ }), /***/ "./scr/Player Opearations/playerOpearations_v1.1.js": /*!**********************************************************!*\ !*** ./scr/Player Opearations/playerOpearations_v1.1.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../api */ \"./scr/api.js\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants */ \"./scr/constants.js\");\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helper */ \"./scr/helper.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || \"\" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\n\n\"use strict\";\n\n// add script to the body\nvar addSentryScript = function addSentryScript() {\n var script = document.createElement(\"script\");\n script.src = \"https://js.sentry-cdn.com/6628ce5e7e5614244019c1bd0c4a271e.min.js\";\n script.crossorigin = \"anonymous\";\n script.type = \"text/javascript\";\n script.async = true;\n document.head.appendChild(script);\n};\naddSentryScript();\n\n// config\nvar uiConfig = _config__WEBPACK_IMPORTED_MODULE_1__.config.uiConfig;\nvar classNameArray = _config__WEBPACK_IMPORTED_MODULE_1__.config.classNameArray;\nvar vachakPlayer = document.querySelector('.vachak-player');\nvar playerController = document.querySelector(\".vachak-player__controller\");\nvar mainPlayDiv = document.querySelector(\".audio-status__play\");\nvar audioStatus = document.querySelector(\".vachak-player__audio-status\");\nvar mainPlayBtn = document.querySelector(\".vachak-player__play-btn\");\nvar voiceIcon = document.querySelector(\".voice-icon\");\nvar voiceListDiv = document.querySelector(\".controller__voice-list\");\nvar pitchListDiv = document.querySelector(\".controller__pitch-list\");\nvar pitchIcon = document.querySelector(\".pitch-icon\");\nvar moveIcon = document.querySelector(\".move-icon\");\nvar closeBtn = document.querySelector(\".audio-controls__close-btn\");\nvar minimiseBtn = document.querySelector(\".audio-controls__minimise-btn\");\n\n// Voice\nvar selectedVoiceDiv = document.querySelector(\".selected-voice-item\");\nvar voiceListItems = document.querySelectorAll(\".voice-list__voice-item\");\n\n// Pitch\nvar selectedPitchDiv = document.querySelector(\".selected-pitch-item\");\nvar pitchListItems = document.querySelectorAll(\".pitch-list__pitch-item\");\n\n// playing and loading\nvar playingGif = document.querySelector(\".audio-status__playing\");\nvar loading = document.querySelector(\".audio-status__loading\");\n\n// Player play and pause button\nvar audioPlayBtn = document.querySelector(\".operations__play-btn\");\nvar audioPauseBtn = document.querySelector(\".operations__pause-btn\");\n\n// Playback speed icon text\nvar playbackText = document.querySelector(\".playback-speed-btn\");\n\n// Volume controls\nvar volRange = document.querySelector(\".vol-slider-range\");\nvar volIcon = document.querySelector(\".vol-icon\");\nvar volumeDiv = document.querySelector(\".controller__volume-slider\");\n\n// play speed controls\nvar playbackBtn = document.querySelector(\".playback-speed-btn\");\nvar playbackDiv = document.querySelector(\".audio-controls__playback-speed-hide\");\n\n// audio seekbar and audio duration\nvar audioSeekbar = document.querySelector(\".audio-slider\");\nvar currentTime = document.querySelector(\".current-audio-progress\");\nvar audioEndTime = document.querySelector(\".audio-end-time\");\n\n//Playback speed seekbar\nvar playbackSeekbar = document.querySelector(\".audio-playback-speed\");\n\n// Audio\nvar audio = document.querySelector(\".vachak-audio\");\n\n// Audio forward/Backward btn\nvar audioRewind = document.querySelector(\".audio-revind\");\nvar audioForward = document.querySelector(\".audio-forward\");\nvar minimizeMessage = document.querySelector('.minimizeMessage');\n\n// Store current time\nvar currentPlayingTime = 0;\n\n// Current playback speed\nvar currentPalybackSpeed = parseFloat(playbackSeekbar.value);\n\n// total time audio is played\nvar totalAudioPlayed = 0;\n\n// --------------------------------Basic Player Operations--------------------------------//\nmainPlayBtn.addEventListener(\"click\", function () {\n playAudioBtnClick();\n if (uiConfig.type === '' || uiConfig.type === 'default' || uiConfig.type === 'replaceable') {\n playerController.style.marginTop = '1.5em';\n }\n if (uiConfig.type === 'replaceable') {\n audioStatus.style.display = \"none\";\n }\n if (uiConfig.type === 'detachable') {\n playerController.style.right = '1em';\n playerController.style.bottom = '1em';\n playerController.style.position = 'fixed';\n }\n});\n\n// Toggle play and pause button\naudioPlayBtn.addEventListener(\"click\", function () {\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n playerStatusChanged(\"play\");\n analyticsCounter(\"play\");\n playAudioBtnClick();\n});\naudioPauseBtn.addEventListener(\"click\", function () {\n audioPauseBtn.style.display = \"none\";\n audioPlayBtn.style.display = \"block\";\n audio.pause();\n playerStatusChanged(\"pause\");\n analyticsCounter(\"pause\");\n});\ncloseBtn.addEventListener(\"click\", function () {\n audio.pause();\n audio.currentTime = 0;\n if (uiConfig.type === 'replaceable') {\n audioStatus.style.display = \"block\";\n }\n playerController.style.display = \"none\";\n volumeDiv.classList.remove(\"show-volume-div\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n\n // Reset the playback speed\n // resetPlaybackSpeed()\n if (window.matchMedia(\"(max-width: 320px)\").matches) {\n playBtnDiv.style.display = \"flex\";\n playingGif.style.display = \"none\";\n return;\n }\n analyticsCounter(\"close\");\n playerStatusChanged(\"close\");\n resizePlayer(0, 0, \"close\");\n});\nminimiseBtn.addEventListener(\"click\", function () {\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"flex\";\n return;\n }\n playerController.style.display = \"none\";\n volumeDiv.classList.remove(\"show-volume-div\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n analyticsCounter(\"minimise\");\n resizePlayer(0, 395, \"minimise\");\n minimizeMessage.style.display = \"block\";\n minimizeMessage.style.zIndex = \"-1\";\n minimizeMessage.style.color = \"#4F4F50\";\n minimizeMessage.style.fontSize = \"1.5em\";\n minimizeMessage.style.marginLeft = \"1em\";\n minimizeMessage.style.background = \"white\";\n minimizeMessage.style.borderRadius = \"2px\";\n minimizeMessage.style.fontWeight = \"bold\";\n if (uiConfig.size === \"small\") {\n minimizeage.style.marginBottom = \"-2.4em\";\n minimizeMessage.style.height = \"2.5em\";\n minimizeMessage.style.padding = \".7em .5em .7em 1.4em\";\n }\n if (uiConfig.size === \"medium\") {\n minimizeMessage.style.marginBottom = \"-2.4em\";\n minimizeMessage.style.height = \"2em\";\n minimizeMessage.style.padding = \".5em .5em .5em 1.4em\";\n }\n if (uiConfig.size === \"large\") {\n minimizeMessage.style.marginBottom = \"-2.7em\";\n minimizeMessage.style.height = \"2.5em\";\n minimizeMessage.style.padding = \".6em .5em .6em 1.4em\";\n }\n});\nplayingGif.addEventListener(\"click\", function () {\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"flex\";\n return;\n }\n playerController.style.display = \"block\";\n minimizeMessage.style.display = \"none\";\n resizePlayer(0, 395, \"play\");\n});\nvoiceListItems.forEach(function (voiceDiv) {\n voiceDiv.addEventListener(\"click\", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var selectedVoice, audioIsPlaying, selectedOptionPair, url;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n analyticsCounter(\"VoiceChanged\");\n if (!voiceDiv.classList.contains(\"selected-voice-item\")) {\n _context.next = 3;\n break;\n }\n return _context.abrupt(\"return\");\n case 3:\n voiceDiv.classList.add(\"selected-voice-item\");\n selectedVoiceDiv.classList.remove(\"selected-voice-item\");\n selectedVoiceDiv = voiceDiv;\n selectedVoice = voiceDiv.children[1].innerText;\n audioIsPlaying = !audio.paused;\n currentPlayingTime = audio.currentTime;\n selectedOptionPair = \"\".concat(_constants__WEBPACK_IMPORTED_MODULE_2__.voiceMap[selectedVoice], \"_\").concat(_config__WEBPACK_IMPORTED_MODULE_1__.config.selectedPitch).concat(_config__WEBPACK_IMPORTED_MODULE_1__.config.classNameString);\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair = selectedOptionPair;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedVoice = selectedVoice;\n _context.next = 14;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 14:\n url = _context.sent;\n if (audioIsPlaying) {\n audio.pause();\n if (url && url !== \"\") {\n optionChanged(url, currentPlayingTime);\n } else {\n resetPlayer();\n playAudioBtnClick();\n }\n } else {\n resetPlayer();\n }\n case 16:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n })));\n});\npitchListItems.forEach(function (pitchDiv) {\n pitchDiv.addEventListener(\"click\", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var selectedPitch, audioIsPlaying, selectedOptionPair, url;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n analyticsCounter(\"pitchChanged\");\n if (!pitchDiv.classList.contains(\"selected-pitch-item\")) {\n _context2.next = 3;\n break;\n }\n return _context2.abrupt(\"return\");\n case 3:\n pitchDiv.classList.add(\"selected-pitch-item\");\n selectedPitchDiv.classList.remove(\"selected-pitch-item\");\n selectedPitchDiv = pitchDiv;\n selectedPitch = _constants__WEBPACK_IMPORTED_MODULE_2__.pitchValuePair[pitchDiv.children[0].innerText];\n audioIsPlaying = !audio.paused;\n currentPlayingTime = audio.currentTime;\n selectedOptionPair = \"\".concat(_constants__WEBPACK_IMPORTED_MODULE_2__.voiceMap[_config__WEBPACK_IMPORTED_MODULE_1__.config.selectedVoice], \"_\").concat(selectedPitch).concat(_config__WEBPACK_IMPORTED_MODULE_1__.config.classNameString);\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedPitch = selectedPitch;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair = selectedOptionPair;\n _context2.next = 14;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 14:\n url = _context2.sent;\n if (audioIsPlaying) {\n audio.pause();\n if (url && url !== \"\") {\n optionChanged(url, currentPlayingTime);\n } else {\n resetPlayer();\n playAudioBtnClick();\n }\n } else {\n resetPlayer();\n }\n case 16:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n })));\n});\n\n//----------------------------------------------Seekbar Operation----------------------------------------------------//\n\naudio.addEventListener(\"loadeddata\", function () {\n audioSeekbar.max = audio.duration;\n var durationInMinutes = parseInt(audio.duration / 60);\n var durationInSeconds = parseInt(audio.duration % 60);\n var durationInHours = parseInt(durationInMinutes / 60);\n var mm = durationInMinutes < 10 ? \"0\".concat(durationInMinutes) : durationInMinutes;\n var ss = durationInSeconds < 10 ? \"0\".concat(durationInSeconds) : durationInSeconds;\n var hh = durationInHours < 10 ? \"0\".concat(durationInHours) : durationInHours;\n var displayTime;\n if (durationInHours > 0) {\n displayTime = \"\".concat(hh, \":\").concat(mm, \":\").concat(ss);\n } else {\n displayTime = \"\".concat(mm, \":\").concat(ss);\n }\n audioEndTime.innerHTML = displayTime;\n});\n\n// Seekbar progress operartion\ndocument.querySelector(\".audio-slider\").oninput = function () {\n audio.currentTime = audioSeekbar.value;\n var value = (this.value - this.min) / (this.max - this.min) * 100;\n if (uiConfig && uiConfig.theme) {\n audioSeekbar.style.background = 'linear-gradient(to right, ' + uiConfig.theme + ' 0%, ' + uiConfig.theme + ' ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n } else {\n audioSeekbar.style.background = 'linear-gradient(to right, #EB5757 0%, #EB5757 ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n }\n};\naudioSeekbar.addEventListener(\"change\", function () {\n analyticsCounter(\"audioSeekbar\");\n});\naudio.addEventListener(\"timeupdate\", function () {\n currentPlayingTime = audio.currentTime;\n audioSeekbar.value = Math.floor(audio.currentTime);\n var cs = parseInt(audio.currentTime % 60);\n var cm = parseInt(audio.currentTime / 60 % 60);\n var ch = parseInt(audio.currentTime / 3600);\n if (cs < 10) {\n cs = \"0\".concat(cs);\n }\n if (cm < 10) {\n cm = \"0\".concat(cm);\n }\n var timeFormat = ch > 0 ? \"\".concat(ch, \":\").concat(cm, \":\").concat(cs) : \"\".concat(cm, \":\").concat(cs);\n currentTime.innerHTML = timeFormat;\n var seekbarValue = audioSeekbar.value;\n var min = audioSeekbar.min;\n var max = audioSeekbar.max;\n var value = (seekbarValue - min) / (max - min) * 100;\n if (uiConfig && uiConfig.theme) {\n audioSeekbar.style.background = 'linear-gradient(to right, ' + uiConfig.theme + ' 0%, ' + uiConfig.theme + ' ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n } else {\n audioSeekbar.style.background = 'linear-gradient(to right, #EB5757 0%, #EB5757 ' + value + '%, #D0D4DB ' + value + '%, #D0D4DB 100%)';\n }\n totalAudioPlayed = audioSeekbar.value;\n});\naudio.addEventListener(\"ended\", function () {\n if (playerController.style.display === 'block') {\n minimizeMessage.style.display = \"none\";\n audioPlayBtn.style.display = \"block\";\n audioPauseBtn.style.display = \"none\";\n playingGif.style.display = \"none\";\n mainPlayDiv.style.display = \"flex\";\n audio.currentTime = 0;\n } else {\n playingGif.style.display = \"none\";\n mainPlayDiv.style.display = \"flex\";\n audio.currentTime = 0;\n }\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n playingGif.style.display = \"none\";\n mainPlayDiv.style.display = \"flex\";\n return;\n }\n currentPlayingTime = 0;\n});\n\n//-----------------------------Volume Operation-------------------------//\nvolRange.addEventListener(\"input\", function () {\n audio.volume = volRange.value / 100;\n var value = (volRange.value - volRange.min) / (volRange.max - volRange.min) * 100;\n if (uiConfig && uiConfig.theme) {\n volRange.style.background = 'linear-gradient(to right, #4F4F50 20%, #4F4F50 ' + value + '%, #7F8693 ' + value + '%, #7F8693 100%)';\n } else {\n volRange.style.background = 'linear-gradient(to right, #4F4F50 20%, #4F4F50 ' + value + '%, #7F8693 ' + value + '%, #7F8693 100%)';\n }\n});\nvolRange.addEventListener(\"change\", function () {\n analyticsCounter(\"volChanged\");\n});\n\n// -----------------------------Audio Forward/Backward operation--------//\naudioRewind.addEventListener(\"click\", function () {\n audio.currentTime = audio.currentTime - 5;\n analyticsCounter(\"skipBackward\");\n});\naudioForward.addEventListener(\"click\", function () {\n audio.currentTime = audio.currentTime + 5;\n analyticsCounter(\"skipForward\");\n});\n\n// -------------------------------Playback Operations -------------------//\n\nplaybackSeekbar.addEventListener(\"input\", function () {\n if (playbackSeekbar.value == 1) {\n document.querySelector(\".play-speed-text\").innerHTML = \"\".concat(playbackSeekbar.value, \".0x Speed\");\n playbackText.innerHTML = \"\".concat(playbackSeekbar.value, \".0x\");\n } else {\n document.querySelector(\".play-speed-text\").innerHTML = \"\".concat(playbackSeekbar.value, \"x Speed\");\n playbackText.innerHTML = \"\".concat(playbackSeekbar.value, \"x\");\n }\n audio.playbackRate = parseFloat(playbackSeekbar.value);\n currentPalybackSpeed = parseFloat(playbackSeekbar.value);\n});\nplaybackSeekbar.addEventListener(\"change\", function () {\n analyticsCounter(\"playback\");\n});\n\n//----------------------------------------Drag and Drop Functionality----------------------------------//\nvar offsetX, offsetY;\nmoveIcon.addEventListener('mousedown', function (event) {\n // Calculate the offset of the mouse pointer relative to the center of the div\n var rect;\n if (uiConfig.type === \"detachable\") {\n rect = playerController.getBoundingClientRect();\n } else {\n rect = vachakPlayer.getBoundingClientRect();\n }\n offsetX = event.clientX - rect.left - rect.width / 60;\n offsetY = event.clientY - rect.top - rect.height / 60;\n\n // Add event listeners for the mousemove and mouseup events\n document.addEventListener('mousemove', moveHandler);\n document.addEventListener('mouseup', upHandler);\n\n // Prevent default behavior for the mousedown event\n event.preventDefault();\n});\nfunction moveHandler(event) {\n // Calculate the new position of the div based on the mouse position and offset\n var left = event.clientX - offsetX;\n var top = event.clientY - offsetY;\n\n // Get the window dimensions\n var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\n var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n\n // Get the dimensions of the div\n var divWidth = vachakPlayer.offsetWidth;\n var divHeight = vachakPlayer.offsetHeight;\n\n // Check if the new position is within the window boundaries\n var isWithinHorizontalBounds = left >= 0 && left + divWidth <= windowWidth;\n var isWithinVerticalBounds = top >= 0 && top + divHeight <= windowHeight;\n\n // Only update the position of the div if it's within the window boundaries\n if (isWithinHorizontalBounds) {\n if (uiConfig.type === 'detachable') {\n playerController.style.left = left + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left = playerController.style.left;\n } else {\n vachakPlayer.style.left = left + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left = vachakPlayer.style.left;\n }\n }\n if (isWithinVerticalBounds) {\n if (uiConfig.type === 'detachable') {\n playerController.style.top = top + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top = playerController.style.top;\n } else {\n vachakPlayer.style.top = top + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top = vachakPlayer.style.top;\n }\n }\n // Prevent default behavior for the mousemove event\n event.preventDefault();\n}\nfunction upHandler(event) {\n // Remove event listeners for mousemove and mouseup events\n analyticsCounter(\"playerDragged\");\n document.removeEventListener('mousemove', moveHandler);\n document.removeEventListener('mouseup', upHandler);\n\n // Prevent default behavior for the mouseup event\n event.preventDefault();\n}\n\n// -----------------------------Click outside audio-player-------------------------------//\nwindow.addEventListener(\"click\", function (e) {\n if (!vachakPlayer.contains(e.target)) {\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n volumeDiv.classList.remove(\"show-volume-div\");\n }\n});\nvar bound = mainPlayDiv.getBoundingClientRect();\nvoiceIcon.addEventListener(\"click\", function () {\n if (loading.style.display !== 'block') {\n voiceListDiv.classList.toggle(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n volumeDiv.classList.remove(\"show-volume-div\");\n if (uiConfig.size === \"large\" && bound.top > 50) resizePlayer(300, 0, \"menu\");\n if (bound.top > 50) resizePlayer(200, 0, \"menu\");\n }\n});\npitchIcon.addEventListener(\"click\", function () {\n if (loading.style.display !== 'block') {\n pitchListDiv.classList.toggle(\"show-pitch-list\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n volumeDiv.classList.remove(\"show-volume-div\");\n if (uiConfig.size === \"large\" && bound.top > 50) resizePlayer(300, 0, \"menu\");\n if (bound.top > 50) resizePlayer(200, 0, \"menu\");\n }\n});\nplaybackBtn.addEventListener(\"click\", function () {\n if (loading.style.display !== 'block') {\n playbackDiv.classList.toggle(\"audio-controls__playback-speed\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n volumeDiv.classList.remove(\"show-volume-div\");\n if (uiConfig.size === \"large\" && bound.top > 50) resizePlayer(300, 0, \"menu\");\n if (bound.top > 50) resizePlayer(200, 0, \"menu\");\n }\n});\nvolIcon.addEventListener(\"click\", function () {\n if (loading.style.display !== 'block') {\n volumeDiv.classList.toggle(\"show-volume-div\");\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n analyticsCounter(\"volume\");\n if (uiConfig.size === \"large\" && bound.top > 50) resizePlayer(300, 0, \"menu\");\n if (bound.top > 50) resizePlayer(200, 0, \"menu\");\n }\n});\n\n//----------------------------------------------Common Methods----------------------------------------//\n\nvar closeAllDivs = function closeAllDivs() {\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n playbackDiv.classList.remove(\"audio-controls__playback-speed\");\n volumeDiv.classList.remove(\"show-volume-div\");\n};\nvar optionChanged = function optionChanged(url, currentAudioTime) {\n audio.src = url;\n audio.currentTime = currentAudioTime - 2;\n audio.playbackRate = currentPalybackSpeed;\n audio.play();\n if (playingGif.style.display == \"block\" && !audio.paused) {\n loading.style.display = \"none\";\n } else {\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n playerController.style.display = \"block\";\n minimizeMessage.style.display = \"none\";\n playerStatusChanged(\"play\");\n }\n voiceListDiv.classList.remove(\"show-voice-list\");\n pitchListDiv.classList.remove(\"show-pitch-list\");\n // resetMenuDiv()\n};\n\nvar resetPlayer = function resetPlayer() {\n playerStatusChanged(\"close\");\n closeAllDivs();\n // playerController.style.display = \"none\";\n return;\n};\nvar playerStatusChanged = function playerStatusChanged(event) {\n if (event === 'loading') {\n mainPlayDiv.style.display = \"none\";\n playingGif.style.display = \"none\";\n loading.style.display = \"block\";\n } else if (event === 'play') {\n mainPlayDiv.style.display = \"none\";\n playingGif.style.display = \"block\";\n loading.style.display = \"none\";\n } else if (event === 'pause') {\n mainPlayDiv.style.display = \"flex\";\n playingGif.style.display = \"none\";\n loading.style.display = \"none\";\n } else if (event === 'minimise') {\n mainPlayDiv.style.display = \"none\";\n playingGif.style.display = \"none\";\n loading.style.display = \"block\";\n } else if (event === 'close') {\n mainPlayDiv.style.display = \"flex\";\n playingGif.style.display = \"none\";\n loading.style.display = \"none\";\n }\n return;\n};\nvar playAudioBtnClick = /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var boundingRect, visualViewportWidth, visualViewportHeight, boundingRectforController, visualViewportWidthforController, visualViewportHeightforController, url, errorObject;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n // Show Loading\n playerStatusChanged(\"loading\");\n // playerController.style.display = \"block\";\n\n // Hide speed and menu container\n closeAllDivs();\n boundingRect = mainPlayDiv.getBoundingClientRect();\n visualViewportWidth = window.visualViewport.width;\n visualViewportHeight = window.visualViewport.height; // Check if the div crosses the right visual viewport boundary\n if (boundingRect.right > visualViewportWidth) {\n mainPlayDiv.style.left = visualViewportWidth - boundingRect.width + \"px\";\n }\n\n // Check if the div crosses the bottom visual viewport boundary\n if (boundingRect.bottom > visualViewportHeight) {\n mainPlayDiv.style.top = visualViewportHeight - boundingRect.height + \"px\";\n }\n\n // Check if the div crosses the left visual viewport boundary\n if (boundingRect.left < 0) {\n mainPlayDiv.style.left = \"0\";\n }\n\n // Check if the div crosses the top visual viewport boundary\n if (boundingRect.top < 0) {\n mainPlayDiv.style.top = \"0\";\n }\n boundingRectforController = vachakPlayer.getBoundingClientRect();\n visualViewportWidthforController = window.visualViewport.width;\n visualViewportHeightforController = window.visualViewport.height; // Check if the div crosses the right visual viewport boundary\n if (boundingRectforController.right > visualViewportWidthforController) {\n vachakPlayer.style.left = visualViewportWidthforController - boundingRectforController.width + \"px\";\n }\n\n // Check if the div crosses the bottom visual viewport boundary\n if (boundingRectforController.bottom > visualViewportHeightforController) {\n vachakPlayer.style.top = visualViewportHeightforController - boundingRectforController.height + \"px\";\n }\n\n // Check if the div crosses the left visual viewport boundary\n if (boundingRectforController.left < 0) {\n vachakPlayer.style.left = \"0\";\n }\n\n // Check if the div crosses the top visual viewport boundary\n if (boundingRectforController.top < 0) {\n vachakPlayer.style.top = \"0\";\n }\n\n // Check if audio is available\n _context3.next = 18;\n return (0,_helper__WEBPACK_IMPORTED_MODULE_3__.findAudio)();\n case 18:\n url = _context3.sent;\n if (!(url === \"\")) {\n _context3.next = 23;\n break;\n }\n _context3.next = 22;\n return (0,_api__WEBPACK_IMPORTED_MODULE_0__.getAudio)();\n case 22:\n url = _context3.sent;\n case 23:\n if (url.error) {\n errorObject = {\n error: url.error\n };\n console.error(errorObject);\n document.body.removeChild(document.getElementsByClassName(\"vachak-player\")[0]);\n }\n audio.src = url;\n if (currentPlayingTime !== 0) {\n audio.currentTime = currentPlayingTime;\n }\n audio.playbackRate = currentPalybackSpeed;\n audio.play();\n\n // Hide Loading Gif\n playerStatusChanged(\"play\");\n playerController.style.display = \"block\";\n minimizeMessage.style.display = \"none\";\n\n // player play and pause btn\n audioPlayBtn.style.display = \"none\";\n audioPauseBtn.style.display = \"block\";\n analyticsCounter(\"play\");\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n _context3.next = 37;\n break;\n }\n playingGif.style.display = \"flex\";\n return _context3.abrupt(\"return\");\n case 37:\n resizePlayer(0, 395, \"play\");\n case 38:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n return function playAudioBtnClick() {\n return _ref3.apply(this, arguments);\n };\n}();\nvar analyticsCounter = function analyticsCounter(event) {\n var selectedOptionPair = _config__WEBPACK_IMPORTED_MODULE_1__.config.selectedOptionPair;\n if (_constants__WEBPACK_IMPORTED_MODULE_2__.analyticData && _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData.hasOwnProperty(selectedOptionPair)) {\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[selectedOptionPair][\"\".concat(Date.now())] = event;\n } else {\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[\"\".concat(selectedOptionPair)] = {};\n _constants__WEBPACK_IMPORTED_MODULE_2__.analyticData[\"\".concat(selectedOptionPair)][\"\".concat(Date.now())] = event;\n }\n return;\n};\nwindow.addEventListener(\"resize\", function () {\n resizePlayer(0, 0, \"resize\");\n});\nwindow.addEventListener(\"beforeunload\", function () {\n (0,_api__WEBPACK_IMPORTED_MODULE_0__.sendAnalytics)();\n});\nvar resizePlayer = function resizePlayer() {\n var height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var event = arguments.length > 2 ? arguments[2] : undefined;\n var audioPlayer = document.querySelector('.vachak-player');\n // Get the bounding rect of the div\n var rect = audioPlayer.getBoundingClientRect();\n // rect.width + width of seekbar div > \n // Get the viewport height and width\n var viewportHeight = window.innerHeight;\n var viewportWidth = window.innerWidth;\n // Calculate the maximum values for top and left\n var maxTop = viewportHeight - (rect.height + 5);\n var maxLeft = viewportWidth - (rect.width + 20);\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n // if (width != 0) {\n // maxLeft = viewportWidth - (width + 20);\n // }\n if (height != 0) {\n maxTop = viewportHeight - (rect.height + height + 5);\n }\n\n // Check if the div is going out of the viewport\n // Update the top and left position of the div\n if (event === 'play') {\n if (viewportWidth < rect.right + 20) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n } else if (event === \"menu\") {\n if (viewportWidth < rect.right + width + 20) {\n audioPlayer.style.left = maxLeft + 'px';\n }\n }\n if (viewportHeight < rect.bottom + height + 5) {\n audioPlayer.style.top = maxTop + 'px';\n }\n if (event === 'close' || event === \"minimise\") {\n audioPlayer.style.top = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top;\n audioPlayer.style.left = _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left;\n }\n // if (!pitchListDiv.classList.contains(\"show-voice-list\") && !voiceListDiv.classList.contains(\"show-pitch-list\") && event === \"menu\") {\n // audioPlayer.style.top = config.playerPosition.top;\n // audioPlayer.style.left = config.playerPosition.left\n // }\n }\n\n if (event === \"resize\") {\n if (!window.matchMedia(\"(max-width: 480px)\").matches) {\n if (viewportHeight < rect.bottom + height + 5) {\n audioPlayer.style.top = Math.max(Math.min(rect.top, maxTop), 0) + 'px';\n }\n if (viewportWidth < rect.right + width + 20) {\n audioPlayer.style.left = Math.max(Math.min(rect.left, maxLeft), 0) + 'px';\n }\n // audioPlayer.style.top = Math.max(Math.min(rect.top, maxTop), 0) + 'px';\n // audioPlayer.style.left = Math.max(Math.min(rect.left, maxLeft), 0) + 'px';\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.top = audioPlayer.style.top;\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerPosition.left = audioPlayer.style.left;\n }\n }\n};\nvar removeVachak = new CustomEvent(\"removeVachak\");\nwindow.addEventListener(\"removeVachak\", function () {\n document.body.removeChild(document.getElementsByClassName(\"vachak-player\")[0]);\n resetConfig();\n});\nvar removeVachakEvent = function removeVachakEvent() {\n window.dispatchEvent(removeVachak);\n};\nwindow.removeVachak = removeVachakEvent;\n\n// add mutation observer\n// const targetNode = document.querySelector('.vachak-player');\n// const observerConfig = { attributes: true, childList: true, subtree: true, characterData: true };\n// const callback = function (mutationsList, observer) {\n// for (let mutation of mutationsList) {\n// if (mutation.type === 'childList') {\n// console.log('A child node has been added or removed.');\n// }\n// else if (mutation.type === 'attributes') {\n// console.log('The ' + mutation.attributeName + ' attribute was modified.');\n// }\n// }\n// };\n// const observer = new MutationObserver(callback);\n// observer.observe(targetNode, observerConfig);\n\n//# sourceURL=webpack://vachak/./scr/Player_Opearations/playerOpearations_v1.1.js?"); /***/ }), /***/ "./scr/Player Template/playerTemplate.js": /*!***********************************************!*\ !*** ./scr/Player Template/playerTemplate.js ***! \***********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderPlayer: () => (/* binding */ renderPlayer)\n/* harmony export */ });\n/* harmony import */ var _style_styleTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/styleTemplate */ \"./style/styleTemplate.js\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../config */ \"./scr/config.js\");\n\n\nvar renderPlayer = function renderPlayer(version) {\n var player;\n if (version === \"v1\") {\n player = document.createElement(\"div\");\n player.classList.add(\"audio-player\");\n player.innerHTML = \"\\n
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
\\n
\\n \\n
\\n \\n \\n \\n
\\n\\n\\n \\n
\\n \\n \\n \\n
\\n \\n
\\n
\\n
\\n \\n
\\n
\\n \\n \\n \\n
\\n
\\n \\n
\\n \\n
\\n
\\n \\n \\n Minimise\\n \\n \\n \\n \\n \\n \\n \\n \\n Close\\n \\n
\\n
\\n \\n
\\n
\\n \\n

00:00

\\n \\n \\n \\n \\n

00:00

\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n \\n \\n Volume\\n \\n \\n \\n \\n \\n \\n Skip Backward\\n \\n \\n \\n \\n Play\\n \\n \\n \\n Pause\\n \\n \\n \\n \\n \\n Skip Forward\\n \\n \\n

1.0x

\\n
\\n
\\n
\\n
\\n
\\n
\\n

1.0x Speed

\\n
\\n
\\n \\n
\\n
\\n

Slower

\\n

Normal

\\n

Faster

\\n
\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n

Select Voice

\\n \\n
\\n
\\n
\\n

English Female

\\n
\\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n
\\n
\\n
\\n

Select Pitch

\\n \\n
\\n
\\n
\\n

0

\\n
\\n
\\n \\n \\n \\n
\\n
\\n
\\n

-3

\\n

-2

\\n

-1

\\n

0

\\n

1

\\n

2

\\n

3

\\n
\\n
\\n
\\n
\\n Contact Us\\n
\\n
\\n \";\n } else if (version === \"v1.1\") {\n player = document.createElement(\"div\");\n player.classList.add(\"vachak-player\");\n player.innerHTML = \"
\\n
\\n \\n \\n Play\\n \\n

Listen

\\n
\\n \\n
\\n
\\n
\\n \\n
\\n
Click to maximise the player
\\n
\\n \\n \\n \\n
\\n
\\n
\\n
\\n \\n
\\n
\\n \\n \\n \\n \\n \\n \\n \\n \\n Move\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n Minimise\\n \\n \\n \\n \\n \\n \\n \\n \\n Close\\n \\n
\\n
\\n \\n
\\n
\\n \\n

00:00

\\n \\n \\n \\n \\n

00:00

\\n
\\n
\\n \\n
\\n
\\n
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n Voice\\n \\n \\n \\n \\n \\n Volume\\n \\n \\n \\n \\n \\n Skip Backward\\n \\n \\n \\n \\n Play\\n \\n \\n \\n Pause\\n \\n \\n \\n \\n \\n Skip Forward\\n \\n \\n

1.0x

\\n \\n \\n \\n Pitch\\n \\n
\\n
\\n
\\n \\n
\\n
\\n \\n
\\n
\\n

Customize your audio experience with volume control tailored to your needs.

\\n
\\n
\\n \\n
\\n
\\n

Choose your preferred voice

\\n

Bringing your words to life with the power of AI voice technology.

\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n

Bringing your words to life with the power of AI voice technology.

\\n
\\n
\\n

1.0x Speed

\\n
\\n
\\n \\n
\\n
\\n

Slower

\\n

Normal

\\n

Faster

\\n
\\n
\\n \\n
\\n
\\n

Choose your preferred Pitch

\\n

Bringing your words to life with the power of AI voice technology.

\\n
\\n
\\n
\\n \\n
\\n

Default

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

X X-Low

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

X-Low

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

Low

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

High

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

X-High

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n \\n
\\n

X X-High

\\n
\\n \\n
\\n \\n \\n \\n
\\n
\\n
\\n
\\n
\";\n }\n player.innerHTML += (0,_style_styleTemplate__WEBPACK_IMPORTED_MODULE_0__.getStyling)(version);\n _config__WEBPACK_IMPORTED_MODULE_1__.config.playerHTML = player;\n return player;\n};\n\n//# sourceURL=webpack://vachak/./scr/Player_Template/playerTemplate.js?"); /***/ }), /***/ "./scr/api.js": /*!********************!*\ !*** ./scr/api.js ***! \********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ detectLanguage: () => (/* binding */ detectLanguage),\n/* harmony export */ getAllAudios: () => (/* binding */ getAllAudios),\n/* harmony export */ getAudio: () => (/* binding */ getAudio),\n/* harmony export */ sendAnalytics: () => (/* binding */ sendAnalytics),\n/* harmony export */ validateUserAndProjectId: () => (/* binding */ validateUserAndProjectId)\n/* harmony export */ });\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./scr/constants.js\");\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helper */ \"./scr/helper.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || \"\" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\nvar BACKEND_URL = 'https://api.vachak.reverieinc.com/api';\n// const BACKEND_URL = 'http://localhost:5000/api'\n\nvar validateUserAndProjectId = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var response, data;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return fetch(\"\".concat(BACKEND_URL, \"/validate/user\"), {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n apikey: _config__WEBPACK_IMPORTED_MODULE_0__.config.apikey,\n projectId: _config__WEBPACK_IMPORTED_MODULE_0__.config.projectId\n })\n });\n case 2:\n response = _context.sent;\n _context.next = 5;\n return response.json();\n case 5:\n data = _context.sent;\n return _context.abrupt(\"return\", data);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function validateUserAndProjectId() {\n return _ref.apply(this, arguments);\n };\n}();\nvar detectLanguage = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(textString) {\n var response, data;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return fetch(\"\".concat(BACKEND_URL, \"/detect/language\"), {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n textString: textString\n })\n });\n case 2:\n response = _context2.sent;\n _context2.next = 5;\n return response.json();\n case 5:\n data = _context2.sent;\n return _context2.abrupt(\"return\", data.language);\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return function detectLanguage(_x) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar getAudio = /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var selectedVoice, selectedPitch, voice, selectedOptionPair, language, response, data, url;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.prev = 0;\n selectedVoice = _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedVoice;\n selectedPitch = _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedPitch;\n voice = _constants__WEBPACK_IMPORTED_MODULE_1__.voiceMap[selectedVoice];\n selectedOptionPair = \"\".concat(voice, \"_\").concat(selectedPitch).concat(_config__WEBPACK_IMPORTED_MODULE_0__.config.classNameString);\n language = selectedVoice.split(\" \")[0];\n _context3.next = 8;\n return fetch(\"\".concat(BACKEND_URL, \"/generate/audio\"), {\n method: \"POST\",\n headers: {\n 'Content-type': 'application/json'\n },\n body: JSON.stringify({\n \"segments\": _config__WEBPACK_IMPORTED_MODULE_0__.config.segmentArray,\n \"apikey\": _config__WEBPACK_IMPORTED_MODULE_0__.config.apikey,\n \"projectId\": _config__WEBPACK_IMPORTED_MODULE_0__.config.projectId,\n \"pageURL\": _config__WEBPACK_IMPORTED_MODULE_0__.config.pageURL,\n \"voice\": voice,\n \"pitch\": selectedPitch,\n \"languagePitchPair\": selectedOptionPair,\n \"classNameArray\": _config__WEBPACK_IMPORTED_MODULE_0__.config.classNameArray\n })\n });\n case 8:\n response = _context3.sent;\n if (response.ok) {\n _context3.next = 11;\n break;\n }\n throw new Error(\"Failed to fetch audio, status: \".concat(response.status));\n case 11:\n _context3.next = 13;\n return response.json();\n case 13:\n data = _context3.sent;\n if (!(data && data.encryptedLocation)) {\n _context3.next = 21;\n break;\n }\n _config__WEBPACK_IMPORTED_MODULE_0__.config.allAudios[selectedOptionPair] = data.encryptedLocation;\n url = (0,_helper__WEBPACK_IMPORTED_MODULE_2__.decodeStr)(data.encryptedLocation);\n _config__WEBPACK_IMPORTED_MODULE_0__.config[\"audioUrl\"] = url;\n return _context3.abrupt(\"return\", url);\n case 21:\n if (!(data && data.error)) {\n _context3.next = 23;\n break;\n }\n return _context3.abrupt(\"return\", data);\n case 23:\n _context3.next = 29;\n break;\n case 25:\n _context3.prev = 25;\n _context3.t0 = _context3[\"catch\"](0);\n console.error(\"Error fetching audio:\", _context3.t0);\n throw _context3.t0;\n case 29:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, null, [[0, 25]]);\n }));\n return function getAudio() {\n return _ref3.apply(this, arguments);\n };\n}();\nvar getAllAudios = /*#__PURE__*/function () {\n var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var params, response, data;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n params = new URLSearchParams({\n apikey: _config__WEBPACK_IMPORTED_MODULE_0__.config.apikey,\n projectId: _config__WEBPACK_IMPORTED_MODULE_0__.config.projectId,\n pageURL: _config__WEBPACK_IMPORTED_MODULE_0__.config.pageURL\n });\n _context4.next = 3;\n return fetch(\"\".concat(BACKEND_URL, \"/audios?\").concat(params), {\n method: \"GET\",\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n case 3:\n response = _context4.sent;\n _context4.next = 6;\n return response.json();\n case 6:\n data = _context4.sent;\n if (data && data.audios) {\n _config__WEBPACK_IMPORTED_MODULE_0__.config.allAudios = data.audios;\n }\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4);\n }));\n return function getAllAudios() {\n return _ref4.apply(this, arguments);\n };\n}();\nvar sendAnalytics = function sendAnalytics(event) {\n fetch(\"\".concat(BACKEND_URL, \"/audio/analytics\"), {\n method: \"POST\",\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n apikey: _config__WEBPACK_IMPORTED_MODULE_0__.config.apikey,\n projectId: _config__WEBPACK_IMPORTED_MODULE_0__.config.projectId,\n pageURL: _config__WEBPACK_IMPORTED_MODULE_0__.config.pageURL,\n languagePitchPair: _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedOptionPair,\n analytics: _constants__WEBPACK_IMPORTED_MODULE_1__.analyticData\n })\n });\n};\n\n//# sourceURL=webpack://vachak/./scr/api.js?"); /***/ }), /***/ "./scr/config.js": /*!***********************!*\ !*** ./scr/config.js ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ config: () => (/* binding */ config)\n/* harmony export */ });\nvar config = {\n apikey: \"\",\n projectId: \"\",\n classNameArray: [],\n lang: \"\",\n playerHTML: \"\",\n segmentArray: [],\n uiConfig: {},\n audioUrl: \"\",\n selectedOptionPair: \"\",\n selectedVoice: \"\",\n selectedPitch: \"\",\n pageURL: \"\",\n allAudios: {},\n classNameString: \"\",\n playerPosition: {\n top: 0,\n left: 0\n }\n};\n\n//# sourceURL=webpack://vachak/./scr/config.js?"); /***/ }), /***/ "./scr/constants.js": /*!**************************!*\ !*** ./scr/constants.js ***! \**************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ analyticData: () => (/* binding */ analyticData),\n/* harmony export */ defaultColorMap: () => (/* binding */ defaultColorMap),\n/* harmony export */ fontSize: () => (/* binding */ fontSize),\n/* harmony export */ pitchValuePair: () => (/* binding */ pitchValuePair),\n/* harmony export */ svgSize: () => (/* binding */ svgSize),\n/* harmony export */ themeElements: () => (/* binding */ themeElements),\n/* harmony export */ versions: () => (/* binding */ versions),\n/* harmony export */ voiceMap: () => (/* binding */ voiceMap),\n/* harmony export */ voiceOptionMap: () => (/* binding */ voiceOptionMap)\n/* harmony export */ });\n//----------------------------Language option based on the text Content -------------------------------------//\nvar languageCodeMap = {\n \"as\": \"assamese\",\n \"bn\": \"bengali\",\n \"en\": \"english\",\n \"gu\": \"gujarati\",\n \"hi\": \"hindi\",\n \"kn\": \"kannada\",\n \"ml\": \"malayalam\",\n \"mr\": \"marathi\",\n \"or\": \"odia\",\n \"pa\": \"punjabi\",\n \"ta\": \"tamil\",\n \"te\": \"telugu\",\n \"fr\": \"french\",\n \"ru\": \"russian\",\n \"es\": \"spanish\",\n \"de\": \"german\",\n \"dgo\": \"dogri\",\n \"bh\": \"maithili\",\n \"sat\": \"santali\",\n \"brx\": \"bodo\",\n \"sbn\": \"sindhi\",\n \"sa\": \"sanskrit\",\n \"ne\": \"nepali\",\n \"mni\": \"manipuri\",\n \"kok\": \"konkani\",\n \"ks\": \"kashmiri\",\n \"zu\": \"zulu\",\n \"tw\": \"twi\",\n \"so\": \"somali\",\n \"sw\": \"swahili\",\n \"ln\": \"lingala\",\n \"syc\": \"aramaic\",\n \"am\": \"amharic\",\n \"af\": \"afrikaans\",\n \"uz\": \"uzbek\",\n \"uk\": \"ukrainian\",\n \"tr\": \"turkish\",\n \"tg\": \"tajik\",\n \"sk\": \"slovak\",\n \"sl\": \"slovenian\",\n \"sr\": \"serbian\",\n \"ro\": \"romanian\",\n \"pl\": \"polish\",\n \"mn\": \"mongolian\",\n \"hu\": \"hungarian\",\n \"fa\": \"farsi\",\n \"et\": \"estonian\",\n \"cs\": \"czech\",\n \"hr\": \"croatian\",\n \"bg\": \"bulgarian\",\n \"sq\": \"albanian\",\n \"vi\": \"vietnamese\",\n \"th\": \"thai\",\n \"syl\": \"sylheti\",\n \"ckb\": \"sorani\",\n \"si\": \"sinhalese\",\n \"ps\": \"pashto\",\n \"mg\": \"malagasy\",\n \"ms\": \"malay\",\n \"lo\": \"lao\",\n \"ku\": \"kurdish\",\n \"id\": \"indonesia\",\n \"km\": \"cambodian\",\n \"my\": \"burmese\",\n \"sv\": \"swedish\",\n \"pt\": \"portuguese\",\n \"no\": \"norwegian\",\n \"mt\": \"maltese\",\n \"it\": \"italian\",\n \"is\": \"icelandic\",\n \"el\": \"greek\",\n \"nl\": \"dutch\",\n \"fi\": \"finnish\",\n \"da\": \"danish\",\n \"ar\": \"arabic\",\n \"az\": \"azeri\",\n \"dv\": \"dhivehi\",\n \"iw\": \"hebrew\",\n \"ur\": \"urdu\"\n};\nvar voiceOptionMap = {\n 'en': [\"English Female\"],\n 'hi': [\"Hindi Female\", \"Hindi Male\"],\n 'mr': [\"Marathi Female\", \"Marathi Male\"],\n 'ta': [\"Tamil Female\", \"Tamil Male\"],\n 'gu': [\"Gujarati Female\", \"Gujarati Male\"],\n 'kn': [\"Kannada Female\", \"Kannada Male\"],\n 'ml': [\"Malayalam Female\", \"Malayalam Male\"],\n 'te': [\"Telugu Female\", \"Telugu Male\"],\n 'or': [\"Odia Female\", \"Odia Male\"],\n 'bn': [\"Bengali Female\", \"Bengali Male\"],\n 'as': [\"Assamese Female\", \"Assamese Male\"],\n 'pa': [\"Punjabi Female\", \"Punjabi Male\"]\n};\nvar voiceMap = {\n // \"English (India) FEMALE\": \"en_g_female\",\n // \"English (India) MALE\": \"en_g_male\",\n \"English Female\": \"en_female\",\n // \"Hindi (India) FEMALE\": \"hi_g_female\",\n // \"Hindi (India) MALE\": \"hi_g_male\",\n \"Hindi Female\": \"hi_female\",\n \"Hindi Male\": \"hi_male\",\n // \"Tamil (India) FEMALE\": \"ta_g_female\",\n // \"Tamil (India) MALE\": \"ta_g_male\",\n \"Tamil Female\": \"ta_female\",\n \"Tamil Male\": \"ta_male\",\n // \"Marathi (India) FEMALE\": \"mr_g_female\",\n // \"Marathi (India) MALE\": \"mr_g_male\",\n \"Marathi Female\": \"mr_female\",\n \"Marathi Male\": \"mr_male\",\n // \"Malayalam (India) FEMALE\": \"ml_g_female\",\n // \"Malayalam (India) MALE\": \"ml_g_male\",\n \"Malayalam Female\": \"ml_female\",\n \"Malayalam Male\": \"ml_male\",\n // \"Telugu (India) FEMALE\": \"te_g_female\",\n // \"Telugu (India) MALE\": \"te_g_male\",\n \"Telugu Female\": \"te_female\",\n \"Telugu Male\": \"te_male\",\n // \"Gujarati (India) FEMALE\": \"gu_g_female\",\n // \"Gujarati (India) MALE\": \"gu_g_male\",\n \"Gujarati Female\": \"gu_female\",\n \"Gujarati Male\": \"gu_male\",\n // \"Kannada (India) FEMALE\": \"kn_g_female\",\n // \"Kannada (India) MALE\": \"kn_g_male\",\n \"Kannada Female\": \"kn_female\",\n \"Kannada Male\": \"kn_male\",\n \"Odia Female\": \"or_female\",\n \"Odia Male\": \"or_male\",\n // \"Bengali (India) FEMALE\": \"bn_g_female\",\n // \"Bengali (India) MALE\": \"bn_g_male\",\n \"Bengali Female\": \"bn_female\",\n \"Bengali Male\": \"bn_male\",\n \"Assamese Female\": \"as_female\",\n \"Assamese Male\": \"as_male\",\n // \"Punjabi (India) FEMALE\": \"pa_g_female\",\n // \"Punjabi (India) MALE\": \"pa_g_male\",\n \"Punjabi Female\": \"pa_female\",\n \"Punjabi Male\": \"pa_male\"\n};\nvar defaultColorMap = {\n playerBackground: \"#FCFCFC\",\n playBtn: \"#EB5757\",\n pauseBtn: \"#EB5757\",\n seekbarThump: \"#EB5757\",\n volBtn: \"#4F4F50\",\n closeBtn: \"#EB5757\",\n minimizeBtn: \"#4F4F50\",\n playbackSpeedThumb: \"#3457B4\",\n menuBtn: \"#4F4F50\",\n loadingAnimationColor: \"0.6rem solid #EB5757\",\n playingAnimationColor: \"#EB5757\"\n};\nvar themeElements = {\n mainPlayBtn: \"play-btn-expand\",\n playBtn: \"\",\n pauseBtn: \"\",\n loadingAnimation: \"\",\n playingAnimation: \"\",\n closeBtn: \"\",\n seekbarThumb: \"\"\n};\nvar fontSize = {\n x_small: \"6px\",\n small: \"8px\",\n medium: \"10px\",\n large: \"12px\",\n x_large: \"14px\"\n};\nvar svgSize = {\n x_small: 0.6,\n small: 0.8,\n medium: 1,\n large: 1.2,\n x_large: 1.4\n};\nvar pitchValuePair = {\n \"X X-Low\": -3,\n \"X-Low\": -2,\n \"Low\": -1,\n \"Default\": 0,\n \"High\": 1,\n \"X-High\": 2,\n \"X X-High\": 3\n};\nvar versions = [\"v1\", \"v1.1\"];\nvar analyticData = {};\n\n//# sourceURL=webpack://vachak/./scr/constants.js?"); /***/ }), /***/ "./scr/customization.js": /*!******************************!*\ !*** ./scr/customization.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ changePlayerSize: () => (/* binding */ changePlayerSize),\n/* harmony export */ changeTheme: () => (/* binding */ changeTheme),\n/* harmony export */ checkPlayerUI: () => (/* binding */ checkPlayerUI),\n/* harmony export */ draggableFunctionality: () => (/* binding */ draggableFunctionality),\n/* harmony export */ generateVoiceOptions: () => (/* binding */ generateVoiceOptions),\n/* harmony export */ setPlayerPosition: () => (/* binding */ setPlayerPosition)\n/* harmony export */ });\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./scr/constants.js\");\n\n\n\nvar uiConfig;\nvar player;\nvar generateVoiceOptions = function generateVoiceOptions(version, voiceList) {\n player = _config__WEBPACK_IMPORTED_MODULE_0__.config.playerHTML;\n uiConfig = _config__WEBPACK_IMPORTED_MODULE_0__.config.uiConfig;\n if (version === 'v1') {\n var voiceSelectedValue = player.querySelector(\".selected_voice\");\n voiceSelectedValue.innerText = voiceList[0];\n _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedVoice = voiceSelectedValue.innerText;\n _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedPitch = 0;\n var voiceOptionList = document.querySelector(\".voice-option-container_select-list\");\n voiceList.forEach(function (element) {\n var p = document.createElement(\"p\");\n p.innerHTML = element;\n p.innerText = element;\n voiceOptionList.appendChild(p);\n });\n } else if (version === 'v1.1') {\n var voiceListDiv = document.querySelector(\".controller__voice-list\");\n _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedVoice = voiceList[0];\n _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedPitch = 0;\n voiceList.forEach(function (voice, key) {\n var voiceOption = document.createElement(\"div\");\n voiceOption.classList.add(\"voice-list__voice-item\");\n key === 0 ? voiceOption.classList.add(\"selected-voice-item\") : 0;\n voiceOption.innerHTML += \"\\n \\n
\\n

\".concat(_config__WEBPACK_IMPORTED_MODULE_0__.config.lang.charAt(0).toUpperCase() + _config__WEBPACK_IMPORTED_MODULE_0__.config.lang.slice(1), \"

\\n
\\n \\n
\\n

\").concat(voice, \"

\\n
\\n \\n
\\n \\n \\n \\n
\\n \");\n voiceListDiv.appendChild(voiceOption);\n });\n }\n};\nvar changeTheme = function changeTheme(version) {\n var color = uiConfig.theme;\n player.style.setProperty('--theme', color);\n if (version === 'v1') {\n document.getElementById(\"play-btn-expand\").setAttribute(\"fill\", color);\n } else if (version === 'v1.1') {\n document.querySelector(\".vachak-player__play-btn\").setAttribute(\"fill\", color);\n }\n\n // player svg and pause svg\n\n document.getElementsByClassName(\"operations__play-btn\")[0].setAttribute(\"fill\", color);\n document.getElementsByClassName(\"operations__pause-btn\")[0].setAttribute(\"fill\", color);\n\n // close btn\n document.getElementsByClassName(\"audio-controls__close-btn\")[0].setAttribute(\"fill\", color);\n};\nvar setPlayerPosition = function setPlayerPosition() {\n //Position of player\n var _uiConfig = uiConfig,\n position = _uiConfig.position;\n if (position && position.hasOwnProperty(\"top\")) {\n player.style.setProperty('--top', position.top);\n }\n if (position && position.hasOwnProperty(\"left\")) {\n player.style.setProperty('--left', position.left);\n }\n // player.style.top = position && position.hasOwnProperty(\"top\") ? position.top : \"\";\n // player.style.left = position && position.hasOwnProperty(\"left\") ? position.left : \"\";\n // player.style.right = position && position.hasOwnProperty(\"right\") ? position.right : \"\";\n // player.style.bottom = position && position.hasOwnProperty(\"bottom\") ? position.bottom : \"\";\n};\n\nvar checkPlayerUI = function checkPlayerUI(version) {\n // Check if the div is going out of the screen size\n // let rect = player.getBoundingClientRect()\n // Get the player element's position and dimensions using offset properties\n var playerTop = player.offsetTop;\n var playerLeft = player.offsetLeft;\n var playerWidth = player.offsetWidth;\n var playerHeight = player.offsetHeight;\n var rect = {\n top: playerTop,\n left: playerLeft,\n right: playerLeft + playerWidth,\n bottom: playerTop + playerHeight,\n height: playerHeight,\n width: playerWidth\n };\n\n // Get the viewport height and width\n var viewportHeight = window.innerHeight;\n var viewportWidth = window.innerWidth;\n\n // Calculate the maximum values for top and left\n var maxTop = viewportHeight - (rect.height + 5);\n var maxLeft = viewportWidth - (rect.width + 20);\n\n // Check if the div is going out of the viewport\n if (rect.top < 0 || rect.bottom > viewportHeight || rect.left < 0 || rect.right > viewportWidth) {\n // Update the top and left position of the div\n player.style.top = Math.max(Math.min(rect.top, maxTop), 0) + 'px';\n player.style.left = Math.max(Math.min(rect.left, maxLeft), 0) + 'px';\n }\n _config__WEBPACK_IMPORTED_MODULE_0__.config.playerPosition.top = player.style.top;\n _config__WEBPACK_IMPORTED_MODULE_0__.config.playerPosition.left = player.style.left;\n _config__WEBPACK_IMPORTED_MODULE_0__.config.playerPosition.bottom = player.style.bottom;\n _config__WEBPACK_IMPORTED_MODULE_0__.config.playerPosition.right = player.style.right;\n};\nvar changePlayerSize = function changePlayerSize() {\n // let player = config.playerHTML\n if (!_constants__WEBPACK_IMPORTED_MODULE_1__.fontSize.hasOwnProperty(uiConfig.size)) {\n uiConfig.size = \"medium\";\n alert(\"Please provide valid size parameter. Default is medium\");\n }\n player.style.setProperty(\"--fontSize\", _constants__WEBPACK_IMPORTED_MODULE_1__.fontSize[uiConfig.size]);\n var allSvgElement = player.querySelectorAll(\"svg\");\n allSvgElement.forEach(function (svg) {\n var width = svg.getAttribute(\"width\");\n var height = svg.getAttribute(\"height\");\n svg.setAttribute(\"width\", width * _constants__WEBPACK_IMPORTED_MODULE_1__.svgSize[uiConfig.size]);\n svg.setAttribute(\"height\", height * _constants__WEBPACK_IMPORTED_MODULE_1__.svgSize[uiConfig.size]);\n });\n};\nvar draggableFunctionality = function draggableFunctionality() {\n if (uiConfig && uiConfig.hasOwnProperty(\"draggable\")) {\n if (uiConfig.draggable) {\n // player.querySelector(\".move-icon\").style.display = \"block\";\n return;\n }\n }\n player.querySelector(\".move-icon\").style.display = \"none\";\n};\n\n//# sourceURL=webpack://vachak/./scr/customization.js?"); /***/ }), /***/ "./scr/helper.js": /*!***********************!*\ !*** ./scr/helper.js ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeStr: () => (/* binding */ decodeStr),\n/* harmony export */ findAudio: () => (/* binding */ findAudio),\n/* harmony export */ getStringArray: () => (/* binding */ getStringArray),\n/* harmony export */ longest_str_in_array: () => (/* binding */ longest_str_in_array),\n/* harmony export */ resetConfig: () => (/* binding */ resetConfig)\n/* harmony export */ });\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./scr/constants.js\");\n/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || \"\" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\nvar getStringArray = function getStringArray(classNameArray) {\n try {\n var segments = [];\n if (classNameArray && classNameArray.length > 0) {\n _config__WEBPACK_IMPORTED_MODULE_0__.config.classNameArray = classNameArray;\n for (var i = 0; i < classNameArray.length; i++) {\n if (document.getElementsByClassName(classNameArray[i]).length > 0) {\n var elements = document.getElementsByClassName(classNameArray[i]);\n if (elements && elements.length > 0) {\n for (var j = 0; j < elements.length; j++) {\n var innerText = elements[j].innerText;\n var newElement = innerText.split(\"\\n\");\n newElement.forEach(function (val) {\n var textNode = val.trim();\n if (textNode && textNode !== \"\") {\n if (textNode.length === 1) {\n if (!containsSpecialChars(textNode)) {\n segments.push(textNode);\n }\n } else {\n segments.push(textNode);\n }\n }\n });\n }\n }\n } else {\n console.log(\"There is no text nodes in class: \".concat(classNameArray[i]));\n }\n }\n } else {\n // Get all text from body tag\n _config__WEBPACK_IMPORTED_MODULE_0__.config.classNameArray = [\"body\"];\n var _elements = document.getElementsByTagName(\"body\")[0].innerText;\n var _newElement = _elements.split(\"\\n\");\n _newElement.forEach(function (val) {\n var textNode = val.trim();\n if (textNode && textNode !== \"\") {\n if (textNode.length === 1) {\n if (!containsSpecialChars(textNode)) {\n segments.push(textNode);\n }\n } else {\n segments.push(textNode);\n }\n }\n });\n }\n return segments;\n } catch (error) {\n console.log(error);\n }\n};\nvar longest_str_in_array = function longest_str_in_array(arra) {\n var max_str = arra[0].length;\n var ans = arra[0];\n for (var i = 1; i < arra.length; i++) {\n var maxi = arra[i].length;\n if (maxi > max_str) {\n ans = arra[i];\n max_str = maxi;\n }\n }\n return ans;\n};\nvar decodeStr = function decodeStr(encodedStr) {\n var bufferO = buffer__WEBPACK_IMPORTED_MODULE_2__.Buffer.from(encodedStr, \"base64\");\n return bufferO.toString(\"utf-8\");\n};\nvar findAudio = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var result, url;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n result = new Promise(function (resolve, reject) {\n var allAudios = _config__WEBPACK_IMPORTED_MODULE_0__.config.allAudios;\n var url = \"\";\n var selectedOptionPair = _config__WEBPACK_IMPORTED_MODULE_0__.config.selectedOptionPair;\n if (selectedOptionPair === \"\" || !allAudios[selectedOptionPair]) {\n resolve(url);\n }\n url = decodeStr(allAudios[selectedOptionPair]);\n _config__WEBPACK_IMPORTED_MODULE_0__.config.audioUrl = url;\n resolve(url);\n });\n _context.next = 3;\n return Promise.resolve(result);\n case 3:\n url = _context.sent;\n return _context.abrupt(\"return\", url);\n case 5:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function findAudio() {\n return _ref.apply(this, arguments);\n };\n}();\nvar resetConfig = function resetConfig() {\n _config__WEBPACK_IMPORTED_MODULE_0__.config = {\n apikey: \"\",\n projectId: \"\",\n classNameArray: [],\n lang: \"\",\n playerHTML: \"\",\n segmentArray: [],\n uiConfig: {},\n audioUrl: \"\",\n selectedOptionPair: \"\",\n selectedVoice: \"\",\n selectedPitch: \"\",\n pageURL: \"\",\n allAudios: {},\n classNameString: \"\",\n playerPosition: {\n top: 0,\n left: 0\n },\n type: \"default\"\n };\n};\nvar containsSpecialChars = function containsSpecialChars(str) {\n var specialChars = /[`!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~↻−‹›©]/;\n return specialChars.test(str);\n};\n\n//# sourceURL=webpack://vachak/./scr/helper.js?"); /***/ }), /***/ "./scr/index.js": /*!**********************!*\ !*** ./scr/index.js ***! \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _player__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./player */ \"./scr/player.js\");\n/* harmony import */ var _helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helper */ \"./scr/helper.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./api */ \"./scr/api.js\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants */ \"./scr/constants.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return { value: void 0, done: !0 }; } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable || \"\" === iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } throw new TypeError(_typeof(iterable) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\n\n\n\n// This is the method that will be called from webpages.\n\nvar vachak = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {\n var apikey, projectId, customConfig, uiConfig, textNodes, sourceLanguage, version, data, audios, stringArray, errorObject, classNameString;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n apikey = options.apikey, projectId = options.projectId, customConfig = options.customConfig, uiConfig = options.uiConfig, textNodes = options.textNodes, sourceLanguage = options.sourceLanguage, version = options.version;\n if (apikey) {\n _context.next = 5;\n break;\n }\n console.log(\"Please pass the apikey\");\n return _context.abrupt(\"return\", \"Please pass the apikey\");\n case 5:\n if (sourceLanguage) {\n _context.next = 8;\n break;\n }\n console.log(\"Please provide the source language\");\n return _context.abrupt(\"return\", \"Please pass the source language\");\n case 8:\n if (projectId) {\n _context.next = 11;\n break;\n }\n console.warn(\"Please pass the projectId\");\n return _context.abrupt(\"return\", \"Please pass the projectId\");\n case 11:\n if (!version) {\n alert(\"Please pass the version.Default version is v1\");\n version = \"v1\";\n }\n if (!_constants__WEBPACK_IMPORTED_MODULE_4__.versions.includes(version)) {\n alert(\"Wrong Version. Default is v1\");\n version = \"v1\";\n }\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"pageURL\"] = window.location.href;\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"lang\"] = sourceLanguage;\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"uiConfig\"] = uiConfig;\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"apikey\"] = apikey, _config__WEBPACK_IMPORTED_MODULE_3__.config[\"projectId\"] = projectId;\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"version\"] = version;\n\n // Check if apikey and projectId is valid\n _context.next = 20;\n return (0,_api__WEBPACK_IMPORTED_MODULE_2__.validateUserAndProjectId)();\n case 20:\n data = _context.sent;\n if (!(data & data.msg === \"User does not exist\")) {\n _context.next = 24;\n break;\n }\n console.log(\"User not exist\");\n return _context.abrupt(\"return\");\n case 24:\n if (!(data && data.msg === \"Project not exist\")) {\n _context.next = 27;\n break;\n }\n console.log(\"Project not exist\");\n return _context.abrupt(\"return\");\n case 27:\n _context.next = 29;\n return (0,_api__WEBPACK_IMPORTED_MODULE_2__.getAllAudios)();\n case 29:\n audios = _context.sent;\n // Get text nodes of different class in single array. \n stringArray = (0,_helper__WEBPACK_IMPORTED_MODULE_1__.getStringArray)(textNodes);\n if (!(stringArray.length === 0)) {\n _context.next = 35;\n break;\n }\n errorObject = {\n error: \"No text data found\"\n };\n console.log(errorObject);\n return _context.abrupt(\"return\");\n case 35:\n // getLongest string in stringArray\n // let longestString = longest_str_in_array(stringArray)\n\n // Language check - call backend api to detect language\n // const lang = await detectLanguage(longestString)\n\n // Update config\n\n _config__WEBPACK_IMPORTED_MODULE_3__.config[\"segmentArray\"] = stringArray;\n // Createplayer UI\n (0,_player__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(version);\n\n // Default voice and pitch pair\n classNameString = \"\";\n if (textNodes && textNodes.length > 0) {\n textNodes.forEach(function (val) {\n classNameString = classNameString + \"_\" + val;\n });\n _config__WEBPACK_IMPORTED_MODULE_3__.config.classNameString = classNameString;\n } else {\n _config__WEBPACK_IMPORTED_MODULE_3__.config.classNameString = \"_body\";\n }\n _config__WEBPACK_IMPORTED_MODULE_3__.config.selectedOptionPair = \"\".concat(sourceLanguage, \"_female_0\").concat(_config__WEBPACK_IMPORTED_MODULE_3__.config.classNameString);\n\n // Add events to the player\n if (version === 'v1') {\n __webpack_require__(/*! ./Player Opearations/PlayerOperations_v1 */ \"./scr/Player Opearations/PlayerOperations_v1.js\");\n } else if (version === \"v1.1\") {\n __webpack_require__(/*! ./Player Opearations/playerOpearations_v1.1 */ \"./scr/Player Opearations/playerOpearations_v1.1.js\");\n }\n console.log(\"Bundle is ready\");\n _context.next = 47;\n break;\n case 44:\n _context.prev = 44;\n _context.t0 = _context[\"catch\"](0);\n return _context.abrupt(\"return\", _context.t0);\n case 47:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[0, 44]]);\n }));\n return function vachak(_x) {\n return _ref.apply(this, arguments);\n };\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vachak);\n\n//# sourceURL=webpack://vachak/./scr/index.js?"); /***/ }), /***/ "./scr/player.js": /*!***********************!*\ !*** ./scr/player.js ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _style_styleTemplate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../style/styleTemplate */ \"./style/styleTemplate.js\");\n/* harmony import */ var _Player_Template_playerTemplate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player Template/playerTemplate */ \"./scr/Player Template/playerTemplate.js\");\n/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ \"./scr/config.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ \"./scr/constants.js\");\n/* harmony import */ var _customization__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./customization */ \"./scr/customization.js\");\n\n\n\n\n\nvar uiConfig, player;\nvar createPlayerUI = function createPlayerUI(version) {\n try {\n uiConfig = _config__WEBPACK_IMPORTED_MODULE_2__.config.uiConfig;\n\n // Append the player to body\n player = (0,_Player_Template_playerTemplate__WEBPACK_IMPORTED_MODULE_1__.renderPlayer)(version);\n document.body.appendChild(player);\n\n //create voice option for player\n var voiceList = _constants__WEBPACK_IMPORTED_MODULE_3__.voiceOptionMap[_config__WEBPACK_IMPORTED_MODULE_2__.config.lang]; //[\"Hindi Female\", \"Hindi Male\"]\n if (voiceList && voiceList.length > 0) {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.generateVoiceOptions)(version, voiceList);\n } else {\n var errorObject = {\n error: \"Source Language not found\"\n };\n console.error(errorObject);\n document.body.removeChild(document.getElementsByClassName(\"audio-player\")[0]);\n }\n\n // UI configs\n\n // Change theme\n if (uiConfig && uiConfig.hasOwnProperty(\"theme\")) {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.changeTheme)(version);\n }\n\n //Change playerSize\n if (uiConfig && uiConfig.hasOwnProperty(\"size\")) {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.changePlayerSize)();\n }\n\n //Font family\n if (uiConfig && uiConfig.hasOwnProperty(\"fontFamily\")) {\n player.style.fontFamily = uiConfig.fontFamily;\n player.style.setProperty(\"--font\", uiConfig.fontFamily);\n }\n if (uiConfig && uiConfig.position) {\n if (navigator.userAgent.includes('Chrome')) {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.setPlayerPosition)();\n } else {\n setTimeout(function () {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.setPlayerPosition)();\n }, 100);\n }\n }\n\n // Check if player is going out of screen\n setTimeout(function () {\n (0,_customization__WEBPACK_IMPORTED_MODULE_4__.checkPlayerUI)(version);\n }, 500);\n\n // Draggable\n version === \"v1.1\" ? (0,_customization__WEBPACK_IMPORTED_MODULE_4__.draggableFunctionality)() : 0;\n } catch (error) {\n console.log(error);\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createPlayerUI);\n\n//# sourceURL=webpack://vachak/./scr/player.js?"); /***/ }), /***/ "./style/styleTemplate.js": /*!********************************!*\ !*** ./style/styleTemplate.js ***! \********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getStyling: () => (/* binding */ getStyling)\n/* harmony export */ });\nvar getStyling = function getStyling(version) {\n var styling;\n if (version === 'v1') {\n styling = \"\\n \";\n } else if (version === 'v1.1') {\n styling = \"\\n \\n\";\n }\n return styling;\n};\n\n//# sourceURL=webpack://vachak/./style/styleTemplate.js?"); /***/ }), /***/ "./node_modules/base64-js/index.js": /*!*****************************************!*\ !*** ./node_modules/base64-js/index.js ***! \*****************************************/ /***/ ((__unused_webpack_module, exports) => { "use strict"; eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack://vachak/./node_modules/base64-js/index.js?"); /***/ }), /***/ "./node_modules/buffer/index.js": /*!**************************************!*\ !*** ./node_modules/buffer/index.js ***! \**************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; eval("/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nconst base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nconst ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n\n\n//# sourceURL=webpack://vachak/./node_modules/buffer/index.js?"); /***/ }), /***/ "./node_modules/ieee754/index.js": /*!***************************************!*\ !*** ./node_modules/ieee754/index.js ***! \***************************************/ /***/ ((__unused_webpack_module, exports) => { eval("/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack://vachak/./node_modules/ieee754/index.js?"); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./scr/index.js"); /******/ vachak = __webpack_exports__["default"]; /******/ /******/ })() ;