yt-playlists-delete-enhancer

Add a button to remove videos watched with more than X percent from watch later playlist.

  1. // ==UserScript==
  2. // @name yt-playlists-delete-enhancer
  3. // @description Add a button to remove videos watched with more than X percent from watch later playlist.
  4. // @version 1.7.2
  5. // @author Andrew Valleteau <avallete@student.42.fr>
  6. // @grant none
  7. // @match *://youtube.com/*
  8. // @match *://www.youtube.com/*
  9. // @namespace greasyfork-namespace-url
  10. // @noframes
  11. // @homepageURL https://github.com/avallete/yt-playlists-delete-enhancer#readme
  12. // @supportURL https://github.com/avallete/yt-playlists-delete-enhancer/issues
  13. // @run-at document-idle
  14. // @license MIT
  15. // ==/UserScript==
  16. /******/ (function(modules) { // webpackBootstrap
  17. /******/ // The module cache
  18. /******/ var installedModules = {};
  19. /******/
  20. /******/ // The require function
  21. /******/ function __webpack_require__(moduleId) {
  22. /******/
  23. /******/ // Check if module is in cache
  24. /******/ if(installedModules[moduleId]) {
  25. /******/ return installedModules[moduleId].exports;
  26. /******/ }
  27. /******/ // Create a new module (and put it into the cache)
  28. /******/ var module = installedModules[moduleId] = {
  29. /******/ i: moduleId,
  30. /******/ l: false,
  31. /******/ exports: {}
  32. /******/ };
  33. /******/
  34. /******/ // Execute the module function
  35. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36. /******/
  37. /******/ // Flag the module as loaded
  38. /******/ module.l = true;
  39. /******/
  40. /******/ // Return the exports of the module
  41. /******/ return module.exports;
  42. /******/ }
  43. /******/
  44. /******/
  45. /******/ // expose the modules object (__webpack_modules__)
  46. /******/ __webpack_require__.m = modules;
  47. /******/
  48. /******/ // expose the module cache
  49. /******/ __webpack_require__.c = installedModules;
  50. /******/
  51. /******/ // define getter function for harmony exports
  52. /******/ __webpack_require__.d = function(exports, name, getter) {
  53. /******/ if(!__webpack_require__.o(exports, name)) {
  54. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  55. /******/ }
  56. /******/ };
  57. /******/
  58. /******/ // define __esModule on exports
  59. /******/ __webpack_require__.r = function(exports) {
  60. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  61. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  62. /******/ }
  63. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  64. /******/ };
  65. /******/
  66. /******/ // create a fake namespace object
  67. /******/ // mode & 1: value is a module id, require it
  68. /******/ // mode & 2: merge all properties of value into the ns
  69. /******/ // mode & 4: return value when already ns object
  70. /******/ // mode & 8|1: behave like require
  71. /******/ __webpack_require__.t = function(value, mode) {
  72. /******/ if(mode & 1) value = __webpack_require__(value);
  73. /******/ if(mode & 8) return value;
  74. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  75. /******/ var ns = Object.create(null);
  76. /******/ __webpack_require__.r(ns);
  77. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  78. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  79. /******/ return ns;
  80. /******/ };
  81. /******/
  82. /******/ // getDefaultExport function for compatibility with non-harmony modules
  83. /******/ __webpack_require__.n = function(module) {
  84. /******/ var getter = module && module.__esModule ?
  85. /******/ function getDefault() { return module['default']; } :
  86. /******/ function getModuleExports() { return module; };
  87. /******/ __webpack_require__.d(getter, 'a', getter);
  88. /******/ return getter;
  89. /******/ };
  90. /******/
  91. /******/ // Object.prototype.hasOwnProperty.call
  92. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  93. /******/
  94. /******/ // __webpack_public_path__
  95. /******/ __webpack_require__.p = "";
  96. /******/
  97. /******/
  98. /******/ // Load entry module and return exports
  99. /******/ return __webpack_require__(__webpack_require__.s = 28);
  100. /******/ })
  101. /************************************************************************/
  102. /******/ ([
  103. /* 0 */
  104. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  105.  
  106. "use strict";
  107. __webpack_require__.r(__webpack_exports__);
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return b; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return g; });
  110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return E; });
  111. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createContext", function() { return F; });
  112. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElement", function() { return y; });
  113. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRef", function() { return _; });
  114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return y; });
  115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hydrate", function() { return B; });
  116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return t; });
  117. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "options", function() { return l; });
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return q; });
  119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toChildArray", function() { return $; });
  120. var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?m(n):null}function w(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return w(n)}}function k(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__v=r.__v,o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&w(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?(d||p.__e!=e||(e=m(p)),e=S(y,e,n)):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)r=t+a,null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d(null,i,null,null,null):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:f<r?f==r-1&&(a=f-r):a=0,f!==t+a&&(i.__u|=65536))):(o=u[r])&&null==o.key&&o.__e&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[r]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8===l.nodeType);return l}function $(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type&&0==(131072&e.__u))return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a.test(l)?u:u+"px"}function T(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/i,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){if(this.l){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}}function D(n){if(this.l)return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,w,k,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof A)try{if(k=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?w=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(k,P):(u.__c=p=new b(k,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=k,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(k,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&k!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(k,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(k,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=k,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(k,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=k,p.__P=n,p.__e=!1,$=l.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),w&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,w=t.props,k=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(k);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,k.is&&k),r=null,e=!1}if(null===x)w===k||e&&l.data===k||(l.data=k);else{if(r=r&&n.call(l.childNodes),w=t.props||c,!e&&null!=r)for(w={},a=0;a<l.attributes.length;a++)w[(_=l.attributes[a]).name]=_.value;for(a in w)_=w[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in k||T(l,a,null,_,o));for(a in k)_=k[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||w[a]===_||T(l,a,_,w[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==w[a])&&T(l,a,g,w[a],!1),a="checked",void 0!==b&&b!==l[a]&&T(l,a,b,w[a],!1))}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,k(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),k(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;
  121. //# sourceMappingURL=preact.module.js.map
  122.  
  123.  
  124. /***/ }),
  125. /* 1 */
  126. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  127.  
  128. "use strict";
  129. /**
  130. * @license
  131. * Copyright 2016 Google Inc.
  132. *
  133. * Permission is hereby granted, free of charge, to any person obtaining a copy
  134. * of this software and associated documentation files (the "Software"), to deal
  135. * in the Software without restriction, including without limitation the rights
  136. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  137. * copies of the Software, and to permit persons to whom the Software is
  138. * furnished to do so, subject to the following conditions:
  139. *
  140. * The above copyright notice and this permission notice shall be included in
  141. * all copies or substantial portions of the Software.
  142. *
  143. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  144. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  145. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  146. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  147. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  148. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  149. * THE SOFTWARE.
  150. */
  151.  
  152. /**
  153. * @template A
  154. */
  155. class MDCFoundation {
  156. /** @return enum{cssClasses} */
  157. static get cssClasses() {
  158. // Classes extending MDCFoundation should implement this method to return an object which exports every
  159. // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
  160. return {};
  161. }
  162.  
  163. /** @return enum{strings} */
  164. static get strings() {
  165. // Classes extending MDCFoundation should implement this method to return an object which exports all
  166. // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
  167. return {};
  168. }
  169.  
  170. /** @return enum{numbers} */
  171. static get numbers() {
  172. // Classes extending MDCFoundation should implement this method to return an object which exports all
  173. // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
  174. return {};
  175. }
  176.  
  177. /** @return {!Object} */
  178. static get defaultAdapter() {
  179. // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
  180. // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
  181. // validation.
  182. return {};
  183. }
  184.  
  185. /**
  186. * @param {A=} adapter
  187. */
  188. constructor(adapter = {}) {
  189. /** @protected {!A} */
  190. this.adapter_ = adapter;
  191. }
  192.  
  193. init() {
  194. // Subclasses should override this method to perform initialization routines (registering events, etc.)
  195. }
  196.  
  197. destroy() {
  198. // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
  199. }
  200. }
  201.  
  202. /* harmony default export */ __webpack_exports__["a"] = (MDCFoundation);
  203.  
  204.  
  205. /***/ }),
  206. /* 2 */
  207. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  208.  
  209. "use strict";
  210. /* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
  211. /**
  212. * @license
  213. * Copyright 2016 Google Inc.
  214. *
  215. * Permission is hereby granted, free of charge, to any person obtaining a copy
  216. * of this software and associated documentation files (the "Software"), to deal
  217. * in the Software without restriction, including without limitation the rights
  218. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  219. * copies of the Software, and to permit persons to whom the Software is
  220. * furnished to do so, subject to the following conditions:
  221. *
  222. * The above copyright notice and this permission notice shall be included in
  223. * all copies or substantial portions of the Software.
  224. *
  225. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  226. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  227. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  228. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  229. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  230. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  231. * THE SOFTWARE.
  232. */
  233.  
  234.  
  235.  
  236. /**
  237. * @template F
  238. */
  239. class MDCComponent {
  240. /**
  241. * @param {!Element} root
  242. * @return {!MDCComponent}
  243. */
  244. static attachTo(root) {
  245. // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
  246. // returns an instantiated component with its root set to that element. Also note that in the cases of
  247. // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
  248. // from getDefaultFoundation().
  249. return new MDCComponent(root, new _foundation__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]());
  250. }
  251.  
  252. /**
  253. * @param {!Element} root
  254. * @param {F=} foundation
  255. * @param {...?} args
  256. */
  257. constructor(root, foundation = undefined, ...args) {
  258. /** @protected {!Element} */
  259. this.root_ = root;
  260. this.initialize(...args);
  261. // Note that we initialize foundation here and not within the constructor's default param so that
  262. // this.root_ is defined and can be used within the foundation class.
  263. /** @protected {!F} */
  264. this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
  265. this.foundation_.init();
  266. this.initialSyncWithDOM();
  267. }
  268.  
  269. initialize(/* ...args */) {
  270. // Subclasses can override this to do any additional setup work that would be considered part of a
  271. // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
  272. // initialized. Any additional arguments besides root and foundation will be passed in here.
  273. }
  274.  
  275. /**
  276. * @return {!F} foundation
  277. */
  278. getDefaultFoundation() {
  279. // Subclasses must override this method to return a properly configured foundation class for the
  280. // component.
  281. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
  282. 'foundation class');
  283. }
  284.  
  285. initialSyncWithDOM() {
  286. // Subclasses should override this method if they need to perform work to synchronize with a host DOM
  287. // object. An example of this would be a form control wrapper that needs to synchronize its internal state
  288. // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
  289. // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
  290. }
  291.  
  292. destroy() {
  293. // Subclasses may implement this method to release any resources / deregister any listeners they have
  294. // attached. An example of this might be deregistering a resize event from the window object.
  295. this.foundation_.destroy();
  296. }
  297.  
  298. /**
  299. * Wrapper method to add an event listener to the component's root element. This is most useful when
  300. * listening for custom events.
  301. * @param {string} evtType
  302. * @param {!Function} handler
  303. */
  304. listen(evtType, handler) {
  305. this.root_.addEventListener(evtType, handler);
  306. }
  307.  
  308. /**
  309. * Wrapper method to remove an event listener to the component's root element. This is most useful when
  310. * unlistening for custom events.
  311. * @param {string} evtType
  312. * @param {!Function} handler
  313. */
  314. unlisten(evtType, handler) {
  315. this.root_.removeEventListener(evtType, handler);
  316. }
  317.  
  318. /**
  319. * Fires a cross-browser-compatible custom event from the component root of the given type,
  320. * with the given data.
  321. * @param {string} evtType
  322. * @param {!Object} evtData
  323. * @param {boolean=} shouldBubble
  324. */
  325. emit(evtType, evtData, shouldBubble = false) {
  326. let evt;
  327. if (typeof CustomEvent === 'function') {
  328. evt = new CustomEvent(evtType, {
  329. detail: evtData,
  330. bubbles: shouldBubble,
  331. });
  332. } else {
  333. evt = document.createEvent('CustomEvent');
  334. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  335. }
  336.  
  337. this.root_.dispatchEvent(evt);
  338. }
  339. }
  340.  
  341. /* harmony default export */ __webpack_exports__["a"] = (MDCComponent);
  342.  
  343.  
  344. /***/ }),
  345. /* 3 */
  346. /***/ (function(module, exports) {
  347.  
  348. function _getPrototypeOf(t) {
  349. return (module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
  350. return t.__proto__ || Object.getPrototypeOf(t);
  351. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _getPrototypeOf(t);
  352. }
  353. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  354.  
  355. /***/ }),
  356. /* 4 */
  357. /***/ (function(module, exports) {
  358.  
  359. function _interopRequireDefault(e) {
  360. return e && e.__esModule ? e : {
  361. "default": e
  362. };
  363. }
  364. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  365.  
  366. /***/ }),
  367. /* 5 */
  368. /***/ (function(module, exports) {
  369.  
  370. function _classCallCheck(a, n) {
  371. if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
  372. }
  373. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  374.  
  375. /***/ }),
  376. /* 6 */
  377. /***/ (function(module, exports, __webpack_require__) {
  378.  
  379. var toPropertyKey = __webpack_require__(37);
  380. function _defineProperties(e, r) {
  381. for (var t = 0; t < r.length; t++) {
  382. var o = r[t];
  383. o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
  384. }
  385. }
  386. function _createClass(e, r, t) {
  387. return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
  388. writable: !1
  389. }), e;
  390. }
  391. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  392.  
  393. /***/ }),
  394. /* 7 */
  395. /***/ (function(module, exports, __webpack_require__) {
  396.  
  397. var _typeof = __webpack_require__(13)["default"];
  398. var assertThisInitialized = __webpack_require__(39);
  399. function _possibleConstructorReturn(t, e) {
  400. if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
  401. if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
  402. return assertThisInitialized(t);
  403. }
  404. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  405.  
  406. /***/ }),
  407. /* 8 */
  408. /***/ (function(module, exports, __webpack_require__) {
  409.  
  410. var setPrototypeOf = __webpack_require__(41);
  411. function _inherits(t, e) {
  412. if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
  413. t.prototype = Object.create(e && e.prototype, {
  414. constructor: {
  415. value: t,
  416. writable: !0,
  417. configurable: !0
  418. }
  419. }), Object.defineProperty(t, "prototype", {
  420. writable: !1
  421. }), e && setPrototypeOf(t, e);
  422. }
  423. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  424.  
  425. /***/ }),
  426. /* 9 */
  427. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  428.  
  429. "use strict";
  430. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return transformStyleProperties; });
  431. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCorrectEventName; });
  432. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCorrectPropertyName; });
  433. /**
  434. * @license
  435. * Copyright 2016 Google Inc.
  436. *
  437. * Permission is hereby granted, free of charge, to any person obtaining a copy
  438. * of this software and associated documentation files (the "Software"), to deal
  439. * in the Software without restriction, including without limitation the rights
  440. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  441. * copies of the Software, and to permit persons to whom the Software is
  442. * furnished to do so, subject to the following conditions:
  443. *
  444. * The above copyright notice and this permission notice shall be included in
  445. * all copies or substantial portions of the Software.
  446. *
  447. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  448. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  449. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  450. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  451. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  452. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  453. * THE SOFTWARE.
  454. */
  455.  
  456. /**
  457. * @typedef {{
  458. * noPrefix: string,
  459. * webkitPrefix: string,
  460. * styleProperty: string
  461. * }}
  462. */
  463. let VendorPropertyMapType;
  464.  
  465. /** @const {Object<string, !VendorPropertyMapType>} */
  466. const eventTypeMap = {
  467. 'animationstart': {
  468. noPrefix: 'animationstart',
  469. webkitPrefix: 'webkitAnimationStart',
  470. styleProperty: 'animation',
  471. },
  472. 'animationend': {
  473. noPrefix: 'animationend',
  474. webkitPrefix: 'webkitAnimationEnd',
  475. styleProperty: 'animation',
  476. },
  477. 'animationiteration': {
  478. noPrefix: 'animationiteration',
  479. webkitPrefix: 'webkitAnimationIteration',
  480. styleProperty: 'animation',
  481. },
  482. 'transitionend': {
  483. noPrefix: 'transitionend',
  484. webkitPrefix: 'webkitTransitionEnd',
  485. styleProperty: 'transition',
  486. },
  487. };
  488.  
  489. /** @const {Object<string, !VendorPropertyMapType>} */
  490. const cssPropertyMap = {
  491. 'animation': {
  492. noPrefix: 'animation',
  493. webkitPrefix: '-webkit-animation',
  494. },
  495. 'transform': {
  496. noPrefix: 'transform',
  497. webkitPrefix: '-webkit-transform',
  498. },
  499. 'transition': {
  500. noPrefix: 'transition',
  501. webkitPrefix: '-webkit-transition',
  502. },
  503. };
  504.  
  505. /**
  506. * @param {!Object} windowObj
  507. * @return {boolean}
  508. */
  509. function hasProperShape(windowObj) {
  510. return (windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function');
  511. }
  512.  
  513. /**
  514. * @param {string} eventType
  515. * @return {boolean}
  516. */
  517. function eventFoundInMaps(eventType) {
  518. return (eventType in eventTypeMap || eventType in cssPropertyMap);
  519. }
  520.  
  521. /**
  522. * @param {string} eventType
  523. * @param {!Object<string, !VendorPropertyMapType>} map
  524. * @param {!Element} el
  525. * @return {string}
  526. */
  527. function getJavaScriptEventName(eventType, map, el) {
  528. return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
  529. }
  530.  
  531. /**
  532. * Helper function to determine browser prefix for CSS3 animation events
  533. * and property names.
  534. * @param {!Object} windowObj
  535. * @param {string} eventType
  536. * @return {string}
  537. */
  538. function getAnimationName(windowObj, eventType) {
  539. if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {
  540. return eventType;
  541. }
  542.  
  543. const map = /** @type {!Object<string, !VendorPropertyMapType>} */ (
  544. eventType in eventTypeMap ? eventTypeMap : cssPropertyMap
  545. );
  546. const el = windowObj['document']['createElement']('div');
  547. let eventName = '';
  548.  
  549. if (map === eventTypeMap) {
  550. eventName = getJavaScriptEventName(eventType, map, el);
  551. } else {
  552. eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
  553. }
  554.  
  555. return eventName;
  556. }
  557.  
  558. // Public functions to access getAnimationName() for JavaScript events or CSS
  559. // property names.
  560.  
  561. const transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform'];
  562.  
  563. /**
  564. * @param {!Object} windowObj
  565. * @param {string} eventType
  566. * @return {string}
  567. */
  568. function getCorrectEventName(windowObj, eventType) {
  569. return getAnimationName(windowObj, eventType);
  570. }
  571.  
  572. /**
  573. * @param {!Object} windowObj
  574. * @param {string} eventType
  575. * @return {string}
  576. */
  577. function getCorrectPropertyName(windowObj, eventType) {
  578. return getAnimationName(windowObj, eventType);
  579. }
  580.  
  581.  
  582.  
  583.  
  584. /***/ }),
  585. /* 10 */
  586. /***/ (function(module, exports, __webpack_require__) {
  587.  
  588. "use strict";
  589.  
  590. Object.defineProperty(exports, "__esModule", { value: true });
  591. exports.XPATH = void 0;
  592. exports.XPATH = {
  593. // We need two class selectors because youtube "custom playlist" and watch later have slightly different ui
  594. APP_RENDER_ROOT: '//div[@class="metadata-wrapper style-scope ytd-playlist-header-renderer" or @class="style-scope ytd-playlist-sidebar-primary-info-renderer"]',
  595. YT_PLAYLIST_VIDEO_RENDERERS: '//ytd-playlist-video-renderer',
  596. YT_PLAYLIST_VIDEO_MENU: '//ytd-playlist-video-renderer//div[@id="menu"]',
  597. YT_NUMBER_OF_VIDEOS_IN_PLAYLIST: '//ytd-playlist-byline-renderer//div/yt-formatted-string/span[1]',
  598. YT_SIDEBAR_CONTAINER: '//div[@class="immersive-header-content style-scope ytd-playlist-header-renderer"]',
  599. };
  600. exports.default = {
  601. XPATH: exports.XPATH,
  602. };
  603.  
  604.  
  605. /***/ }),
  606. /* 11 */
  607. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  608.  
  609. "use strict";
  610. __webpack_require__.r(__webpack_exports__);
  611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsx", function() { return u; });
  612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxAttr", function() { return l; });
  613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxDEV", function() { return u; });
  614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxEscape", function() { return _; });
  615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxTemplate", function() { return a; });
  616. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsxs", function() { return u; });
  617. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  618. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return preact__WEBPACK_IMPORTED_MODULE_0__["Fragment"]; });
  619.  
  620. var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){var a,c,p={};for(c in t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return preact__WEBPACK_IMPORTED_MODULE_0__["options"].vnode&&preact__WEBPACK_IMPORTED_MODULE_0__["options"].vnode(l),l}function a(r){var t=u(preact__WEBPACK_IMPORTED_MODULE_0__["Fragment"],{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(preact__WEBPACK_IMPORTED_MODULE_0__["options"].attr){var f=preact__WEBPACK_IMPORTED_MODULE_0__["options"].attr(e,t);if("string"==typeof f)return f}if("ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),_=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(_="px;"),i=i+l+":"+a+_}}return e+'="'+i+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(t)+'"'}function _(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=_(r[e]);return r}}return n(""+r)}
  621. //# sourceMappingURL=jsxRuntime.module.js.map
  622.  
  623.  
  624. /***/ }),
  625. /* 12 */
  626. /***/ (function(module, exports, __webpack_require__) {
  627.  
  628. "use strict";
  629.  
  630. Object.defineProperty(exports, "__esModule", { value: true });
  631. // Query DOM Xpath and return an array of Node
  632. // Usage is similar to $x in console
  633. function getElementsByXPath(xpath, parent) {
  634. const results = [];
  635. const query = document.evaluate(xpath, parent || document, undefined, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
  636. const length = query.snapshotLength;
  637. for (let index = 0; index < length; index += 1) {
  638. results.push(query.snapshotItem(index));
  639. }
  640. // force cast since we keep into snapshotLength limit, no item should be null
  641. return results;
  642. }
  643. exports.default = getElementsByXPath;
  644.  
  645.  
  646. /***/ }),
  647. /* 13 */
  648. /***/ (function(module, exports) {
  649.  
  650. function _typeof(o) {
  651. "@babel/helpers - typeof";
  652.  
  653. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  654. return typeof o;
  655. } : function (o) {
  656. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  657. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  658. }
  659. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  660.  
  661. /***/ }),
  662. /* 14 */
  663. /***/ (function(module, exports, __webpack_require__) {
  664.  
  665. "use strict";
  666.  
  667.  
  668. var _interopRequireDefault = __webpack_require__(4);
  669.  
  670. Object.defineProperty(exports, "__esModule", {
  671. value: true
  672. });
  673. exports.default = exports.MaterialComponent = void 0;
  674.  
  675. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  676.  
  677. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  678.  
  679. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  680.  
  681. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  682.  
  683. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  684.  
  685. var _typeof2 = _interopRequireDefault(__webpack_require__(13));
  686.  
  687. var _ripple = __webpack_require__(22);
  688.  
  689. var _bindDecorator = __webpack_require__(25);
  690.  
  691. var _preact = __webpack_require__(0);
  692.  
  693. var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
  694. var c = arguments.length,
  695. r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
  696. d;
  697. if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof2.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
  698. if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  699. }
  700. return c > 3 && r && Object.defineProperty(target, key, r), r;
  701. };
  702.  
  703. var doNotRemoveProps = ['disabled'];
  704. /**
  705. * Base class for every Material component in this package
  706. * NOTE: every component should add a ref by the name of `control` to its root dom for autoInit Properties
  707. *
  708. * @export
  709. * @class MaterialComponent
  710. * @extends {Component}
  711. */
  712.  
  713. var MaterialComponent =
  714. /*#__PURE__*/
  715. function (_Component) {
  716. (0, _inherits2.default)(MaterialComponent, _Component);
  717.  
  718. function MaterialComponent() {
  719. (0, _classCallCheck2.default)(this, MaterialComponent);
  720. return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MaterialComponent).apply(this, arguments));
  721. }
  722.  
  723. (0, _createClass2.default)(MaterialComponent, [{
  724. key: "render",
  725. value: function render(props) {
  726. if (!this.classText) {
  727. this.classText = this.buildClassName(props);
  728. } // Fetch a VNode
  729.  
  730.  
  731. var componentProps = props;
  732. var userDefinedClasses = componentProps.className || componentProps.class || ''; // We delete class props and add them later in the final
  733. // step so every component does not need to handle user specified classes.
  734.  
  735. if (componentProps.class) {
  736. delete componentProps.class;
  737. }
  738.  
  739. if (componentProps.className) {
  740. delete componentProps.className;
  741. }
  742.  
  743. var element = this.materialDom(componentProps);
  744. var propName = 'attributes';
  745.  
  746. if ('props' in element) {
  747. propName = 'props'; // @ts-ignore
  748.  
  749. element.props = element.props || {};
  750. } else {
  751. element.attributes = element.attributes || {};
  752. } // @ts-ignore
  753.  
  754.  
  755. element[propName].className = "".concat(userDefinedClasses, " ").concat(this.getClassName(element)).split(' ').filter(function (value, index, self) {
  756. return self.indexOf(value) === index && value !== '';
  757. }) // Unique + exclude empty class names
  758. .join(' '); // Clean this shit of proxy attributes
  759.  
  760. this.mdcProps.forEach(function (prop) {
  761. // TODO: Fix this better
  762. if (prop in doNotRemoveProps) {
  763. return;
  764. } // @ts-ignore
  765.  
  766.  
  767. delete element[propName][prop];
  768. });
  769. return element;
  770. }
  771. /** Attach the ripple effect */
  772.  
  773. }, {
  774. key: "componentDidMount",
  775. value: function componentDidMount() {
  776. if (this.props.ripple && this.control) {
  777. this.ripple = new _ripple.MDCRipple(this.control);
  778. }
  779. }
  780. }, {
  781. key: "componentWillReceiveProps",
  782. value: function componentWillReceiveProps(nextProps) {
  783. if (this.MDComponent && this.mdcNotifyProps) {
  784. var _iteratorNormalCompletion = true;
  785. var _didIteratorError = false;
  786. var _iteratorError = undefined;
  787.  
  788. try {
  789. for (var _iterator = this.mdcNotifyProps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  790. var prop = _step.value;
  791.  
  792. if (this.props[prop] !== nextProps[prop]) {
  793. this.MDComponent[prop] = nextProps[prop];
  794. }
  795. }
  796. } catch (err) {
  797. _didIteratorError = true;
  798. _iteratorError = err;
  799. } finally {
  800. try {
  801. if (!_iteratorNormalCompletion && _iterator.return != null) {
  802. _iterator.return();
  803. }
  804. } finally {
  805. if (_didIteratorError) {
  806. throw _iteratorError;
  807. }
  808. }
  809. }
  810. }
  811.  
  812. var _iteratorNormalCompletion2 = true;
  813. var _didIteratorError2 = false;
  814. var _iteratorError2 = undefined;
  815.  
  816. try {
  817. for (var _iterator2 = this.mdcProps[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  818. var _prop = _step2.value;
  819.  
  820. if (this.props[_prop] !== nextProps[_prop]) {
  821. this.classText = this.buildClassName(nextProps);
  822. break;
  823. }
  824. }
  825. } catch (err) {
  826. _didIteratorError2 = true;
  827. _iteratorError2 = err;
  828. } finally {
  829. try {
  830. if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
  831. _iterator2.return();
  832. }
  833. } finally {
  834. if (_didIteratorError2) {
  835. throw _iteratorError2;
  836. }
  837. }
  838. }
  839. }
  840. }, {
  841. key: "componentWillUnmount",
  842. value: function componentWillUnmount() {
  843. if (this.ripple) {
  844. this.ripple.destroy();
  845. }
  846. }
  847. }, {
  848. key: "afterComponentDidMount",
  849. value: function afterComponentDidMount() {
  850. if (this.MDComponent && this.mdcNotifyProps) {
  851. var _iteratorNormalCompletion3 = true;
  852. var _didIteratorError3 = false;
  853. var _iteratorError3 = undefined;
  854.  
  855. try {
  856. for (var _iterator3 = this.mdcNotifyProps[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
  857. var prop = _step3.value;
  858. this.MDComponent[prop] = this.props[prop];
  859. }
  860. } catch (err) {
  861. _didIteratorError3 = true;
  862. _iteratorError3 = err;
  863. } finally {
  864. try {
  865. if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
  866. _iterator3.return();
  867. }
  868. } finally {
  869. if (_didIteratorError3) {
  870. throw _iteratorError3;
  871. }
  872. }
  873. }
  874. }
  875. } // Shared setter for the root element ref
  876.  
  877. }, {
  878. key: "setControlRef",
  879. value: function setControlRef(control) {
  880. this.control = control;
  881. }
  882. /** Build the className based on component names and mdc props */
  883.  
  884. }, {
  885. key: "buildClassName",
  886. value: function buildClassName(props) {
  887. // Class name based on component name
  888. var classText = 'mdc-' + this.componentName; // Loop over mdcProps to turn them into classNames
  889.  
  890. for (var propKey in props) {
  891. if (props.hasOwnProperty(propKey)) {
  892. var prop = props[propKey];
  893.  
  894. if (typeof prop === 'boolean' && prop) {
  895. if (this.mdcProps.indexOf(propKey) !== -1) {
  896. classText += " mdc-".concat(this.componentName, "--").concat(propKey);
  897. }
  898. }
  899. }
  900. }
  901.  
  902. return classText;
  903. }
  904. /** Returns the class name for element */
  905.  
  906. }, {
  907. key: "getClassName",
  908. value: function getClassName(element) {
  909. if (!element) {
  910. return '';
  911. }
  912.  
  913. var propName = 'attributes';
  914.  
  915. if ('props' in element) {
  916. propName = 'props'; // @ts-ignore
  917.  
  918. element.props = element.props || {};
  919. } else {
  920. element.attributes = element.attributes || {};
  921. } // @ts-ignore
  922.  
  923.  
  924. var attrs = element[propName] = element[propName] || {};
  925. var classText = this.classText;
  926.  
  927. if (attrs.class) {
  928. classText += ' ' + attrs.class;
  929. }
  930.  
  931. if (attrs.className && attrs.className !== attrs.class) {
  932. classText += ' ' + attrs.className;
  933. }
  934.  
  935. return classText;
  936. }
  937. }]);
  938. return MaterialComponent;
  939. }(_preact.Component);
  940.  
  941. exports.MaterialComponent = MaterialComponent;
  942.  
  943. __decorate([_bindDecorator.bind], MaterialComponent.prototype, "setControlRef", null);
  944.  
  945. var _default = MaterialComponent;
  946. exports.default = _default;
  947. //# sourceMappingURL=MaterialComponent.js.map
  948.  
  949. /***/ }),
  950. /* 15 */
  951. /***/ (function(module, exports, __webpack_require__) {
  952.  
  953. "use strict";
  954.  
  955.  
  956. /*
  957. MIT License http://www.opensource.org/licenses/mit-license.php
  958. Author Tobias Koppers @sokra
  959. */
  960. // css base code, injected by the css-loader
  961. // eslint-disable-next-line func-names
  962. module.exports = function (useSourceMap) {
  963. var list = []; // return the list of modules as css string
  964.  
  965. list.toString = function toString() {
  966. return this.map(function (item) {
  967. var content = cssWithMappingToString(item, useSourceMap);
  968.  
  969. if (item[2]) {
  970. return "@media ".concat(item[2], " {").concat(content, "}");
  971. }
  972.  
  973. return content;
  974. }).join('');
  975. }; // import a list of modules into the list
  976. // eslint-disable-next-line func-names
  977.  
  978.  
  979. list.i = function (modules, mediaQuery, dedupe) {
  980. if (typeof modules === 'string') {
  981. // eslint-disable-next-line no-param-reassign
  982. modules = [[null, modules, '']];
  983. }
  984.  
  985. var alreadyImportedModules = {};
  986.  
  987. if (dedupe) {
  988. for (var i = 0; i < this.length; i++) {
  989. // eslint-disable-next-line prefer-destructuring
  990. var id = this[i][0];
  991.  
  992. if (id != null) {
  993. alreadyImportedModules[id] = true;
  994. }
  995. }
  996. }
  997.  
  998. for (var _i = 0; _i < modules.length; _i++) {
  999. var item = [].concat(modules[_i]);
  1000.  
  1001. if (dedupe && alreadyImportedModules[item[0]]) {
  1002. // eslint-disable-next-line no-continue
  1003. continue;
  1004. }
  1005.  
  1006. if (mediaQuery) {
  1007. if (!item[2]) {
  1008. item[2] = mediaQuery;
  1009. } else {
  1010. item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
  1011. }
  1012. }
  1013.  
  1014. list.push(item);
  1015. }
  1016. };
  1017.  
  1018. return list;
  1019. };
  1020.  
  1021. function cssWithMappingToString(item, useSourceMap) {
  1022. var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
  1023.  
  1024. var cssMapping = item[3];
  1025.  
  1026. if (!cssMapping) {
  1027. return content;
  1028. }
  1029.  
  1030. if (useSourceMap && typeof btoa === 'function') {
  1031. var sourceMapping = toComment(cssMapping);
  1032. var sourceURLs = cssMapping.sources.map(function (source) {
  1033. return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
  1034. });
  1035. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  1036. }
  1037.  
  1038. return [content].join('\n');
  1039. } // Adapted from convert-source-map (MIT)
  1040.  
  1041.  
  1042. function toComment(sourceMap) {
  1043. // eslint-disable-next-line no-undef
  1044. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  1045. var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
  1046. return "/*# ".concat(data, " */");
  1047. }
  1048.  
  1049. /***/ }),
  1050. /* 16 */
  1051. /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
  1052.  
  1053. "use strict";
  1054. __webpack_require__.r(__webpack_exports__);
  1055. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stylesheet", function() { return stylesheet; });
  1056. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insert", function() { return insert; });
  1057. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enable", function() { return enable; });
  1058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disable", function() { return disable; });
  1059. const MATCH_ALL = "all";
  1060. const MATCH_NONE = "not all";
  1061. function stylesheet(spec) {
  1062. return spec;
  1063. }
  1064. function insert(stylesheets) {
  1065. const fragment = document.createDocumentFragment();
  1066. Object.entries(stylesheets).forEach(([_, sheet]) => {
  1067. const style = document.createElement("style");
  1068. if (sheet.id !== undefined)
  1069. style.id = sheet.id;
  1070. style.textContent = sheet.css;
  1071. style.media = sheet.condition(window) ? MATCH_ALL : MATCH_NONE;
  1072. fragment.appendChild(style);
  1073. });
  1074. document.documentElement.appendChild(fragment);
  1075. }
  1076. const setMediaQuery = (m) => (s) => {
  1077. const element = document.getElementById(s.id);
  1078. if (element !== null) {
  1079. element.setAttribute("media", m);
  1080. }
  1081. };
  1082. const enable = setMediaQuery(MATCH_ALL);
  1083. const disable = setMediaQuery(MATCH_NONE);
  1084.  
  1085.  
  1086. /***/ }),
  1087. /* 17 */
  1088. /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
  1089.  
  1090. "use strict";
  1091. // ESM COMPAT FLAG
  1092. __webpack_require__.r(__webpack_exports__);
  1093.  
  1094. // EXPORTS
  1095. __webpack_require__.d(__webpack_exports__, "operation", function() { return /* binding */ operation; });
  1096. __webpack_require__.d(__webpack_exports__, "run", function() { return /* binding */ run; });
  1097.  
  1098. // CONCATENATED MODULE: ./node_modules/ts-type-guards/dist/is.mjs
  1099. const TYPE_GUARDS_PRIMITIVE = [isBoolean, isNumber, isString, isSymbol, isNull, isUndefined];
  1100. function isBoolean(x) {
  1101. return typeof x === "boolean";
  1102. }
  1103. function isNumber(x) {
  1104. return typeof x === "number";
  1105. }
  1106. function isString(x) {
  1107. return typeof x === "string";
  1108. }
  1109. function isSymbol(x) {
  1110. return typeof x === "symbol";
  1111. }
  1112. function isNull(x) {
  1113. return x === null;
  1114. }
  1115. function isUndefined(x) {
  1116. return x === undefined;
  1117. }
  1118. function isPrimitive(x) {
  1119. return TYPE_GUARDS_PRIMITIVE.some(f => f(x));
  1120. }
  1121. function isNonPrimitive(x) {
  1122. return !isPrimitive(x);
  1123. }
  1124. function namedFunction(name, fun) {
  1125. return Object.defineProperty(fun, "name", { value: name, writable: false });
  1126. }
  1127. function namedTypeGuard(creator, type, typeGuard) {
  1128. return namedFunction(`${creator.name}(${type.name})`, typeGuard);
  1129. }
  1130. function is(type) {
  1131. if (isPrimitive(type)) {
  1132. return (_) => false;
  1133. }
  1134. return namedTypeGuard(is, type, (x) => x instanceof type);
  1135. }
  1136. function isLike(reference) {
  1137. for (const f of TYPE_GUARDS_PRIMITIVE) {
  1138. if (f(reference)) {
  1139. return (x) => f(x);
  1140. }
  1141. }
  1142. if (is(Array)(reference)) {
  1143. const referenceAsArray = reference;
  1144. return (x) => is(Array)(x) && (referenceAsArray.length > 0 ? x.every(isLike(referenceAsArray[0])) : true);
  1145. }
  1146. if (reference.constructor === Object) {
  1147. return (x) => (![undefined, null].includes(x)
  1148. &&
  1149. Object.keys(reference).every(k => isLike(reference[k])(x[k])));
  1150. }
  1151. if (reference.constructor instanceof Function) {
  1152. return is(reference.constructor);
  1153. }
  1154. throw new TypeError(isLike.name + ` cannot use this object as reference because it has no constructor: ` + JSON.stringify(reference));
  1155. }
  1156. //# sourceMappingURL=is.js.map
  1157. // CONCATENATED MODULE: ./node_modules/userscripter/lib/operations.mjs
  1158.  
  1159. const SUCCESS = undefined;
  1160. function operation(spec) {
  1161. return spec;
  1162. }
  1163. function run(plan) {
  1164. function recurse(operations, failures, triesLeft) {
  1165. const lastTry = isNumber(triesLeft) && triesLeft <= 0;
  1166. const operationsToRunNow = [];
  1167. const remaining = [];
  1168. const readyState = document.readyState;
  1169. for (const o of operations) {
  1170. const shouldRunNow = o.deferUntil === undefined || o.deferUntil(readyState);
  1171. (shouldRunNow ? operationsToRunNow : remaining).push(o);
  1172. }
  1173. for (const o of operationsToRunNow) {
  1174. const result = tryToPerform(o);
  1175. if (result !== SUCCESS) {
  1176. switch (result.reason) {
  1177. case 0:
  1178. if (lastTry) {
  1179. failures.push({ result, operation: o });
  1180. }
  1181. else {
  1182. remaining.push(o);
  1183. }
  1184. break;
  1185. case 1:
  1186. failures.push({ result, operation: o });
  1187. break;
  1188. }
  1189. }
  1190. }
  1191. if (remaining.length > 0) {
  1192. setTimeout(() => recurse(remaining, failures, (isNumber(triesLeft)
  1193. ? triesLeft - 1
  1194. : plan.tryUntil(readyState) ? plan.extraTries : undefined)), plan.interval);
  1195. }
  1196. else if (failures.length > 0) {
  1197. plan.handleFailures(failures);
  1198. }
  1199. }
  1200. recurse(plan.operations.filter(o => o.condition(window)), []);
  1201. }
  1202. function tryToPerform(o) {
  1203. const dependencies = o.dependencies === undefined ? {} : o.dependencies;
  1204. const queryResults = Object.entries(dependencies).map(([key, selector]) => ({
  1205. key, selector,
  1206. element: document.querySelector(selector),
  1207. }));
  1208. const missingDependencies = queryResults.filter(x => isNull(x.element));
  1209. if (missingDependencies.length > 0) {
  1210. return { reason: 0, dependencies: missingDependencies };
  1211. }
  1212. const e = queryResults.reduce((acc, x) => Object.defineProperty(acc, x.key, { value: x.element }), {});
  1213. return fromActionResult(o.action(e));
  1214. }
  1215. function fromActionResult(r) {
  1216. return isString(r) ? { reason: 1, message: r } : SUCCESS;
  1217. }
  1218.  
  1219.  
  1220. /***/ }),
  1221. /* 18 */
  1222. /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
  1223.  
  1224. "use strict";
  1225. __webpack_require__.r(__webpack_exports__);
  1226. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ALWAYS", function() { return ALWAYS; });
  1227. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NEVER", function() { return NEVER; });
  1228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMCONTENTLOADED", function() { return DOMCONTENTLOADED; });
  1229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOAD", function() { return LOAD; });
  1230. const ALWAYS = () => true;
  1231. const NEVER = () => false;
  1232. const DOMCONTENTLOADED = (state) => state !== "loading";
  1233. const LOAD = (state) => state === "complete";
  1234.  
  1235.  
  1236. /***/ }),
  1237. /* 19 */
  1238. /***/ (function(module, exports, __webpack_require__) {
  1239.  
  1240. "use strict";
  1241.  
  1242. var __importDefault = (this && this.__importDefault) || function (mod) {
  1243. return (mod && mod.__esModule) ? mod : { "default": mod };
  1244. };
  1245. Object.defineProperty(exports, "__esModule", { value: true });
  1246. // This file is generated from package.json with build-config-from-package-json command
  1247. // if you need to add or remove data from it, see package.json script section
  1248. // Additional details: https://github.com/avallete/userscripter-boilerplate/issues/30
  1249. const metadata_config_json_1 = __importDefault(__webpack_require__(33));
  1250. const userscriptMetadata = {
  1251. id: metadata_config_json_1.default.name, // Used to generate the final dist files (like so: `${id}.user.js`)
  1252. name: metadata_config_json_1.default.name, // Used into metadata and manifest.json as extension/userscript name
  1253. description: metadata_config_json_1.default.description,
  1254. version: metadata_config_json_1.default.version, // Automatically match the userscript metadata version to the package.json one
  1255. author: metadata_config_json_1.default.author,
  1256. homepage: metadata_config_json_1.default.homepage,
  1257. support: metadata_config_json_1.default.bugs.url,
  1258. hostname: 'youtube.com', // Will be used to generate matches (see: metadata.ts)
  1259. sitename: 'youtube',
  1260. repositoryURL: metadata_config_json_1.default.repository.url, // Used to generate the downloadURL of your userscript into metadata.ts
  1261. license: metadata_config_json_1.default.license,
  1262. run_at: 'document-idle',
  1263. // Will be used to generate the downloadURL into metadata.ts
  1264. // Make sure it match the branch where final release are pushed (see .github/workflow/deploy-gh-pages.yml)
  1265. releaseBranch: 'gh-pages',
  1266. };
  1267. exports.default = userscriptMetadata;
  1268.  
  1269.  
  1270. /***/ }),
  1271. /* 20 */
  1272. /***/ (function(module, exports, __webpack_require__) {
  1273.  
  1274. var superPropBase = __webpack_require__(40);
  1275. function _get() {
  1276. return (module.exports = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
  1277. var p = superPropBase(e, t);
  1278. if (p) {
  1279. var n = Object.getOwnPropertyDescriptor(p, t);
  1280. return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
  1281. }
  1282. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _get.apply(null, arguments);
  1283. }
  1284. module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
  1285.  
  1286. /***/ }),
  1287. /* 21 */
  1288. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1289.  
  1290. "use strict";
  1291. __webpack_require__.r(__webpack_exports__);
  1292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useCallback", function() { return x; });
  1293. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useContext", function() { return P; });
  1294. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return V; });
  1295. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useEffect", function() { return _; });
  1296. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useErrorBoundary", function() { return b; });
  1297. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useId", function() { return g; });
  1298. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return T; });
  1299. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return A; });
  1300. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useMemo", function() { return q; });
  1301. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useReducer", function() { return y; });
  1302. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRef", function() { return F; });
  1303. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useState", function() { return p; });
  1304. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  1305. var t,r,u,i,o=0,f=[],c=[],e=preact__WEBPACK_IMPORTED_MODULE_0__["options"],a=e.__b,v=e.__r,l=e.diffed,m=e.__c,s=e.unmount,d=e.__;function h(n,t){e.__h&&e.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({__V:c}),u.__[n]}function p(n){return o=1,y(D,n)}function y(n,u,i){var o=h(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return!!n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function _(n,u){var i=h(t++,3);!e.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i))}function A(n,u){var i=h(t++,4);!e.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__h.push(i))}function F(n){return o=5,q(function(){return{current:n}},[])}function T(n,t,r){o=6,A(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function q(n,r){var u=h(t++,7);return C(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function x(n,t){return o=8,q(function(){return n},t)}function P(n){var u=r.context[n.__c],i=h(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function V(n,t){e.useDebugValue&&e.useDebugValue(t?t(n):n)}function b(n){var u=h(t++,10),i=p();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=h(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__="P"+i[0]+"-"+i[1]++}return n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[]}catch(t){n.__H.__h=[],e.__e(t,n.__v)}}e.__b=function(n){r=null,a&&a(n)},e.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),d&&d(n,t)},e.__r=function(n){v&&v(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r},e.diffed=function(n){l&&l(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===e.requestAnimationFrame||((i=e.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},e.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],e.__e(r,n.__v)}}),m&&m(n,t)},e.unmount=function(n){s&&s(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&e.__e(t,r.__v))};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return"function"==typeof t?t(n):t}
  1306. //# sourceMappingURL=hooks.module.js.map
  1307.  
  1308.  
  1309. /***/ }),
  1310. /* 22 */
  1311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1312.  
  1313. "use strict";
  1314. // ESM COMPAT FLAG
  1315. __webpack_require__.r(__webpack_exports__);
  1316.  
  1317. // EXPORTS
  1318. __webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return /* binding */ ripple_MDCRipple; });
  1319. __webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return /* reexport */ ripple_foundation; });
  1320. __webpack_require__.d(__webpack_exports__, "RippleCapableSurface", function() { return /* binding */ RippleCapableSurface; });
  1321. __webpack_require__.d(__webpack_exports__, "util", function() { return /* reexport */ util_namespaceObject; });
  1322.  
  1323. // NAMESPACE OBJECT: ./node_modules/@material/ripple/util.js
  1324. var util_namespaceObject = {};
  1325. __webpack_require__.r(util_namespaceObject);
  1326. __webpack_require__.d(util_namespaceObject, "supportsCssVariables", function() { return supportsCssVariables; });
  1327. __webpack_require__.d(util_namespaceObject, "applyPassive", function() { return applyPassive; });
  1328. __webpack_require__.d(util_namespaceObject, "getMatchesProperty", function() { return getMatchesProperty; });
  1329. __webpack_require__.d(util_namespaceObject, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; });
  1330.  
  1331. // EXTERNAL MODULE: ./node_modules/@material/base/component.js
  1332. var component = __webpack_require__(2);
  1333.  
  1334. // CONCATENATED MODULE: ./node_modules/@material/ripple/adapter.js
  1335. /**
  1336. * @license
  1337. * Copyright 2016 Google Inc.
  1338. *
  1339. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1340. * of this software and associated documentation files (the "Software"), to deal
  1341. * in the Software without restriction, including without limitation the rights
  1342. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1343. * copies of the Software, and to permit persons to whom the Software is
  1344. * furnished to do so, subject to the following conditions:
  1345. *
  1346. * The above copyright notice and this permission notice shall be included in
  1347. * all copies or substantial portions of the Software.
  1348. *
  1349. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1350. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1351. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1352. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1353. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1354. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1355. * THE SOFTWARE.
  1356. */
  1357.  
  1358. /* eslint no-unused-vars: [2, {"args": "none"}] */
  1359.  
  1360. /**
  1361. * Adapter for MDC Ripple. Provides an interface for managing
  1362. * - classes
  1363. * - dom
  1364. * - CSS variables
  1365. * - position
  1366. * - dimensions
  1367. * - scroll position
  1368. * - event handlers
  1369. * - unbounded, active and disabled states
  1370. *
  1371. * Additionally, provides type information for the adapter to the Closure
  1372. * compiler.
  1373. *
  1374. * Implement this adapter for your framework of choice to delegate updates to
  1375. * the component in your framework of choice. See architecture documentation
  1376. * for more details.
  1377. * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
  1378. *
  1379. * @record
  1380. */
  1381. class MDCRippleAdapter {
  1382. /** @return {boolean} */
  1383. browserSupportsCssVars() {}
  1384.  
  1385. /** @return {boolean} */
  1386. isUnbounded() {}
  1387.  
  1388. /** @return {boolean} */
  1389. isSurfaceActive() {}
  1390.  
  1391. /** @return {boolean} */
  1392. isSurfaceDisabled() {}
  1393.  
  1394. /** @param {string} className */
  1395. addClass(className) {}
  1396.  
  1397. /** @param {string} className */
  1398. removeClass(className) {}
  1399.  
  1400. /** @param {!EventTarget} target */
  1401. containsEventTarget(target) {}
  1402.  
  1403. /**
  1404. * @param {string} evtType
  1405. * @param {!Function} handler
  1406. */
  1407. registerInteractionHandler(evtType, handler) {}
  1408.  
  1409. /**
  1410. * @param {string} evtType
  1411. * @param {!Function} handler
  1412. */
  1413. deregisterInteractionHandler(evtType, handler) {}
  1414.  
  1415. /**
  1416. * @param {string} evtType
  1417. * @param {!Function} handler
  1418. */
  1419. registerDocumentInteractionHandler(evtType, handler) {}
  1420.  
  1421. /**
  1422. * @param {string} evtType
  1423. * @param {!Function} handler
  1424. */
  1425. deregisterDocumentInteractionHandler(evtType, handler) {}
  1426.  
  1427. /**
  1428. * @param {!Function} handler
  1429. */
  1430. registerResizeHandler(handler) {}
  1431.  
  1432. /**
  1433. * @param {!Function} handler
  1434. */
  1435. deregisterResizeHandler(handler) {}
  1436.  
  1437. /**
  1438. * @param {string} varName
  1439. * @param {?number|string} value
  1440. */
  1441. updateCssVariable(varName, value) {}
  1442.  
  1443. /** @return {!ClientRect} */
  1444. computeBoundingRect() {}
  1445.  
  1446. /** @return {{x: number, y: number}} */
  1447. getWindowPageOffset() {}
  1448. }
  1449.  
  1450. /* harmony default export */ var adapter = (MDCRippleAdapter);
  1451.  
  1452. // EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
  1453. var foundation = __webpack_require__(1);
  1454.  
  1455. // CONCATENATED MODULE: ./node_modules/@material/ripple/constants.js
  1456. /**
  1457. * @license
  1458. * Copyright 2016 Google Inc.
  1459. *
  1460. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1461. * of this software and associated documentation files (the "Software"), to deal
  1462. * in the Software without restriction, including without limitation the rights
  1463. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1464. * copies of the Software, and to permit persons to whom the Software is
  1465. * furnished to do so, subject to the following conditions:
  1466. *
  1467. * The above copyright notice and this permission notice shall be included in
  1468. * all copies or substantial portions of the Software.
  1469. *
  1470. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1471. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1472. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1473. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1474. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1475. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1476. * THE SOFTWARE.
  1477. */
  1478.  
  1479. const cssClasses = {
  1480. // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  1481. // given that it's an 'upgrade' to an existing component. That being said it is the root
  1482. // CSS class that all other CSS classes derive from.
  1483. ROOT: 'mdc-ripple-upgraded',
  1484. UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
  1485. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  1486. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  1487. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  1488. };
  1489.  
  1490. const strings = {
  1491. VAR_LEFT: '--mdc-ripple-left',
  1492. VAR_TOP: '--mdc-ripple-top',
  1493. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  1494. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  1495. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  1496. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  1497. };
  1498.  
  1499. const numbers = {
  1500. PADDING: 10,
  1501. INITIAL_ORIGIN_SCALE: 0.6,
  1502. DEACTIVATION_TIMEOUT_MS: 225, // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration)
  1503. FG_DEACTIVATION_MS: 150, // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration)
  1504. TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
  1505. };
  1506.  
  1507.  
  1508.  
  1509. // CONCATENATED MODULE: ./node_modules/@material/ripple/util.js
  1510. /**
  1511. * @license
  1512. * Copyright 2016 Google Inc.
  1513. *
  1514. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1515. * of this software and associated documentation files (the "Software"), to deal
  1516. * in the Software without restriction, including without limitation the rights
  1517. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1518. * copies of the Software, and to permit persons to whom the Software is
  1519. * furnished to do so, subject to the following conditions:
  1520. *
  1521. * The above copyright notice and this permission notice shall be included in
  1522. * all copies or substantial portions of the Software.
  1523. *
  1524. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1525. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1526. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1527. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1528. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1529. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1530. * THE SOFTWARE.
  1531. */
  1532.  
  1533. /**
  1534. * Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support.
  1535. * @private {boolean|undefined}
  1536. */
  1537. let supportsCssVariables_;
  1538.  
  1539. /**
  1540. * Stores result from applyPassive to avoid redundant processing to detect passive event listener support.
  1541. * @private {boolean|undefined}
  1542. */
  1543. let supportsPassive_;
  1544.  
  1545. /**
  1546. * @param {!Window} windowObj
  1547. * @return {boolean}
  1548. */
  1549. function detectEdgePseudoVarBug(windowObj) {
  1550. // Detect versions of Edge with buggy var() support
  1551. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
  1552. const document = windowObj.document;
  1553. const node = document.createElement('div');
  1554. node.className = 'mdc-ripple-surface--test-edge-var-bug';
  1555. document.body.appendChild(node);
  1556.  
  1557. // The bug exists if ::before style ends up propagating to the parent element.
  1558. // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
  1559. // but Firefox is known to support CSS custom properties correctly.
  1560. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  1561. const computedStyle = windowObj.getComputedStyle(node);
  1562. const hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
  1563. node.remove();
  1564. return hasPseudoVarBug;
  1565. }
  1566.  
  1567. /**
  1568. * @param {!Window} windowObj
  1569. * @param {boolean=} forceRefresh
  1570. * @return {boolean|undefined}
  1571. */
  1572.  
  1573. function supportsCssVariables(windowObj, forceRefresh = false) {
  1574. let supportsCssVariables = supportsCssVariables_;
  1575. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  1576. return supportsCssVariables;
  1577. }
  1578.  
  1579. const supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
  1580. if (!supportsFunctionPresent) {
  1581. return;
  1582. }
  1583.  
  1584. const explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
  1585. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  1586. // See: README section on Safari
  1587. const weAreFeatureDetectingSafari10plus = (
  1588. windowObj.CSS.supports('(--css-vars: yes)') &&
  1589. windowObj.CSS.supports('color', '#00000000')
  1590. );
  1591.  
  1592. if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
  1593. supportsCssVariables = !detectEdgePseudoVarBug(windowObj);
  1594. } else {
  1595. supportsCssVariables = false;
  1596. }
  1597.  
  1598. if (!forceRefresh) {
  1599. supportsCssVariables_ = supportsCssVariables;
  1600. }
  1601. return supportsCssVariables;
  1602. }
  1603.  
  1604. //
  1605. /**
  1606. * Determine whether the current browser supports passive event listeners, and if so, use them.
  1607. * @param {!Window=} globalObj
  1608. * @param {boolean=} forceRefresh
  1609. * @return {boolean|{passive: boolean}}
  1610. */
  1611. function applyPassive(globalObj = window, forceRefresh = false) {
  1612. if (supportsPassive_ === undefined || forceRefresh) {
  1613. let isSupported = false;
  1614. try {
  1615. globalObj.document.addEventListener('test', null, {get passive() {
  1616. isSupported = true;
  1617. }});
  1618. } catch (e) { }
  1619.  
  1620. supportsPassive_ = isSupported;
  1621. }
  1622.  
  1623. return supportsPassive_ ? {passive: true} : false;
  1624. }
  1625.  
  1626. /**
  1627. * @param {!Object} HTMLElementPrototype
  1628. * @return {!Array<string>}
  1629. */
  1630. function getMatchesProperty(HTMLElementPrototype) {
  1631. return [
  1632. 'webkitMatchesSelector', 'msMatchesSelector', 'matches',
  1633. ].filter((p) => p in HTMLElementPrototype).pop();
  1634. }
  1635.  
  1636. /**
  1637. * @param {!Event} ev
  1638. * @param {{x: number, y: number}} pageOffset
  1639. * @param {!ClientRect} clientRect
  1640. * @return {{x: number, y: number}}
  1641. */
  1642. function getNormalizedEventCoords(ev, pageOffset, clientRect) {
  1643. const {x, y} = pageOffset;
  1644. const documentX = x + clientRect.left;
  1645. const documentY = y + clientRect.top;
  1646.  
  1647. let normalizedX;
  1648. let normalizedY;
  1649. // Determine touch point relative to the ripple container.
  1650. if (ev.type === 'touchstart') {
  1651. normalizedX = ev.changedTouches[0].pageX - documentX;
  1652. normalizedY = ev.changedTouches[0].pageY - documentY;
  1653. } else {
  1654. normalizedX = ev.pageX - documentX;
  1655. normalizedY = ev.pageY - documentY;
  1656. }
  1657.  
  1658. return {x: normalizedX, y: normalizedY};
  1659. }
  1660.  
  1661.  
  1662.  
  1663. // CONCATENATED MODULE: ./node_modules/@material/ripple/foundation.js
  1664. /**
  1665. * @license
  1666. * Copyright 2016 Google Inc.
  1667. *
  1668. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1669. * of this software and associated documentation files (the "Software"), to deal
  1670. * in the Software without restriction, including without limitation the rights
  1671. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1672. * copies of the Software, and to permit persons to whom the Software is
  1673. * furnished to do so, subject to the following conditions:
  1674. *
  1675. * The above copyright notice and this permission notice shall be included in
  1676. * all copies or substantial portions of the Software.
  1677. *
  1678. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1679. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1680. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1681. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1682. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1683. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  1684. * THE SOFTWARE.
  1685. */
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692. /**
  1693. * @typedef {{
  1694. * isActivated: (boolean|undefined),
  1695. * hasDeactivationUXRun: (boolean|undefined),
  1696. * wasActivatedByPointer: (boolean|undefined),
  1697. * wasElementMadeActive: (boolean|undefined),
  1698. * activationEvent: Event,
  1699. * isProgrammatic: (boolean|undefined)
  1700. * }}
  1701. */
  1702. let ActivationStateType;
  1703.  
  1704. /**
  1705. * @typedef {{
  1706. * activate: (string|undefined),
  1707. * deactivate: (string|undefined),
  1708. * focus: (string|undefined),
  1709. * blur: (string|undefined)
  1710. * }}
  1711. */
  1712. let ListenerInfoType;
  1713.  
  1714. /**
  1715. * @typedef {{
  1716. * activate: function(!Event),
  1717. * deactivate: function(!Event),
  1718. * focus: function(),
  1719. * blur: function()
  1720. * }}
  1721. */
  1722. let ListenersType;
  1723.  
  1724. /**
  1725. * @typedef {{
  1726. * x: number,
  1727. * y: number
  1728. * }}
  1729. */
  1730. let PointType;
  1731.  
  1732. // Activation events registered on the root element of each instance for activation
  1733. const ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  1734.  
  1735. // Deactivation events registered on documentElement when a pointer-related down event occurs
  1736. const POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup'];
  1737.  
  1738. // Tracks activations that have occurred on the current frame, to avoid simultaneous nested activations
  1739. /** @type {!Array<!EventTarget>} */
  1740. let activatedTargets = [];
  1741.  
  1742. /**
  1743. * @extends {MDCFoundation<!MDCRippleAdapter>}
  1744. */
  1745. class foundation_MDCRippleFoundation extends foundation["a" /* default */] {
  1746. static get cssClasses() {
  1747. return cssClasses;
  1748. }
  1749.  
  1750. static get strings() {
  1751. return strings;
  1752. }
  1753.  
  1754. static get numbers() {
  1755. return numbers;
  1756. }
  1757.  
  1758. static get defaultAdapter() {
  1759. return {
  1760. browserSupportsCssVars: () => /* boolean - cached */ {},
  1761. isUnbounded: () => /* boolean */ {},
  1762. isSurfaceActive: () => /* boolean */ {},
  1763. isSurfaceDisabled: () => /* boolean */ {},
  1764. addClass: (/* className: string */) => {},
  1765. removeClass: (/* className: string */) => {},
  1766. containsEventTarget: (/* target: !EventTarget */) => {},
  1767. registerInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
  1768. deregisterInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
  1769. registerDocumentInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
  1770. deregisterDocumentInteractionHandler: (/* evtType: string, handler: EventListener */) => {},
  1771. registerResizeHandler: (/* handler: EventListener */) => {},
  1772. deregisterResizeHandler: (/* handler: EventListener */) => {},
  1773. updateCssVariable: (/* varName: string, value: string */) => {},
  1774. computeBoundingRect: () => /* ClientRect */ {},
  1775. getWindowPageOffset: () => /* {x: number, y: number} */ {},
  1776. };
  1777. }
  1778.  
  1779. constructor(adapter) {
  1780. super(Object.assign(foundation_MDCRippleFoundation.defaultAdapter, adapter));
  1781.  
  1782. /** @private {number} */
  1783. this.layoutFrame_ = 0;
  1784.  
  1785. /** @private {!ClientRect} */
  1786. this.frame_ = /** @type {!ClientRect} */ ({width: 0, height: 0});
  1787.  
  1788. /** @private {!ActivationStateType} */
  1789. this.activationState_ = this.defaultActivationState_();
  1790.  
  1791. /** @private {number} */
  1792. this.initialSize_ = 0;
  1793.  
  1794. /** @private {number} */
  1795. this.maxRadius_ = 0;
  1796.  
  1797. /** @private {function(!Event)} */
  1798. this.activateHandler_ = (e) => this.activate_(e);
  1799.  
  1800. /** @private {function(!Event)} */
  1801. this.deactivateHandler_ = (e) => this.deactivate_(e);
  1802.  
  1803. /** @private {function(?Event=)} */
  1804. this.focusHandler_ = () => this.handleFocus();
  1805.  
  1806. /** @private {function(?Event=)} */
  1807. this.blurHandler_ = () => this.handleBlur();
  1808.  
  1809. /** @private {!Function} */
  1810. this.resizeHandler_ = () => this.layout();
  1811.  
  1812. /** @private {{left: number, top:number}} */
  1813. this.unboundedCoords_ = {
  1814. left: 0,
  1815. top: 0,
  1816. };
  1817.  
  1818. /** @private {number} */
  1819. this.fgScale_ = 0;
  1820.  
  1821. /** @private {number} */
  1822. this.activationTimer_ = 0;
  1823.  
  1824. /** @private {number} */
  1825. this.fgDeactivationRemovalTimer_ = 0;
  1826.  
  1827. /** @private {boolean} */
  1828. this.activationAnimationHasEnded_ = false;
  1829.  
  1830. /** @private {!Function} */
  1831. this.activationTimerCallback_ = () => {
  1832. this.activationAnimationHasEnded_ = true;
  1833. this.runDeactivationUXLogicIfReady_();
  1834. };
  1835.  
  1836. /** @private {?Event} */
  1837. this.previousActivationEvent_ = null;
  1838. }
  1839.  
  1840. /**
  1841. * We compute this property so that we are not querying information about the client
  1842. * until the point in time where the foundation requests it. This prevents scenarios where
  1843. * client-side feature-detection may happen too early, such as when components are rendered on the server
  1844. * and then initialized at mount time on the client.
  1845. * @return {boolean}
  1846. * @private
  1847. */
  1848. supportsPressRipple_() {
  1849. return this.adapter_.browserSupportsCssVars();
  1850. }
  1851.  
  1852. /**
  1853. * @return {!ActivationStateType}
  1854. */
  1855. defaultActivationState_() {
  1856. return {
  1857. isActivated: false,
  1858. hasDeactivationUXRun: false,
  1859. wasActivatedByPointer: false,
  1860. wasElementMadeActive: false,
  1861. activationEvent: null,
  1862. isProgrammatic: false,
  1863. };
  1864. }
  1865.  
  1866. /** @override */
  1867. init() {
  1868. const supportsPressRipple = this.supportsPressRipple_();
  1869.  
  1870. this.registerRootHandlers_(supportsPressRipple);
  1871.  
  1872. if (supportsPressRipple) {
  1873. const {ROOT, UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
  1874. requestAnimationFrame(() => {
  1875. this.adapter_.addClass(ROOT);
  1876. if (this.adapter_.isUnbounded()) {
  1877. this.adapter_.addClass(UNBOUNDED);
  1878. // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
  1879. this.layoutInternal_();
  1880. }
  1881. });
  1882. }
  1883. }
  1884.  
  1885. /** @override */
  1886. destroy() {
  1887. if (this.supportsPressRipple_()) {
  1888. if (this.activationTimer_) {
  1889. clearTimeout(this.activationTimer_);
  1890. this.activationTimer_ = 0;
  1891. this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  1892. }
  1893.  
  1894. if (this.fgDeactivationRemovalTimer_) {
  1895. clearTimeout(this.fgDeactivationRemovalTimer_);
  1896. this.fgDeactivationRemovalTimer_ = 0;
  1897. this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  1898. }
  1899.  
  1900. const {ROOT, UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
  1901. requestAnimationFrame(() => {
  1902. this.adapter_.removeClass(ROOT);
  1903. this.adapter_.removeClass(UNBOUNDED);
  1904. this.removeCssVars_();
  1905. });
  1906. }
  1907.  
  1908. this.deregisterRootHandlers_();
  1909. this.deregisterDeactivationHandlers_();
  1910. }
  1911.  
  1912. /**
  1913. * @param {boolean} supportsPressRipple Passed from init to save a redundant function call
  1914. * @private
  1915. */
  1916. registerRootHandlers_(supportsPressRipple) {
  1917. if (supportsPressRipple) {
  1918. ACTIVATION_EVENT_TYPES.forEach((type) => {
  1919. this.adapter_.registerInteractionHandler(type, this.activateHandler_);
  1920. });
  1921. if (this.adapter_.isUnbounded()) {
  1922. this.adapter_.registerResizeHandler(this.resizeHandler_);
  1923. }
  1924. }
  1925.  
  1926. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  1927. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  1928. }
  1929.  
  1930. /**
  1931. * @param {!Event} e
  1932. * @private
  1933. */
  1934. registerDeactivationHandlers_(e) {
  1935. if (e.type === 'keydown') {
  1936. this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
  1937. } else {
  1938. POINTER_DEACTIVATION_EVENT_TYPES.forEach((type) => {
  1939. this.adapter_.registerDocumentInteractionHandler(type, this.deactivateHandler_);
  1940. });
  1941. }
  1942. }
  1943.  
  1944. /** @private */
  1945. deregisterRootHandlers_() {
  1946. ACTIVATION_EVENT_TYPES.forEach((type) => {
  1947. this.adapter_.deregisterInteractionHandler(type, this.activateHandler_);
  1948. });
  1949. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  1950. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  1951.  
  1952. if (this.adapter_.isUnbounded()) {
  1953. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  1954. }
  1955. }
  1956.  
  1957. /** @private */
  1958. deregisterDeactivationHandlers_() {
  1959. this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
  1960. POINTER_DEACTIVATION_EVENT_TYPES.forEach((type) => {
  1961. this.adapter_.deregisterDocumentInteractionHandler(type, this.deactivateHandler_);
  1962. });
  1963. }
  1964.  
  1965. /** @private */
  1966. removeCssVars_() {
  1967. const {strings} = foundation_MDCRippleFoundation;
  1968. Object.keys(strings).forEach((k) => {
  1969. if (k.indexOf('VAR_') === 0) {
  1970. this.adapter_.updateCssVariable(strings[k], null);
  1971. }
  1972. });
  1973. }
  1974.  
  1975. /**
  1976. * @param {?Event} e
  1977. * @private
  1978. */
  1979. activate_(e) {
  1980. if (this.adapter_.isSurfaceDisabled()) {
  1981. return;
  1982. }
  1983.  
  1984. const activationState = this.activationState_;
  1985. if (activationState.isActivated) {
  1986. return;
  1987. }
  1988.  
  1989. // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
  1990. const previousActivationEvent = this.previousActivationEvent_;
  1991. const isSameInteraction = previousActivationEvent && e && previousActivationEvent.type !== e.type;
  1992. if (isSameInteraction) {
  1993. return;
  1994. }
  1995.  
  1996. activationState.isActivated = true;
  1997. activationState.isProgrammatic = e === null;
  1998. activationState.activationEvent = e;
  1999. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : (
  2000. e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown'
  2001. );
  2002.  
  2003. const hasActivatedChild =
  2004. e && activatedTargets.length > 0 && activatedTargets.some((target) => this.adapter_.containsEventTarget(target));
  2005. if (hasActivatedChild) {
  2006. // Immediately reset activation state, while preserving logic that prevents touch follow-on events
  2007. this.resetActivationState_();
  2008. return;
  2009. }
  2010.  
  2011. if (e) {
  2012. activatedTargets.push(/** @type {!EventTarget} */ (e.target));
  2013. this.registerDeactivationHandlers_(e);
  2014. }
  2015.  
  2016. activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
  2017. if (activationState.wasElementMadeActive) {
  2018. this.animateActivation_();
  2019. }
  2020.  
  2021. requestAnimationFrame(() => {
  2022. // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
  2023. activatedTargets = [];
  2024.  
  2025. if (!activationState.wasElementMadeActive && (e.key === ' ' || e.keyCode === 32)) {
  2026. // If space was pressed, try again within an rAF call to detect :active, because different UAs report
  2027. // active states inconsistently when they're called within event handling code:
  2028. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  2029. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  2030. // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
  2031. // variable is set within a rAF callback for a submit button interaction (#2241).
  2032. activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
  2033. if (activationState.wasElementMadeActive) {
  2034. this.animateActivation_();
  2035. }
  2036. }
  2037.  
  2038. if (!activationState.wasElementMadeActive) {
  2039. // Reset activation state immediately if element was not made active.
  2040. this.activationState_ = this.defaultActivationState_();
  2041. }
  2042. });
  2043. }
  2044.  
  2045. /**
  2046. * @param {?Event} e
  2047. * @private
  2048. */
  2049. checkElementMadeActive_(e) {
  2050. return (e && e.type === 'keydown') ? this.adapter_.isSurfaceActive() : true;
  2051. }
  2052.  
  2053. /**
  2054. * @param {?Event=} event Optional event containing position information.
  2055. */
  2056. activate(event = null) {
  2057. this.activate_(event);
  2058. }
  2059.  
  2060. /** @private */
  2061. animateActivation_() {
  2062. const {VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END} = foundation_MDCRippleFoundation.strings;
  2063. const {FG_DEACTIVATION, FG_ACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
  2064. const {DEACTIVATION_TIMEOUT_MS} = foundation_MDCRippleFoundation.numbers;
  2065.  
  2066. this.layoutInternal_();
  2067.  
  2068. let translateStart = '';
  2069. let translateEnd = '';
  2070.  
  2071. if (!this.adapter_.isUnbounded()) {
  2072. const {startPoint, endPoint} = this.getFgTranslationCoordinates_();
  2073. translateStart = `${startPoint.x}px, ${startPoint.y}px`;
  2074. translateEnd = `${endPoint.x}px, ${endPoint.y}px`;
  2075. }
  2076.  
  2077. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  2078. this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  2079. // Cancel any ongoing activation/deactivation animations
  2080. clearTimeout(this.activationTimer_);
  2081. clearTimeout(this.fgDeactivationRemovalTimer_);
  2082. this.rmBoundedActivationClasses_();
  2083. this.adapter_.removeClass(FG_DEACTIVATION);
  2084.  
  2085. // Force layout in order to re-trigger the animation.
  2086. this.adapter_.computeBoundingRect();
  2087. this.adapter_.addClass(FG_ACTIVATION);
  2088. this.activationTimer_ = setTimeout(() => this.activationTimerCallback_(), DEACTIVATION_TIMEOUT_MS);
  2089. }
  2090.  
  2091. /**
  2092. * @private
  2093. * @return {{startPoint: PointType, endPoint: PointType}}
  2094. */
  2095. getFgTranslationCoordinates_() {
  2096. const {activationEvent, wasActivatedByPointer} = this.activationState_;
  2097.  
  2098. let startPoint;
  2099. if (wasActivatedByPointer) {
  2100. startPoint = getNormalizedEventCoords(
  2101. /** @type {!Event} */ (activationEvent),
  2102. this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect()
  2103. );
  2104. } else {
  2105. startPoint = {
  2106. x: this.frame_.width / 2,
  2107. y: this.frame_.height / 2,
  2108. };
  2109. }
  2110. // Center the element around the start point.
  2111. startPoint = {
  2112. x: startPoint.x - (this.initialSize_ / 2),
  2113. y: startPoint.y - (this.initialSize_ / 2),
  2114. };
  2115.  
  2116. const endPoint = {
  2117. x: (this.frame_.width / 2) - (this.initialSize_ / 2),
  2118. y: (this.frame_.height / 2) - (this.initialSize_ / 2),
  2119. };
  2120.  
  2121. return {startPoint, endPoint};
  2122. }
  2123.  
  2124. /** @private */
  2125. runDeactivationUXLogicIfReady_() {
  2126. // This method is called both when a pointing device is released, and when the activation animation ends.
  2127. // The deactivation animation should only run after both of those occur.
  2128. const {FG_DEACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
  2129. const {hasDeactivationUXRun, isActivated} = this.activationState_;
  2130. const activationHasEnded = hasDeactivationUXRun || !isActivated;
  2131.  
  2132. if (activationHasEnded && this.activationAnimationHasEnded_) {
  2133. this.rmBoundedActivationClasses_();
  2134. this.adapter_.addClass(FG_DEACTIVATION);
  2135. this.fgDeactivationRemovalTimer_ = setTimeout(() => {
  2136. this.adapter_.removeClass(FG_DEACTIVATION);
  2137. }, numbers.FG_DEACTIVATION_MS);
  2138. }
  2139. }
  2140.  
  2141. /** @private */
  2142. rmBoundedActivationClasses_() {
  2143. const {FG_ACTIVATION} = foundation_MDCRippleFoundation.cssClasses;
  2144. this.adapter_.removeClass(FG_ACTIVATION);
  2145. this.activationAnimationHasEnded_ = false;
  2146. this.adapter_.computeBoundingRect();
  2147. }
  2148.  
  2149. resetActivationState_() {
  2150. this.previousActivationEvent_ = this.activationState_.activationEvent;
  2151. this.activationState_ = this.defaultActivationState_();
  2152. // Touch devices may fire additional events for the same interaction within a short time.
  2153. // Store the previous event until it's safe to assume that subsequent events are for new interactions.
  2154. setTimeout(() => this.previousActivationEvent_ = null, foundation_MDCRippleFoundation.numbers.TAP_DELAY_MS);
  2155. }
  2156.  
  2157. /**
  2158. * @param {?Event} e
  2159. * @private
  2160. */
  2161. deactivate_(e) {
  2162. const activationState = this.activationState_;
  2163. // This can happen in scenarios such as when you have a keyup event that blurs the element.
  2164. if (!activationState.isActivated) {
  2165. return;
  2166. }
  2167.  
  2168. const state = /** @type {!ActivationStateType} */ (Object.assign({}, activationState));
  2169.  
  2170. if (activationState.isProgrammatic) {
  2171. const evtObject = null;
  2172. requestAnimationFrame(() => this.animateDeactivation_(evtObject, state));
  2173. this.resetActivationState_();
  2174. } else {
  2175. this.deregisterDeactivationHandlers_();
  2176. requestAnimationFrame(() => {
  2177. this.activationState_.hasDeactivationUXRun = true;
  2178. this.animateDeactivation_(e, state);
  2179. this.resetActivationState_();
  2180. });
  2181. }
  2182. }
  2183.  
  2184. /**
  2185. * @param {?Event=} event Optional event containing position information.
  2186. */
  2187. deactivate(event = null) {
  2188. this.deactivate_(event);
  2189. }
  2190.  
  2191. /**
  2192. * @param {Event} e
  2193. * @param {!ActivationStateType} options
  2194. * @private
  2195. */
  2196. animateDeactivation_(e, {wasActivatedByPointer, wasElementMadeActive}) {
  2197. if (wasActivatedByPointer || wasElementMadeActive) {
  2198. this.runDeactivationUXLogicIfReady_();
  2199. }
  2200. }
  2201.  
  2202. layout() {
  2203. if (this.layoutFrame_) {
  2204. cancelAnimationFrame(this.layoutFrame_);
  2205. }
  2206. this.layoutFrame_ = requestAnimationFrame(() => {
  2207. this.layoutInternal_();
  2208. this.layoutFrame_ = 0;
  2209. });
  2210. }
  2211.  
  2212. /** @private */
  2213. layoutInternal_() {
  2214. this.frame_ = this.adapter_.computeBoundingRect();
  2215. const maxDim = Math.max(this.frame_.height, this.frame_.width);
  2216.  
  2217. // Surface diameter is treated differently for unbounded vs. bounded ripples.
  2218. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
  2219. // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
  2220. // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
  2221. // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
  2222. // `overflow: hidden`.
  2223. const getBoundedRadius = () => {
  2224. const hypotenuse = Math.sqrt(Math.pow(this.frame_.width, 2) + Math.pow(this.frame_.height, 2));
  2225. return hypotenuse + foundation_MDCRippleFoundation.numbers.PADDING;
  2226. };
  2227.  
  2228. this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
  2229.  
  2230. // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
  2231. this.initialSize_ = maxDim * foundation_MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE;
  2232. this.fgScale_ = this.maxRadius_ / this.initialSize_;
  2233.  
  2234. this.updateLayoutCssVars_();
  2235. }
  2236.  
  2237. /** @private */
  2238. updateLayoutCssVars_() {
  2239. const {
  2240. VAR_FG_SIZE, VAR_LEFT, VAR_TOP, VAR_FG_SCALE,
  2241. } = foundation_MDCRippleFoundation.strings;
  2242.  
  2243. this.adapter_.updateCssVariable(VAR_FG_SIZE, `${this.initialSize_}px`);
  2244. this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
  2245.  
  2246. if (this.adapter_.isUnbounded()) {
  2247. this.unboundedCoords_ = {
  2248. left: Math.round((this.frame_.width / 2) - (this.initialSize_ / 2)),
  2249. top: Math.round((this.frame_.height / 2) - (this.initialSize_ / 2)),
  2250. };
  2251.  
  2252. this.adapter_.updateCssVariable(VAR_LEFT, `${this.unboundedCoords_.left}px`);
  2253. this.adapter_.updateCssVariable(VAR_TOP, `${this.unboundedCoords_.top}px`);
  2254. }
  2255. }
  2256.  
  2257. /** @param {boolean} unbounded */
  2258. setUnbounded(unbounded) {
  2259. const {UNBOUNDED} = foundation_MDCRippleFoundation.cssClasses;
  2260. if (unbounded) {
  2261. this.adapter_.addClass(UNBOUNDED);
  2262. } else {
  2263. this.adapter_.removeClass(UNBOUNDED);
  2264. }
  2265. }
  2266.  
  2267. handleFocus() {
  2268. requestAnimationFrame(() =>
  2269. this.adapter_.addClass(foundation_MDCRippleFoundation.cssClasses.BG_FOCUSED));
  2270. }
  2271.  
  2272. handleBlur() {
  2273. requestAnimationFrame(() =>
  2274. this.adapter_.removeClass(foundation_MDCRippleFoundation.cssClasses.BG_FOCUSED));
  2275. }
  2276. }
  2277.  
  2278. /* harmony default export */ var ripple_foundation = (foundation_MDCRippleFoundation);
  2279.  
  2280. // CONCATENATED MODULE: ./node_modules/@material/ripple/index.js
  2281. /**
  2282. * @license
  2283. * Copyright 2016 Google Inc.
  2284. *
  2285. * Permission is hereby granted, free of charge, to any person obtaining a copy
  2286. * of this software and associated documentation files (the "Software"), to deal
  2287. * in the Software without restriction, including without limitation the rights
  2288. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  2289. * copies of the Software, and to permit persons to whom the Software is
  2290. * furnished to do so, subject to the following conditions:
  2291. *
  2292. * The above copyright notice and this permission notice shall be included in
  2293. * all copies or substantial portions of the Software.
  2294. *
  2295. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  2296. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  2297. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  2298. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  2299. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  2300. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  2301. * THE SOFTWARE.
  2302. */
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309. /**
  2310. * @extends MDCComponent<!MDCRippleFoundation>
  2311. */
  2312. class ripple_MDCRipple extends component["a" /* default */] {
  2313. /** @param {...?} args */
  2314. constructor(...args) {
  2315. super(...args);
  2316.  
  2317. /** @type {boolean} */
  2318. this.disabled = false;
  2319.  
  2320. /** @private {boolean} */
  2321. this.unbounded_;
  2322. }
  2323.  
  2324. /**
  2325. * @param {!Element} root
  2326. * @param {{isUnbounded: (boolean|undefined)}=} options
  2327. * @return {!MDCRipple}
  2328. */
  2329. static attachTo(root, {isUnbounded = undefined} = {}) {
  2330. const ripple = new ripple_MDCRipple(root);
  2331. // Only override unbounded behavior if option is explicitly specified
  2332. if (isUnbounded !== undefined) {
  2333. ripple.unbounded = /** @type {boolean} */ (isUnbounded);
  2334. }
  2335. return ripple;
  2336. }
  2337.  
  2338. /**
  2339. * @param {!RippleCapableSurface} instance
  2340. * @return {!MDCRippleAdapter}
  2341. */
  2342. static createAdapter(instance) {
  2343. const MATCHES = getMatchesProperty(HTMLElement.prototype);
  2344.  
  2345. return {
  2346. browserSupportsCssVars: () => supportsCssVariables(window),
  2347. isUnbounded: () => instance.unbounded,
  2348. isSurfaceActive: () => instance.root_[MATCHES](':active'),
  2349. isSurfaceDisabled: () => instance.disabled,
  2350. addClass: (className) => instance.root_.classList.add(className),
  2351. removeClass: (className) => instance.root_.classList.remove(className),
  2352. containsEventTarget: (target) => instance.root_.contains(target),
  2353. registerInteractionHandler: (evtType, handler) =>
  2354. instance.root_.addEventListener(evtType, handler, applyPassive()),
  2355. deregisterInteractionHandler: (evtType, handler) =>
  2356. instance.root_.removeEventListener(evtType, handler, applyPassive()),
  2357. registerDocumentInteractionHandler: (evtType, handler) =>
  2358. document.documentElement.addEventListener(evtType, handler, applyPassive()),
  2359. deregisterDocumentInteractionHandler: (evtType, handler) =>
  2360. document.documentElement.removeEventListener(evtType, handler, applyPassive()),
  2361. registerResizeHandler: (handler) => window.addEventListener('resize', handler),
  2362. deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler),
  2363. updateCssVariable: (varName, value) => instance.root_.style.setProperty(varName, value),
  2364. computeBoundingRect: () => instance.root_.getBoundingClientRect(),
  2365. getWindowPageOffset: () => ({x: window.pageXOffset, y: window.pageYOffset}),
  2366. };
  2367. }
  2368.  
  2369. /** @return {boolean} */
  2370. get unbounded() {
  2371. return this.unbounded_;
  2372. }
  2373.  
  2374. /** @param {boolean} unbounded */
  2375. set unbounded(unbounded) {
  2376. this.unbounded_ = Boolean(unbounded);
  2377. this.setUnbounded_();
  2378. }
  2379.  
  2380. /**
  2381. * Closure Compiler throws an access control error when directly accessing a
  2382. * protected or private property inside a getter/setter, like unbounded above.
  2383. * By accessing the protected property inside a method, we solve that problem.
  2384. * That's why this function exists.
  2385. * @private
  2386. */
  2387. setUnbounded_() {
  2388. this.foundation_.setUnbounded(this.unbounded_);
  2389. }
  2390.  
  2391. activate() {
  2392. this.foundation_.activate();
  2393. }
  2394.  
  2395. deactivate() {
  2396. this.foundation_.deactivate();
  2397. }
  2398.  
  2399. layout() {
  2400. this.foundation_.layout();
  2401. }
  2402.  
  2403. /**
  2404. * @return {!MDCRippleFoundation}
  2405. * @override
  2406. */
  2407. getDefaultFoundation() {
  2408. return new ripple_foundation(ripple_MDCRipple.createAdapter(this));
  2409. }
  2410.  
  2411. /** @override */
  2412. initialSyncWithDOM() {
  2413. this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
  2414. }
  2415. }
  2416.  
  2417. /**
  2418. * See Material Design spec for more details on when to use ripples.
  2419. * https://material.io/guidelines/motion/choreography.html#choreography-creation
  2420. * @record
  2421. */
  2422. class RippleCapableSurface {}
  2423.  
  2424. /** @protected {!Element} */
  2425. RippleCapableSurface.prototype.root_;
  2426.  
  2427. /**
  2428. * Whether or not the ripple bleeds out of the bounds of the element.
  2429. * @type {boolean|undefined}
  2430. */
  2431. RippleCapableSurface.prototype.unbounded;
  2432.  
  2433. /**
  2434. * Whether or not the ripple is attached to a disabled component.
  2435. * @type {boolean|undefined}
  2436. */
  2437. RippleCapableSurface.prototype.disabled;
  2438.  
  2439.  
  2440.  
  2441.  
  2442. /***/ }),
  2443. /* 23 */
  2444. /***/ (function(module, exports, __webpack_require__) {
  2445.  
  2446. "use strict";
  2447.  
  2448. // This file cannot contain Webpack-resolved imports (e.g. "~src/foo").
  2449. var __importDefault = (this && this.__importDefault) || function (mod) {
  2450. return (mod && mod.__esModule) ? mod : { "default": mod };
  2451. };
  2452. Object.defineProperty(exports, "__esModule", { value: true });
  2453. exports.YT_LOCATION_CHANGE_EVENT = exports.APP_ROOT_ID = exports.HOSTNAME = exports.NAME = void 0;
  2454. const userscript_1 = __importDefault(__webpack_require__(19));
  2455. exports.NAME = userscript_1.default.sitename;
  2456. exports.HOSTNAME = userscript_1.default.hostname;
  2457. exports.APP_ROOT_ID = userscript_1.default.id;
  2458. exports.YT_LOCATION_CHANGE_EVENT = 'yt-navigate-finish';
  2459.  
  2460.  
  2461. /***/ }),
  2462. /* 24 */
  2463. /***/ (function(module, exports, __webpack_require__) {
  2464.  
  2465. "use strict";
  2466.  
  2467.  
  2468. var _interopRequireDefault = __webpack_require__(4);
  2469.  
  2470. Object.defineProperty(exports, "__esModule", {
  2471. value: true
  2472. });
  2473. exports.default = exports.LinearProgress = void 0;
  2474.  
  2475. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  2476.  
  2477. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  2478.  
  2479. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  2480.  
  2481. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  2482.  
  2483. var _get2 = _interopRequireDefault(__webpack_require__(20));
  2484.  
  2485. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  2486.  
  2487. var _linearProgress = __webpack_require__(72);
  2488.  
  2489. var _preact = __webpack_require__(0);
  2490.  
  2491. var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
  2492.  
  2493. var LinearProgress =
  2494. /*#__PURE__*/
  2495. function (_MaterialComponent) {
  2496. (0, _inherits2.default)(LinearProgress, _MaterialComponent);
  2497.  
  2498. function LinearProgress() {
  2499. var _this;
  2500.  
  2501. (0, _classCallCheck2.default)(this, LinearProgress);
  2502. _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(LinearProgress).apply(this, arguments));
  2503. _this.componentName = 'linear-progress';
  2504. _this.mdcProps = ['reversed', 'indeterminate'];
  2505. _this.themeProps = ['primary', 'secondary'];
  2506. _this.mdcNotifyProps = ['progress'];
  2507. return _this;
  2508. }
  2509.  
  2510. (0, _createClass2.default)(LinearProgress, [{
  2511. key: "componentDidMount",
  2512. value: function componentDidMount() {
  2513. (0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentDidMount", this).call(this);
  2514.  
  2515. if (this.control) {
  2516. this.MDComponent = new _linearProgress.MDCLinearProgress(this.control);
  2517. this.MDComponent.determinate = !this.props.indeterminate;
  2518. this.MDComponent.reverse = !!this.props.reversed;
  2519. }
  2520.  
  2521. this.afterComponentDidMount();
  2522. }
  2523. }, {
  2524. key: "componentWillReceiveProps",
  2525. value: function componentWillReceiveProps(nextProps) {
  2526. (0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentWillReceiveProps", this).call(this, nextProps);
  2527.  
  2528. if (this.MDComponent) {
  2529. this.MDComponent.determinate = !this.props.indeterminate;
  2530. this.MDComponent.reverse = !!nextProps.reversed;
  2531. }
  2532. }
  2533. }, {
  2534. key: "componentWillUnmount",
  2535. value: function componentWillUnmount() {
  2536. (0, _get2.default)((0, _getPrototypeOf2.default)(LinearProgress.prototype), "componentWillUnmount", this).call(this);
  2537.  
  2538. if (this.MDComponent) {
  2539. this.MDComponent.destroy();
  2540. }
  2541. }
  2542. }, {
  2543. key: "materialDom",
  2544. value: function materialDom(props) {
  2545. // TODO: Fix theme props
  2546. return (0, _preact.h)("div", Object.assign({
  2547. role: "progressbar"
  2548. }, props, {
  2549. ref: this.setControlRef
  2550. }), (0, _preact.h)("div", {
  2551. className: "mdc-linear-progress__buffering-dots"
  2552. }), (0, _preact.h)("div", {
  2553. className: "mdc-linear-progress__buffer"
  2554. }), (0, _preact.h)("div", {
  2555. className: "mdc-linear-progress__bar mdc-linear-progress__primary-bar"
  2556. }, (0, _preact.h)("span", {
  2557. className: "mdc-linear-progress__bar-inner"
  2558. })), (0, _preact.h)("div", {
  2559. className: "mdc-linear-progress__bar mdc-linear-progress__secondary-bar"
  2560. }, (0, _preact.h)("span", {
  2561. className: "mdc-linear-progress__bar-inner"
  2562. })));
  2563. }
  2564. }]);
  2565. return LinearProgress;
  2566. }(_MaterialComponent2.default);
  2567.  
  2568. exports.LinearProgress = LinearProgress;
  2569. var _default = LinearProgress;
  2570. exports.default = _default;
  2571. //# sourceMappingURL=index.js.map
  2572.  
  2573. /***/ }),
  2574. /* 25 */
  2575. /***/ (function(module, exports, __webpack_require__) {
  2576.  
  2577. "use strict";
  2578.  
  2579. Object.defineProperty(exports, "__esModule", { value: true });
  2580. var constants;
  2581. (function (constants) {
  2582. constants.typeOfFunction = 'function';
  2583. constants.boolTrue = true;
  2584. })(constants || (constants = {}));
  2585. function bind(target, propertyKey, descriptor) {
  2586. if (!descriptor || (typeof descriptor.value !== constants.typeOfFunction)) {
  2587. throw new TypeError("Only methods can be decorated with @bind. <" + propertyKey + "> is not a method!");
  2588. }
  2589. return {
  2590. configurable: constants.boolTrue,
  2591. get: function () {
  2592. var bound = descriptor.value.bind(this);
  2593. // Credits to https://github.com/andreypopp/autobind-decorator for memoizing the result of bind against a symbol on the instance.
  2594. Object.defineProperty(this, propertyKey, {
  2595. value: bound,
  2596. configurable: constants.boolTrue,
  2597. writable: constants.boolTrue
  2598. });
  2599. return bound;
  2600. }
  2601. };
  2602. }
  2603. exports.bind = bind;
  2604. exports.default = bind;
  2605.  
  2606.  
  2607. /***/ }),
  2608. /* 26 */
  2609. /***/ (function(module, exports, __webpack_require__) {
  2610.  
  2611. "use strict";
  2612.  
  2613.  
  2614. var _interopRequireDefault = __webpack_require__(4);
  2615.  
  2616. Object.defineProperty(exports, "__esModule", {
  2617. value: true
  2618. });
  2619. exports.default = exports.IconButton = exports.Icon = void 0;
  2620.  
  2621. var _get2 = _interopRequireDefault(__webpack_require__(20));
  2622.  
  2623. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  2624.  
  2625. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  2626.  
  2627. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  2628.  
  2629. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  2630.  
  2631. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  2632.  
  2633. var _iconButton = __webpack_require__(74);
  2634.  
  2635. var _preact = __webpack_require__(0);
  2636.  
  2637. var _MaterialComponent3 = _interopRequireDefault(__webpack_require__(14));
  2638.  
  2639. var Icon =
  2640. /*#__PURE__*/
  2641. function (_MaterialComponent) {
  2642. (0, _inherits2.default)(Icon, _MaterialComponent);
  2643.  
  2644. function Icon() {
  2645. var _this;
  2646.  
  2647. (0, _classCallCheck2.default)(this, Icon);
  2648. _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Icon).apply(this, arguments));
  2649. _this.componentName = 'icon-button__icon';
  2650. _this.mdcProps = ['on'];
  2651. return _this;
  2652. }
  2653.  
  2654. (0, _createClass2.default)(Icon, [{
  2655. key: "materialDom",
  2656. value: function materialDom(props) {
  2657. var IconElement = props.element || 'i';
  2658. return (0, _preact.h)(IconElement, Object.assign({
  2659. class: "material-icons"
  2660. }, props), props.children);
  2661. }
  2662. }]);
  2663. return Icon;
  2664. }(_MaterialComponent3.default);
  2665.  
  2666. exports.Icon = Icon;
  2667.  
  2668. var IconButton =
  2669. /*#__PURE__*/
  2670. function (_MaterialComponent2) {
  2671. (0, _inherits2.default)(IconButton, _MaterialComponent2);
  2672.  
  2673. function IconButton() {
  2674. var _this2;
  2675.  
  2676. (0, _classCallCheck2.default)(this, IconButton);
  2677. _this2 = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(IconButton).apply(this, arguments));
  2678. _this2.componentName = 'icon-button';
  2679. _this2.mdcProps = [];
  2680. return _this2;
  2681. }
  2682.  
  2683. (0, _createClass2.default)(IconButton, [{
  2684. key: "componentDidMount",
  2685. value: function componentDidMount() {
  2686. (0, _get2.default)((0, _getPrototypeOf2.default)(IconButton.prototype), "componentDidMount", this).call(this);
  2687. this.MDComponent = new _iconButton.MDCIconButtonToggle(this.control);
  2688. }
  2689. }, {
  2690. key: "componentWillUnmount",
  2691. value: function componentWillUnmount() {
  2692. (0, _get2.default)((0, _getPrototypeOf2.default)(IconButton.prototype), "componentWillUnmount", this).call(this);
  2693.  
  2694. if (this.MDComponent) {
  2695. this.MDComponent.destroy();
  2696. }
  2697. }
  2698. }, {
  2699. key: "materialDom",
  2700. value: function materialDom(props) {
  2701. return (0, _preact.h)("button", Object.assign({
  2702. ref: this.setControlRef
  2703. }, props), this.props.children);
  2704. }
  2705. }]);
  2706. return IconButton;
  2707. }(_MaterialComponent3.default);
  2708.  
  2709. exports.IconButton = IconButton;
  2710.  
  2711. var default_1 =
  2712. /*#__PURE__*/
  2713. function (_IconButton) {
  2714. (0, _inherits2.default)(default_1, _IconButton);
  2715.  
  2716. function default_1() {
  2717. (0, _classCallCheck2.default)(this, default_1);
  2718. return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(default_1).apply(this, arguments));
  2719. }
  2720.  
  2721. return default_1;
  2722. }(IconButton);
  2723.  
  2724. exports.default = default_1;
  2725. default_1.Icon = Icon;
  2726. //# sourceMappingURL=index.js.map
  2727.  
  2728. /***/ }),
  2729. /* 27 */
  2730. /***/ (function(module, exports) {
  2731.  
  2732. var charenc = {
  2733. // UTF-8 encoding
  2734. utf8: {
  2735. // Convert a string to a byte array
  2736. stringToBytes: function(str) {
  2737. return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
  2738. },
  2739.  
  2740. // Convert a byte array to a string
  2741. bytesToString: function(bytes) {
  2742. return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
  2743. }
  2744. },
  2745.  
  2746. // Binary encoding
  2747. bin: {
  2748. // Convert a string to a byte array
  2749. stringToBytes: function(str) {
  2750. for (var bytes = [], i = 0; i < str.length; i++)
  2751. bytes.push(str.charCodeAt(i) & 0xFF);
  2752. return bytes;
  2753. },
  2754.  
  2755. // Convert a byte array to a string
  2756. bytesToString: function(bytes) {
  2757. for (var str = [], i = 0; i < bytes.length; i++)
  2758. str.push(String.fromCharCode(bytes[i]));
  2759. return str.join('');
  2760. }
  2761. }
  2762. };
  2763.  
  2764. module.exports = charenc;
  2765.  
  2766.  
  2767. /***/ }),
  2768. /* 28 */
  2769. /***/ (function(module, exports, __webpack_require__) {
  2770.  
  2771. "use strict";
  2772.  
  2773. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2774. if (k2 === undefined) k2 = k;
  2775. var desc = Object.getOwnPropertyDescriptor(m, k);
  2776. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2777. desc = { enumerable: true, get: function() { return m[k]; } };
  2778. }
  2779. Object.defineProperty(o, k2, desc);
  2780. }) : (function(o, m, k, k2) {
  2781. if (k2 === undefined) k2 = k;
  2782. o[k2] = m[k];
  2783. }));
  2784. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2785. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2786. }) : function(o, v) {
  2787. o["default"] = v;
  2788. });
  2789. var __importStar = (this && this.__importStar) || function (mod) {
  2790. if (mod && mod.__esModule) return mod;
  2791. var result = {};
  2792. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2793. __setModuleDefault(result, mod);
  2794. return result;
  2795. };
  2796. var __importDefault = (this && this.__importDefault) || function (mod) {
  2797. return (mod && mod.__esModule) ? mod : { "default": mod };
  2798. };
  2799. Object.defineProperty(exports, "__esModule", { value: true });
  2800. const compose_1 = __webpack_require__(75);
  2801. const userscripter_1 = __webpack_require__(71);
  2802. const CONFIG = __importStar(__webpack_require__(29));
  2803. const operations_1 = __importDefault(__webpack_require__(30));
  2804. const SITE = __importStar(__webpack_require__(23));
  2805. const stylesheets_1 = __importDefault(__webpack_require__(64));
  2806. const userscript_1 = __importDefault(__webpack_require__(19));
  2807. const describeFailure = userscripter_1.errors.failureDescriber({
  2808. siteName: SITE.NAME,
  2809. extensionName: userscript_1.default.name,
  2810. location: document.location,
  2811. });
  2812. userscripter_1.userscripter.run({
  2813. id: userscript_1.default.id,
  2814. name: userscript_1.default.name,
  2815. initialAction: () => userscripter_1.log.log(`${userscript_1.default.name} ${userscript_1.default.version}`),
  2816. stylesheets: stylesheets_1.default,
  2817. operationsPlan: {
  2818. operations: operations_1.default,
  2819. interval: CONFIG.OPERATIONS_INTERVAL,
  2820. tryUntil: userscripter_1.environment.DOMCONTENTLOADED,
  2821. extraTries: CONFIG.OPERATIONS_EXTRA_TRIES,
  2822. // eslint-disable-next-line unicorn/no-array-for-each
  2823. handleFailures: (failures) => failures.forEach((0, compose_1.compose)(userscripter_1.log.error, describeFailure)),
  2824. },
  2825. });
  2826.  
  2827.  
  2828. /***/ }),
  2829. /* 29 */
  2830. /***/ (function(module, exports, __webpack_require__) {
  2831.  
  2832. "use strict";
  2833.  
  2834. // This file cannot contain Webpack-resolved imports (e.g. "~src/foo").
  2835. Object.defineProperty(exports, "__esModule", { value: true });
  2836. exports.OPERATIONS_EXTRA_TRIES = exports.OPERATIONS_INTERVAL = void 0;
  2837. exports.OPERATIONS_INTERVAL = 200; // ms
  2838. exports.OPERATIONS_EXTRA_TRIES = 3;
  2839.  
  2840.  
  2841. /***/ }),
  2842. /* 30 */
  2843. /***/ (function(module, exports, __webpack_require__) {
  2844.  
  2845. "use strict";
  2846.  
  2847. var __importDefault = (this && this.__importDefault) || function (mod) {
  2848. return (mod && mod.__esModule) ? mod : { "default": mod };
  2849. };
  2850. Object.defineProperty(exports, "__esModule", { value: true });
  2851. const operations_1 = __webpack_require__(17);
  2852. const environment_1 = __webpack_require__(18);
  2853. const js_cookie_1 = __webpack_require__(31);
  2854. const add_location_change_event_hook_1 = __importDefault(__webpack_require__(32));
  2855. const is_on_playlist_page_1 = __importDefault(__webpack_require__(34));
  2856. const selectors_1 = __webpack_require__(10);
  2857. const append_app_to_dom_1 = __importDefault(__webpack_require__(35));
  2858. function mainWrapper() {
  2859. const url = new URL(window.location.href);
  2860. const playlistName = url.searchParams.get('list');
  2861. /* eslint-disable no-underscore-dangle */
  2862. const config = {
  2863. DEVICE: window.ytcfg.data_.DEVICE,
  2864. DELEGATED_SESSION_ID: window.ytcfg.data_.DELEGATED_SESSION_ID,
  2865. ID_TOKEN: window.ytcfg.data_.ID_TOKEN,
  2866. INNERTUBE_API_KEY: window.ytcfg.data_.INNERTUBE_API_KEY,
  2867. INNERTUBE_CONTEXT_CLIENT_NAME: window.ytcfg.data_.INNERTUBE_CONTEXT_CLIENT_NAME,
  2868. INNERTUBE_CONTEXT_CLIENT_VERSION: window.ytcfg.data_.INNERTUBE_CONTEXT_CLIENT_VERSION,
  2869. PAGE_BUILD_LABEL: window.ytcfg.data_.PAGE_BUILD_LABEL,
  2870. PAGE_CL: window.ytcfg.data_.PAGE_CL,
  2871. VISITOR_DATA: window.ytcfg.data_.VISITOR_DATA,
  2872. SAPISID: (0, js_cookie_1.get)('SAPISID'),
  2873. ORIGIN_URL: new URL(document.URL).origin,
  2874. };
  2875. document.addEventListener('yt-action', (event) => {
  2876. if (event.detail.actionName === 'yt-service-request') {
  2877. (0, append_app_to_dom_1.default)(config, playlistName, selectors_1.XPATH.APP_RENDER_ROOT);
  2878. }
  2879. });
  2880. }
  2881. // Called every time app navigation occurs
  2882. function protectedMainWrapper() {
  2883. if ((0, is_on_playlist_page_1.default)(window)) {
  2884. mainWrapper();
  2885. }
  2886. }
  2887. const OPERATIONS = [
  2888. (0, operations_1.operation)({
  2889. description: 'run main if the script start on playlist page',
  2890. condition: is_on_playlist_page_1.default,
  2891. action: () => {
  2892. mainWrapper();
  2893. },
  2894. deferUntil: environment_1.DOMCONTENTLOADED,
  2895. }),
  2896. (0, operations_1.operation)({
  2897. description: 'init yt-navigate-finish hooks to watch in-app navigation',
  2898. condition: environment_1.ALWAYS,
  2899. action: () => {
  2900. (0, add_location_change_event_hook_1.default)(protectedMainWrapper);
  2901. },
  2902. deferUntil: environment_1.DOMCONTENTLOADED,
  2903. }),
  2904. ];
  2905. exports.default = OPERATIONS;
  2906.  
  2907.  
  2908. /***/ }),
  2909. /* 31 */
  2910. /***/ (function(module, exports, __webpack_require__) {
  2911.  
  2912. /*! js-cookie v3.0.5 | MIT */
  2913. ;
  2914. (function (global, factory) {
  2915. true ? module.exports = factory() :
  2916. undefined;
  2917. })(this, (function () { 'use strict';
  2918.  
  2919. /* eslint-disable no-var */
  2920. function assign (target) {
  2921. for (var i = 1; i < arguments.length; i++) {
  2922. var source = arguments[i];
  2923. for (var key in source) {
  2924. target[key] = source[key];
  2925. }
  2926. }
  2927. return target
  2928. }
  2929. /* eslint-enable no-var */
  2930.  
  2931. /* eslint-disable no-var */
  2932. var defaultConverter = {
  2933. read: function (value) {
  2934. if (value[0] === '"') {
  2935. value = value.slice(1, -1);
  2936. }
  2937. return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
  2938. },
  2939. write: function (value) {
  2940. return encodeURIComponent(value).replace(
  2941. /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
  2942. decodeURIComponent
  2943. )
  2944. }
  2945. };
  2946. /* eslint-enable no-var */
  2947.  
  2948. /* eslint-disable no-var */
  2949.  
  2950. function init (converter, defaultAttributes) {
  2951. function set (name, value, attributes) {
  2952. if (typeof document === 'undefined') {
  2953. return
  2954. }
  2955.  
  2956. attributes = assign({}, defaultAttributes, attributes);
  2957.  
  2958. if (typeof attributes.expires === 'number') {
  2959. attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
  2960. }
  2961. if (attributes.expires) {
  2962. attributes.expires = attributes.expires.toUTCString();
  2963. }
  2964.  
  2965. name = encodeURIComponent(name)
  2966. .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
  2967. .replace(/[()]/g, escape);
  2968.  
  2969. var stringifiedAttributes = '';
  2970. for (var attributeName in attributes) {
  2971. if (!attributes[attributeName]) {
  2972. continue
  2973. }
  2974.  
  2975. stringifiedAttributes += '; ' + attributeName;
  2976.  
  2977. if (attributes[attributeName] === true) {
  2978. continue
  2979. }
  2980.  
  2981. // Considers RFC 6265 section 5.2:
  2982. // ...
  2983. // 3. If the remaining unparsed-attributes contains a %x3B (";")
  2984. // character:
  2985. // Consume the characters of the unparsed-attributes up to,
  2986. // not including, the first %x3B (";") character.
  2987. // ...
  2988. stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
  2989. }
  2990.  
  2991. return (document.cookie =
  2992. name + '=' + converter.write(value, name) + stringifiedAttributes)
  2993. }
  2994.  
  2995. function get (name) {
  2996. if (typeof document === 'undefined' || (arguments.length && !name)) {
  2997. return
  2998. }
  2999.  
  3000. // To prevent the for loop in the first place assign an empty array
  3001. // in case there are no cookies at all.
  3002. var cookies = document.cookie ? document.cookie.split('; ') : [];
  3003. var jar = {};
  3004. for (var i = 0; i < cookies.length; i++) {
  3005. var parts = cookies[i].split('=');
  3006. var value = parts.slice(1).join('=');
  3007.  
  3008. try {
  3009. var found = decodeURIComponent(parts[0]);
  3010. jar[found] = converter.read(value, found);
  3011.  
  3012. if (name === found) {
  3013. break
  3014. }
  3015. } catch (e) {}
  3016. }
  3017.  
  3018. return name ? jar[name] : jar
  3019. }
  3020.  
  3021. return Object.create(
  3022. {
  3023. set,
  3024. get,
  3025. remove: function (name, attributes) {
  3026. set(
  3027. name,
  3028. '',
  3029. assign({}, attributes, {
  3030. expires: -1
  3031. })
  3032. );
  3033. },
  3034. withAttributes: function (attributes) {
  3035. return init(this.converter, assign({}, this.attributes, attributes))
  3036. },
  3037. withConverter: function (converter) {
  3038. return init(assign({}, this.converter, converter), this.attributes)
  3039. }
  3040. },
  3041. {
  3042. attributes: { value: Object.freeze(defaultAttributes) },
  3043. converter: { value: Object.freeze(converter) }
  3044. }
  3045. )
  3046. }
  3047.  
  3048. var api = init(defaultConverter, { path: '/' });
  3049. /* eslint-enable no-var */
  3050.  
  3051. return api;
  3052.  
  3053. }));
  3054.  
  3055.  
  3056. /***/ }),
  3057. /* 32 */
  3058. /***/ (function(module, exports, __webpack_require__) {
  3059.  
  3060. "use strict";
  3061.  
  3062. Object.defineProperty(exports, "__esModule", { value: true });
  3063. const site_1 = __webpack_require__(23);
  3064. // Add location change event hooks
  3065. function addLocationChangeEventHooks(callback) {
  3066. window.addEventListener(site_1.YT_LOCATION_CHANGE_EVENT, callback);
  3067. }
  3068. exports.default = addLocationChangeEventHooks;
  3069.  
  3070.  
  3071. /***/ }),
  3072. /* 33 */
  3073. /***/ (function(module) {
  3074.  
  3075. module.exports = JSON.parse("{\"name\":\"yt-playlists-delete-enhancer\",\"description\":\"Add a button to remove videos watched with more than X percent from watch later playlist.\",\"repository\":{\"type\":\"git\",\"url\":\"git@github.com:avallete/yt-playlists-delete-enhancer.git\"},\"bugs\":{\"url\":\"https://github.com/avallete/yt-playlists-delete-enhancer/issues\"},\"version\":\"1.7.2\",\"homepage\":\"https://github.com/avallete/yt-playlists-delete-enhancer#readme\",\"license\":\"MIT\",\"author\":\"Andrew Valleteau <avallete@student.42.fr>\"}");
  3076.  
  3077. /***/ }),
  3078. /* 34 */
  3079. /***/ (function(module, exports, __webpack_require__) {
  3080.  
  3081. "use strict";
  3082.  
  3083. Object.defineProperty(exports, "__esModule", { value: true });
  3084. const PLAYLIST_URL_PATHNAME = '/playlist';
  3085. const isOnPlaylistPage = (window_) => {
  3086. const url = new URL(window_.location.href);
  3087. return url.pathname === PLAYLIST_URL_PATHNAME;
  3088. };
  3089. exports.default = isOnPlaylistPage;
  3090.  
  3091.  
  3092. /***/ }),
  3093. /* 35 */
  3094. /***/ (function(module, exports, __webpack_require__) {
  3095.  
  3096. "use strict";
  3097.  
  3098. var __importDefault = (this && this.__importDefault) || function (mod) {
  3099. return (mod && mod.__esModule) ? mod : { "default": mod };
  3100. };
  3101. Object.defineProperty(exports, "__esModule", { value: true });
  3102. const jsx_runtime_1 = __webpack_require__(11);
  3103. const preact_1 = __webpack_require__(0);
  3104. const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
  3105. const remove_video_enhancer_app_1 = __importDefault(__webpack_require__(36));
  3106. const userscript_1 = __importDefault(__webpack_require__(19));
  3107. function appendAppToDom(config, playlistName, xpathRoot) {
  3108. const existingElement = document.querySelector(`#${userscript_1.default.id}${playlistName}`);
  3109. if (!existingElement) {
  3110. const elementToAppendTo = (0, get_elements_by_xpath_1.default)(xpathRoot)
  3111. // get only currently visibles elements because youtube hide elements instead of removing them from the DOM
  3112. .find((element) => element.offsetHeight > 0 || element.offsetWidth > 0);
  3113. // Use Date.now() to force re-mount component to trigger playlist fetch after yt-navigate-finish events
  3114. // See: #62
  3115. const AppContainer = ((0, jsx_runtime_1.jsx)("div", { id: `${userscript_1.default.id}${playlistName}`, children: (0, jsx_runtime_1.jsx)(remove_video_enhancer_app_1.default, { config: config, playlistName: playlistName }, Date.now()) }, Date.now()));
  3116. if (elementToAppendTo) {
  3117. (0, preact_1.render)(AppContainer, elementToAppendTo, elementToAppendTo.lastElementChild);
  3118. }
  3119. else {
  3120. throw new Error(`Cannot found ${xpathRoot} in the DOM`);
  3121. }
  3122. }
  3123. }
  3124. exports.default = appendAppToDom;
  3125.  
  3126.  
  3127. /***/ }),
  3128. /* 36 */
  3129. /***/ (function(module, exports, __webpack_require__) {
  3130.  
  3131. "use strict";
  3132.  
  3133. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3134. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3135. return new (P || (P = Promise))(function (resolve, reject) {
  3136. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3137. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3138. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3139. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3140. });
  3141. };
  3142. var __importDefault = (this && this.__importDefault) || function (mod) {
  3143. return (mod && mod.__esModule) ? mod : { "default": mod };
  3144. };
  3145. Object.defineProperty(exports, "__esModule", { value: true });
  3146. const jsx_runtime_1 = __webpack_require__(11);
  3147. const preact_1 = __webpack_require__(0);
  3148. const LinearProgress_1 = __importDefault(__webpack_require__(24));
  3149. const remove_video_enhancer_container_1 = __importDefault(__webpack_require__(42));
  3150. const yt_api_1 = __webpack_require__(49);
  3151. const partition_1 = __importDefault(__webpack_require__(58));
  3152. const remove_watched_from_playlist_ui_1 = __importDefault(__webpack_require__(59));
  3153. const remove_videos_from_playlist_ui_1 = __importDefault(__webpack_require__(60));
  3154. class RemoveVideoEnhancerApp extends preact_1.Component {
  3155. constructor(properties) {
  3156. super(properties);
  3157. this.state = {};
  3158. this.removeVideoWatchedPercentHandler = this.removeVideoWatchedPercentHandler.bind(this);
  3159. this.resetVideoHandler = this.resetVideoHandler.bind(this);
  3160. this.removeVideoHandler = this.removeVideoHandler.bind(this);
  3161. }
  3162. componentDidMount() {
  3163. return __awaiter(this, void 0, void 0, function* () {
  3164. try {
  3165. const playlist = yield (0, yt_api_1.fetchAllPlaylistContent)(this.props.config, this.props.playlistName);
  3166. this.setState({ playlist });
  3167. }
  3168. catch (error) {
  3169. this.setState({ errorMessages: [error.message] });
  3170. }
  3171. });
  3172. }
  3173. resetVideoHandler(videoId) {
  3174. return __awaiter(this, void 0, void 0, function* () {
  3175. try {
  3176. yield (0, yt_api_1.removeWatchHistoryForVideo)(this.props.config, videoId);
  3177. (0, remove_watched_from_playlist_ui_1.default)(videoId);
  3178. const { playlist } = this.state;
  3179. if (playlist) {
  3180. for (const v of playlist.continuations[0].videos) {
  3181. if (v.videoId === videoId) {
  3182. v.percentDurationWatched = 0;
  3183. }
  3184. }
  3185. }
  3186. else {
  3187. throw new Error('Playlist not found');
  3188. }
  3189. }
  3190. catch (error) {
  3191. this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
  3192. }
  3193. });
  3194. }
  3195. removeVideoWatchedPercentHandler(watchTimeValue) {
  3196. return __awaiter(this, void 0, void 0, function* () {
  3197. const { playlist } = this.state;
  3198. if (playlist && playlist.continuations[0].videos.length > 0) {
  3199. const [toDeleteVideos, toKeepVideos] = (0, partition_1.default)(playlist.continuations[0].videos, (v) => v.percentDurationWatched >= watchTimeValue);
  3200. if (toDeleteVideos.length > 0) {
  3201. try {
  3202. yield (0, yt_api_1.removeVideosFromPlaylist)(this.props.config, playlist === null || playlist === void 0 ? void 0 : playlist.playlistId, toDeleteVideos);
  3203. playlist.continuations[0].videos = toKeepVideos;
  3204. (0, remove_videos_from_playlist_ui_1.default)(toDeleteVideos);
  3205. this.setState(Object.assign(Object.assign({}, this.state), { playlist }));
  3206. }
  3207. catch (error) {
  3208. this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
  3209. }
  3210. }
  3211. }
  3212. });
  3213. }
  3214. removeVideoHandler(videoId) {
  3215. return __awaiter(this, void 0, void 0, function* () {
  3216. const { playlist } = this.state;
  3217. if (playlist && playlist.continuations[0].videos.length > 0) {
  3218. const [toDeleteVideos, toKeepVideos] = (0, partition_1.default)(playlist.continuations[0].videos, (v) => v.videoId === videoId);
  3219. if (toDeleteVideos.length > 0) {
  3220. try {
  3221. yield (0, yt_api_1.removeVideosFromPlaylist)(this.props.config, playlist === null || playlist === void 0 ? void 0 : playlist.playlistId, toDeleteVideos);
  3222. playlist.continuations[0].videos = toKeepVideos;
  3223. (0, remove_videos_from_playlist_ui_1.default)(toDeleteVideos);
  3224. this.setState(Object.assign(Object.assign({}, this.state), { playlist }));
  3225. }
  3226. catch (error) {
  3227. this.setState(Object.assign(Object.assign({}, this.state), { errorMessages: [error.message] }));
  3228. }
  3229. }
  3230. }
  3231. });
  3232. }
  3233. shouldComponentUpdate(nextProperties) {
  3234. var _a, _b;
  3235. return nextProperties.playlistName !== ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.playlist) === null || _b === void 0 ? void 0 : _b.playlistId);
  3236. }
  3237. componentDidUpdate(previousProperties) {
  3238. return __awaiter(this, void 0, void 0, function* () {
  3239. if (previousProperties.playlistName !== this.props.playlistName) {
  3240. try {
  3241. this.setState({ playlist: undefined, errorMessages: undefined });
  3242. const playlist = yield (0, yt_api_1.fetchAllPlaylistContent)(this.props.config, this.props.playlistName);
  3243. this.setState({ playlist });
  3244. }
  3245. catch (error) {
  3246. this.setState({ errorMessages: [error.message] });
  3247. }
  3248. }
  3249. });
  3250. }
  3251. render() {
  3252. var _a, _b, _c, _d;
  3253. if ((_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.errorMessages) === null || _b === void 0 ? void 0 : _b.length) {
  3254. return (0, jsx_runtime_1.jsx)("div", { children: (_c = this.state) === null || _c === void 0 ? void 0 : _c.errorMessages.join(' ') });
  3255. }
  3256. if ((_d = this.state) === null || _d === void 0 ? void 0 : _d.playlist) {
  3257. if (this.state.playlist.isEditable) {
  3258. return ((0, jsx_runtime_1.jsx)(remove_video_enhancer_container_1.default, { removeVideoWatchedPercentHandler: this.removeVideoWatchedPercentHandler, resetVideoHandler: this.resetVideoHandler, removeVideoHandler: this.removeVideoHandler }));
  3259. }
  3260. return (0, jsx_runtime_1.jsx)("div", { children: "Playlist isn't editable" });
  3261. }
  3262. return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { indeterminate: true }) }));
  3263. }
  3264. }
  3265. exports.default = RemoveVideoEnhancerApp;
  3266.  
  3267.  
  3268. /***/ }),
  3269. /* 37 */
  3270. /***/ (function(module, exports, __webpack_require__) {
  3271.  
  3272. var _typeof = __webpack_require__(13)["default"];
  3273. var toPrimitive = __webpack_require__(38);
  3274. function toPropertyKey(t) {
  3275. var i = toPrimitive(t, "string");
  3276. return "symbol" == _typeof(i) ? i : i + "";
  3277. }
  3278. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3279.  
  3280. /***/ }),
  3281. /* 38 */
  3282. /***/ (function(module, exports, __webpack_require__) {
  3283.  
  3284. var _typeof = __webpack_require__(13)["default"];
  3285. function toPrimitive(t, r) {
  3286. if ("object" != _typeof(t) || !t) return t;
  3287. var e = t[Symbol.toPrimitive];
  3288. if (void 0 !== e) {
  3289. var i = e.call(t, r || "default");
  3290. if ("object" != _typeof(i)) return i;
  3291. throw new TypeError("@@toPrimitive must return a primitive value.");
  3292. }
  3293. return ("string" === r ? String : Number)(t);
  3294. }
  3295. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3296.  
  3297. /***/ }),
  3298. /* 39 */
  3299. /***/ (function(module, exports) {
  3300.  
  3301. function _assertThisInitialized(e) {
  3302. if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  3303. return e;
  3304. }
  3305. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3306.  
  3307. /***/ }),
  3308. /* 40 */
  3309. /***/ (function(module, exports, __webpack_require__) {
  3310.  
  3311. var getPrototypeOf = __webpack_require__(3);
  3312. function _superPropBase(t, o) {
  3313. for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t)););
  3314. return t;
  3315. }
  3316. module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3317.  
  3318. /***/ }),
  3319. /* 41 */
  3320. /***/ (function(module, exports) {
  3321.  
  3322. function _setPrototypeOf(t, e) {
  3323. return (module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
  3324. return t.__proto__ = e, t;
  3325. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _setPrototypeOf(t, e);
  3326. }
  3327. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3328.  
  3329. /***/ }),
  3330. /* 42 */
  3331. /***/ (function(module, exports, __webpack_require__) {
  3332.  
  3333. "use strict";
  3334.  
  3335. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3336. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3337. return new (P || (P = Promise))(function (resolve, reject) {
  3338. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3339. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3340. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3341. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3342. });
  3343. };
  3344. var __importDefault = (this && this.__importDefault) || function (mod) {
  3345. return (mod && mod.__esModule) ? mod : { "default": mod };
  3346. };
  3347. Object.defineProperty(exports, "__esModule", { value: true });
  3348. exports.REMOVE_BUTTON_ALT = exports.INPUT_ALT = void 0;
  3349. const jsx_runtime_1 = __webpack_require__(11);
  3350. const preact_1 = __webpack_require__(0);
  3351. const hooks_1 = __webpack_require__(21);
  3352. const Button_1 = __importDefault(__webpack_require__(43));
  3353. const Slider_1 = __importDefault(__webpack_require__(46));
  3354. const LinearProgress_1 = __importDefault(__webpack_require__(24));
  3355. const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
  3356. const selectors_1 = __webpack_require__(10);
  3357. const video_item_quick_reset_button_1 = __importDefault(__webpack_require__(47));
  3358. const video_item_quick_delete_button_1 = __importDefault(__webpack_require__(48));
  3359. exports.INPUT_ALT = 'Input number between 0 and 100 to choose under how much percentage of watched time a video should be removed';
  3360. exports.REMOVE_BUTTON_ALT = 'Remove button to start removing videos';
  3361. function validate(value) {
  3362. const numberValue = Number(value);
  3363. return !!(Number.isSafeInteger(numberValue) && numberValue >= 0 && numberValue <= 100);
  3364. }
  3365. function RemoveVideoEnhancerContainer({ removeVideoWatchedPercentHandler, initialValue = 100, resetVideoHandler, removeVideoHandler, }) {
  3366. const [inputValue, setValue] = (0, hooks_1.useState)(initialValue);
  3367. const [isReadyToRemove, setIsReadyToRemove] = (0, hooks_1.useState)(true);
  3368. function onChange({ detail }) {
  3369. // eslint-disable-next-line no-underscore-dangle
  3370. const value = detail.foundation_.value_;
  3371. if (validate(value)) {
  3372. setValue(value);
  3373. }
  3374. }
  3375. const removeVideo = (0, hooks_1.useCallback)((videoId) => __awaiter(this, void 0, void 0, function* () {
  3376. yield removeVideoHandler(videoId);
  3377. }), []);
  3378. const resetVideo = (0, hooks_1.useCallback)((videoId) => __awaiter(this, void 0, void 0, function* () {
  3379. yield resetVideoHandler(videoId);
  3380. }), []);
  3381. (0, hooks_1.useEffect)(() => {
  3382. var _a, _b;
  3383. const menus = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_MENU);
  3384. for (const element of menus) {
  3385. element.style.display = 'inline-flex';
  3386. (0, preact_1.render)([
  3387. (0, preact_1.h)(video_item_quick_reset_button_1.default, {
  3388. // @ts-ignore element.data does not exists on types
  3389. videoId: (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.data.videoId,
  3390. onClick: resetVideo,
  3391. }),
  3392. (0, preact_1.h)(video_item_quick_delete_button_1.default, {
  3393. // @ts-ignore element.data does not exists on types
  3394. videoId: (_b = element.parentElement) === null || _b === void 0 ? void 0 : _b.data.videoId,
  3395. onClick: removeVideo,
  3396. }),
  3397. ], element);
  3398. }
  3399. const sidebar = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_SIDEBAR_CONTAINER);
  3400. if (sidebar.length > 0) {
  3401. sidebar[0].style.overflow = 'visible';
  3402. }
  3403. }, []);
  3404. return ((0, jsx_runtime_1.jsx)("div", { className: 'style-scope ytd-playlist-sidebar-renderer', children: (0, jsx_runtime_1.jsxs)("div", { className: 'style-scope ytd-menu-service-item-renderer', role: 'option', "aria-disabled": 'false', children: [(0, jsx_runtime_1.jsxs)("p", { children: ["Remove all videos that have been watched to at least ", inputValue, "%"] }), (0, jsx_runtime_1.jsx)(Slider_1.default, { min: 0, max: 100, step: 5, value: inputValue, onChange: onChange, alt: exports.INPUT_ALT, discrete: true }), (0, jsx_runtime_1.jsxs)(Button_1.default, { raised: true, ripple: true, secondary: true, alt: exports.REMOVE_BUTTON_ALT, disabled: !isReadyToRemove, onClick: () => __awaiter(this, void 0, void 0, function* () {
  3405. setIsReadyToRemove(false);
  3406. yield removeVideoWatchedPercentHandler(inputValue);
  3407. setIsReadyToRemove(true);
  3408. }), children: [!isReadyToRemove && (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { indeterminate: true }), isReadyToRemove && (0, jsx_runtime_1.jsx)("div", { children: "Remove!" })] })] }) }));
  3409. }
  3410. exports.default = RemoveVideoEnhancerContainer;
  3411.  
  3412.  
  3413. /***/ }),
  3414. /* 43 */
  3415. /***/ (function(module, exports, __webpack_require__) {
  3416.  
  3417. "use strict";
  3418.  
  3419.  
  3420. var _interopRequireDefault = __webpack_require__(4);
  3421.  
  3422. Object.defineProperty(exports, "__esModule", {
  3423. value: true
  3424. });
  3425. exports.default = exports.Button = exports.ButtonIcon = void 0;
  3426.  
  3427. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  3428.  
  3429. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  3430.  
  3431. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  3432.  
  3433. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  3434.  
  3435. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  3436.  
  3437. var _preact = __webpack_require__(0);
  3438.  
  3439. var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
  3440.  
  3441. var _Icon2 = _interopRequireDefault(__webpack_require__(44));
  3442.  
  3443. var _generateThemeClass = _interopRequireDefault(__webpack_require__(45));
  3444.  
  3445. var ButtonIcon =
  3446. /*#__PURE__*/
  3447. function (_Icon) {
  3448. (0, _inherits2.default)(ButtonIcon, _Icon);
  3449.  
  3450. function ButtonIcon() {
  3451. var _this;
  3452.  
  3453. (0, _classCallCheck2.default)(this, ButtonIcon);
  3454. _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ButtonIcon).apply(this, arguments));
  3455. _this.componentName = 'button__icon';
  3456. return _this;
  3457. }
  3458.  
  3459. return ButtonIcon;
  3460. }(_Icon2.default);
  3461.  
  3462. exports.ButtonIcon = ButtonIcon;
  3463.  
  3464. var Button =
  3465. /*#__PURE__*/
  3466. function (_MaterialComponent) {
  3467. (0, _inherits2.default)(Button, _MaterialComponent);
  3468.  
  3469. function Button() {
  3470. var _this2;
  3471.  
  3472. (0, _classCallCheck2.default)(this, Button);
  3473. _this2 = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Button).apply(this, arguments));
  3474. _this2.componentName = 'button';
  3475. _this2.mdcProps = ['dense', 'raised', 'unelevated', 'outlined'];
  3476. _this2.themeProps = ['primary', 'secondary'];
  3477. return _this2;
  3478. }
  3479.  
  3480. (0, _createClass2.default)(Button, [{
  3481. key: "materialDom",
  3482. value: function materialDom(props) {
  3483. var ButtonElement = props.href ? 'a' : 'button';
  3484. var className = '';
  3485. this.themeProps.forEach(function (themeProp) {
  3486. if (themeProp in props && props[themeProp] !== false) {
  3487. className += (0, _generateThemeClass.default)(themeProp) + ' ';
  3488. }
  3489. });
  3490. return (0, _preact.h)(ButtonElement, Object.assign({
  3491. ref: this.setControlRef
  3492. }, props, {
  3493. className: className
  3494. }), this.props.children);
  3495. }
  3496. }]);
  3497. return Button;
  3498. }(_MaterialComponent2.default);
  3499.  
  3500. exports.Button = Button;
  3501.  
  3502. var default_1 =
  3503. /*#__PURE__*/
  3504. function (_Button) {
  3505. (0, _inherits2.default)(default_1, _Button);
  3506.  
  3507. function default_1() {
  3508. (0, _classCallCheck2.default)(this, default_1);
  3509. return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(default_1).apply(this, arguments));
  3510. }
  3511.  
  3512. return default_1;
  3513. }(Button);
  3514.  
  3515. exports.default = default_1;
  3516. default_1.Icon = ButtonIcon;
  3517. //# sourceMappingURL=index.js.map
  3518.  
  3519. /***/ }),
  3520. /* 44 */
  3521. /***/ (function(module, exports, __webpack_require__) {
  3522.  
  3523. "use strict";
  3524.  
  3525.  
  3526. var _interopRequireDefault = __webpack_require__(4);
  3527.  
  3528. Object.defineProperty(exports, "__esModule", {
  3529. value: true
  3530. });
  3531. exports.default = exports.Icon = void 0;
  3532.  
  3533. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  3534.  
  3535. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  3536.  
  3537. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  3538.  
  3539. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  3540.  
  3541. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  3542.  
  3543. var _preact = __webpack_require__(0);
  3544.  
  3545. var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
  3546.  
  3547. var Icon =
  3548. /*#__PURE__*/
  3549. function (_MaterialComponent) {
  3550. (0, _inherits2.default)(Icon, _MaterialComponent);
  3551.  
  3552. function Icon() {
  3553. var _this;
  3554.  
  3555. (0, _classCallCheck2.default)(this, Icon);
  3556. _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Icon).apply(this, arguments));
  3557. _this.componentName = 'icon';
  3558. _this.mdcProps = [];
  3559. return _this;
  3560. }
  3561.  
  3562. (0, _createClass2.default)(Icon, [{
  3563. key: "materialDom",
  3564. value: function materialDom(props) {
  3565. var classes = ['material-icons']; // CardActionIcon sends className
  3566.  
  3567. if (props.className) {
  3568. classes.push(props.className);
  3569. }
  3570.  
  3571. return (0, _preact.h)("i", Object.assign({}, props, {
  3572. className: classes.join(' ')
  3573. }), props.children);
  3574. }
  3575. }]);
  3576. return Icon;
  3577. }(_MaterialComponent2.default);
  3578.  
  3579. exports.Icon = Icon;
  3580. var _default = Icon;
  3581. exports.default = _default;
  3582. //# sourceMappingURL=index.js.map
  3583.  
  3584. /***/ }),
  3585. /* 45 */
  3586. /***/ (function(module, exports, __webpack_require__) {
  3587.  
  3588. "use strict";
  3589.  
  3590.  
  3591. Object.defineProperty(exports, "__esModule", {
  3592. value: true
  3593. });
  3594. exports.default = _default;
  3595.  
  3596. function _default(prop) {
  3597. return "mdc-theme--".concat(prop, "-bg");
  3598. }
  3599. //# sourceMappingURL=generateThemeClass.js.map
  3600.  
  3601. /***/ }),
  3602. /* 46 */
  3603. /***/ (function(module, exports, __webpack_require__) {
  3604.  
  3605. "use strict";
  3606.  
  3607.  
  3608. var _interopRequireDefault = __webpack_require__(4);
  3609.  
  3610. Object.defineProperty(exports, "__esModule", {
  3611. value: true
  3612. });
  3613. exports.default = exports.Slider = void 0;
  3614.  
  3615. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(5));
  3616.  
  3617. var _createClass2 = _interopRequireDefault(__webpack_require__(6));
  3618.  
  3619. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(7));
  3620.  
  3621. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(3));
  3622.  
  3623. var _get2 = _interopRequireDefault(__webpack_require__(20));
  3624.  
  3625. var _inherits2 = _interopRequireDefault(__webpack_require__(8));
  3626.  
  3627. var _typeof2 = _interopRequireDefault(__webpack_require__(13));
  3628.  
  3629. var _slider = __webpack_require__(73);
  3630.  
  3631. var _bindDecorator = __webpack_require__(25);
  3632.  
  3633. var _preact = __webpack_require__(0);
  3634.  
  3635. var _MaterialComponent2 = _interopRequireDefault(__webpack_require__(14));
  3636.  
  3637. var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
  3638. var c = arguments.length,
  3639. r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
  3640. d;
  3641. if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof2.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
  3642. if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3643. }
  3644. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3645. };
  3646.  
  3647. var __rest = void 0 && (void 0).__rest || function (s, e) {
  3648. var t = {};
  3649.  
  3650. for (var p in s) {
  3651. if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  3652. }
  3653.  
  3654. if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  3655. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  3656. }
  3657. return t;
  3658. };
  3659.  
  3660. var Slider =
  3661. /*#__PURE__*/
  3662. function (_MaterialComponent) {
  3663. (0, _inherits2.default)(Slider, _MaterialComponent);
  3664.  
  3665. function Slider() {
  3666. var _this;
  3667.  
  3668. (0, _classCallCheck2.default)(this, Slider);
  3669. _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Slider).apply(this, arguments));
  3670. _this.componentName = 'slider';
  3671. _this.mdcProps = ['discrete'];
  3672. return _this;
  3673. }
  3674.  
  3675. (0, _createClass2.default)(Slider, [{
  3676. key: "componentDidMount",
  3677. value: function componentDidMount() {
  3678. (0, _get2.default)((0, _getPrototypeOf2.default)(Slider.prototype), "componentDidMount", this).call(this);
  3679.  
  3680. if (this.control) {
  3681. this.MDComponent = new _slider.MDCSlider(this.control);
  3682. this.MDComponent.listen('MDCSlider:change', this.onChange);
  3683. this.MDComponent.listen('MDCSlider:input', this.onInput);
  3684. }
  3685.  
  3686. this.setValue(this.props.value); // set initial value programatically because of error if min is greater than initial max
  3687. }
  3688. }, {
  3689. key: "componentWillUnmount",
  3690. value: function componentWillUnmount() {
  3691. (0, _get2.default)((0, _getPrototypeOf2.default)(Slider.prototype), "componentWillUnmount", this).call(this);
  3692.  
  3693. if (this.MDComponent) {
  3694. this.MDComponent.unlisten('MDCSlider:change', this.onChange);
  3695. this.MDComponent.unlisten('MDCSlider:input', this.onInput);
  3696. this.MDComponent.destroy();
  3697. }
  3698. }
  3699. }, {
  3700. key: "getValue",
  3701. value: function getValue() {
  3702. if (this.MDComponent) {
  3703. return this.MDComponent.value;
  3704. }
  3705. }
  3706. }, {
  3707. key: "setValue",
  3708. value: function setValue(value) {
  3709. var _this$props = this.props,
  3710. _this$props$disabled = _this$props.disabled,
  3711. disabled = _this$props$disabled === void 0 ? false : _this$props$disabled,
  3712. _this$props$min = _this$props.min,
  3713. min = _this$props$min === void 0 ? 0 : _this$props$min,
  3714. _this$props$max = _this$props.max,
  3715. max = _this$props$max === void 0 ? 100 : _this$props$max,
  3716. step = _this$props.step;
  3717.  
  3718. if (this.MDComponent) {
  3719. if (min > this.MDComponent.max) {
  3720. this.MDComponent.max = max;
  3721. this.MDComponent.min = min;
  3722. } else {
  3723. this.MDComponent.min = min;
  3724. this.MDComponent.max = max;
  3725. }
  3726.  
  3727. if (value) {
  3728. this.MDComponent.value = value;
  3729. }
  3730.  
  3731. this.MDComponent.disabled = disabled;
  3732.  
  3733. if (step) {
  3734. this.MDComponent.step = step;
  3735. }
  3736. }
  3737. }
  3738. }, {
  3739. key: "onChange",
  3740. value: function onChange(e) {
  3741. if (this.props.onChange) {
  3742. this.props.onChange(e);
  3743. }
  3744. }
  3745. }, {
  3746. key: "onInput",
  3747. value: function onInput(e) {
  3748. if (this.props.onInput) {
  3749. this.props.onInput(e);
  3750. }
  3751. }
  3752. }, {
  3753. key: "materialDom",
  3754. value: function materialDom(allprops) {
  3755. var _allprops$tabindex = allprops.tabindex,
  3756. tabIndex = _allprops$tabindex === void 0 ? 0 : _allprops$tabindex,
  3757. props = __rest(allprops, ["tabindex"]);
  3758.  
  3759. this.setValue(allprops);
  3760. return (0, _preact.h)("div", Object.assign({
  3761. tabIndex: tabIndex,
  3762. role: "slider",
  3763. "aria-label": "Select Value",
  3764. ref: this.setControlRef
  3765. }, props), (0, _preact.h)("div", {
  3766. class: "mdc-slider__track-container"
  3767. }, (0, _preact.h)("div", {
  3768. class: "mdc-slider__track"
  3769. })), (0, _preact.h)("div", {
  3770. class: "mdc-slider__thumb-container"
  3771. }, props.discrete && (0, _preact.h)("div", {
  3772. class: "mdc-slider__pin"
  3773. }, (0, _preact.h)("span", {
  3774. class: "mdc-slider__pin-value-marker"
  3775. })), (0, _preact.h)("svg", {
  3776. class: "mdc-slider__thumb",
  3777. width: "21",
  3778. height: "21"
  3779. }, (0, _preact.h)("circle", {
  3780. cx: "10.5",
  3781. cy: "10.5",
  3782. r: "7.875"
  3783. })), (0, _preact.h)("div", {
  3784. class: "mdc-slider__focus-ring"
  3785. })));
  3786. }
  3787. }]);
  3788. return Slider;
  3789. }(_MaterialComponent2.default);
  3790.  
  3791. exports.Slider = Slider;
  3792.  
  3793. __decorate([_bindDecorator.bind], Slider.prototype, "onChange", null);
  3794.  
  3795. __decorate([_bindDecorator.bind], Slider.prototype, "onInput", null);
  3796.  
  3797. var _default = Slider;
  3798. exports.default = _default;
  3799. //# sourceMappingURL=index.js.map
  3800.  
  3801. /***/ }),
  3802. /* 47 */
  3803. /***/ (function(module, exports, __webpack_require__) {
  3804.  
  3805. "use strict";
  3806.  
  3807. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3808. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3809. return new (P || (P = Promise))(function (resolve, reject) {
  3810. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3811. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3812. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3813. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3814. });
  3815. };
  3816. var __importDefault = (this && this.__importDefault) || function (mod) {
  3817. return (mod && mod.__esModule) ? mod : { "default": mod };
  3818. };
  3819. Object.defineProperty(exports, "__esModule", { value: true });
  3820. const jsx_runtime_1 = __webpack_require__(11);
  3821. const hooks_1 = __webpack_require__(21);
  3822. const IconButton_1 = __importDefault(__webpack_require__(26));
  3823. function VideoItemQuickResetButton(properties) {
  3824. const [loading, setLoading] = (0, hooks_1.useState)(false);
  3825. return ((0, jsx_runtime_1.jsx)(IconButton_1.default
  3826. // we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
  3827. , {
  3828. // we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
  3829. style: { order: -1 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
  3830. setLoading(true);
  3831. yield properties.onClick(properties.videoId);
  3832. setLoading(false);
  3833. }), disabled: loading, title: 'Mark as unwatched', children: (0, jsx_runtime_1.jsx)(IconButton_1.default.Icon, { style: { color: '#e10000' }, children: "refresh" }) }));
  3834. }
  3835. exports.default = VideoItemQuickResetButton;
  3836.  
  3837.  
  3838. /***/ }),
  3839. /* 48 */
  3840. /***/ (function(module, exports, __webpack_require__) {
  3841.  
  3842. "use strict";
  3843.  
  3844. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3845. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3846. return new (P || (P = Promise))(function (resolve, reject) {
  3847. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3848. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3849. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3850. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3851. });
  3852. };
  3853. var __importDefault = (this && this.__importDefault) || function (mod) {
  3854. return (mod && mod.__esModule) ? mod : { "default": mod };
  3855. };
  3856. Object.defineProperty(exports, "__esModule", { value: true });
  3857. const jsx_runtime_1 = __webpack_require__(11);
  3858. const hooks_1 = __webpack_require__(21);
  3859. const IconButton_1 = __importDefault(__webpack_require__(26));
  3860. function VideoItemQuickDeleteButton(properties) {
  3861. const [loading, setLoading] = (0, hooks_1.useState)(false);
  3862. return ((0, jsx_runtime_1.jsx)(IconButton_1.default
  3863. // we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
  3864. , {
  3865. // we use this order -1 to avoid the button sometimes being render AFTER the row menu when swtiching between playlist
  3866. style: { order: -1 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
  3867. setLoading(true);
  3868. yield properties.onClick(properties.videoId);
  3869. setLoading(false);
  3870. }), disabled: loading, title: 'Remove video', children: (0, jsx_runtime_1.jsx)(IconButton_1.default.Icon, { style: { color: '#e10000' }, children: "delete" }) }));
  3871. }
  3872. exports.default = VideoItemQuickDeleteButton;
  3873.  
  3874.  
  3875. /***/ }),
  3876. /* 49 */
  3877. /***/ (function(module, exports, __webpack_require__) {
  3878.  
  3879. "use strict";
  3880.  
  3881. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3882. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3883. return new (P || (P = Promise))(function (resolve, reject) {
  3884. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  3885. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  3886. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  3887. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3888. });
  3889. };
  3890. var __importDefault = (this && this.__importDefault) || function (mod) {
  3891. return (mod && mod.__esModule) ? mod : { "default": mod };
  3892. };
  3893. Object.defineProperty(exports, "__esModule", { value: true });
  3894. exports.removeVideosFromPlaylist = exports.removeWatchHistoryForVideo = exports.fetchAllPlaylistContent = void 0;
  3895. const sha1_1 = __importDefault(__webpack_require__(50));
  3896. const errors_1 = __webpack_require__(57);
  3897. const API_BASE_URL = new URL('https://www.youtube.com/youtubei/v1');
  3898. const API_GET_PLAYLIST_VIDEOS_URL = new URL(`${API_BASE_URL}/browse`);
  3899. const API_EDIT_PLAYLIST_VIDEOS_URL = new URL(`${API_GET_PLAYLIST_VIDEOS_URL}/edit_playlist`);
  3900. const BASE_REFERER_URL = new URL('https://www.youtube.com/playlist');
  3901. const API_V1_REQUIRED_HEADERS = [
  3902. 'Content-Type',
  3903. 'Authorization',
  3904. 'X-Goog-Visitor-Id',
  3905. 'X-YouTube-Client-Name',
  3906. 'X-YouTube-Client-Version',
  3907. 'X-Goog-AuthUser',
  3908. 'X-Goog-PageId',
  3909. ];
  3910. const API_REQUIRED_HEADERS = [
  3911. 'X-YouTube-Client-Name',
  3912. 'X-YouTube-Client-Version',
  3913. 'X-YouTube-Device',
  3914. 'X-YouTube-Identity-Token',
  3915. 'X-YouTube-Page-CL',
  3916. 'X-YouTube-Page-Label',
  3917. ];
  3918. function generateSAPISIDHASH(origin, sapisid, date = new Date()) {
  3919. const roundedTimestamp = Math.floor(date.getTime() / 1000);
  3920. // deepcode ignore InsecureHash: we need to replicate youtube webapp behavior
  3921. // eslint-disable-next-line sonarjs/no-nested-template-literals
  3922. return `${roundedTimestamp}_${(0, sha1_1.default)(`${roundedTimestamp} ${sapisid} ${origin}`)}`;
  3923. }
  3924. function generateRequestHeaders(config, headerKeys = []) {
  3925. const allHeaders = {
  3926. 'Content-Type': 'application/json',
  3927. 'X-Goog-Visitor-Id': config.VISITOR_DATA,
  3928. 'X-YouTube-Client-Name': config.INNERTUBE_CONTEXT_CLIENT_NAME,
  3929. 'X-YouTube-Client-Version': config.INNERTUBE_CONTEXT_CLIENT_VERSION,
  3930. 'X-YouTube-Device': config.DEVICE,
  3931. 'X-YouTube-Identity-Token': config.ID_TOKEN,
  3932. 'X-YouTube-Page-CL': config.PAGE_CL,
  3933. 'X-YouTube-Page-Label': config.PAGE_BUILD_LABEL,
  3934. // Those two are mandatory together to successfully perform request
  3935. 'X-Goog-AuthUser': '1',
  3936. 'X-Goog-PageId': config.DELEGATED_SESSION_ID,
  3937. Authorization: `SAPISIDHASH ${generateSAPISIDHASH(config.ORIGIN_URL, config.SAPISID)}`,
  3938. };
  3939. const result = {};
  3940. // Add each wanted header key to result headers
  3941. for (const headerKey of headerKeys) {
  3942. result[headerKey] = allHeaders[headerKey];
  3943. }
  3944. return result;
  3945. }
  3946. function extractPlaylistVideoListRendererContents(playlistVideoListContents) {
  3947. return playlistVideoListContents.map((item) => {
  3948. var _a;
  3949. return {
  3950. videoId: item.playlistVideoRenderer.videoId,
  3951. percentDurationWatched: ((_a = item.playlistVideoRenderer.thumbnailOverlays[1].thumbnailOverlayResumePlaybackRenderer) === null || _a === void 0 ? void 0 : _a.percentDurationWatched) || 0,
  3952. };
  3953. });
  3954. }
  3955. function extractPlaylistContinuation(playlistContents) {
  3956. // ContinuationToken should be in the last item of the playlist contents
  3957. const lastItem = playlistContents.at(-1);
  3958. if (lastItem && lastItem.continuationItemRenderer) {
  3959. // Remove last item from playlist contents since it contain continuationItem
  3960. playlistContents.pop();
  3961. return {
  3962. videos: extractPlaylistVideoListRendererContents(playlistContents),
  3963. continuationToken: lastItem.continuationItemRenderer.continuationEndpoint.continuationCommand.token,
  3964. };
  3965. }
  3966. return {
  3967. videos: extractPlaylistVideoListRendererContents(playlistContents),
  3968. };
  3969. }
  3970. function fetchPlaylistInitialData(config, playlistName) {
  3971. return __awaiter(this, void 0, void 0, function* () {
  3972. const url = new URL(`${BASE_REFERER_URL}`);
  3973. const headers = generateRequestHeaders(config, API_REQUIRED_HEADERS);
  3974. url.searchParams.append('list', playlistName);
  3975. // Get the first page data for the playlist
  3976. url.searchParams.append('pbj', '1');
  3977. const response = yield fetch(`${url}`, {
  3978. credentials: 'include',
  3979. headers,
  3980. method: 'GET',
  3981. mode: 'cors',
  3982. });
  3983. const respJson = yield response.json();
  3984. const data = respJson.response.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer
  3985. .contents[0].itemSectionRenderer.contents[0].playlistVideoListRenderer;
  3986. if (!data) {
  3987. throw errors_1.PlaylistEmptyError;
  3988. }
  3989. return {
  3990. playlistId: data.playlistId,
  3991. isEditable: data.isEditable,
  3992. canReorder: data.canReorder,
  3993. continuations: [extractPlaylistContinuation(data.contents)],
  3994. };
  3995. });
  3996. }
  3997. function fetchPlaylistContinuation(config, continuation) {
  3998. return __awaiter(this, void 0, void 0, function* () {
  3999. const url = new URL(`${API_GET_PLAYLIST_VIDEOS_URL}`);
  4000. const headers = generateRequestHeaders(config, API_V1_REQUIRED_HEADERS);
  4001. const body = {
  4002. context: {
  4003. client: {
  4004. clientName: config.INNERTUBE_CONTEXT_CLIENT_NAME,
  4005. clientVersion: config.INNERTUBE_CONTEXT_CLIENT_VERSION,
  4006. },
  4007. },
  4008. continuation: continuation.continuationToken,
  4009. };
  4010. url.searchParams.append('key', config.INNERTUBE_API_KEY);
  4011. const response = yield fetch(`${url}`, {
  4012. credentials: 'include',
  4013. headers,
  4014. body: JSON.stringify(body),
  4015. method: 'POST',
  4016. mode: 'cors',
  4017. });
  4018. const responseJson = yield response.json();
  4019. const data = responseJson.onResponseReceivedActions[0].appendContinuationItemsAction.continuationItems;
  4020. return extractPlaylistContinuation(data);
  4021. });
  4022. }
  4023. function fetchAllPlaylistContent(config, playlistName) {
  4024. return __awaiter(this, void 0, void 0, function* () {
  4025. var _a;
  4026. const playlist = yield fetchPlaylistInitialData(config, playlistName);
  4027. if (playlist.isEditable) {
  4028. // If all data has been retrieved, the last continuation item token will be undefined
  4029. while (((_a = playlist.continuations.at(-1)) === null || _a === void 0 ? void 0 : _a.continuationToken) !== undefined) {
  4030. playlist.continuations.push(
  4031. // We need the next continuationToken to launch the next request
  4032. // eslint-disable-next-line no-await-in-loop
  4033. yield fetchPlaylistContinuation(config, playlist.continuations.at(-1)));
  4034. }
  4035. // Merge all the videos into a single PlaylistContinuation
  4036. let videos = [];
  4037. for (const continuation of playlist.continuations) {
  4038. // eslint-disable-next-line unicorn/prefer-spread
  4039. videos = [...videos, ...continuation.videos];
  4040. }
  4041. playlist.continuations = [{ videos }];
  4042. return playlist;
  4043. }
  4044. throw errors_1.PlaylistNotEditableError;
  4045. });
  4046. }
  4047. exports.fetchAllPlaylistContent = fetchAllPlaylistContent;
  4048. function getRemoveFromHistoryToken(videoId) {
  4049. return __awaiter(this, void 0, void 0, function* () {
  4050. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
  4051. const initDataRegex = /(?:window\["ytInitialData"]|ytInitialData)\W?=\W?({.*?});/;
  4052. const result = yield fetch('https://www.youtube.com/feed/history', {
  4053. credentials: 'include',
  4054. method: 'GET',
  4055. mode: 'cors',
  4056. });
  4057. const body = yield result.text();
  4058. try {
  4059. const matchedData = body.match(initDataRegex);
  4060. if (!matchedData || !matchedData[1])
  4061. throw new Error('Failed to parse initData');
  4062. const initData = JSON.parse(matchedData[1]);
  4063. const groups = (_g = (_f = (_e = (_d = (_c = (_b = (_a = initData === null || initData === void 0 ? void 0 : initData.contents) === null || _a === void 0 ? void 0 : _a.twoColumnBrowseResultsRenderer) === null || _b === void 0 ? void 0 : _b.tabs) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.tabRenderer) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.sectionListRenderer) === null || _g === void 0 ? void 0 : _g.contents.map((group) => group.itemSectionRenderer).filter(Boolean);
  4064. let matchingVideo;
  4065. for (const item of groups) {
  4066. for (const { videoRenderer } of item.contents) {
  4067. if ((videoRenderer === null || videoRenderer === void 0 ? void 0 : videoRenderer.videoId) && videoId === (videoRenderer === null || videoRenderer === void 0 ? void 0 : videoRenderer.videoId)) {
  4068. matchingVideo = videoRenderer;
  4069. break;
  4070. }
  4071. }
  4072. }
  4073. if (!matchingVideo) {
  4074. throw new Error('Video not found in watch history');
  4075. }
  4076. return (_p = (_o = (_m = (_l = (_k = (_j = (_h = matchingVideo === null || matchingVideo === void 0 ? void 0 : matchingVideo.menu) === null || _h === void 0 ? void 0 : _h.menuRenderer) === null || _j === void 0 ? void 0 : _j.topLevelButtons) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.buttonRenderer) === null || _m === void 0 ? void 0 : _m.serviceEndpoint) === null || _o === void 0 ? void 0 : _o.feedbackEndpoint) === null || _p === void 0 ? void 0 : _p.feedbackToken;
  4077. }
  4078. catch (error) {
  4079. // eslint-disable-next-line no-console
  4080. console.log(error);
  4081. throw new Error('Failed to parse initData');
  4082. }
  4083. });
  4084. }
  4085. const makeFeedbackPayload = (feedbackToken) => ({
  4086. context: {
  4087. client: {
  4088. hl: 'en',
  4089. clientName: 'WEB',
  4090. clientVersion: '2.20210711.07.00',
  4091. },
  4092. user: {
  4093. lockedSafetyMode: false,
  4094. },
  4095. request: {
  4096. useSsl: true,
  4097. internalExperimentFlags: [],
  4098. consistencyTokenJars: [],
  4099. },
  4100. },
  4101. isFeedbackTokenUnencrypted: false,
  4102. shouldMerge: false,
  4103. feedbackTokens: [feedbackToken],
  4104. });
  4105. function sendFeedbackRequest(config, feedbackToken) {
  4106. return __awaiter(this, void 0, void 0, function* () {
  4107. const url = `https://www.youtube.com/youtubei/v1/feedback?key=${config.INNERTUBE_API_KEY}`;
  4108. const rawResponse = yield fetch(url, {
  4109. method: 'POST',
  4110. headers: generateRequestHeaders(config, API_V1_REQUIRED_HEADERS),
  4111. body: JSON.stringify(makeFeedbackPayload(feedbackToken)),
  4112. });
  4113. const response = yield rawResponse.json();
  4114. if (!response.feedbackResponses[0].isProcessed) {
  4115. throw new Error('Failed to remove video from watch history');
  4116. }
  4117. });
  4118. }
  4119. function removeWatchHistoryForVideo(config, videoId) {
  4120. return __awaiter(this, void 0, void 0, function* () {
  4121. const feedbackToken = yield getRemoveFromHistoryToken(videoId);
  4122. if (feedbackToken) {
  4123. yield sendFeedbackRequest(config, feedbackToken);
  4124. }
  4125. });
  4126. }
  4127. exports.removeWatchHistoryForVideo = removeWatchHistoryForVideo;
  4128. function removeVideosFromPlaylist(config, playlistId, videosToRemove) {
  4129. return __awaiter(this, void 0, void 0, function* () {
  4130. const url = new URL(`${API_EDIT_PLAYLIST_VIDEOS_URL}`);
  4131. const headers = generateRequestHeaders(config, API_V1_REQUIRED_HEADERS);
  4132. const body = {
  4133. actions: videosToRemove.map(({ videoId }) => ({
  4134. removedVideoId: videoId,
  4135. action: 'ACTION_REMOVE_VIDEO_BY_VIDEO_ID',
  4136. })),
  4137. context: {
  4138. client: {
  4139. clientName: config.INNERTUBE_CONTEXT_CLIENT_NAME,
  4140. clientVersion: config.INNERTUBE_CONTEXT_CLIENT_VERSION,
  4141. },
  4142. },
  4143. params: 'CAFAAQ%3D%3D',
  4144. playlistId,
  4145. };
  4146. url.searchParams.append('key', config.INNERTUBE_API_KEY);
  4147. const response = yield fetch(`${url}`, {
  4148. credentials: 'include',
  4149. headers,
  4150. body: JSON.stringify(body),
  4151. method: 'POST',
  4152. mode: 'cors',
  4153. });
  4154. const data = yield response.json();
  4155. return data.status !== 'STATUS_SUCCEEDED';
  4156. });
  4157. }
  4158. exports.removeVideosFromPlaylist = removeVideosFromPlaylist;
  4159.  
  4160.  
  4161. /***/ }),
  4162. /* 50 */
  4163. /***/ (function(module, exports, __webpack_require__) {
  4164.  
  4165. /* WEBPACK VAR INJECTION */(function(Buffer) {(function() {
  4166. var crypt = __webpack_require__(56),
  4167. utf8 = __webpack_require__(27).utf8,
  4168. bin = __webpack_require__(27).bin,
  4169.  
  4170. // The core
  4171. sha1 = function (message) {
  4172. // Convert to byte array
  4173. if (message.constructor == String)
  4174. message = utf8.stringToBytes(message);
  4175. else if (typeof Buffer !== 'undefined' && typeof Buffer.isBuffer == 'function' && Buffer.isBuffer(message))
  4176. message = Array.prototype.slice.call(message, 0);
  4177. else if (!Array.isArray(message))
  4178. message = message.toString();
  4179.  
  4180. // otherwise assume byte array
  4181.  
  4182. var m = crypt.bytesToWords(message),
  4183. l = message.length * 8,
  4184. w = [],
  4185. H0 = 1732584193,
  4186. H1 = -271733879,
  4187. H2 = -1732584194,
  4188. H3 = 271733878,
  4189. H4 = -1009589776;
  4190.  
  4191. // Padding
  4192. m[l >> 5] |= 0x80 << (24 - l % 32);
  4193. m[((l + 64 >>> 9) << 4) + 15] = l;
  4194.  
  4195. for (var i = 0; i < m.length; i += 16) {
  4196. var a = H0,
  4197. b = H1,
  4198. c = H2,
  4199. d = H3,
  4200. e = H4;
  4201.  
  4202. for (var j = 0; j < 80; j++) {
  4203.  
  4204. if (j < 16)
  4205. w[j] = m[i + j];
  4206. else {
  4207. var n = w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16];
  4208. w[j] = (n << 1) | (n >>> 31);
  4209. }
  4210.  
  4211. var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (
  4212. j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :
  4213. j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
  4214. j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
  4215. (H1 ^ H2 ^ H3) - 899497514);
  4216.  
  4217. H4 = H3;
  4218. H3 = H2;
  4219. H2 = (H1 << 30) | (H1 >>> 2);
  4220. H1 = H0;
  4221. H0 = t;
  4222. }
  4223.  
  4224. H0 += a;
  4225. H1 += b;
  4226. H2 += c;
  4227. H3 += d;
  4228. H4 += e;
  4229. }
  4230.  
  4231. return [H0, H1, H2, H3, H4];
  4232. },
  4233.  
  4234. // Public API
  4235. api = function (message, options) {
  4236. var digestbytes = crypt.wordsToBytes(sha1(message));
  4237. return options && options.asBytes ? digestbytes :
  4238. options && options.asString ? bin.bytesToString(digestbytes) :
  4239. crypt.bytesToHex(digestbytes);
  4240. };
  4241.  
  4242. api._blocksize = 16;
  4243. api._digestsize = 20;
  4244.  
  4245. module.exports = api;
  4246. })();
  4247.  
  4248. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(51).Buffer))
  4249.  
  4250. /***/ }),
  4251. /* 51 */
  4252. /***/ (function(module, exports, __webpack_require__) {
  4253.  
  4254. "use strict";
  4255. /* WEBPACK VAR INJECTION */(function(global) {/*!
  4256. * The buffer module from node.js, for the browser.
  4257. *
  4258. * @author Feross Aboukhadijeh <http://feross.org>
  4259. * @license MIT
  4260. */
  4261. /* eslint-disable no-proto */
  4262.  
  4263.  
  4264.  
  4265. var base64 = __webpack_require__(53)
  4266. var ieee754 = __webpack_require__(54)
  4267. var isArray = __webpack_require__(55)
  4268.  
  4269. exports.Buffer = Buffer
  4270. exports.SlowBuffer = SlowBuffer
  4271. exports.INSPECT_MAX_BYTES = 50
  4272.  
  4273. /**
  4274. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  4275. * === true Use Uint8Array implementation (fastest)
  4276. * === false Use Object implementation (most compatible, even IE6)
  4277. *
  4278. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  4279. * Opera 11.6+, iOS 4.2+.
  4280. *
  4281. * Due to various browser bugs, sometimes the Object implementation will be used even
  4282. * when the browser supports typed arrays.
  4283. *
  4284. * Note:
  4285. *
  4286. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  4287. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  4288. *
  4289. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  4290. *
  4291. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  4292. * incorrect length in some situations.
  4293.  
  4294. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  4295. * get the Object implementation, which is slower but behaves correctly.
  4296. */
  4297. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  4298. ? global.TYPED_ARRAY_SUPPORT
  4299. : typedArraySupport()
  4300.  
  4301. /*
  4302. * Export kMaxLength after typed array support is determined.
  4303. */
  4304. exports.kMaxLength = kMaxLength()
  4305.  
  4306. function typedArraySupport () {
  4307. try {
  4308. var arr = new Uint8Array(1)
  4309. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  4310. return arr.foo() === 42 && // typed array instances can be augmented
  4311. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  4312. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  4313. } catch (e) {
  4314. return false
  4315. }
  4316. }
  4317.  
  4318. function kMaxLength () {
  4319. return Buffer.TYPED_ARRAY_SUPPORT
  4320. ? 0x7fffffff
  4321. : 0x3fffffff
  4322. }
  4323.  
  4324. function createBuffer (that, length) {
  4325. if (kMaxLength() < length) {
  4326. throw new RangeError('Invalid typed array length')
  4327. }
  4328. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4329. // Return an augmented `Uint8Array` instance, for best performance
  4330. that = new Uint8Array(length)
  4331. that.__proto__ = Buffer.prototype
  4332. } else {
  4333. // Fallback: Return an object instance of the Buffer class
  4334. if (that === null) {
  4335. that = new Buffer(length)
  4336. }
  4337. that.length = length
  4338. }
  4339.  
  4340. return that
  4341. }
  4342.  
  4343. /**
  4344. * The Buffer constructor returns instances of `Uint8Array` that have their
  4345. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  4346. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  4347. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  4348. * returns a single octet.
  4349. *
  4350. * The `Uint8Array` prototype remains unmodified.
  4351. */
  4352.  
  4353. function Buffer (arg, encodingOrOffset, length) {
  4354. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  4355. return new Buffer(arg, encodingOrOffset, length)
  4356. }
  4357.  
  4358. // Common case.
  4359. if (typeof arg === 'number') {
  4360. if (typeof encodingOrOffset === 'string') {
  4361. throw new Error(
  4362. 'If encoding is specified then the first argument must be a string'
  4363. )
  4364. }
  4365. return allocUnsafe(this, arg)
  4366. }
  4367. return from(this, arg, encodingOrOffset, length)
  4368. }
  4369.  
  4370. Buffer.poolSize = 8192 // not used by this implementation
  4371.  
  4372. // TODO: Legacy, not needed anymore. Remove in next major version.
  4373. Buffer._augment = function (arr) {
  4374. arr.__proto__ = Buffer.prototype
  4375. return arr
  4376. }
  4377.  
  4378. function from (that, value, encodingOrOffset, length) {
  4379. if (typeof value === 'number') {
  4380. throw new TypeError('"value" argument must not be a number')
  4381. }
  4382.  
  4383. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  4384. return fromArrayBuffer(that, value, encodingOrOffset, length)
  4385. }
  4386.  
  4387. if (typeof value === 'string') {
  4388. return fromString(that, value, encodingOrOffset)
  4389. }
  4390.  
  4391. return fromObject(that, value)
  4392. }
  4393.  
  4394. /**
  4395. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  4396. * if value is a number.
  4397. * Buffer.from(str[, encoding])
  4398. * Buffer.from(array)
  4399. * Buffer.from(buffer)
  4400. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  4401. **/
  4402. Buffer.from = function (value, encodingOrOffset, length) {
  4403. return from(null, value, encodingOrOffset, length)
  4404. }
  4405.  
  4406. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4407. Buffer.prototype.__proto__ = Uint8Array.prototype
  4408. Buffer.__proto__ = Uint8Array
  4409. if (typeof Symbol !== 'undefined' && Symbol.species &&
  4410. Buffer[Symbol.species] === Buffer) {
  4411. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  4412. Object.defineProperty(Buffer, Symbol.species, {
  4413. value: null,
  4414. configurable: true
  4415. })
  4416. }
  4417. }
  4418.  
  4419. function assertSize (size) {
  4420. if (typeof size !== 'number') {
  4421. throw new TypeError('"size" argument must be a number')
  4422. } else if (size < 0) {
  4423. throw new RangeError('"size" argument must not be negative')
  4424. }
  4425. }
  4426.  
  4427. function alloc (that, size, fill, encoding) {
  4428. assertSize(size)
  4429. if (size <= 0) {
  4430. return createBuffer(that, size)
  4431. }
  4432. if (fill !== undefined) {
  4433. // Only pay attention to encoding if it's a string. This
  4434. // prevents accidentally sending in a number that would
  4435. // be interpretted as a start offset.
  4436. return typeof encoding === 'string'
  4437. ? createBuffer(that, size).fill(fill, encoding)
  4438. : createBuffer(that, size).fill(fill)
  4439. }
  4440. return createBuffer(that, size)
  4441. }
  4442.  
  4443. /**
  4444. * Creates a new filled Buffer instance.
  4445. * alloc(size[, fill[, encoding]])
  4446. **/
  4447. Buffer.alloc = function (size, fill, encoding) {
  4448. return alloc(null, size, fill, encoding)
  4449. }
  4450.  
  4451. function allocUnsafe (that, size) {
  4452. assertSize(size)
  4453. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  4454. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  4455. for (var i = 0; i < size; ++i) {
  4456. that[i] = 0
  4457. }
  4458. }
  4459. return that
  4460. }
  4461.  
  4462. /**
  4463. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  4464. * */
  4465. Buffer.allocUnsafe = function (size) {
  4466. return allocUnsafe(null, size)
  4467. }
  4468. /**
  4469. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  4470. */
  4471. Buffer.allocUnsafeSlow = function (size) {
  4472. return allocUnsafe(null, size)
  4473. }
  4474.  
  4475. function fromString (that, string, encoding) {
  4476. if (typeof encoding !== 'string' || encoding === '') {
  4477. encoding = 'utf8'
  4478. }
  4479.  
  4480. if (!Buffer.isEncoding(encoding)) {
  4481. throw new TypeError('"encoding" must be a valid string encoding')
  4482. }
  4483.  
  4484. var length = byteLength(string, encoding) | 0
  4485. that = createBuffer(that, length)
  4486.  
  4487. var actual = that.write(string, encoding)
  4488.  
  4489. if (actual !== length) {
  4490. // Writing a hex string, for example, that contains invalid characters will
  4491. // cause everything after the first invalid character to be ignored. (e.g.
  4492. // 'abxxcd' will be treated as 'ab')
  4493. that = that.slice(0, actual)
  4494. }
  4495.  
  4496. return that
  4497. }
  4498.  
  4499. function fromArrayLike (that, array) {
  4500. var length = array.length < 0 ? 0 : checked(array.length) | 0
  4501. that = createBuffer(that, length)
  4502. for (var i = 0; i < length; i += 1) {
  4503. that[i] = array[i] & 255
  4504. }
  4505. return that
  4506. }
  4507.  
  4508. function fromArrayBuffer (that, array, byteOffset, length) {
  4509. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  4510.  
  4511. if (byteOffset < 0 || array.byteLength < byteOffset) {
  4512. throw new RangeError('\'offset\' is out of bounds')
  4513. }
  4514.  
  4515. if (array.byteLength < byteOffset + (length || 0)) {
  4516. throw new RangeError('\'length\' is out of bounds')
  4517. }
  4518.  
  4519. if (byteOffset === undefined && length === undefined) {
  4520. array = new Uint8Array(array)
  4521. } else if (length === undefined) {
  4522. array = new Uint8Array(array, byteOffset)
  4523. } else {
  4524. array = new Uint8Array(array, byteOffset, length)
  4525. }
  4526.  
  4527. if (Buffer.TYPED_ARRAY_SUPPORT) {
  4528. // Return an augmented `Uint8Array` instance, for best performance
  4529. that = array
  4530. that.__proto__ = Buffer.prototype
  4531. } else {
  4532. // Fallback: Return an object instance of the Buffer class
  4533. that = fromArrayLike(that, array)
  4534. }
  4535. return that
  4536. }
  4537.  
  4538. function fromObject (that, obj) {
  4539. if (Buffer.isBuffer(obj)) {
  4540. var len = checked(obj.length) | 0
  4541. that = createBuffer(that, len)
  4542.  
  4543. if (that.length === 0) {
  4544. return that
  4545. }
  4546.  
  4547. obj.copy(that, 0, 0, len)
  4548. return that
  4549. }
  4550.  
  4551. if (obj) {
  4552. if ((typeof ArrayBuffer !== 'undefined' &&
  4553. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  4554. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  4555. return createBuffer(that, 0)
  4556. }
  4557. return fromArrayLike(that, obj)
  4558. }
  4559.  
  4560. if (obj.type === 'Buffer' && isArray(obj.data)) {
  4561. return fromArrayLike(that, obj.data)
  4562. }
  4563. }
  4564.  
  4565. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  4566. }
  4567.  
  4568. function checked (length) {
  4569. // Note: cannot use `length < kMaxLength()` here because that fails when
  4570. // length is NaN (which is otherwise coerced to zero.)
  4571. if (length >= kMaxLength()) {
  4572. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  4573. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  4574. }
  4575. return length | 0
  4576. }
  4577.  
  4578. function SlowBuffer (length) {
  4579. if (+length != length) { // eslint-disable-line eqeqeq
  4580. length = 0
  4581. }
  4582. return Buffer.alloc(+length)
  4583. }
  4584.  
  4585. Buffer.isBuffer = function isBuffer (b) {
  4586. return !!(b != null && b._isBuffer)
  4587. }
  4588.  
  4589. Buffer.compare = function compare (a, b) {
  4590. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  4591. throw new TypeError('Arguments must be Buffers')
  4592. }
  4593.  
  4594. if (a === b) return 0
  4595.  
  4596. var x = a.length
  4597. var y = b.length
  4598.  
  4599. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  4600. if (a[i] !== b[i]) {
  4601. x = a[i]
  4602. y = b[i]
  4603. break
  4604. }
  4605. }
  4606.  
  4607. if (x < y) return -1
  4608. if (y < x) return 1
  4609. return 0
  4610. }
  4611.  
  4612. Buffer.isEncoding = function isEncoding (encoding) {
  4613. switch (String(encoding).toLowerCase()) {
  4614. case 'hex':
  4615. case 'utf8':
  4616. case 'utf-8':
  4617. case 'ascii':
  4618. case 'latin1':
  4619. case 'binary':
  4620. case 'base64':
  4621. case 'ucs2':
  4622. case 'ucs-2':
  4623. case 'utf16le':
  4624. case 'utf-16le':
  4625. return true
  4626. default:
  4627. return false
  4628. }
  4629. }
  4630.  
  4631. Buffer.concat = function concat (list, length) {
  4632. if (!isArray(list)) {
  4633. throw new TypeError('"list" argument must be an Array of Buffers')
  4634. }
  4635.  
  4636. if (list.length === 0) {
  4637. return Buffer.alloc(0)
  4638. }
  4639.  
  4640. var i
  4641. if (length === undefined) {
  4642. length = 0
  4643. for (i = 0; i < list.length; ++i) {
  4644. length += list[i].length
  4645. }
  4646. }
  4647.  
  4648. var buffer = Buffer.allocUnsafe(length)
  4649. var pos = 0
  4650. for (i = 0; i < list.length; ++i) {
  4651. var buf = list[i]
  4652. if (!Buffer.isBuffer(buf)) {
  4653. throw new TypeError('"list" argument must be an Array of Buffers')
  4654. }
  4655. buf.copy(buffer, pos)
  4656. pos += buf.length
  4657. }
  4658. return buffer
  4659. }
  4660.  
  4661. function byteLength (string, encoding) {
  4662. if (Buffer.isBuffer(string)) {
  4663. return string.length
  4664. }
  4665. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  4666. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  4667. return string.byteLength
  4668. }
  4669. if (typeof string !== 'string') {
  4670. string = '' + string
  4671. }
  4672.  
  4673. var len = string.length
  4674. if (len === 0) return 0
  4675.  
  4676. // Use a for loop to avoid recursion
  4677. var loweredCase = false
  4678. for (;;) {
  4679. switch (encoding) {
  4680. case 'ascii':
  4681. case 'latin1':
  4682. case 'binary':
  4683. return len
  4684. case 'utf8':
  4685. case 'utf-8':
  4686. case undefined:
  4687. return utf8ToBytes(string).length
  4688. case 'ucs2':
  4689. case 'ucs-2':
  4690. case 'utf16le':
  4691. case 'utf-16le':
  4692. return len * 2
  4693. case 'hex':
  4694. return len >>> 1
  4695. case 'base64':
  4696. return base64ToBytes(string).length
  4697. default:
  4698. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  4699. encoding = ('' + encoding).toLowerCase()
  4700. loweredCase = true
  4701. }
  4702. }
  4703. }
  4704. Buffer.byteLength = byteLength
  4705.  
  4706. function slowToString (encoding, start, end) {
  4707. var loweredCase = false
  4708.  
  4709. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  4710. // property of a typed array.
  4711.  
  4712. // This behaves neither like String nor Uint8Array in that we set start/end
  4713. // to their upper/lower bounds if the value passed is out of range.
  4714. // undefined is handled specially as per ECMA-262 6th Edition,
  4715. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  4716. if (start === undefined || start < 0) {
  4717. start = 0
  4718. }
  4719. // Return early if start > this.length. Done here to prevent potential uint32
  4720. // coercion fail below.
  4721. if (start > this.length) {
  4722. return ''
  4723. }
  4724.  
  4725. if (end === undefined || end > this.length) {
  4726. end = this.length
  4727. }
  4728.  
  4729. if (end <= 0) {
  4730. return ''
  4731. }
  4732.  
  4733. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  4734. end >>>= 0
  4735. start >>>= 0
  4736.  
  4737. if (end <= start) {
  4738. return ''
  4739. }
  4740.  
  4741. if (!encoding) encoding = 'utf8'
  4742.  
  4743. while (true) {
  4744. switch (encoding) {
  4745. case 'hex':
  4746. return hexSlice(this, start, end)
  4747.  
  4748. case 'utf8':
  4749. case 'utf-8':
  4750. return utf8Slice(this, start, end)
  4751.  
  4752. case 'ascii':
  4753. return asciiSlice(this, start, end)
  4754.  
  4755. case 'latin1':
  4756. case 'binary':
  4757. return latin1Slice(this, start, end)
  4758.  
  4759. case 'base64':
  4760. return base64Slice(this, start, end)
  4761.  
  4762. case 'ucs2':
  4763. case 'ucs-2':
  4764. case 'utf16le':
  4765. case 'utf-16le':
  4766. return utf16leSlice(this, start, end)
  4767.  
  4768. default:
  4769. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  4770. encoding = (encoding + '').toLowerCase()
  4771. loweredCase = true
  4772. }
  4773. }
  4774. }
  4775.  
  4776. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  4777. // Buffer instances.
  4778. Buffer.prototype._isBuffer = true
  4779.  
  4780. function swap (b, n, m) {
  4781. var i = b[n]
  4782. b[n] = b[m]
  4783. b[m] = i
  4784. }
  4785.  
  4786. Buffer.prototype.swap16 = function swap16 () {
  4787. var len = this.length
  4788. if (len % 2 !== 0) {
  4789. throw new RangeError('Buffer size must be a multiple of 16-bits')
  4790. }
  4791. for (var i = 0; i < len; i += 2) {
  4792. swap(this, i, i + 1)
  4793. }
  4794. return this
  4795. }
  4796.  
  4797. Buffer.prototype.swap32 = function swap32 () {
  4798. var len = this.length
  4799. if (len % 4 !== 0) {
  4800. throw new RangeError('Buffer size must be a multiple of 32-bits')
  4801. }
  4802. for (var i = 0; i < len; i += 4) {
  4803. swap(this, i, i + 3)
  4804. swap(this, i + 1, i + 2)
  4805. }
  4806. return this
  4807. }
  4808.  
  4809. Buffer.prototype.swap64 = function swap64 () {
  4810. var len = this.length
  4811. if (len % 8 !== 0) {
  4812. throw new RangeError('Buffer size must be a multiple of 64-bits')
  4813. }
  4814. for (var i = 0; i < len; i += 8) {
  4815. swap(this, i, i + 7)
  4816. swap(this, i + 1, i + 6)
  4817. swap(this, i + 2, i + 5)
  4818. swap(this, i + 3, i + 4)
  4819. }
  4820. return this
  4821. }
  4822.  
  4823. Buffer.prototype.toString = function toString () {
  4824. var length = this.length | 0
  4825. if (length === 0) return ''
  4826. if (arguments.length === 0) return utf8Slice(this, 0, length)
  4827. return slowToString.apply(this, arguments)
  4828. }
  4829.  
  4830. Buffer.prototype.equals = function equals (b) {
  4831. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  4832. if (this === b) return true
  4833. return Buffer.compare(this, b) === 0
  4834. }
  4835.  
  4836. Buffer.prototype.inspect = function inspect () {
  4837. var str = ''
  4838. var max = exports.INSPECT_MAX_BYTES
  4839. if (this.length > 0) {
  4840. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  4841. if (this.length > max) str += ' ... '
  4842. }
  4843. return '<Buffer ' + str + '>'
  4844. }
  4845.  
  4846. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  4847. if (!Buffer.isBuffer(target)) {
  4848. throw new TypeError('Argument must be a Buffer')
  4849. }
  4850.  
  4851. if (start === undefined) {
  4852. start = 0
  4853. }
  4854. if (end === undefined) {
  4855. end = target ? target.length : 0
  4856. }
  4857. if (thisStart === undefined) {
  4858. thisStart = 0
  4859. }
  4860. if (thisEnd === undefined) {
  4861. thisEnd = this.length
  4862. }
  4863.  
  4864. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  4865. throw new RangeError('out of range index')
  4866. }
  4867.  
  4868. if (thisStart >= thisEnd && start >= end) {
  4869. return 0
  4870. }
  4871. if (thisStart >= thisEnd) {
  4872. return -1
  4873. }
  4874. if (start >= end) {
  4875. return 1
  4876. }
  4877.  
  4878. start >>>= 0
  4879. end >>>= 0
  4880. thisStart >>>= 0
  4881. thisEnd >>>= 0
  4882.  
  4883. if (this === target) return 0
  4884.  
  4885. var x = thisEnd - thisStart
  4886. var y = end - start
  4887. var len = Math.min(x, y)
  4888.  
  4889. var thisCopy = this.slice(thisStart, thisEnd)
  4890. var targetCopy = target.slice(start, end)
  4891.  
  4892. for (var i = 0; i < len; ++i) {
  4893. if (thisCopy[i] !== targetCopy[i]) {
  4894. x = thisCopy[i]
  4895. y = targetCopy[i]
  4896. break
  4897. }
  4898. }
  4899.  
  4900. if (x < y) return -1
  4901. if (y < x) return 1
  4902. return 0
  4903. }
  4904.  
  4905. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  4906. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  4907. //
  4908. // Arguments:
  4909. // - buffer - a Buffer to search
  4910. // - val - a string, Buffer, or number
  4911. // - byteOffset - an index into `buffer`; will be clamped to an int32
  4912. // - encoding - an optional encoding, relevant is val is a string
  4913. // - dir - true for indexOf, false for lastIndexOf
  4914. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  4915. // Empty buffer means no match
  4916. if (buffer.length === 0) return -1
  4917.  
  4918. // Normalize byteOffset
  4919. if (typeof byteOffset === 'string') {
  4920. encoding = byteOffset
  4921. byteOffset = 0
  4922. } else if (byteOffset > 0x7fffffff) {
  4923. byteOffset = 0x7fffffff
  4924. } else if (byteOffset < -0x80000000) {
  4925. byteOffset = -0x80000000
  4926. }
  4927. byteOffset = +byteOffset // Coerce to Number.
  4928. if (isNaN(byteOffset)) {
  4929. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  4930. byteOffset = dir ? 0 : (buffer.length - 1)
  4931. }
  4932.  
  4933. // Normalize byteOffset: negative offsets start from the end of the buffer
  4934. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  4935. if (byteOffset >= buffer.length) {
  4936. if (dir) return -1
  4937. else byteOffset = buffer.length - 1
  4938. } else if (byteOffset < 0) {
  4939. if (dir) byteOffset = 0
  4940. else return -1
  4941. }
  4942.  
  4943. // Normalize val
  4944. if (typeof val === 'string') {
  4945. val = Buffer.from(val, encoding)
  4946. }
  4947.  
  4948. // Finally, search either indexOf (if dir is true) or lastIndexOf
  4949. if (Buffer.isBuffer(val)) {
  4950. // Special case: looking for empty string/buffer always fails
  4951. if (val.length === 0) {
  4952. return -1
  4953. }
  4954. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  4955. } else if (typeof val === 'number') {
  4956. val = val & 0xFF // Search for a byte value [0-255]
  4957. if (Buffer.TYPED_ARRAY_SUPPORT &&
  4958. typeof Uint8Array.prototype.indexOf === 'function') {
  4959. if (dir) {
  4960. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  4961. } else {
  4962. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  4963. }
  4964. }
  4965. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  4966. }
  4967.  
  4968. throw new TypeError('val must be string, number or Buffer')
  4969. }
  4970.  
  4971. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  4972. var indexSize = 1
  4973. var arrLength = arr.length
  4974. var valLength = val.length
  4975.  
  4976. if (encoding !== undefined) {
  4977. encoding = String(encoding).toLowerCase()
  4978. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  4979. encoding === 'utf16le' || encoding === 'utf-16le') {
  4980. if (arr.length < 2 || val.length < 2) {
  4981. return -1
  4982. }
  4983. indexSize = 2
  4984. arrLength /= 2
  4985. valLength /= 2
  4986. byteOffset /= 2
  4987. }
  4988. }
  4989.  
  4990. function read (buf, i) {
  4991. if (indexSize === 1) {
  4992. return buf[i]
  4993. } else {
  4994. return buf.readUInt16BE(i * indexSize)
  4995. }
  4996. }
  4997.  
  4998. var i
  4999. if (dir) {
  5000. var foundIndex = -1
  5001. for (i = byteOffset; i < arrLength; i++) {
  5002. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  5003. if (foundIndex === -1) foundIndex = i
  5004. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  5005. } else {
  5006. if (foundIndex !== -1) i -= i - foundIndex
  5007. foundIndex = -1
  5008. }
  5009. }
  5010. } else {
  5011. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  5012. for (i = byteOffset; i >= 0; i--) {
  5013. var found = true
  5014. for (var j = 0; j < valLength; j++) {
  5015. if (read(arr, i + j) !== read(val, j)) {
  5016. found = false
  5017. break
  5018. }
  5019. }
  5020. if (found) return i
  5021. }
  5022. }
  5023.  
  5024. return -1
  5025. }
  5026.  
  5027. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  5028. return this.indexOf(val, byteOffset, encoding) !== -1
  5029. }
  5030.  
  5031. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  5032. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  5033. }
  5034.  
  5035. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  5036. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  5037. }
  5038.  
  5039. function hexWrite (buf, string, offset, length) {
  5040. offset = Number(offset) || 0
  5041. var remaining = buf.length - offset
  5042. if (!length) {
  5043. length = remaining
  5044. } else {
  5045. length = Number(length)
  5046. if (length > remaining) {
  5047. length = remaining
  5048. }
  5049. }
  5050.  
  5051. // must be an even number of digits
  5052. var strLen = string.length
  5053. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  5054.  
  5055. if (length > strLen / 2) {
  5056. length = strLen / 2
  5057. }
  5058. for (var i = 0; i < length; ++i) {
  5059. var parsed = parseInt(string.substr(i * 2, 2), 16)
  5060. if (isNaN(parsed)) return i
  5061. buf[offset + i] = parsed
  5062. }
  5063. return i
  5064. }
  5065.  
  5066. function utf8Write (buf, string, offset, length) {
  5067. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  5068. }
  5069.  
  5070. function asciiWrite (buf, string, offset, length) {
  5071. return blitBuffer(asciiToBytes(string), buf, offset, length)
  5072. }
  5073.  
  5074. function latin1Write (buf, string, offset, length) {
  5075. return asciiWrite(buf, string, offset, length)
  5076. }
  5077.  
  5078. function base64Write (buf, string, offset, length) {
  5079. return blitBuffer(base64ToBytes(string), buf, offset, length)
  5080. }
  5081.  
  5082. function ucs2Write (buf, string, offset, length) {
  5083. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  5084. }
  5085.  
  5086. Buffer.prototype.write = function write (string, offset, length, encoding) {
  5087. // Buffer#write(string)
  5088. if (offset === undefined) {
  5089. encoding = 'utf8'
  5090. length = this.length
  5091. offset = 0
  5092. // Buffer#write(string, encoding)
  5093. } else if (length === undefined && typeof offset === 'string') {
  5094. encoding = offset
  5095. length = this.length
  5096. offset = 0
  5097. // Buffer#write(string, offset[, length][, encoding])
  5098. } else if (isFinite(offset)) {
  5099. offset = offset | 0
  5100. if (isFinite(length)) {
  5101. length = length | 0
  5102. if (encoding === undefined) encoding = 'utf8'
  5103. } else {
  5104. encoding = length
  5105. length = undefined
  5106. }
  5107. // legacy write(string, encoding, offset, length) - remove in v0.13
  5108. } else {
  5109. throw new Error(
  5110. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  5111. )
  5112. }
  5113.  
  5114. var remaining = this.length - offset
  5115. if (length === undefined || length > remaining) length = remaining
  5116.  
  5117. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  5118. throw new RangeError('Attempt to write outside buffer bounds')
  5119. }
  5120.  
  5121. if (!encoding) encoding = 'utf8'
  5122.  
  5123. var loweredCase = false
  5124. for (;;) {
  5125. switch (encoding) {
  5126. case 'hex':
  5127. return hexWrite(this, string, offset, length)
  5128.  
  5129. case 'utf8':
  5130. case 'utf-8':
  5131. return utf8Write(this, string, offset, length)
  5132.  
  5133. case 'ascii':
  5134. return asciiWrite(this, string, offset, length)
  5135.  
  5136. case 'latin1':
  5137. case 'binary':
  5138. return latin1Write(this, string, offset, length)
  5139.  
  5140. case 'base64':
  5141. // Warning: maxLength not taken into account in base64Write
  5142. return base64Write(this, string, offset, length)
  5143.  
  5144. case 'ucs2':
  5145. case 'ucs-2':
  5146. case 'utf16le':
  5147. case 'utf-16le':
  5148. return ucs2Write(this, string, offset, length)
  5149.  
  5150. default:
  5151. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  5152. encoding = ('' + encoding).toLowerCase()
  5153. loweredCase = true
  5154. }
  5155. }
  5156. }
  5157.  
  5158. Buffer.prototype.toJSON = function toJSON () {
  5159. return {
  5160. type: 'Buffer',
  5161. data: Array.prototype.slice.call(this._arr || this, 0)
  5162. }
  5163. }
  5164.  
  5165. function base64Slice (buf, start, end) {
  5166. if (start === 0 && end === buf.length) {
  5167. return base64.fromByteArray(buf)
  5168. } else {
  5169. return base64.fromByteArray(buf.slice(start, end))
  5170. }
  5171. }
  5172.  
  5173. function utf8Slice (buf, start, end) {
  5174. end = Math.min(buf.length, end)
  5175. var res = []
  5176.  
  5177. var i = start
  5178. while (i < end) {
  5179. var firstByte = buf[i]
  5180. var codePoint = null
  5181. var bytesPerSequence = (firstByte > 0xEF) ? 4
  5182. : (firstByte > 0xDF) ? 3
  5183. : (firstByte > 0xBF) ? 2
  5184. : 1
  5185.  
  5186. if (i + bytesPerSequence <= end) {
  5187. var secondByte, thirdByte, fourthByte, tempCodePoint
  5188.  
  5189. switch (bytesPerSequence) {
  5190. case 1:
  5191. if (firstByte < 0x80) {
  5192. codePoint = firstByte
  5193. }
  5194. break
  5195. case 2:
  5196. secondByte = buf[i + 1]
  5197. if ((secondByte & 0xC0) === 0x80) {
  5198. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  5199. if (tempCodePoint > 0x7F) {
  5200. codePoint = tempCodePoint
  5201. }
  5202. }
  5203. break
  5204. case 3:
  5205. secondByte = buf[i + 1]
  5206. thirdByte = buf[i + 2]
  5207. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  5208. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  5209. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  5210. codePoint = tempCodePoint
  5211. }
  5212. }
  5213. break
  5214. case 4:
  5215. secondByte = buf[i + 1]
  5216. thirdByte = buf[i + 2]
  5217. fourthByte = buf[i + 3]
  5218. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  5219. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  5220. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  5221. codePoint = tempCodePoint
  5222. }
  5223. }
  5224. }
  5225. }
  5226.  
  5227. if (codePoint === null) {
  5228. // we did not generate a valid codePoint so insert a
  5229. // replacement char (U+FFFD) and advance only 1 byte
  5230. codePoint = 0xFFFD
  5231. bytesPerSequence = 1
  5232. } else if (codePoint > 0xFFFF) {
  5233. // encode to utf16 (surrogate pair dance)
  5234. codePoint -= 0x10000
  5235. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  5236. codePoint = 0xDC00 | codePoint & 0x3FF
  5237. }
  5238.  
  5239. res.push(codePoint)
  5240. i += bytesPerSequence
  5241. }
  5242.  
  5243. return decodeCodePointsArray(res)
  5244. }
  5245.  
  5246. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  5247. // the lowest limit is Chrome, with 0x10000 args.
  5248. // We go 1 magnitude less, for safety
  5249. var MAX_ARGUMENTS_LENGTH = 0x1000
  5250.  
  5251. function decodeCodePointsArray (codePoints) {
  5252. var len = codePoints.length
  5253. if (len <= MAX_ARGUMENTS_LENGTH) {
  5254. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  5255. }
  5256.  
  5257. // Decode in chunks to avoid "call stack size exceeded".
  5258. var res = ''
  5259. var i = 0
  5260. while (i < len) {
  5261. res += String.fromCharCode.apply(
  5262. String,
  5263. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  5264. )
  5265. }
  5266. return res
  5267. }
  5268.  
  5269. function asciiSlice (buf, start, end) {
  5270. var ret = ''
  5271. end = Math.min(buf.length, end)
  5272.  
  5273. for (var i = start; i < end; ++i) {
  5274. ret += String.fromCharCode(buf[i] & 0x7F)
  5275. }
  5276. return ret
  5277. }
  5278.  
  5279. function latin1Slice (buf, start, end) {
  5280. var ret = ''
  5281. end = Math.min(buf.length, end)
  5282.  
  5283. for (var i = start; i < end; ++i) {
  5284. ret += String.fromCharCode(buf[i])
  5285. }
  5286. return ret
  5287. }
  5288.  
  5289. function hexSlice (buf, start, end) {
  5290. var len = buf.length
  5291.  
  5292. if (!start || start < 0) start = 0
  5293. if (!end || end < 0 || end > len) end = len
  5294.  
  5295. var out = ''
  5296. for (var i = start; i < end; ++i) {
  5297. out += toHex(buf[i])
  5298. }
  5299. return out
  5300. }
  5301.  
  5302. function utf16leSlice (buf, start, end) {
  5303. var bytes = buf.slice(start, end)
  5304. var res = ''
  5305. for (var i = 0; i < bytes.length; i += 2) {
  5306. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  5307. }
  5308. return res
  5309. }
  5310.  
  5311. Buffer.prototype.slice = function slice (start, end) {
  5312. var len = this.length
  5313. start = ~~start
  5314. end = end === undefined ? len : ~~end
  5315.  
  5316. if (start < 0) {
  5317. start += len
  5318. if (start < 0) start = 0
  5319. } else if (start > len) {
  5320. start = len
  5321. }
  5322.  
  5323. if (end < 0) {
  5324. end += len
  5325. if (end < 0) end = 0
  5326. } else if (end > len) {
  5327. end = len
  5328. }
  5329.  
  5330. if (end < start) end = start
  5331.  
  5332. var newBuf
  5333. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5334. newBuf = this.subarray(start, end)
  5335. newBuf.__proto__ = Buffer.prototype
  5336. } else {
  5337. var sliceLen = end - start
  5338. newBuf = new Buffer(sliceLen, undefined)
  5339. for (var i = 0; i < sliceLen; ++i) {
  5340. newBuf[i] = this[i + start]
  5341. }
  5342. }
  5343.  
  5344. return newBuf
  5345. }
  5346.  
  5347. /*
  5348. * Need to make sure that buffer isn't trying to write out of bounds.
  5349. */
  5350. function checkOffset (offset, ext, length) {
  5351. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  5352. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  5353. }
  5354.  
  5355. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  5356. offset = offset | 0
  5357. byteLength = byteLength | 0
  5358. if (!noAssert) checkOffset(offset, byteLength, this.length)
  5359.  
  5360. var val = this[offset]
  5361. var mul = 1
  5362. var i = 0
  5363. while (++i < byteLength && (mul *= 0x100)) {
  5364. val += this[offset + i] * mul
  5365. }
  5366.  
  5367. return val
  5368. }
  5369.  
  5370. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  5371. offset = offset | 0
  5372. byteLength = byteLength | 0
  5373. if (!noAssert) {
  5374. checkOffset(offset, byteLength, this.length)
  5375. }
  5376.  
  5377. var val = this[offset + --byteLength]
  5378. var mul = 1
  5379. while (byteLength > 0 && (mul *= 0x100)) {
  5380. val += this[offset + --byteLength] * mul
  5381. }
  5382.  
  5383. return val
  5384. }
  5385.  
  5386. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  5387. if (!noAssert) checkOffset(offset, 1, this.length)
  5388. return this[offset]
  5389. }
  5390.  
  5391. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  5392. if (!noAssert) checkOffset(offset, 2, this.length)
  5393. return this[offset] | (this[offset + 1] << 8)
  5394. }
  5395.  
  5396. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  5397. if (!noAssert) checkOffset(offset, 2, this.length)
  5398. return (this[offset] << 8) | this[offset + 1]
  5399. }
  5400.  
  5401. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  5402. if (!noAssert) checkOffset(offset, 4, this.length)
  5403.  
  5404. return ((this[offset]) |
  5405. (this[offset + 1] << 8) |
  5406. (this[offset + 2] << 16)) +
  5407. (this[offset + 3] * 0x1000000)
  5408. }
  5409.  
  5410. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  5411. if (!noAssert) checkOffset(offset, 4, this.length)
  5412.  
  5413. return (this[offset] * 0x1000000) +
  5414. ((this[offset + 1] << 16) |
  5415. (this[offset + 2] << 8) |
  5416. this[offset + 3])
  5417. }
  5418.  
  5419. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  5420. offset = offset | 0
  5421. byteLength = byteLength | 0
  5422. if (!noAssert) checkOffset(offset, byteLength, this.length)
  5423.  
  5424. var val = this[offset]
  5425. var mul = 1
  5426. var i = 0
  5427. while (++i < byteLength && (mul *= 0x100)) {
  5428. val += this[offset + i] * mul
  5429. }
  5430. mul *= 0x80
  5431.  
  5432. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  5433.  
  5434. return val
  5435. }
  5436.  
  5437. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  5438. offset = offset | 0
  5439. byteLength = byteLength | 0
  5440. if (!noAssert) checkOffset(offset, byteLength, this.length)
  5441.  
  5442. var i = byteLength
  5443. var mul = 1
  5444. var val = this[offset + --i]
  5445. while (i > 0 && (mul *= 0x100)) {
  5446. val += this[offset + --i] * mul
  5447. }
  5448. mul *= 0x80
  5449.  
  5450. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  5451.  
  5452. return val
  5453. }
  5454.  
  5455. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  5456. if (!noAssert) checkOffset(offset, 1, this.length)
  5457. if (!(this[offset] & 0x80)) return (this[offset])
  5458. return ((0xff - this[offset] + 1) * -1)
  5459. }
  5460.  
  5461. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  5462. if (!noAssert) checkOffset(offset, 2, this.length)
  5463. var val = this[offset] | (this[offset + 1] << 8)
  5464. return (val & 0x8000) ? val | 0xFFFF0000 : val
  5465. }
  5466.  
  5467. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  5468. if (!noAssert) checkOffset(offset, 2, this.length)
  5469. var val = this[offset + 1] | (this[offset] << 8)
  5470. return (val & 0x8000) ? val | 0xFFFF0000 : val
  5471. }
  5472.  
  5473. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  5474. if (!noAssert) checkOffset(offset, 4, this.length)
  5475.  
  5476. return (this[offset]) |
  5477. (this[offset + 1] << 8) |
  5478. (this[offset + 2] << 16) |
  5479. (this[offset + 3] << 24)
  5480. }
  5481.  
  5482. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  5483. if (!noAssert) checkOffset(offset, 4, this.length)
  5484.  
  5485. return (this[offset] << 24) |
  5486. (this[offset + 1] << 16) |
  5487. (this[offset + 2] << 8) |
  5488. (this[offset + 3])
  5489. }
  5490.  
  5491. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  5492. if (!noAssert) checkOffset(offset, 4, this.length)
  5493. return ieee754.read(this, offset, true, 23, 4)
  5494. }
  5495.  
  5496. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  5497. if (!noAssert) checkOffset(offset, 4, this.length)
  5498. return ieee754.read(this, offset, false, 23, 4)
  5499. }
  5500.  
  5501. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  5502. if (!noAssert) checkOffset(offset, 8, this.length)
  5503. return ieee754.read(this, offset, true, 52, 8)
  5504. }
  5505.  
  5506. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  5507. if (!noAssert) checkOffset(offset, 8, this.length)
  5508. return ieee754.read(this, offset, false, 52, 8)
  5509. }
  5510.  
  5511. function checkInt (buf, value, offset, ext, max, min) {
  5512. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  5513. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  5514. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  5515. }
  5516.  
  5517. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  5518. value = +value
  5519. offset = offset | 0
  5520. byteLength = byteLength | 0
  5521. if (!noAssert) {
  5522. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  5523. checkInt(this, value, offset, byteLength, maxBytes, 0)
  5524. }
  5525.  
  5526. var mul = 1
  5527. var i = 0
  5528. this[offset] = value & 0xFF
  5529. while (++i < byteLength && (mul *= 0x100)) {
  5530. this[offset + i] = (value / mul) & 0xFF
  5531. }
  5532.  
  5533. return offset + byteLength
  5534. }
  5535.  
  5536. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  5537. value = +value
  5538. offset = offset | 0
  5539. byteLength = byteLength | 0
  5540. if (!noAssert) {
  5541. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  5542. checkInt(this, value, offset, byteLength, maxBytes, 0)
  5543. }
  5544.  
  5545. var i = byteLength - 1
  5546. var mul = 1
  5547. this[offset + i] = value & 0xFF
  5548. while (--i >= 0 && (mul *= 0x100)) {
  5549. this[offset + i] = (value / mul) & 0xFF
  5550. }
  5551.  
  5552. return offset + byteLength
  5553. }
  5554.  
  5555. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  5556. value = +value
  5557. offset = offset | 0
  5558. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  5559. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  5560. this[offset] = (value & 0xff)
  5561. return offset + 1
  5562. }
  5563.  
  5564. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  5565. if (value < 0) value = 0xffff + value + 1
  5566. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  5567. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  5568. (littleEndian ? i : 1 - i) * 8
  5569. }
  5570. }
  5571.  
  5572. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  5573. value = +value
  5574. offset = offset | 0
  5575. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  5576. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5577. this[offset] = (value & 0xff)
  5578. this[offset + 1] = (value >>> 8)
  5579. } else {
  5580. objectWriteUInt16(this, value, offset, true)
  5581. }
  5582. return offset + 2
  5583. }
  5584.  
  5585. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  5586. value = +value
  5587. offset = offset | 0
  5588. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  5589. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5590. this[offset] = (value >>> 8)
  5591. this[offset + 1] = (value & 0xff)
  5592. } else {
  5593. objectWriteUInt16(this, value, offset, false)
  5594. }
  5595. return offset + 2
  5596. }
  5597.  
  5598. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  5599. if (value < 0) value = 0xffffffff + value + 1
  5600. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  5601. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  5602. }
  5603. }
  5604.  
  5605. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  5606. value = +value
  5607. offset = offset | 0
  5608. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  5609. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5610. this[offset + 3] = (value >>> 24)
  5611. this[offset + 2] = (value >>> 16)
  5612. this[offset + 1] = (value >>> 8)
  5613. this[offset] = (value & 0xff)
  5614. } else {
  5615. objectWriteUInt32(this, value, offset, true)
  5616. }
  5617. return offset + 4
  5618. }
  5619.  
  5620. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  5621. value = +value
  5622. offset = offset | 0
  5623. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  5624. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5625. this[offset] = (value >>> 24)
  5626. this[offset + 1] = (value >>> 16)
  5627. this[offset + 2] = (value >>> 8)
  5628. this[offset + 3] = (value & 0xff)
  5629. } else {
  5630. objectWriteUInt32(this, value, offset, false)
  5631. }
  5632. return offset + 4
  5633. }
  5634.  
  5635. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  5636. value = +value
  5637. offset = offset | 0
  5638. if (!noAssert) {
  5639. var limit = Math.pow(2, 8 * byteLength - 1)
  5640.  
  5641. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  5642. }
  5643.  
  5644. var i = 0
  5645. var mul = 1
  5646. var sub = 0
  5647. this[offset] = value & 0xFF
  5648. while (++i < byteLength && (mul *= 0x100)) {
  5649. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  5650. sub = 1
  5651. }
  5652. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  5653. }
  5654.  
  5655. return offset + byteLength
  5656. }
  5657.  
  5658. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  5659. value = +value
  5660. offset = offset | 0
  5661. if (!noAssert) {
  5662. var limit = Math.pow(2, 8 * byteLength - 1)
  5663.  
  5664. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  5665. }
  5666.  
  5667. var i = byteLength - 1
  5668. var mul = 1
  5669. var sub = 0
  5670. this[offset + i] = value & 0xFF
  5671. while (--i >= 0 && (mul *= 0x100)) {
  5672. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  5673. sub = 1
  5674. }
  5675. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  5676. }
  5677.  
  5678. return offset + byteLength
  5679. }
  5680.  
  5681. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  5682. value = +value
  5683. offset = offset | 0
  5684. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  5685. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  5686. if (value < 0) value = 0xff + value + 1
  5687. this[offset] = (value & 0xff)
  5688. return offset + 1
  5689. }
  5690.  
  5691. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  5692. value = +value
  5693. offset = offset | 0
  5694. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  5695. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5696. this[offset] = (value & 0xff)
  5697. this[offset + 1] = (value >>> 8)
  5698. } else {
  5699. objectWriteUInt16(this, value, offset, true)
  5700. }
  5701. return offset + 2
  5702. }
  5703.  
  5704. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  5705. value = +value
  5706. offset = offset | 0
  5707. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  5708. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5709. this[offset] = (value >>> 8)
  5710. this[offset + 1] = (value & 0xff)
  5711. } else {
  5712. objectWriteUInt16(this, value, offset, false)
  5713. }
  5714. return offset + 2
  5715. }
  5716.  
  5717. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  5718. value = +value
  5719. offset = offset | 0
  5720. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  5721. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5722. this[offset] = (value & 0xff)
  5723. this[offset + 1] = (value >>> 8)
  5724. this[offset + 2] = (value >>> 16)
  5725. this[offset + 3] = (value >>> 24)
  5726. } else {
  5727. objectWriteUInt32(this, value, offset, true)
  5728. }
  5729. return offset + 4
  5730. }
  5731.  
  5732. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  5733. value = +value
  5734. offset = offset | 0
  5735. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  5736. if (value < 0) value = 0xffffffff + value + 1
  5737. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5738. this[offset] = (value >>> 24)
  5739. this[offset + 1] = (value >>> 16)
  5740. this[offset + 2] = (value >>> 8)
  5741. this[offset + 3] = (value & 0xff)
  5742. } else {
  5743. objectWriteUInt32(this, value, offset, false)
  5744. }
  5745. return offset + 4
  5746. }
  5747.  
  5748. function checkIEEE754 (buf, value, offset, ext, max, min) {
  5749. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  5750. if (offset < 0) throw new RangeError('Index out of range')
  5751. }
  5752.  
  5753. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  5754. if (!noAssert) {
  5755. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  5756. }
  5757. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  5758. return offset + 4
  5759. }
  5760.  
  5761. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  5762. return writeFloat(this, value, offset, true, noAssert)
  5763. }
  5764.  
  5765. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  5766. return writeFloat(this, value, offset, false, noAssert)
  5767. }
  5768.  
  5769. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  5770. if (!noAssert) {
  5771. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  5772. }
  5773. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  5774. return offset + 8
  5775. }
  5776.  
  5777. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  5778. return writeDouble(this, value, offset, true, noAssert)
  5779. }
  5780.  
  5781. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  5782. return writeDouble(this, value, offset, false, noAssert)
  5783. }
  5784.  
  5785. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  5786. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  5787. if (!start) start = 0
  5788. if (!end && end !== 0) end = this.length
  5789. if (targetStart >= target.length) targetStart = target.length
  5790. if (!targetStart) targetStart = 0
  5791. if (end > 0 && end < start) end = start
  5792.  
  5793. // Copy 0 bytes; we're done
  5794. if (end === start) return 0
  5795. if (target.length === 0 || this.length === 0) return 0
  5796.  
  5797. // Fatal error conditions
  5798. if (targetStart < 0) {
  5799. throw new RangeError('targetStart out of bounds')
  5800. }
  5801. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  5802. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  5803.  
  5804. // Are we oob?
  5805. if (end > this.length) end = this.length
  5806. if (target.length - targetStart < end - start) {
  5807. end = target.length - targetStart + start
  5808. }
  5809.  
  5810. var len = end - start
  5811. var i
  5812.  
  5813. if (this === target && start < targetStart && targetStart < end) {
  5814. // descending copy from end
  5815. for (i = len - 1; i >= 0; --i) {
  5816. target[i + targetStart] = this[i + start]
  5817. }
  5818. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  5819. // ascending copy from start
  5820. for (i = 0; i < len; ++i) {
  5821. target[i + targetStart] = this[i + start]
  5822. }
  5823. } else {
  5824. Uint8Array.prototype.set.call(
  5825. target,
  5826. this.subarray(start, start + len),
  5827. targetStart
  5828. )
  5829. }
  5830.  
  5831. return len
  5832. }
  5833.  
  5834. // Usage:
  5835. // buffer.fill(number[, offset[, end]])
  5836. // buffer.fill(buffer[, offset[, end]])
  5837. // buffer.fill(string[, offset[, end]][, encoding])
  5838. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  5839. // Handle string cases:
  5840. if (typeof val === 'string') {
  5841. if (typeof start === 'string') {
  5842. encoding = start
  5843. start = 0
  5844. end = this.length
  5845. } else if (typeof end === 'string') {
  5846. encoding = end
  5847. end = this.length
  5848. }
  5849. if (val.length === 1) {
  5850. var code = val.charCodeAt(0)
  5851. if (code < 256) {
  5852. val = code
  5853. }
  5854. }
  5855. if (encoding !== undefined && typeof encoding !== 'string') {
  5856. throw new TypeError('encoding must be a string')
  5857. }
  5858. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  5859. throw new TypeError('Unknown encoding: ' + encoding)
  5860. }
  5861. } else if (typeof val === 'number') {
  5862. val = val & 255
  5863. }
  5864.  
  5865. // Invalid ranges are not set to a default, so can range check early.
  5866. if (start < 0 || this.length < start || this.length < end) {
  5867. throw new RangeError('Out of range index')
  5868. }
  5869.  
  5870. if (end <= start) {
  5871. return this
  5872. }
  5873.  
  5874. start = start >>> 0
  5875. end = end === undefined ? this.length : end >>> 0
  5876.  
  5877. if (!val) val = 0
  5878.  
  5879. var i
  5880. if (typeof val === 'number') {
  5881. for (i = start; i < end; ++i) {
  5882. this[i] = val
  5883. }
  5884. } else {
  5885. var bytes = Buffer.isBuffer(val)
  5886. ? val
  5887. : utf8ToBytes(new Buffer(val, encoding).toString())
  5888. var len = bytes.length
  5889. for (i = 0; i < end - start; ++i) {
  5890. this[i + start] = bytes[i % len]
  5891. }
  5892. }
  5893.  
  5894. return this
  5895. }
  5896.  
  5897. // HELPER FUNCTIONS
  5898. // ================
  5899.  
  5900. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  5901.  
  5902. function base64clean (str) {
  5903. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  5904. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  5905. // Node converts strings with length < 2 to ''
  5906. if (str.length < 2) return ''
  5907. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  5908. while (str.length % 4 !== 0) {
  5909. str = str + '='
  5910. }
  5911. return str
  5912. }
  5913.  
  5914. function stringtrim (str) {
  5915. if (str.trim) return str.trim()
  5916. return str.replace(/^\s+|\s+$/g, '')
  5917. }
  5918.  
  5919. function toHex (n) {
  5920. if (n < 16) return '0' + n.toString(16)
  5921. return n.toString(16)
  5922. }
  5923.  
  5924. function utf8ToBytes (string, units) {
  5925. units = units || Infinity
  5926. var codePoint
  5927. var length = string.length
  5928. var leadSurrogate = null
  5929. var bytes = []
  5930.  
  5931. for (var i = 0; i < length; ++i) {
  5932. codePoint = string.charCodeAt(i)
  5933.  
  5934. // is surrogate component
  5935. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  5936. // last char was a lead
  5937. if (!leadSurrogate) {
  5938. // no lead yet
  5939. if (codePoint > 0xDBFF) {
  5940. // unexpected trail
  5941. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  5942. continue
  5943. } else if (i + 1 === length) {
  5944. // unpaired lead
  5945. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  5946. continue
  5947. }
  5948.  
  5949. // valid lead
  5950. leadSurrogate = codePoint
  5951.  
  5952. continue
  5953. }
  5954.  
  5955. // 2 leads in a row
  5956. if (codePoint < 0xDC00) {
  5957. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  5958. leadSurrogate = codePoint
  5959. continue
  5960. }
  5961.  
  5962. // valid surrogate pair
  5963. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  5964. } else if (leadSurrogate) {
  5965. // valid bmp char, but last char was a lead
  5966. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  5967. }
  5968.  
  5969. leadSurrogate = null
  5970.  
  5971. // encode utf8
  5972. if (codePoint < 0x80) {
  5973. if ((units -= 1) < 0) break
  5974. bytes.push(codePoint)
  5975. } else if (codePoint < 0x800) {
  5976. if ((units -= 2) < 0) break
  5977. bytes.push(
  5978. codePoint >> 0x6 | 0xC0,
  5979. codePoint & 0x3F | 0x80
  5980. )
  5981. } else if (codePoint < 0x10000) {
  5982. if ((units -= 3) < 0) break
  5983. bytes.push(
  5984. codePoint >> 0xC | 0xE0,
  5985. codePoint >> 0x6 & 0x3F | 0x80,
  5986. codePoint & 0x3F | 0x80
  5987. )
  5988. } else if (codePoint < 0x110000) {
  5989. if ((units -= 4) < 0) break
  5990. bytes.push(
  5991. codePoint >> 0x12 | 0xF0,
  5992. codePoint >> 0xC & 0x3F | 0x80,
  5993. codePoint >> 0x6 & 0x3F | 0x80,
  5994. codePoint & 0x3F | 0x80
  5995. )
  5996. } else {
  5997. throw new Error('Invalid code point')
  5998. }
  5999. }
  6000.  
  6001. return bytes
  6002. }
  6003.  
  6004. function asciiToBytes (str) {
  6005. var byteArray = []
  6006. for (var i = 0; i < str.length; ++i) {
  6007. // Node's code seems to be doing this and not & 0x7F..
  6008. byteArray.push(str.charCodeAt(i) & 0xFF)
  6009. }
  6010. return byteArray
  6011. }
  6012.  
  6013. function utf16leToBytes (str, units) {
  6014. var c, hi, lo
  6015. var byteArray = []
  6016. for (var i = 0; i < str.length; ++i) {
  6017. if ((units -= 2) < 0) break
  6018.  
  6019. c = str.charCodeAt(i)
  6020. hi = c >> 8
  6021. lo = c % 256
  6022. byteArray.push(lo)
  6023. byteArray.push(hi)
  6024. }
  6025.  
  6026. return byteArray
  6027. }
  6028.  
  6029. function base64ToBytes (str) {
  6030. return base64.toByteArray(base64clean(str))
  6031. }
  6032.  
  6033. function blitBuffer (src, dst, offset, length) {
  6034. for (var i = 0; i < length; ++i) {
  6035. if ((i + offset >= dst.length) || (i >= src.length)) break
  6036. dst[i + offset] = src[i]
  6037. }
  6038. return i
  6039. }
  6040.  
  6041. function isnan (val) {
  6042. return val !== val // eslint-disable-line no-self-compare
  6043. }
  6044.  
  6045. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(52)))
  6046.  
  6047. /***/ }),
  6048. /* 52 */
  6049. /***/ (function(module, exports) {
  6050.  
  6051. var g;
  6052.  
  6053. // This works in non-strict mode
  6054. g = (function() {
  6055. return this;
  6056. })();
  6057.  
  6058. try {
  6059. // This works if eval is allowed (see CSP)
  6060. g = g || new Function("return this")();
  6061. } catch (e) {
  6062. // This works if the window reference is available
  6063. if (typeof window === "object") g = window;
  6064. }
  6065.  
  6066. // g can still be undefined, but nothing to do about it...
  6067. // We return undefined, instead of nothing here, so it's
  6068. // easier to handle this case. if(!global) { ...}
  6069.  
  6070. module.exports = g;
  6071.  
  6072.  
  6073. /***/ }),
  6074. /* 53 */
  6075. /***/ (function(module, exports, __webpack_require__) {
  6076.  
  6077. "use strict";
  6078.  
  6079.  
  6080. exports.byteLength = byteLength
  6081. exports.toByteArray = toByteArray
  6082. exports.fromByteArray = fromByteArray
  6083.  
  6084. var lookup = []
  6085. var revLookup = []
  6086. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  6087.  
  6088. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  6089. for (var i = 0, len = code.length; i < len; ++i) {
  6090. lookup[i] = code[i]
  6091. revLookup[code.charCodeAt(i)] = i
  6092. }
  6093.  
  6094. // Support decoding URL-safe base64 strings, as Node.js does.
  6095. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  6096. revLookup['-'.charCodeAt(0)] = 62
  6097. revLookup['_'.charCodeAt(0)] = 63
  6098.  
  6099. function getLens (b64) {
  6100. var len = b64.length
  6101.  
  6102. if (len % 4 > 0) {
  6103. throw new Error('Invalid string. Length must be a multiple of 4')
  6104. }
  6105.  
  6106. // Trim off extra bytes after placeholder bytes are found
  6107. // See: https://github.com/beatgammit/base64-js/issues/42
  6108. var validLen = b64.indexOf('=')
  6109. if (validLen === -1) validLen = len
  6110.  
  6111. var placeHoldersLen = validLen === len
  6112. ? 0
  6113. : 4 - (validLen % 4)
  6114.  
  6115. return [validLen, placeHoldersLen]
  6116. }
  6117.  
  6118. // base64 is 4/3 + up to two characters of the original data
  6119. function byteLength (b64) {
  6120. var lens = getLens(b64)
  6121. var validLen = lens[0]
  6122. var placeHoldersLen = lens[1]
  6123. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  6124. }
  6125.  
  6126. function _byteLength (b64, validLen, placeHoldersLen) {
  6127. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  6128. }
  6129.  
  6130. function toByteArray (b64) {
  6131. var tmp
  6132. var lens = getLens(b64)
  6133. var validLen = lens[0]
  6134. var placeHoldersLen = lens[1]
  6135.  
  6136. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  6137.  
  6138. var curByte = 0
  6139.  
  6140. // if there are placeholders, only get up to the last complete 4 chars
  6141. var len = placeHoldersLen > 0
  6142. ? validLen - 4
  6143. : validLen
  6144.  
  6145. var i
  6146. for (i = 0; i < len; i += 4) {
  6147. tmp =
  6148. (revLookup[b64.charCodeAt(i)] << 18) |
  6149. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  6150. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  6151. revLookup[b64.charCodeAt(i + 3)]
  6152. arr[curByte++] = (tmp >> 16) & 0xFF
  6153. arr[curByte++] = (tmp >> 8) & 0xFF
  6154. arr[curByte++] = tmp & 0xFF
  6155. }
  6156.  
  6157. if (placeHoldersLen === 2) {
  6158. tmp =
  6159. (revLookup[b64.charCodeAt(i)] << 2) |
  6160. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  6161. arr[curByte++] = tmp & 0xFF
  6162. }
  6163.  
  6164. if (placeHoldersLen === 1) {
  6165. tmp =
  6166. (revLookup[b64.charCodeAt(i)] << 10) |
  6167. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  6168. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  6169. arr[curByte++] = (tmp >> 8) & 0xFF
  6170. arr[curByte++] = tmp & 0xFF
  6171. }
  6172.  
  6173. return arr
  6174. }
  6175.  
  6176. function tripletToBase64 (num) {
  6177. return lookup[num >> 18 & 0x3F] +
  6178. lookup[num >> 12 & 0x3F] +
  6179. lookup[num >> 6 & 0x3F] +
  6180. lookup[num & 0x3F]
  6181. }
  6182.  
  6183. function encodeChunk (uint8, start, end) {
  6184. var tmp
  6185. var output = []
  6186. for (var i = start; i < end; i += 3) {
  6187. tmp =
  6188. ((uint8[i] << 16) & 0xFF0000) +
  6189. ((uint8[i + 1] << 8) & 0xFF00) +
  6190. (uint8[i + 2] & 0xFF)
  6191. output.push(tripletToBase64(tmp))
  6192. }
  6193. return output.join('')
  6194. }
  6195.  
  6196. function fromByteArray (uint8) {
  6197. var tmp
  6198. var len = uint8.length
  6199. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  6200. var parts = []
  6201. var maxChunkLength = 16383 // must be multiple of 3
  6202.  
  6203. // go through the array every three bytes, we'll deal with trailing stuff later
  6204. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  6205. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  6206. }
  6207.  
  6208. // pad the end with zeros, but make sure to not forget the extra bytes
  6209. if (extraBytes === 1) {
  6210. tmp = uint8[len - 1]
  6211. parts.push(
  6212. lookup[tmp >> 2] +
  6213. lookup[(tmp << 4) & 0x3F] +
  6214. '=='
  6215. )
  6216. } else if (extraBytes === 2) {
  6217. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  6218. parts.push(
  6219. lookup[tmp >> 10] +
  6220. lookup[(tmp >> 4) & 0x3F] +
  6221. lookup[(tmp << 2) & 0x3F] +
  6222. '='
  6223. )
  6224. }
  6225.  
  6226. return parts.join('')
  6227. }
  6228.  
  6229.  
  6230. /***/ }),
  6231. /* 54 */
  6232. /***/ (function(module, exports) {
  6233.  
  6234. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  6235. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  6236. var e, m
  6237. var eLen = (nBytes * 8) - mLen - 1
  6238. var eMax = (1 << eLen) - 1
  6239. var eBias = eMax >> 1
  6240. var nBits = -7
  6241. var i = isLE ? (nBytes - 1) : 0
  6242. var d = isLE ? -1 : 1
  6243. var s = buffer[offset + i]
  6244.  
  6245. i += d
  6246.  
  6247. e = s & ((1 << (-nBits)) - 1)
  6248. s >>= (-nBits)
  6249. nBits += eLen
  6250. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  6251.  
  6252. m = e & ((1 << (-nBits)) - 1)
  6253. e >>= (-nBits)
  6254. nBits += mLen
  6255. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  6256.  
  6257. if (e === 0) {
  6258. e = 1 - eBias
  6259. } else if (e === eMax) {
  6260. return m ? NaN : ((s ? -1 : 1) * Infinity)
  6261. } else {
  6262. m = m + Math.pow(2, mLen)
  6263. e = e - eBias
  6264. }
  6265. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  6266. }
  6267.  
  6268. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  6269. var e, m, c
  6270. var eLen = (nBytes * 8) - mLen - 1
  6271. var eMax = (1 << eLen) - 1
  6272. var eBias = eMax >> 1
  6273. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  6274. var i = isLE ? 0 : (nBytes - 1)
  6275. var d = isLE ? 1 : -1
  6276. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  6277.  
  6278. value = Math.abs(value)
  6279.  
  6280. if (isNaN(value) || value === Infinity) {
  6281. m = isNaN(value) ? 1 : 0
  6282. e = eMax
  6283. } else {
  6284. e = Math.floor(Math.log(value) / Math.LN2)
  6285. if (value * (c = Math.pow(2, -e)) < 1) {
  6286. e--
  6287. c *= 2
  6288. }
  6289. if (e + eBias >= 1) {
  6290. value += rt / c
  6291. } else {
  6292. value += rt * Math.pow(2, 1 - eBias)
  6293. }
  6294. if (value * c >= 2) {
  6295. e++
  6296. c /= 2
  6297. }
  6298.  
  6299. if (e + eBias >= eMax) {
  6300. m = 0
  6301. e = eMax
  6302. } else if (e + eBias >= 1) {
  6303. m = ((value * c) - 1) * Math.pow(2, mLen)
  6304. e = e + eBias
  6305. } else {
  6306. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  6307. e = 0
  6308. }
  6309. }
  6310.  
  6311. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  6312.  
  6313. e = (e << mLen) | m
  6314. eLen += mLen
  6315. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  6316.  
  6317. buffer[offset + i - d] |= s * 128
  6318. }
  6319.  
  6320.  
  6321. /***/ }),
  6322. /* 55 */
  6323. /***/ (function(module, exports) {
  6324.  
  6325. var toString = {}.toString;
  6326.  
  6327. module.exports = Array.isArray || function (arr) {
  6328. return toString.call(arr) == '[object Array]';
  6329. };
  6330.  
  6331.  
  6332. /***/ }),
  6333. /* 56 */
  6334. /***/ (function(module, exports) {
  6335.  
  6336. (function() {
  6337. var base64map
  6338. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
  6339.  
  6340. crypt = {
  6341. // Bit-wise rotation left
  6342. rotl: function(n, b) {
  6343. return (n << b) | (n >>> (32 - b));
  6344. },
  6345.  
  6346. // Bit-wise rotation right
  6347. rotr: function(n, b) {
  6348. return (n << (32 - b)) | (n >>> b);
  6349. },
  6350.  
  6351. // Swap big-endian to little-endian and vice versa
  6352. endian: function(n) {
  6353. // If number given, swap endian
  6354. if (n.constructor == Number) {
  6355. return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
  6356. }
  6357.  
  6358. // Else, assume array and swap all items
  6359. for (var i = 0; i < n.length; i++)
  6360. n[i] = crypt.endian(n[i]);
  6361. return n;
  6362. },
  6363.  
  6364. // Generate an array of any length of random bytes
  6365. randomBytes: function(n) {
  6366. for (var bytes = []; n > 0; n--)
  6367. bytes.push(Math.floor(Math.random() * 256));
  6368. return bytes;
  6369. },
  6370.  
  6371. // Convert a byte array to big-endian 32-bit words
  6372. bytesToWords: function(bytes) {
  6373. for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
  6374. words[b >>> 5] |= bytes[i] << (24 - b % 32);
  6375. return words;
  6376. },
  6377.  
  6378. // Convert big-endian 32-bit words to a byte array
  6379. wordsToBytes: function(words) {
  6380. for (var bytes = [], b = 0; b < words.length * 32; b += 8)
  6381. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
  6382. return bytes;
  6383. },
  6384.  
  6385. // Convert a byte array to a hex string
  6386. bytesToHex: function(bytes) {
  6387. for (var hex = [], i = 0; i < bytes.length; i++) {
  6388. hex.push((bytes[i] >>> 4).toString(16));
  6389. hex.push((bytes[i] & 0xF).toString(16));
  6390. }
  6391. return hex.join('');
  6392. },
  6393.  
  6394. // Convert a hex string to a byte array
  6395. hexToBytes: function(hex) {
  6396. for (var bytes = [], c = 0; c < hex.length; c += 2)
  6397. bytes.push(parseInt(hex.substr(c, 2), 16));
  6398. return bytes;
  6399. },
  6400.  
  6401. // Convert a byte array to a base-64 string
  6402. bytesToBase64: function(bytes) {
  6403. for (var base64 = [], i = 0; i < bytes.length; i += 3) {
  6404. var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
  6405. for (var j = 0; j < 4; j++)
  6406. if (i * 8 + j * 6 <= bytes.length * 8)
  6407. base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
  6408. else
  6409. base64.push('=');
  6410. }
  6411. return base64.join('');
  6412. },
  6413.  
  6414. // Convert a base-64 string to a byte array
  6415. base64ToBytes: function(base64) {
  6416. // Remove non-base-64 characters
  6417. base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
  6418.  
  6419. for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
  6420. imod4 = ++i % 4) {
  6421. if (imod4 == 0) continue;
  6422. bytes.push(((base64map.indexOf(base64.charAt(i - 1))
  6423. & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
  6424. | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
  6425. }
  6426. return bytes;
  6427. }
  6428. };
  6429.  
  6430. module.exports = crypt;
  6431. })();
  6432.  
  6433.  
  6434. /***/ }),
  6435. /* 57 */
  6436. /***/ (function(module, exports, __webpack_require__) {
  6437.  
  6438. "use strict";
  6439.  
  6440. Object.defineProperty(exports, "__esModule", { value: true });
  6441. exports.PlaylistEmptyError = exports.PlaylistVideosRemoveError = exports.PlaylistDataFetchError = exports.PlaylistNotEditableError = void 0;
  6442. exports.PlaylistNotEditableError = new Error('playlist is not editable');
  6443. exports.PlaylistDataFetchError = new Error('cannot fetch some data for the playlist');
  6444. exports.PlaylistVideosRemoveError = new Error('cannot remove videos from playlist');
  6445. exports.PlaylistEmptyError = new Error('playlist is empty');
  6446.  
  6447.  
  6448. /***/ }),
  6449. /* 58 */
  6450. /***/ (function(module, exports, __webpack_require__) {
  6451.  
  6452. "use strict";
  6453.  
  6454. Object.defineProperty(exports, "__esModule", { value: true });
  6455. /**
  6456. * Creates an array of elements split into two groups, the first of which
  6457. * contains elements `predicate` returns truthy for, the second of which
  6458. * contains elements `predicate` returns falsey for. The predicate is
  6459. * invoked with one argument: (value).
  6460. */
  6461. function partition(collection, predicate) {
  6462. const result = [[], []];
  6463. for (const item of collection) {
  6464. result[predicate(item) ? 0 : 1].push(item);
  6465. }
  6466. return result;
  6467. }
  6468. exports.default = partition;
  6469.  
  6470.  
  6471. /***/ }),
  6472. /* 59 */
  6473. /***/ (function(module, exports, __webpack_require__) {
  6474.  
  6475. "use strict";
  6476.  
  6477. var __importDefault = (this && this.__importDefault) || function (mod) {
  6478. return (mod && mod.__esModule) ? mod : { "default": mod };
  6479. };
  6480. Object.defineProperty(exports, "__esModule", { value: true });
  6481. const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
  6482. const selectors_1 = __webpack_require__(10);
  6483. function removeWatchedFromPlaylistUI(videoId) {
  6484. const playlistVideoRendererNodes = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_RENDERERS);
  6485. for (const video of playlistVideoRendererNodes) {
  6486. if (video.data.videoId === videoId) {
  6487. video.querySelector('#overlays ytd-thumbnail-overlay-resume-playback-renderer').remove();
  6488. }
  6489. }
  6490. }
  6491. exports.default = removeWatchedFromPlaylistUI;
  6492.  
  6493.  
  6494. /***/ }),
  6495. /* 60 */
  6496. /***/ (function(module, exports, __webpack_require__) {
  6497.  
  6498. "use strict";
  6499.  
  6500. var __importDefault = (this && this.__importDefault) || function (mod) {
  6501. return (mod && mod.__esModule) ? mod : { "default": mod };
  6502. };
  6503. Object.defineProperty(exports, "__esModule", { value: true });
  6504. exports.removeVideoFromPlaylistUI = void 0;
  6505. const remove_videos_from_playlist_1 = __importDefault(__webpack_require__(61));
  6506. const decrement_number_of_videos_in_playlist_1 = __importDefault(__webpack_require__(63));
  6507. function removeVideoFromPlaylistUI(videoId) {
  6508. try {
  6509. (0, remove_videos_from_playlist_1.default)([{ videoId, percentDurationWatched: 100 }]);
  6510. (0, decrement_number_of_videos_in_playlist_1.default)(1);
  6511. }
  6512. catch (error) {
  6513. // eslint-disable-next-line no-console
  6514. console.error(error);
  6515. // If an error occurs while trying to dynamically update the UI
  6516. // reload the page to update the UI
  6517. window.location.reload();
  6518. }
  6519. }
  6520. exports.removeVideoFromPlaylistUI = removeVideoFromPlaylistUI;
  6521. function removeVideosFromPlaylistUI(toDeleteVideos) {
  6522. try {
  6523. (0, remove_videos_from_playlist_1.default)(toDeleteVideos);
  6524. (0, decrement_number_of_videos_in_playlist_1.default)(toDeleteVideos.length);
  6525. }
  6526. catch (error) {
  6527. // eslint-disable-next-line no-console
  6528. console.error(error);
  6529. // If an error occurs while trying to dynamically update the UI
  6530. // reload the page to update the UI
  6531. window.location.reload();
  6532. }
  6533. }
  6534. exports.default = removeVideosFromPlaylistUI;
  6535.  
  6536.  
  6537. /***/ }),
  6538. /* 61 */
  6539. /***/ (function(module, exports, __webpack_require__) {
  6540.  
  6541. "use strict";
  6542.  
  6543. var __importDefault = (this && this.__importDefault) || function (mod) {
  6544. return (mod && mod.__esModule) ? mod : { "default": mod };
  6545. };
  6546. Object.defineProperty(exports, "__esModule", { value: true });
  6547. const selectors_1 = __webpack_require__(10);
  6548. const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
  6549. const list_map_search_1 = __importDefault(__webpack_require__(62));
  6550. function removeVideoWithYtAction(videoId) {
  6551. document.querySelectorAll('ytd-app')[0].dispatchEvent(new CustomEvent('yt-action', {
  6552. detail: {
  6553. actionName: 'yt-playlist-remove-videos-action',
  6554. args: [
  6555. {
  6556. playlistRemoveVideosAction: {
  6557. setVideoIds: [videoId],
  6558. },
  6559. },
  6560. ],
  6561. returnValue: [],
  6562. },
  6563. }));
  6564. }
  6565. function removeVideosFromPlaylist(videosToDelete) {
  6566. // cast Node as any to access .data property availlable on ytd-playlist-video-renderer elements
  6567. const playlistVideoRendererNodes = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_PLAYLIST_VIDEO_RENDERERS);
  6568. // All videos to remove MAY be present in the UI because if there is more videos to remove
  6569. // than videos found into the UI, some removed videos aren't loaded in the UI
  6570. const uniqueVideosToDelete = [...new Map(videosToDelete.map((item) => [item.videoId, item])).values()];
  6571. if (playlistVideoRendererNodes.length >= videosToDelete.length) {
  6572. const searchMap = (0, list_map_search_1.default)(uniqueVideosToDelete, playlistVideoRendererNodes, (video) => video.videoId, (node) => node.data.videoId);
  6573. // if all videos to remove are present in the UI
  6574. if (searchMap) {
  6575. const htmlElements = Object.values(searchMap);
  6576. for (const element of htmlElements) {
  6577. // eslint-disable-next-line no-underscore-dangle
  6578. const videoId = element.data.setVideoId;
  6579. removeVideoWithYtAction(videoId);
  6580. }
  6581. return;
  6582. }
  6583. }
  6584. throw new Error('some videos are missing from the UI, cannot dynamically delete');
  6585. }
  6586. exports.default = removeVideosFromPlaylist;
  6587.  
  6588.  
  6589. /***/ }),
  6590. /* 62 */
  6591. /***/ (function(module, exports, __webpack_require__) {
  6592.  
  6593. "use strict";
  6594.  
  6595. Object.defineProperty(exports, "__esModule", { value: true });
  6596. /**
  6597. * Search into two lists of objects needles and haystack using hashmap
  6598. * If all elements from needles has been found into haystack it return the hashmap
  6599. * If some elements are missing into haystack, we return false.
  6600. *
  6601. * The hashmap keys are generated using needleGetter and haystackGetter
  6602. * The needles must not contain duplicates
  6603. *
  6604. * @param needles unique list of element to search
  6605. * @param haystack list of elements to search in
  6606. * @param needleKeyGetter get the value to use as key from needles
  6607. * @param haystackKeyGetter get the value to match with needle key
  6608. */
  6609. function listMapSearch(needles, haystack, needleKeyGetter, haystackKeyGetter) {
  6610. const searchMap = {};
  6611. // We cannot found all our needles into our haystack
  6612. if (haystack.length < needles.length) {
  6613. return false;
  6614. }
  6615. // Fill our searchMap keys with needles to search
  6616. for (const needle of needles) {
  6617. searchMap[needleKeyGetter(needle)] = undefined;
  6618. }
  6619. // matches elements from needles with haystack
  6620. let found = 0;
  6621. for (const item of haystack) {
  6622. const itemKey = haystackKeyGetter(item);
  6623. // if key exist in the searchMap and value is still undefined
  6624. if (Object.prototype.hasOwnProperty.call(searchMap, itemKey) === true && searchMap[itemKey] === undefined) {
  6625. searchMap[itemKey] = item;
  6626. found += 1;
  6627. // early break if all elements have already been found
  6628. if (found === needles.length) {
  6629. return searchMap;
  6630. }
  6631. }
  6632. }
  6633. return found === needles.length ? searchMap : false;
  6634. }
  6635. exports.default = listMapSearch;
  6636.  
  6637.  
  6638. /***/ }),
  6639. /* 63 */
  6640. /***/ (function(module, exports, __webpack_require__) {
  6641.  
  6642. "use strict";
  6643.  
  6644. var __importDefault = (this && this.__importDefault) || function (mod) {
  6645. return (mod && mod.__esModule) ? mod : { "default": mod };
  6646. };
  6647. Object.defineProperty(exports, "__esModule", { value: true });
  6648. const selectors_1 = __webpack_require__(10);
  6649. const get_elements_by_xpath_1 = __importDefault(__webpack_require__(12));
  6650. // Decrement the numbers of videos in the playlist in the UI
  6651. function decrementNumberOfVideosInPlaylist(value) {
  6652. const spanElement = (0, get_elements_by_xpath_1.default)(selectors_1.XPATH.YT_NUMBER_OF_VIDEOS_IN_PLAYLIST)[0];
  6653. if (spanElement) {
  6654. const newValue = Number(spanElement.textContent) - value;
  6655. spanElement.textContent = `${newValue}`;
  6656. }
  6657. else {
  6658. // A reload is performed to properly restore the state of an empty playlist:
  6659. // - The "There are no videos in this playlist yet" text
  6660. // - The "No videos" text
  6661. // Both strings are not part of the `yt.msgs_` object to use for localization
  6662. // eslint-disable-next-line no-console
  6663. console.log('empty playlist reload');
  6664. window.location.reload();
  6665. }
  6666. }
  6667. exports.default = decrementNumberOfVideosInPlaylist;
  6668.  
  6669.  
  6670. /***/ }),
  6671. /* 64 */
  6672. /***/ (function(module, exports, __webpack_require__) {
  6673.  
  6674. "use strict";
  6675.  
  6676. var __importDefault = (this && this.__importDefault) || function (mod) {
  6677. return (mod && mod.__esModule) ? mod : { "default": mod };
  6678. };
  6679. Object.defineProperty(exports, "__esModule", { value: true });
  6680. const environment_1 = __webpack_require__(18);
  6681. const stylesheets_1 = __webpack_require__(16);
  6682. const preact_material_scss_1 = __importDefault(__webpack_require__(65));
  6683. const STYLESHEETS = {
  6684. preactMaterial: (0, stylesheets_1.stylesheet)({
  6685. condition: environment_1.ALWAYS,
  6686. css: preact_material_scss_1.default,
  6687. }),
  6688. };
  6689. // This trick uncovers type errors in STYLESHEETS
  6690. // while retaining the static knowledge of its properties
  6691. // (so we can still write e.g. STYLESHEETS.foo):
  6692. const style = STYLESHEETS;
  6693. // eslint-disable-next-line no-void
  6694. void style;
  6695. exports.default = STYLESHEETS;
  6696.  
  6697.  
  6698. /***/ }),
  6699. /* 65 */
  6700. /***/ (function(module, exports, __webpack_require__) {
  6701.  
  6702.  
  6703. var result = __webpack_require__(66);
  6704.  
  6705. if (result && result.__esModule) {
  6706. result = result.default;
  6707. }
  6708.  
  6709. if (typeof result === "string") {
  6710. module.exports = result;
  6711. } else {
  6712. module.exports = result.toString();
  6713. }
  6714.  
  6715. /***/ }),
  6716. /* 66 */
  6717. /***/ (function(module, exports, __webpack_require__) {
  6718.  
  6719. // Imports
  6720. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
  6721. var ___CSS_LOADER_AT_RULE_IMPORT_0___ = __webpack_require__(67);
  6722. var ___CSS_LOADER_AT_RULE_IMPORT_1___ = __webpack_require__(68);
  6723. var ___CSS_LOADER_AT_RULE_IMPORT_2___ = __webpack_require__(69);
  6724. var ___CSS_LOADER_AT_RULE_IMPORT_3___ = __webpack_require__(70);
  6725. exports = ___CSS_LOADER_API_IMPORT___(false);
  6726. exports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
  6727. exports.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
  6728. exports.i(___CSS_LOADER_AT_RULE_IMPORT_2___);
  6729. exports.i(___CSS_LOADER_AT_RULE_IMPORT_3___);
  6730. // Module
  6731. exports.push([module.i, "#yt-playlists-delete-enhancer{--mdc-theme-primary: #e10000;--mdc-theme-on-primary: #fff;--mdc-theme-accent: #e10000;--mdc-theme-secondary: #e10000;--mdc-theme-on-secondary: #fff;--mdc-theme-background: #fff;--mdc-theme-surface: #fff;--mdc-theme-on-surface: #fff}@font-face{font-family:\"Material Icons\";font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format(\"woff2\")}.material-icons{font-family:\"Material Icons\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-moz-font-feature-settings:\"liga\";-moz-osx-font-smoothing:grayscale}", ""]);
  6732. // Exports
  6733. exports.locals = {
  6734. "yt-playlists-delete-enhancer": "yt-playlists-delete-enhancer",
  6735. "material-icons": "material-icons"
  6736. };
  6737. module.exports = exports;
  6738.  
  6739.  
  6740. /***/ }),
  6741. /* 67 */
  6742. /***/ (function(module, exports, __webpack_require__) {
  6743.  
  6744. // Imports
  6745. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
  6746. exports = ___CSS_LOADER_API_IMPORT___(false);
  6747. // Module
  6748. exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n@keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n.mdc-ripple-surface--test-edge-var-bug {\n --mdc-ripple-surface-test-edge-var: 1px solid #000;\n visibility: hidden; }\n .mdc-ripple-surface--test-edge-var-bug::before {\n border: var(--mdc-ripple-surface-test-edge-var); }\n\n.mdc-button {\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.875rem;\n line-height: 2.25rem;\n font-weight: 500;\n letter-spacing: 0.08929em;\n text-decoration: none;\n text-transform: uppercase;\n --mdc-ripple-fg-size: 0;\n --mdc-ripple-left: 0;\n --mdc-ripple-top: 0;\n --mdc-ripple-fg-scale: 1;\n --mdc-ripple-fg-translate-end: 0;\n --mdc-ripple-fg-translate-start: 0;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n will-change: transform, opacity;\n padding: 0 8px 0 8px;\n display: inline-flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 64px;\n height: 36px;\n border: none;\n outline: none;\n /* @alternate */\n line-height: inherit;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-appearance: none;\n overflow: hidden;\n vertical-align: middle;\n border-radius: 2px; }\n .mdc-button::before, .mdc-button::after {\n position: absolute;\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n content: \"\"; }\n .mdc-button::before {\n transition: opacity 15ms linear;\n z-index: 1; }\n .mdc-button.mdc-ripple-upgraded::before {\n -webkit-transform: scale(var(--mdc-ripple-fg-scale, 1));\n transform: scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-button.mdc-ripple-upgraded::after {\n top: 0;\n /* @noflip */\n left: 0;\n -webkit-transform: scale(0);\n transform: scale(0);\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n .mdc-button.mdc-ripple-upgraded--unbounded::after {\n top: var(--mdc-ripple-top, 0);\n /* @noflip */\n left: var(--mdc-ripple-left, 0); }\n .mdc-button.mdc-ripple-upgraded--foreground-activation::after {\n -webkit-animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards;\n animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards; }\n .mdc-button.mdc-ripple-upgraded--foreground-deactivation::after {\n -webkit-animation: 150ms :local(mdc-ripple-fg-opacity-out);\n animation: 150ms :local(mdc-ripple-fg-opacity-out);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-button::before, .mdc-button::after {\n top: calc(50% - 100%);\n /* @noflip */\n left: calc(50% - 100%);\n width: 200%;\n height: 200%; }\n .mdc-button.mdc-ripple-upgraded::after {\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-button::-moz-focus-inner {\n padding: 0;\n border: 0; }\n .mdc-button:active {\n outline: none; }\n .mdc-button:hover {\n cursor: pointer; }\n .mdc-button:disabled {\n background-color: transparent;\n color: rgba(0, 0, 0, 0.37);\n cursor: default;\n pointer-events: none; }\n .mdc-button:not(:disabled) {\n background-color: transparent; }\n .mdc-button:not(:disabled) {\n color: #6200ee;\n /* @alternate */\n color: var(--mdc-theme-primary, #6200ee); }\n .mdc-button::before, .mdc-button::after {\n background-color: #6200ee; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button::before, .mdc-button::after {\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); } }\n .mdc-button:hover::before {\n opacity: 0.04; }\n .mdc-button:not(.mdc-ripple-upgraded):focus::before, .mdc-button.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.12; }\n .mdc-button:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-button:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.16; }\n .mdc-button.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.16; }\n .mdc-button .mdc-button__icon {\n /* @noflip */\n margin-left: 0;\n /* @noflip */\n margin-right: 8px;\n display: inline-block;\n width: 18px;\n height: 18px;\n font-size: 18px;\n vertical-align: top; }\n [dir=\"rtl\"] .mdc-button .mdc-button__icon, .mdc-button .mdc-button__icon[dir=\"rtl\"] {\n /* @noflip */\n margin-left: 8px;\n /* @noflip */\n margin-right: 0; }\n .mdc-button svg.mdc-button__icon {\n fill: currentColor; }\n\n.mdc-button--raised .mdc-button__icon,\n.mdc-button--unelevated .mdc-button__icon,\n.mdc-button--outlined .mdc-button__icon {\n /* @noflip */\n margin-left: -4px;\n /* @noflip */\n margin-right: 8px; }\n [dir=\"rtl\"] .mdc-button--raised .mdc-button__icon, .mdc-button--raised .mdc-button__icon[dir=\"rtl\"], [dir=\"rtl\"]\n .mdc-button--unelevated .mdc-button__icon,\n .mdc-button--unelevated .mdc-button__icon[dir=\"rtl\"], [dir=\"rtl\"]\n .mdc-button--outlined .mdc-button__icon,\n .mdc-button--outlined .mdc-button__icon[dir=\"rtl\"] {\n /* @noflip */\n margin-left: 8px;\n /* @noflip */\n margin-right: -4px; }\n\n.mdc-button--raised,\n.mdc-button--unelevated {\n padding: 0 16px 0 16px; }\n .mdc-button--raised:disabled,\n .mdc-button--unelevated:disabled {\n background-color: rgba(0, 0, 0, 0.12);\n color: rgba(0, 0, 0, 0.37); }\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n background-color: #6200ee; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); } }\n .mdc-button--raised:not(:disabled),\n .mdc-button--unelevated:not(:disabled) {\n color: #fff;\n /* @alternate */\n color: var(--mdc-theme-on-primary, #fff); }\n .mdc-button--raised::before, .mdc-button--raised::after,\n .mdc-button--unelevated::before,\n .mdc-button--unelevated::after {\n background-color: #fff; }\n @supports not (-ms-ime-align: auto) {\n .mdc-button--raised::before, .mdc-button--raised::after,\n .mdc-button--unelevated::before,\n .mdc-button--unelevated::after {\n /* @alternate */\n background-color: var(--mdc-theme-on-primary, #fff); } }\n .mdc-button--raised:hover::before,\n .mdc-button--unelevated:hover::before {\n opacity: 0.08; }\n .mdc-button--raised:not(.mdc-ripple-upgraded):focus::before, .mdc-button--raised.mdc-ripple-upgraded--background-focused::before,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded):focus::before,\n .mdc-button--unelevated.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.24; }\n .mdc-button--raised:not(.mdc-ripple-upgraded)::after,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-button--raised:not(.mdc-ripple-upgraded):active::after,\n .mdc-button--unelevated:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.32; }\n .mdc-button--raised.mdc-ripple-upgraded,\n .mdc-button--unelevated.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.32; }\n\n.mdc-button--raised {\n box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);\n transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1); }\n .mdc-button--raised:hover, .mdc-button--raised:focus {\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); }\n .mdc-button--raised:active {\n box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12); }\n .mdc-button--raised:disabled {\n box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12); }\n\n.mdc-button--outlined {\n border-style: solid;\n padding: 0 14px 0 14px;\n border-width: 2px; }\n .mdc-button--outlined:disabled {\n border-color: rgba(0, 0, 0, 0.37); }\n .mdc-button--outlined:not(:disabled) {\n border-color: #6200ee;\n /* @alternate */\n border-color: var(--mdc-theme-primary, #6200ee); }\n\n.mdc-button--dense {\n height: 32px;\n font-size: .8125rem; }", ""]);
  6749. // Exports
  6750. exports.locals = {
  6751. "mdc-ripple-surface--test-edge-var-bug": "mdc-ripple-surface--test-edge-var-bug",
  6752. "mdc-button": "mdc-button",
  6753. "mdc-ripple-upgraded": "mdc-ripple-upgraded",
  6754. "mdc-ripple-upgraded--unbounded": "mdc-ripple-upgraded--unbounded",
  6755. "mdc-ripple-upgraded--foreground-activation": "mdc-ripple-upgraded--foreground-activation",
  6756. "mdc-ripple-upgraded--foreground-deactivation": "mdc-ripple-upgraded--foreground-deactivation",
  6757. "mdc-ripple-upgraded--background-focused": "mdc-ripple-upgraded--background-focused",
  6758. "mdc-button__icon": "mdc-button__icon",
  6759. "mdc-button--raised": "mdc-button--raised",
  6760. "mdc-button--unelevated": "mdc-button--unelevated",
  6761. "mdc-button--outlined": "mdc-button--outlined",
  6762. "mdc-button--dense": "mdc-button--dense",
  6763. "mdc-ripple-fg-radius-in": "mdc-ripple-fg-radius-in",
  6764. "mdc-ripple-fg-opacity-in": "mdc-ripple-fg-opacity-in",
  6765. "mdc-ripple-fg-opacity-out": "mdc-ripple-fg-opacity-out"
  6766. };
  6767. module.exports = exports;
  6768.  
  6769.  
  6770. /***/ }),
  6771. /* 68 */
  6772. /***/ (function(module, exports, __webpack_require__) {
  6773.  
  6774. // Imports
  6775. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
  6776. exports = ___CSS_LOADER_API_IMPORT___(false);
  6777. // Module
  6778. exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-slider-emphasize {\n 0% {\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n -webkit-transform: scale(0.85);\n transform: scale(0.85); }\n 100% {\n -webkit-transform: scale(0.571);\n transform: scale(0.571); } }\n\n@keyframes mdc-slider-emphasize {\n 0% {\n -webkit-animation-timing-function: ease-out;\n animation-timing-function: ease-out; }\n 50% {\n -webkit-animation-timing-function: ease-in;\n animation-timing-function: ease-in;\n -webkit-transform: scale(0.85);\n transform: scale(0.85); }\n 100% {\n -webkit-transform: scale(0.571);\n transform: scale(0.571); } }\n\n.mdc-slider {\n position: relative;\n width: 100%;\n height: 48px;\n cursor: pointer;\n touch-action: pan-x;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-container {\n background-color: rgba(1, 135, 134, 0.26); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-marker::after,\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__track-marker-container::after {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__thumb {\n fill: #018786;\n /* @alternate */\n fill: var(--mdc-theme-secondary, #018786);\n stroke: #018786;\n /* @alternate */\n stroke: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__focus-ring {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__pin {\n background-color: #018786;\n /* @alternate */\n background-color: var(--mdc-theme-secondary, #018786); }\n .mdc-slider:not(.mdc-slider--disabled) .mdc-slider__pin {\n color: white;\n /* @alternate */\n color: var(--mdc-theme-text-primary-on-dark, white); }\n .mdc-slider--disabled {\n cursor: auto; }\n .mdc-slider--disabled .mdc-slider__track {\n background-color: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__track-container {\n background-color: rgba(154, 154, 154, 0.26); }\n .mdc-slider--disabled .mdc-slider__track-marker::after,\n .mdc-slider--disabled .mdc-slider__track-marker-container::after {\n background-color: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__thumb {\n fill: #9a9a9a;\n stroke: #9a9a9a; }\n .mdc-slider--disabled .mdc-slider__thumb {\n /* @alternate */\n stroke: white;\n stroke: var(--mdc-slider-bg-color-behind-component, white); }\n .mdc-slider:focus {\n outline: none; }\n .mdc-slider__track-container {\n position: absolute;\n top: 50%;\n width: 100%;\n height: 2px;\n overflow: hidden; }\n .mdc-slider__track {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-transform-origin: left top;\n transform-origin: left top;\n will-change: transform; }\n .mdc-slider[dir=\"rtl\"] .mdc-slider__track,\n [dir=\"rtl\"] .mdc-slider .mdc-slider__track {\n -webkit-transform-origin: right top;\n transform-origin: right top; }\n .mdc-slider__track-marker-container {\n display: flex;\n margin-right: 0;\n margin-left: -1px;\n visibility: hidden; }\n .mdc-slider[dir=\"rtl\"] .mdc-slider__track-marker-container,\n [dir=\"rtl\"] .mdc-slider .mdc-slider__track-marker-container {\n margin-right: -1px;\n margin-left: 0; }\n .mdc-slider__track-marker-container::after {\n display: block;\n width: 2px;\n height: 2px;\n content: \"\"; }\n .mdc-slider__track-marker {\n flex: 1; }\n .mdc-slider__track-marker::after {\n display: block;\n width: 2px;\n height: 2px;\n content: \"\"; }\n .mdc-slider__track-marker:first-child::after {\n width: 3px; }\n .mdc-slider__thumb-container {\n position: absolute;\n top: 15px;\n left: 0;\n width: 21px;\n height: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n will-change: transform; }\n .mdc-slider__thumb {\n position: absolute;\n top: 0;\n left: 0;\n -webkit-transform: scale(0.571);\n transform: scale(0.571);\n transition: fill 100ms ease-out, stroke 100ms ease-out, -webkit-transform 100ms ease-out;\n transition: transform 100ms ease-out, fill 100ms ease-out, stroke 100ms ease-out;\n transition: transform 100ms ease-out, fill 100ms ease-out, stroke 100ms ease-out, -webkit-transform 100ms ease-out;\n stroke-width: 3.5; }\n .mdc-slider__focus-ring {\n width: 21px;\n height: 21px;\n transition: opacity 266.67ms ease-out, background-color 266.67ms ease-out, -webkit-transform 266.67ms ease-out;\n transition: transform 266.67ms ease-out, opacity 266.67ms ease-out, background-color 266.67ms ease-out;\n transition: transform 266.67ms ease-out, opacity 266.67ms ease-out, background-color 266.67ms ease-out, -webkit-transform 266.67ms ease-out;\n border-radius: 50%;\n opacity: 0; }\n .mdc-slider__pin {\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n margin-top: -2px;\n margin-left: -2px;\n -webkit-transform: rotate(-45deg) scale(0) translate(0, 0);\n transform: rotate(-45deg) scale(0) translate(0, 0);\n transition: -webkit-transform 100ms ease-out;\n transition: transform 100ms ease-out;\n transition: transform 100ms ease-out, -webkit-transform 100ms ease-out;\n border-radius: 50% 50% 50% 0%;\n z-index: 1; }\n .mdc-slider__pin-value-marker {\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 400;\n letter-spacing: 0.01786em;\n text-decoration: inherit;\n text-transform: inherit;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg); }\n\n.mdc-slider--active .mdc-slider__thumb {\n -webkit-transform: scale3d(1, 1, 1);\n transform: scale3d(1, 1, 1); }\n\n.mdc-slider--focus .mdc-slider__thumb {\n -webkit-animation: mdc-slider-emphasize 266.67ms linear;\n animation: mdc-slider-emphasize 266.67ms linear; }\n\n.mdc-slider--focus .mdc-slider__focus-ring {\n -webkit-transform: scale3d(1.55, 1.55, 1.55);\n transform: scale3d(1.55, 1.55, 1.55);\n opacity: .25; }\n\n.mdc-slider--in-transit .mdc-slider__thumb {\n transition-delay: 140ms; }\n\n.mdc-slider--in-transit .mdc-slider__thumb-container,\n.mdc-slider--in-transit .mdc-slider__track,\n.mdc-slider:focus:not(.mdc-slider--active) .mdc-slider__thumb-container,\n.mdc-slider:focus:not(.mdc-slider--active) .mdc-slider__track {\n transition: -webkit-transform 80ms ease;\n transition: transform 80ms ease;\n transition: transform 80ms ease, -webkit-transform 80ms ease; }\n\n.mdc-slider--discrete.mdc-slider--active .mdc-slider__thumb {\n -webkit-transform: scale(calc(12 / 21));\n transform: scale(calc(12 / 21)); }\n\n.mdc-slider--discrete.mdc-slider--active .mdc-slider__pin {\n -webkit-transform: rotate(-45deg) scale(1) translate(19px, -20px);\n transform: rotate(-45deg) scale(1) translate(19px, -20px); }\n\n.mdc-slider--discrete.mdc-slider--focus .mdc-slider__thumb {\n -webkit-animation: none;\n animation: none; }\n\n.mdc-slider--discrete.mdc-slider--display-markers .mdc-slider__track-marker-container {\n visibility: visible; }", ""]);
  6779. // Exports
  6780. exports.locals = {
  6781. "mdc-slider": "mdc-slider",
  6782. "mdc-slider--disabled": "mdc-slider--disabled",
  6783. "mdc-slider__track": "mdc-slider__track",
  6784. "mdc-slider__track-container": "mdc-slider__track-container",
  6785. "mdc-slider__track-marker": "mdc-slider__track-marker",
  6786. "mdc-slider__track-marker-container": "mdc-slider__track-marker-container",
  6787. "mdc-slider__thumb": "mdc-slider__thumb",
  6788. "mdc-slider__focus-ring": "mdc-slider__focus-ring",
  6789. "mdc-slider__pin": "mdc-slider__pin",
  6790. "mdc-slider__thumb-container": "mdc-slider__thumb-container",
  6791. "mdc-slider__pin-value-marker": "mdc-slider__pin-value-marker",
  6792. "mdc-slider--active": "mdc-slider--active",
  6793. "mdc-slider--focus": "mdc-slider--focus",
  6794. "mdc-slider-emphasize": "mdc-slider-emphasize",
  6795. "mdc-slider--in-transit": "mdc-slider--in-transit",
  6796. "mdc-slider--discrete": "mdc-slider--discrete",
  6797. "mdc-slider--display-markers": "mdc-slider--display-markers"
  6798. };
  6799. module.exports = exports;
  6800.  
  6801.  
  6802. /***/ }),
  6803. /* 69 */
  6804. /***/ (function(module, exports, __webpack_require__) {
  6805.  
  6806. // Imports
  6807. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
  6808. exports = ___CSS_LOADER_API_IMPORT___(false);
  6809. // Module
  6810. exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes primary-indeterminate-translate {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(83.67142%);\n transform: translateX(83.67142%); }\n 100% {\n -webkit-transform: translateX(200.61106%);\n transform: translateX(200.61106%); } }\n\n@keyframes primary-indeterminate-translate {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(83.67142%);\n transform: translateX(83.67142%); }\n 100% {\n -webkit-transform: translateX(200.61106%);\n transform: translateX(200.61106%); } }\n\n@-webkit-keyframes primary-indeterminate-scale {\n 0% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 36.65% {\n -webkit-animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 69.15% {\n -webkit-animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n -webkit-transform: scaleX(0.66148);\n transform: scaleX(0.66148); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@keyframes primary-indeterminate-scale {\n 0% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 36.65% {\n -webkit-animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n animation-timing-function: cubic-bezier(0.33473, 0.12482, 0.78584, 1);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 69.15% {\n -webkit-animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);\n -webkit-transform: scaleX(0.66148);\n transform: scaleX(0.66148); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@-webkit-keyframes secondary-indeterminate-translate {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(37.65191%);\n transform: translateX(37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(84.38617%);\n transform: translateX(84.38617%); }\n 100% {\n -webkit-transform: translateX(160.27778%);\n transform: translateX(160.27778%); } }\n\n@keyframes secondary-indeterminate-translate {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(37.65191%);\n transform: translateX(37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(84.38617%);\n transform: translateX(84.38617%); }\n 100% {\n -webkit-transform: translateX(160.27778%);\n transform: translateX(160.27778%); } }\n\n@-webkit-keyframes secondary-indeterminate-scale {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 19.15% {\n -webkit-animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n -webkit-transform: scaleX(0.4571);\n transform: scaleX(0.4571); }\n 44.15% {\n -webkit-animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n -webkit-transform: scaleX(0.72796);\n transform: scaleX(0.72796); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@keyframes secondary-indeterminate-scale {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n animation-timing-function: cubic-bezier(0.20503, 0.05705, 0.57661, 0.45397);\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); }\n 19.15% {\n -webkit-animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n animation-timing-function: cubic-bezier(0.15231, 0.19643, 0.64837, 1.00432);\n -webkit-transform: scaleX(0.4571);\n transform: scaleX(0.4571); }\n 44.15% {\n -webkit-animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n animation-timing-function: cubic-bezier(0.25776, -0.00316, 0.21176, 1.38179);\n -webkit-transform: scaleX(0.72796);\n transform: scaleX(0.72796); }\n 100% {\n -webkit-transform: scaleX(0.08);\n transform: scaleX(0.08); } }\n\n@-webkit-keyframes buffering {\n to {\n -webkit-transform: translateX(-10px);\n transform: translateX(-10px); } }\n\n@keyframes buffering {\n to {\n -webkit-transform: translateX(-10px);\n transform: translateX(-10px); } }\n\n@-webkit-keyframes primary-indeterminate-translate-reverse {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(-83.67142%);\n transform: translateX(-83.67142%); }\n 100% {\n -webkit-transform: translateX(-200.61106%);\n transform: translateX(-200.61106%); } }\n\n@keyframes primary-indeterminate-translate-reverse {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 20% {\n -webkit-animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n animation-timing-function: cubic-bezier(0.5, 0, 0.70173, 0.49582);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 59.15% {\n -webkit-animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n animation-timing-function: cubic-bezier(0.30244, 0.38135, 0.55, 0.95635);\n -webkit-transform: translateX(-83.67142%);\n transform: translateX(-83.67142%); }\n 100% {\n -webkit-transform: translateX(-200.61106%);\n transform: translateX(-200.61106%); } }\n\n@-webkit-keyframes secondary-indeterminate-translate-reverse {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(-37.65191%);\n transform: translateX(-37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(-84.38617%);\n transform: translateX(-84.38617%); }\n 100% {\n -webkit-transform: translateX(-160.27778%);\n transform: translateX(-160.27778%); } }\n\n@keyframes secondary-indeterminate-translate-reverse {\n 0% {\n -webkit-animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n animation-timing-function: cubic-bezier(0.15, 0, 0.51506, 0.40969);\n -webkit-transform: translateX(0);\n transform: translateX(0); }\n 25% {\n -webkit-animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n animation-timing-function: cubic-bezier(0.31033, 0.28406, 0.8, 0.73371);\n -webkit-transform: translateX(-37.65191%);\n transform: translateX(-37.65191%); }\n 48.35% {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n animation-timing-function: cubic-bezier(0.4, 0.62704, 0.6, 0.90203);\n -webkit-transform: translateX(-84.38617%);\n transform: translateX(-84.38617%); }\n 100% {\n -webkit-transform: translateX(-160.27778%);\n transform: translateX(-160.27778%); } }\n\n@-webkit-keyframes buffering-reverse {\n to {\n -webkit-transform: translateX(10px);\n transform: translateX(10px); } }\n\n@keyframes buffering-reverse {\n to {\n -webkit-transform: translateX(10px);\n transform: translateX(10px); } }\n\n.mdc-linear-progress {\n position: relative;\n width: 100%;\n height: 4px;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n overflow: hidden; }\n .mdc-linear-progress__bar {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: none;\n animation: none;\n -webkit-transform-origin: top left;\n transform-origin: top left;\n transition: -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1); }\n .mdc-linear-progress__bar-inner {\n display: inline-block;\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: none;\n animation: none; }\n .mdc-linear-progress__buffering-dots {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-animation: buffering 250ms infinite linear;\n animation: buffering 250ms infinite linear;\n background-repeat: repeat-x;\n background-size: 10px 4px; }\n .mdc-linear-progress__buffer {\n position: absolute;\n width: 100%;\n height: 100%;\n -webkit-transform-origin: top left;\n transform-origin: top left;\n transition: -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1);\n transition: transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1); }\n .mdc-linear-progress__primary-bar {\n -webkit-transform: scaleX(0);\n transform: scaleX(0); }\n .mdc-linear-progress__secondary-bar {\n visibility: hidden; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__bar {\n transition: none; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar {\n left: -145.166611%;\n -webkit-animation: primary-indeterminate-translate 2s infinite linear;\n animation: primary-indeterminate-translate 2s infinite linear; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar > .mdc-linear-progress__bar-inner {\n -webkit-animation: primary-indeterminate-scale 2s infinite linear;\n animation: primary-indeterminate-scale 2s infinite linear; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar {\n left: -54.888891%;\n -webkit-animation: secondary-indeterminate-translate 2s infinite linear;\n animation: secondary-indeterminate-translate 2s infinite linear;\n visibility: visible; }\n .mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar > .mdc-linear-progress__bar-inner {\n -webkit-animation: secondary-indeterminate-scale 2s infinite linear;\n animation: secondary-indeterminate-scale 2s infinite linear; }\n .mdc-linear-progress--reversed .mdc-linear-progress__bar,\n .mdc-linear-progress--reversed .mdc-linear-progress__buffer {\n right: 0;\n -webkit-transform-origin: center right;\n transform-origin: center right; }\n .mdc-linear-progress--reversed .mdc-linear-progress__primary-bar {\n -webkit-animation-name: primary-indeterminate-translate-reverse;\n animation-name: primary-indeterminate-translate-reverse; }\n .mdc-linear-progress--reversed .mdc-linear-progress__secondary-bar {\n -webkit-animation-name: secondary-indeterminate-translate-reverse;\n animation-name: secondary-indeterminate-translate-reverse; }\n .mdc-linear-progress--reversed .mdc-linear-progress__buffering-dots {\n -webkit-animation: buffering-reverse 250ms infinite linear;\n animation: buffering-reverse 250ms infinite linear; }\n .mdc-linear-progress--closed {\n opacity: 0; }\n\n.mdc-linear-progress__bar-inner {\n background-color: #6200ee;\n /* @alternate */\n background-color: var(--mdc-theme-primary, #6200ee); }\n\n.mdc-linear-progress__buffering-dots {\n background-image: url(\"data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E\"); }\n\n.mdc-linear-progress__buffer {\n background-color: #e6e6e6; }\n\n.mdc-linear-progress--indeterminate.mdc-linear-progress--reversed .mdc-linear-progress__primary-bar {\n right: -145.166611%;\n left: auto; }\n\n.mdc-linear-progress--indeterminate.mdc-linear-progress--reversed .mdc-linear-progress__secondary-bar {\n right: -54.888891%;\n left: auto; }", ""]);
  6811. // Exports
  6812. exports.locals = {
  6813. "mdc-linear-progress": "mdc-linear-progress",
  6814. "mdc-linear-progress__bar": "mdc-linear-progress__bar",
  6815. "mdc-linear-progress__bar-inner": "mdc-linear-progress__bar-inner",
  6816. "mdc-linear-progress__buffering-dots": "mdc-linear-progress__buffering-dots",
  6817. "buffering": "buffering",
  6818. "mdc-linear-progress__buffer": "mdc-linear-progress__buffer",
  6819. "mdc-linear-progress__primary-bar": "mdc-linear-progress__primary-bar",
  6820. "mdc-linear-progress__secondary-bar": "mdc-linear-progress__secondary-bar",
  6821. "mdc-linear-progress--indeterminate": "mdc-linear-progress--indeterminate",
  6822. "primary-indeterminate-translate": "primary-indeterminate-translate",
  6823. "primary-indeterminate-scale": "primary-indeterminate-scale",
  6824. "secondary-indeterminate-translate": "secondary-indeterminate-translate",
  6825. "secondary-indeterminate-scale": "secondary-indeterminate-scale",
  6826. "mdc-linear-progress--reversed": "mdc-linear-progress--reversed",
  6827. "primary-indeterminate-translate-reverse": "primary-indeterminate-translate-reverse",
  6828. "secondary-indeterminate-translate-reverse": "secondary-indeterminate-translate-reverse",
  6829. "buffering-reverse": "buffering-reverse",
  6830. "mdc-linear-progress--closed": "mdc-linear-progress--closed"
  6831. };
  6832. module.exports = exports;
  6833.  
  6834.  
  6835. /***/ }),
  6836. /* 70 */
  6837. /***/ (function(module, exports, __webpack_require__) {
  6838.  
  6839. // Imports
  6840. var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(15);
  6841. exports = ___CSS_LOADER_API_IMPORT___(false);
  6842. // Module
  6843. exports.push([module.i, "/*!\n Material Components for the Web\n Copyright (c) 2018 Google Inc.\n License: MIT\n*/\n@-webkit-keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@keyframes mdc-ripple-fg-radius-in {\n from {\n -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);\n transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); }\n to {\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@keyframes mdc-ripple-fg-opacity-in {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: 0; }\n to {\n opacity: var(--mdc-ripple-fg-opacity, 0); } }\n\n@-webkit-keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n@keyframes mdc-ripple-fg-opacity-out {\n from {\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n opacity: var(--mdc-ripple-fg-opacity, 0); }\n to {\n opacity: 0; } }\n\n.mdc-ripple-surface--test-edge-var-bug {\n --mdc-ripple-surface-test-edge-var: 1px solid #000;\n visibility: hidden; }\n .mdc-ripple-surface--test-edge-var-bug::before {\n border: var(--mdc-ripple-surface-test-edge-var); }\n\n.mdc-icon-button {\n --mdc-ripple-fg-size: 0;\n --mdc-ripple-left: 0;\n --mdc-ripple-top: 0;\n --mdc-ripple-fg-scale: 1;\n --mdc-ripple-fg-translate-end: 0;\n --mdc-ripple-fg-translate-start: 0;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n will-change: transform, opacity;\n width: 48px;\n height: 48px;\n padding: 12px;\n font-size: 24px;\n display: inline-block;\n position: relative;\n box-sizing: border-box;\n border: none;\n outline: none;\n background-color: transparent;\n fill: currentColor;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none; }\n .mdc-icon-button::before, .mdc-icon-button::after {\n position: absolute;\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n content: \"\"; }\n .mdc-icon-button::before {\n transition: opacity 15ms linear;\n z-index: 1; }\n .mdc-icon-button.mdc-ripple-upgraded::before {\n -webkit-transform: scale(var(--mdc-ripple-fg-scale, 1));\n transform: scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-icon-button.mdc-ripple-upgraded::after {\n top: 0;\n /* @noflip */\n left: 0;\n -webkit-transform: scale(0);\n transform: scale(0);\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n .mdc-icon-button.mdc-ripple-upgraded--unbounded::after {\n top: var(--mdc-ripple-top, 0);\n /* @noflip */\n left: var(--mdc-ripple-left, 0); }\n .mdc-icon-button.mdc-ripple-upgraded--foreground-activation::after {\n -webkit-animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards;\n animation: 225ms :local(mdc-ripple-fg-radius-in) forwards, 75ms :local(mdc-ripple-fg-opacity-in) forwards; }\n .mdc-icon-button.mdc-ripple-upgraded--foreground-deactivation::after {\n -webkit-animation: 150ms :local(mdc-ripple-fg-opacity-out);\n animation: 150ms :local(mdc-ripple-fg-opacity-out);\n -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));\n transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); }\n .mdc-icon-button::before, .mdc-icon-button::after {\n top: calc(50% - 50%);\n /* @noflip */\n left: calc(50% - 50%);\n width: 100%;\n height: 100%; }\n .mdc-icon-button.mdc-ripple-upgraded::before, .mdc-icon-button.mdc-ripple-upgraded::after {\n top: var(--mdc-ripple-top, calc(50% - 50%));\n /* @noflip */\n left: var(--mdc-ripple-left, calc(50% - 50%));\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-icon-button.mdc-ripple-upgraded::after {\n width: var(--mdc-ripple-fg-size, 100%);\n height: var(--mdc-ripple-fg-size, 100%); }\n .mdc-icon-button svg,\n .mdc-icon-button img {\n width: 24px;\n height: 24px; }\n .mdc-icon-button:disabled {\n color: rgba(0, 0, 0, 0.38);\n /* @alternate */\n color: var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38));\n cursor: default;\n pointer-events: none; }\n .mdc-icon-button::before, .mdc-icon-button::after {\n background-color: black; }\n .mdc-icon-button:hover::before {\n opacity: 0.04; }\n .mdc-icon-button:not(.mdc-ripple-upgraded):focus::before, .mdc-icon-button.mdc-ripple-upgraded--background-focused::before {\n transition-duration: 75ms;\n opacity: 0.12; }\n .mdc-icon-button:not(.mdc-ripple-upgraded)::after {\n transition: opacity 150ms linear; }\n .mdc-icon-button:not(.mdc-ripple-upgraded):active::after {\n transition-duration: 75ms;\n opacity: 0.16; }\n .mdc-icon-button.mdc-ripple-upgraded {\n --mdc-ripple-fg-opacity: 0.16; }\n\n.mdc-icon-button__icon {\n display: inline-block; }\n .mdc-icon-button__icon.mdc-icon-button__icon--on {\n display: none; }\n\n.mdc-icon-button--on .mdc-icon-button__icon {\n display: none; }\n .mdc-icon-button--on .mdc-icon-button__icon.mdc-icon-button__icon--on {\n display: inline-block; }", ""]);
  6844. // Exports
  6845. exports.locals = {
  6846. "mdc-ripple-surface--test-edge-var-bug": "mdc-ripple-surface--test-edge-var-bug",
  6847. "mdc-icon-button": "mdc-icon-button",
  6848. "mdc-ripple-upgraded": "mdc-ripple-upgraded",
  6849. "mdc-ripple-upgraded--unbounded": "mdc-ripple-upgraded--unbounded",
  6850. "mdc-ripple-upgraded--foreground-activation": "mdc-ripple-upgraded--foreground-activation",
  6851. "mdc-ripple-upgraded--foreground-deactivation": "mdc-ripple-upgraded--foreground-deactivation",
  6852. "mdc-ripple-upgraded--background-focused": "mdc-ripple-upgraded--background-focused",
  6853. "mdc-icon-button__icon": "mdc-icon-button__icon",
  6854. "mdc-icon-button__icon--on": "mdc-icon-button__icon--on",
  6855. "mdc-icon-button--on": "mdc-icon-button--on",
  6856. "mdc-ripple-fg-radius-in": "mdc-ripple-fg-radius-in",
  6857. "mdc-ripple-fg-opacity-in": "mdc-ripple-fg-opacity-in",
  6858. "mdc-ripple-fg-opacity-out": "mdc-ripple-fg-opacity-out"
  6859. };
  6860. module.exports = exports;
  6861.  
  6862.  
  6863. /***/ }),
  6864. /* 71 */
  6865. /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
  6866.  
  6867. "use strict";
  6868. // ESM COMPAT FLAG
  6869. __webpack_require__.r(__webpack_exports__);
  6870.  
  6871. // EXPORTS
  6872. __webpack_require__.d(__webpack_exports__, "environment", function() { return /* reexport */ environment; });
  6873. __webpack_require__.d(__webpack_exports__, "errors", function() { return /* reexport */ errors_namespaceObject; });
  6874. __webpack_require__.d(__webpack_exports__, "log", function() { return /* reexport */ log_namespaceObject; });
  6875. __webpack_require__.d(__webpack_exports__, "operations", function() { return /* reexport */ operations; });
  6876. __webpack_require__.d(__webpack_exports__, "preferences", function() { return /* reexport */ preferences_namespaceObject; });
  6877. __webpack_require__.d(__webpack_exports__, "stylesheets", function() { return /* reexport */ stylesheets; });
  6878. __webpack_require__.d(__webpack_exports__, "userscripter", function() { return /* reexport */ userscripter_namespaceObject; });
  6879.  
  6880. // NAMESPACE OBJECT: ./node_modules/userscripter/lib/errors.mjs
  6881. var errors_namespaceObject = {};
  6882. __webpack_require__.r(errors_namespaceObject);
  6883. __webpack_require__.d(errors_namespaceObject, "explanation", function() { return explanation; });
  6884. __webpack_require__.d(errors_namespaceObject, "failureDescriber", function() { return failureDescriber; });
  6885.  
  6886. // NAMESPACE OBJECT: ./node_modules/userscripter/lib/log.mjs
  6887. var log_namespaceObject = {};
  6888. __webpack_require__.r(log_namespaceObject);
  6889. __webpack_require__.d(log_namespaceObject, "setPrefix", function() { return setPrefix; });
  6890. __webpack_require__.d(log_namespaceObject, "setLogger", function() { return setLogger; });
  6891. __webpack_require__.d(log_namespaceObject, "log", function() { return log; });
  6892. __webpack_require__.d(log_namespaceObject, "info", function() { return info; });
  6893. __webpack_require__.d(log_namespaceObject, "warning", function() { return warning; });
  6894. __webpack_require__.d(log_namespaceObject, "error", function() { return error; });
  6895.  
  6896. // NAMESPACE OBJECT: ./node_modules/userscripter/lib/preferences.mjs
  6897. var preferences_namespaceObject = {};
  6898. __webpack_require__.r(preferences_namespaceObject);
  6899. __webpack_require__.d(preferences_namespaceObject, "subscriptable", function() { return subscriptable; });
  6900. __webpack_require__.d(preferences_namespaceObject, "loggingResponseHandler", function() { return loggingResponseHandler; });
  6901. __webpack_require__.d(preferences_namespaceObject, "noopResponseHandler", function() { return noopResponseHandler; });
  6902.  
  6903. // NAMESPACE OBJECT: ./node_modules/userscripter/lib/userscripter.mjs
  6904. var userscripter_namespaceObject = {};
  6905. __webpack_require__.r(userscripter_namespaceObject);
  6906. __webpack_require__.d(userscripter_namespaceObject, "run", function() { return run; });
  6907.  
  6908. // EXTERNAL MODULE: ./node_modules/userscripter/lib/environment.mjs
  6909. var environment = __webpack_require__(18);
  6910.  
  6911. // CONCATENATED MODULE: ./node_modules/lines-unlines/dist/index.mjs
  6912. function lines(s) {
  6913. return s === "" ? [] : s.replace(/\n$/, "").split("\n");
  6914. }
  6915. function unlines(ls) {
  6916. return ls.map(line => line + "\n").join("");
  6917. }
  6918. //# sourceMappingURL=index.js.map
  6919. // CONCATENATED MODULE: ./node_modules/userscripter/lib/errors.mjs
  6920.  
  6921. const INDENTATION = " ";
  6922. function formatDependency(d) {
  6923. return INDENTATION + d.key + ": " + d.selector;
  6924. }
  6925. function explanation(failure) {
  6926. switch (failure.result.reason) {
  6927. case 0:
  6928. return unlines([
  6929. `These dependencies were not found:`,
  6930. ``,
  6931. unlines(failure.result.dependencies.map(formatDependency)),
  6932. ]);
  6933. case 1:
  6934. return unlines([
  6935. `The operation failed with this error:`,
  6936. ``,
  6937. failure.result.message,
  6938. ]);
  6939. }
  6940. }
  6941. function failureDescriber(context) {
  6942. return failure => unlines([
  6943. `Could not ${failure.operation.description} on this page:`,
  6944. ``,
  6945. INDENTATION + location.href,
  6946. ``,
  6947. explanation(failure).trim(),
  6948. ``,
  6949. `This problem might be caused by ${context.siteName} changing its content/structure, in which case ${context.extensionName} needs to be updated accordingly. Otherwise, it's probably a bug in ${context.extensionName}.`,
  6950. ``,
  6951. `If you file a bug report, please include this message.`,
  6952. ]);
  6953. }
  6954.  
  6955. // CONCATENATED MODULE: ./node_modules/userscripter/lib/log.mjs
  6956. let prefix = "";
  6957. let logger = console;
  6958. function setPrefix(p) {
  6959. prefix = p;
  6960. }
  6961. function setLogger(l) {
  6962. logger = l;
  6963. }
  6964. function log(str) {
  6965. logger.log(prefix, str);
  6966. }
  6967. function info(str) {
  6968. logger.info(prefix, str);
  6969. }
  6970. function warning(str) {
  6971. logger.warn(prefix, str);
  6972. }
  6973. function error(str) {
  6974. logger.error(prefix, str);
  6975. }
  6976.  
  6977. // EXTERNAL MODULE: ./node_modules/userscripter/lib/operations.mjs + 1 modules
  6978. var operations = __webpack_require__(17);
  6979.  
  6980. // CONCATENATED MODULE: ./node_modules/userscripter/lib/preferences.mjs
  6981.  
  6982. function subscriptable(handler) {
  6983. const changeListeners = new Set();
  6984. return {
  6985. subscribe: (listener) => { changeListeners.add(listener); },
  6986. unsubscribe: (listener) => { changeListeners.delete(listener); },
  6987. handler: (summary, preferences) => {
  6988. if (summary.action === "set") {
  6989. changeListeners.forEach(f => f(summary.preference));
  6990. }
  6991. return handler(summary, preferences);
  6992. },
  6993. };
  6994. }
  6995. function loggingResponseHandler(summary, preferences) {
  6996. const response = summary.response;
  6997. switch (response.status) {
  6998. case 0:
  6999. return response;
  7000. case 1:
  7001. if (summary.action === "get") {
  7002. warning(`The saved value for preference '${summary.preference.key}' (${JSON.stringify(response.saved)}) was invalid. Replacing it with ${JSON.stringify(response.value)}.`);
  7003. preferences.set(summary.preference, response.value);
  7004. }
  7005. if (summary.action === "set") {
  7006. warning(`Could not set value ${JSON.stringify(response.value)} for preference '${summary.preference.key}' because it was invalid.`);
  7007. }
  7008. return response;
  7009. case 2:
  7010. if (summary.action === "get") {
  7011. warning(`The saved value for preference '${summary.preference.key}' had the wrong type. Replacing it with ${JSON.stringify(response.value)}.`);
  7012. preferences.set(summary.preference, response.value);
  7013. }
  7014. return response;
  7015. case 3:
  7016. if (summary.action === "get") {
  7017. warning(`The saved value for preference '${summary.preference.key}' could not be parsed. Replacing it with ${JSON.stringify(response.value)}.`);
  7018. preferences.set(summary.preference, response.value);
  7019. }
  7020. return response;
  7021. case 4:
  7022. switch (summary.action) {
  7023. case "get":
  7024. error(`Could not read preference '${summary.preference.key}' because localStorage could not be accessed. Using value ${JSON.stringify(summary.preference.default)}.`);
  7025. break;
  7026. case "set":
  7027. error(`Could not save value ${JSON.stringify(summary.response.value)} for preference '${summary.preference.key}' because localStorage could not be accessed.`);
  7028. break;
  7029. default:
  7030. assertUnreachable(summary.action);
  7031. }
  7032. return response;
  7033. default:
  7034. return assertUnreachable(response.status);
  7035. }
  7036. }
  7037. function noopResponseHandler(summary, _) {
  7038. return summary.response;
  7039. }
  7040. function assertUnreachable(x) {
  7041. throw new Error("assertUnreachable: " + x);
  7042. }
  7043.  
  7044. // EXTERNAL MODULE: ./node_modules/userscripter/lib/stylesheets.mjs
  7045. var stylesheets = __webpack_require__(16);
  7046.  
  7047. // CONCATENATED MODULE: ./node_modules/userscripter/lib/userscripter.mjs
  7048.  
  7049.  
  7050.  
  7051. function run(userscript) {
  7052. setPrefix(`[${userscript.name}]`);
  7053. const attr = attribute(userscript.id);
  7054. if (document.documentElement.hasAttribute(attr)) {
  7055. warning(`It looks as though ${userscript.name} has already run (because the attribute "${attr}" was found on <head>). Stopping.`);
  7056. }
  7057. else {
  7058. document.documentElement.setAttribute(attr, "");
  7059. userscript.initialAction();
  7060. stylesheets["insert"](userscript.stylesheets);
  7061. operations["run"](userscript.operationsPlan);
  7062. }
  7063. }
  7064. function attribute(id) {
  7065. return "data-" + id + "-has-run";
  7066. }
  7067.  
  7068. // CONCATENATED MODULE: ./node_modules/userscripter/lib/index.mjs
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079. /***/ }),
  7080. /* 72 */
  7081. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7082.  
  7083. "use strict";
  7084. // ESM COMPAT FLAG
  7085. __webpack_require__.r(__webpack_exports__);
  7086.  
  7087. // EXPORTS
  7088. __webpack_require__.d(__webpack_exports__, "MDCLinearProgressFoundation", function() { return /* reexport */ foundation_MDCLinearProgressFoundation; });
  7089. __webpack_require__.d(__webpack_exports__, "MDCLinearProgress", function() { return /* binding */ linear_progress_MDCLinearProgress; });
  7090.  
  7091. // EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
  7092. var foundation = __webpack_require__(1);
  7093.  
  7094. // EXTERNAL MODULE: ./node_modules/@material/base/component.js
  7095. var component = __webpack_require__(2);
  7096.  
  7097. // CONCATENATED MODULE: ./node_modules/@material/base/index.js
  7098. /**
  7099. * @license
  7100. * Copyright 2016 Google Inc.
  7101. *
  7102. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7103. * of this software and associated documentation files (the "Software"), to deal
  7104. * in the Software without restriction, including without limitation the rights
  7105. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7106. * copies of the Software, and to permit persons to whom the Software is
  7107. * furnished to do so, subject to the following conditions:
  7108. *
  7109. * The above copyright notice and this permission notice shall be included in
  7110. * all copies or substantial portions of the Software.
  7111. *
  7112. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7113. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7114. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7115. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7116. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7117. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7118. * THE SOFTWARE.
  7119. */
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126. // EXTERNAL MODULE: ./node_modules/@material/animation/index.js
  7127. var animation = __webpack_require__(9);
  7128.  
  7129. // CONCATENATED MODULE: ./node_modules/@material/linear-progress/constants.js
  7130. /**
  7131. * @license
  7132. * Copyright 2017 Google Inc.
  7133. *
  7134. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7135. * of this software and associated documentation files (the "Software"), to deal
  7136. * in the Software without restriction, including without limitation the rights
  7137. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7138. * copies of the Software, and to permit persons to whom the Software is
  7139. * furnished to do so, subject to the following conditions:
  7140. *
  7141. * The above copyright notice and this permission notice shall be included in
  7142. * all copies or substantial portions of the Software.
  7143. *
  7144. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7145. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7146. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7147. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7148. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7149. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7150. * THE SOFTWARE.
  7151. */
  7152.  
  7153. const cssClasses = {
  7154. CLOSED_CLASS: 'mdc-linear-progress--closed',
  7155. INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
  7156. REVERSED_CLASS: 'mdc-linear-progress--reversed',
  7157. };
  7158.  
  7159. const strings = {
  7160. PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar',
  7161. BUFFER_SELECTOR: '.mdc-linear-progress__buffer',
  7162. };
  7163.  
  7164. // CONCATENATED MODULE: ./node_modules/@material/linear-progress/foundation.js
  7165. /**
  7166. * @license
  7167. * Copyright 2017 Google Inc.
  7168. *
  7169. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7170. * of this software and associated documentation files (the "Software"), to deal
  7171. * in the Software without restriction, including without limitation the rights
  7172. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7173. * copies of the Software, and to permit persons to whom the Software is
  7174. * furnished to do so, subject to the following conditions:
  7175. *
  7176. * The above copyright notice and this permission notice shall be included in
  7177. * all copies or substantial portions of the Software.
  7178. *
  7179. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7180. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7181. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7182. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7183. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7184. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7185. * THE SOFTWARE.
  7186. */
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193. class foundation_MDCLinearProgressFoundation extends foundation["a" /* default */] {
  7194. static get cssClasses() {
  7195. return cssClasses;
  7196. }
  7197.  
  7198. static get strings() {
  7199. return strings;
  7200. }
  7201.  
  7202. static get defaultAdapter() {
  7203. return {
  7204. addClass: (/* className: string */) => {},
  7205. getPrimaryBar: () => /* el: Element */ {},
  7206. getBuffer: () => /* el: Element */ {},
  7207. hasClass: (/* className: string */) => false,
  7208. removeClass: (/* className: string */) => {},
  7209. setStyle: (/* el: Element, styleProperty: string, value: string */) => {},
  7210. };
  7211. }
  7212.  
  7213. constructor(adapter) {
  7214. super(Object.assign(foundation_MDCLinearProgressFoundation.defaultAdapter, adapter));
  7215. }
  7216.  
  7217. init() {
  7218. this.determinate_ = !this.adapter_.hasClass(cssClasses.INDETERMINATE_CLASS);
  7219. this.reverse_ = this.adapter_.hasClass(cssClasses.REVERSED_CLASS);
  7220. this.progress_ = 0;
  7221. }
  7222.  
  7223. setDeterminate(isDeterminate) {
  7224. this.determinate_ = isDeterminate;
  7225. if (this.determinate_) {
  7226. this.adapter_.removeClass(cssClasses.INDETERMINATE_CLASS);
  7227. this.setScale_(this.adapter_.getPrimaryBar(), this.progress_);
  7228. } else {
  7229. this.adapter_.addClass(cssClasses.INDETERMINATE_CLASS);
  7230. this.setScale_(this.adapter_.getPrimaryBar(), 1);
  7231. this.setScale_(this.adapter_.getBuffer(), 1);
  7232. }
  7233. }
  7234.  
  7235. setProgress(value) {
  7236. this.progress_ = value;
  7237. if (this.determinate_) {
  7238. this.setScale_(this.adapter_.getPrimaryBar(), value);
  7239. }
  7240. }
  7241.  
  7242. setBuffer(value) {
  7243. if (this.determinate_) {
  7244. this.setScale_(this.adapter_.getBuffer(), value);
  7245. }
  7246. }
  7247.  
  7248. setReverse(isReversed) {
  7249. this.reverse_ = isReversed;
  7250. if (this.reverse_) {
  7251. this.adapter_.addClass(cssClasses.REVERSED_CLASS);
  7252. } else {
  7253. this.adapter_.removeClass(cssClasses.REVERSED_CLASS);
  7254. }
  7255. }
  7256.  
  7257. open() {
  7258. this.adapter_.removeClass(cssClasses.CLOSED_CLASS);
  7259. }
  7260.  
  7261. close() {
  7262. this.adapter_.addClass(cssClasses.CLOSED_CLASS);
  7263. }
  7264.  
  7265. setScale_(el, scaleValue) {
  7266. const value = 'scaleX(' + scaleValue + ')';
  7267. animation["c" /* transformStyleProperties */].forEach((transformStyleProperty) => {
  7268. this.adapter_.setStyle(el, transformStyleProperty, value);
  7269. });
  7270. }
  7271. }
  7272.  
  7273. // CONCATENATED MODULE: ./node_modules/@material/linear-progress/index.js
  7274. /**
  7275. * @license
  7276. * Copyright 2017 Google Inc.
  7277. *
  7278. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7279. * of this software and associated documentation files (the "Software"), to deal
  7280. * in the Software without restriction, including without limitation the rights
  7281. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7282. * copies of the Software, and to permit persons to whom the Software is
  7283. * furnished to do so, subject to the following conditions:
  7284. *
  7285. * The above copyright notice and this permission notice shall be included in
  7286. * all copies or substantial portions of the Software.
  7287. *
  7288. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7289. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7290. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7291. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7292. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7293. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7294. * THE SOFTWARE.
  7295. */
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302. class linear_progress_MDCLinearProgress extends component["a" /* default */] {
  7303. static attachTo(root) {
  7304. return new linear_progress_MDCLinearProgress(root);
  7305. }
  7306.  
  7307. set determinate(value) {
  7308. this.foundation_.setDeterminate(value);
  7309. }
  7310.  
  7311. set progress(value) {
  7312. this.foundation_.setProgress(value);
  7313. }
  7314.  
  7315. set buffer(value) {
  7316. this.foundation_.setBuffer(value);
  7317. }
  7318.  
  7319. set reverse(value) {
  7320. this.foundation_.setReverse(value);
  7321. }
  7322.  
  7323. open() {
  7324. this.foundation_.open();
  7325. }
  7326.  
  7327. close() {
  7328. this.foundation_.close();
  7329. }
  7330.  
  7331. getDefaultFoundation() {
  7332. return new foundation_MDCLinearProgressFoundation({
  7333. addClass: (className) => this.root_.classList.add(className),
  7334. getPrimaryBar: () => this.root_.querySelector(foundation_MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR),
  7335. getBuffer: () => this.root_.querySelector(foundation_MDCLinearProgressFoundation.strings.BUFFER_SELECTOR),
  7336. hasClass: (className) => this.root_.classList.contains(className),
  7337. removeClass: (className) => this.root_.classList.remove(className),
  7338. setStyle: (el, styleProperty, value) => el.style[styleProperty] = value,
  7339. });
  7340. }
  7341. }
  7342.  
  7343.  
  7344. /***/ }),
  7345. /* 73 */
  7346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7347.  
  7348. "use strict";
  7349. // ESM COMPAT FLAG
  7350. __webpack_require__.r(__webpack_exports__);
  7351.  
  7352. // EXPORTS
  7353. __webpack_require__.d(__webpack_exports__, "MDCSliderFoundation", function() { return /* reexport */ slider_foundation; });
  7354. __webpack_require__.d(__webpack_exports__, "MDCSlider", function() { return /* binding */ slider_MDCSlider; });
  7355.  
  7356. // EXTERNAL MODULE: ./node_modules/@material/base/component.js
  7357. var component = __webpack_require__(2);
  7358.  
  7359. // CONCATENATED MODULE: ./node_modules/@material/slider/constants.js
  7360. /**
  7361. * @license
  7362. * Copyright 2017 Google Inc.
  7363. *
  7364. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7365. * of this software and associated documentation files (the "Software"), to deal
  7366. * in the Software without restriction, including without limitation the rights
  7367. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7368. * copies of the Software, and to permit persons to whom the Software is
  7369. * furnished to do so, subject to the following conditions:
  7370. *
  7371. * The above copyright notice and this permission notice shall be included in
  7372. * all copies or substantial portions of the Software.
  7373. *
  7374. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7375. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7376. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7377. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7378. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7379. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7380. * THE SOFTWARE.
  7381. */
  7382.  
  7383. /** @enum {string} */
  7384. const cssClasses = {
  7385. ACTIVE: 'mdc-slider--active',
  7386. DISABLED: 'mdc-slider--disabled',
  7387. DISCRETE: 'mdc-slider--discrete',
  7388. FOCUS: 'mdc-slider--focus',
  7389. IN_TRANSIT: 'mdc-slider--in-transit',
  7390. IS_DISCRETE: 'mdc-slider--discrete',
  7391. HAS_TRACK_MARKER: 'mdc-slider--display-markers',
  7392. };
  7393.  
  7394. /** @enum {string} */
  7395. const strings = {
  7396. TRACK_SELECTOR: '.mdc-slider__track',
  7397. TRACK_MARKER_CONTAINER_SELECTOR: '.mdc-slider__track-marker-container',
  7398. LAST_TRACK_MARKER_SELECTOR: '.mdc-slider__track-marker:last-child',
  7399. THUMB_CONTAINER_SELECTOR: '.mdc-slider__thumb-container',
  7400. PIN_VALUE_MARKER_SELECTOR: '.mdc-slider__pin-value-marker',
  7401. ARIA_VALUEMIN: 'aria-valuemin',
  7402. ARIA_VALUEMAX: 'aria-valuemax',
  7403. ARIA_VALUENOW: 'aria-valuenow',
  7404. ARIA_DISABLED: 'aria-disabled',
  7405. STEP_DATA_ATTR: 'data-step',
  7406. CHANGE_EVENT: 'MDCSlider:change',
  7407. INPUT_EVENT: 'MDCSlider:input',
  7408. };
  7409.  
  7410. /** @enum {number} */
  7411. const numbers = {
  7412. PAGE_FACTOR: 4,
  7413. };
  7414.  
  7415.  
  7416.  
  7417. // CONCATENATED MODULE: ./node_modules/@material/slider/adapter.js
  7418. /**
  7419. * @license
  7420. * Copyright 2017 Google Inc.
  7421. *
  7422. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7423. * of this software and associated documentation files (the "Software"), to deal
  7424. * in the Software without restriction, including without limitation the rights
  7425. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7426. * copies of the Software, and to permit persons to whom the Software is
  7427. * furnished to do so, subject to the following conditions:
  7428. *
  7429. * The above copyright notice and this permission notice shall be included in
  7430. * all copies or substantial portions of the Software.
  7431. *
  7432. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7433. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7434. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7435. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7436. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7437. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7438. * THE SOFTWARE.
  7439. */
  7440.  
  7441. /* eslint-disable no-unused-vars */
  7442.  
  7443. /**
  7444. * Adapter for MDC Slider.
  7445. *
  7446. * Defines the shape of the adapter expected by the foundation. Implement this
  7447. * adapter to integrate the Slider into your framework. See
  7448. * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md
  7449. * for more information.
  7450. *
  7451. * @record
  7452. */
  7453. class MDCSliderAdapter {
  7454. /**
  7455. * Returns true if className exists for the slider Element
  7456. * @param {string} className
  7457. * @return {boolean}
  7458. */
  7459. hasClass(className) {}
  7460.  
  7461. /**
  7462. * Adds a class to the slider Element
  7463. * @param {string} className
  7464. */
  7465. addClass(className) {}
  7466.  
  7467. /**
  7468. * Removes a class from the slider Element
  7469. * @param {string} className
  7470. */
  7471. removeClass(className) {}
  7472.  
  7473. /**
  7474. * Returns a string if attribute name exists on the slider Element,
  7475. * otherwise returns null
  7476. * @param {string} name
  7477. * @return {?string}
  7478. */
  7479. getAttribute(name) {}
  7480.  
  7481. /**
  7482. * Sets attribute name on slider Element to value
  7483. * @param {string} name
  7484. * @param {string} value
  7485. */
  7486. setAttribute(name, value) {}
  7487.  
  7488. /**
  7489. * Removes attribute name from slider Element
  7490. * @param {string} name
  7491. */
  7492. removeAttribute(name) {}
  7493.  
  7494. /**
  7495. * Returns the bounding client rect for the slider Element
  7496. * @return {?ClientRect}
  7497. */
  7498. computeBoundingRect() {}
  7499.  
  7500. /**
  7501. * Returns the tab index of the slider Element
  7502. * @return {number}
  7503. */
  7504. getTabIndex() {}
  7505.  
  7506. /**
  7507. * Registers an event handler on the root element for a given event.
  7508. * @param {string} type
  7509. * @param {function(!Event): undefined} handler
  7510. */
  7511. registerInteractionHandler(type, handler) {}
  7512.  
  7513. /**
  7514. * Deregisters an event handler on the root element for a given event.
  7515. * @param {string} type
  7516. * @param {function(!Event): undefined} handler
  7517. */
  7518. deregisterInteractionHandler(type, handler) {}
  7519.  
  7520. /**
  7521. * Registers an event handler on the thumb container element for a given event.
  7522. * @param {string} type
  7523. * @param {function(!Event): undefined} handler
  7524. */
  7525. registerThumbContainerInteractionHandler(type, handler) {}
  7526.  
  7527. /**
  7528. * Deregisters an event handler on the thumb container element for a given event.
  7529. * @param {string} type
  7530. * @param {function(!Event): undefined} handler
  7531. */
  7532. deregisterThumbContainerInteractionHandler(type, handler) {}
  7533.  
  7534. /**
  7535. * Registers an event handler on the body for a given event.
  7536. * @param {string} type
  7537. * @param {function(!Event): undefined} handler
  7538. */
  7539. registerBodyInteractionHandler(type, handler) {}
  7540.  
  7541. /**
  7542. * Deregisters an event handler on the body for a given event.
  7543. * @param {string} type
  7544. * @param {function(!Event): undefined} handler
  7545. */
  7546. deregisterBodyInteractionHandler(type, handler) {}
  7547.  
  7548. /**
  7549. * Registers an event handler for the window resize event
  7550. * @param {function(!Event): undefined} handler
  7551. */
  7552. registerResizeHandler(handler) {}
  7553.  
  7554. /**
  7555. * Deregisters an event handler for the window resize event
  7556. * @param {function(!Event): undefined} handler
  7557. */
  7558. deregisterResizeHandler(handler) {}
  7559.  
  7560. /**
  7561. * Emits a custom event MDCSlider:input from the root
  7562. */
  7563. notifyInput() {}
  7564.  
  7565. /**
  7566. * Emits a custom event MDCSlider:change from the root
  7567. */
  7568. notifyChange() {}
  7569.  
  7570. /**
  7571. * Sets a style property of the thumb container element to the passed value
  7572. * @param {string} propertyName
  7573. * @param {string} value
  7574. */
  7575. setThumbContainerStyleProperty(propertyName, value) {}
  7576.  
  7577. /**
  7578. * Sets a style property of the track element to the passed value
  7579. * @param {string} propertyName
  7580. * @param {string} value
  7581. */
  7582. setTrackStyleProperty(propertyName, value) {}
  7583.  
  7584. /**
  7585. * Sets the inner text of the pin marker to the passed value
  7586. * @param {number} value
  7587. */
  7588. setMarkerValue(value) {}
  7589.  
  7590. /**
  7591. * Appends the passed number of track markers to the track mark container element
  7592. * @param {number} numMarkers
  7593. */
  7594. appendTrackMarkers(numMarkers) {}
  7595.  
  7596. /**
  7597. * Removes all track markers fromt he track mark container element
  7598. */
  7599. removeTrackMarkers() {}
  7600.  
  7601. /**
  7602. * Sets a style property of the last track marker to the passed value
  7603. * @param {string} propertyName
  7604. * @param {string} value
  7605. */
  7606. setLastTrackMarkersStyleProperty(propertyName, value) {}
  7607.  
  7608. /**
  7609. * Returns true if the root element is RTL, otherwise false
  7610. * @return {boolean}
  7611. */
  7612. isRTL() {}
  7613. }
  7614.  
  7615. /* harmony default export */ var adapter = (MDCSliderAdapter);
  7616.  
  7617. // EXTERNAL MODULE: ./node_modules/@material/animation/index.js
  7618. var animation = __webpack_require__(9);
  7619.  
  7620. // EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
  7621. var foundation = __webpack_require__(1);
  7622.  
  7623. // CONCATENATED MODULE: ./node_modules/@material/slider/foundation.js
  7624. /**
  7625. * @license
  7626. * Copyright 2017 Google Inc.
  7627. *
  7628. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7629. * of this software and associated documentation files (the "Software"), to deal
  7630. * in the Software without restriction, including without limitation the rights
  7631. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7632. * copies of the Software, and to permit persons to whom the Software is
  7633. * furnished to do so, subject to the following conditions:
  7634. *
  7635. * The above copyright notice and this permission notice shall be included in
  7636. * all copies or substantial portions of the Software.
  7637. *
  7638. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7639. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7640. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7641. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7642. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7643. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7644. * THE SOFTWARE.
  7645. */
  7646.  
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653. /** @enum {string} */
  7654. const KEY_IDS = {
  7655. ARROW_LEFT: 'ArrowLeft',
  7656. ARROW_RIGHT: 'ArrowRight',
  7657. ARROW_UP: 'ArrowUp',
  7658. ARROW_DOWN: 'ArrowDown',
  7659. HOME: 'Home',
  7660. END: 'End',
  7661. PAGE_UP: 'PageUp',
  7662. PAGE_DOWN: 'PageDown',
  7663. };
  7664.  
  7665. /** @enum {string} */
  7666. const MOVE_EVENT_MAP = {
  7667. 'mousedown': 'mousemove',
  7668. 'touchstart': 'touchmove',
  7669. 'pointerdown': 'pointermove',
  7670. };
  7671.  
  7672. const DOWN_EVENTS = ['mousedown', 'pointerdown', 'touchstart'];
  7673. const UP_EVENTS = ['mouseup', 'pointerup', 'touchend'];
  7674.  
  7675. /**
  7676. * @extends {MDCFoundation<!MDCSliderAdapter>}
  7677. */
  7678. class foundation_MDCSliderFoundation extends foundation["a" /* default */] {
  7679. /** @return enum {cssClasses} */
  7680. static get cssClasses() {
  7681. return cssClasses;
  7682. }
  7683.  
  7684. /** @return enum {strings} */
  7685. static get strings() {
  7686. return strings;
  7687. }
  7688.  
  7689. /** @return enum {numbers} */
  7690. static get numbers() {
  7691. return numbers;
  7692. }
  7693.  
  7694. /** @return {!MDCSliderAdapter} */
  7695. static get defaultAdapter() {
  7696. return /** @type {!MDCSliderAdapter} */ ({
  7697. hasClass: (/* className: string */) => /* boolean */ false,
  7698. addClass: (/* className: string */) => {},
  7699. removeClass: (/* className: string */) => {},
  7700. getAttribute: (/* name: string */) => /* string|null */ null,
  7701. setAttribute: (/* name: string, value: string */) => {},
  7702. removeAttribute: (/* name: string */) => {},
  7703. computeBoundingRect: () => /* ClientRect */ ({
  7704. top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0,
  7705. }),
  7706. getTabIndex: () => /* number */ 0,
  7707. registerInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7708. deregisterInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7709. registerThumbContainerInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7710. deregisterThumbContainerInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7711. registerBodyInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7712. deregisterBodyInteractionHandler: (/* type: string, handler: EventListener */) => {},
  7713. registerResizeHandler: (/* handler: EventListener */) => {},
  7714. deregisterResizeHandler: (/* handler: EventListener */) => {},
  7715. notifyInput: () => {},
  7716. notifyChange: () => {},
  7717. setThumbContainerStyleProperty: (/* propertyName: string, value: string */) => {},
  7718. setTrackStyleProperty: (/* propertyName: string, value: string */) => {},
  7719. setMarkerValue: (/* value: number */) => {},
  7720. appendTrackMarkers: (/* numMarkers: number */) => {},
  7721. removeTrackMarkers: () => {},
  7722. setLastTrackMarkersStyleProperty: (/* propertyName: string, value: string */) => {},
  7723. isRTL: () => /* boolean */ false,
  7724. });
  7725. }
  7726.  
  7727. /**
  7728. * Creates a new instance of MDCSliderFoundation
  7729. * @param {?MDCSliderAdapter} adapter
  7730. */
  7731. constructor(adapter) {
  7732. super(Object.assign(foundation_MDCSliderFoundation.defaultAdapter, adapter));
  7733. /** @private {?ClientRect} */
  7734. this.rect_ = null;
  7735. // We set this to NaN since we want it to be a number, but we can't use '0' or '-1'
  7736. // because those could be valid tabindices set by the client code.
  7737. this.savedTabIndex_ = NaN;
  7738. this.active_ = false;
  7739. this.inTransit_ = false;
  7740. this.isDiscrete_ = false;
  7741. this.hasTrackMarker_ = false;
  7742. this.handlingThumbTargetEvt_ = false;
  7743. this.min_ = 0;
  7744. this.max_ = 100;
  7745. this.step_ = 0;
  7746. this.value_ = 0;
  7747. this.disabled_ = false;
  7748. this.preventFocusState_ = false;
  7749. this.updateUIFrame_ = 0;
  7750. this.thumbContainerPointerHandler_ = () => {
  7751. this.handlingThumbTargetEvt_ = true;
  7752. };
  7753. this.interactionStartHandler_ = (evt) => this.handleDown_(evt);
  7754. this.keydownHandler_ = (evt) => this.handleKeydown_(evt);
  7755. this.focusHandler_ = () => this.handleFocus_();
  7756. this.blurHandler_ = () => this.handleBlur_();
  7757. this.resizeHandler_ = () => this.layout();
  7758. }
  7759.  
  7760. init() {
  7761. this.isDiscrete_ = this.adapter_.hasClass(cssClasses.IS_DISCRETE);
  7762. this.hasTrackMarker_ = this.adapter_.hasClass(cssClasses.HAS_TRACK_MARKER);
  7763. DOWN_EVENTS.forEach((evtName) => this.adapter_.registerInteractionHandler(evtName, this.interactionStartHandler_));
  7764. this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
  7765. this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
  7766. this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
  7767. DOWN_EVENTS.forEach((evtName) => {
  7768. this.adapter_.registerThumbContainerInteractionHandler(evtName, this.thumbContainerPointerHandler_);
  7769. });
  7770. this.adapter_.registerResizeHandler(this.resizeHandler_);
  7771. this.layout();
  7772. // At last step, provide a reasonable default value to discrete slider
  7773. if (this.isDiscrete_ && this.getStep() == 0) {
  7774. this.step_ = 1;
  7775. }
  7776. }
  7777.  
  7778. destroy() {
  7779. DOWN_EVENTS.forEach((evtName) => {
  7780. this.adapter_.deregisterInteractionHandler(evtName, this.interactionStartHandler_);
  7781. });
  7782. this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
  7783. this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
  7784. this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
  7785. DOWN_EVENTS.forEach((evtName) => {
  7786. this.adapter_.deregisterThumbContainerInteractionHandler(evtName, this.thumbContainerPointerHandler_);
  7787. });
  7788. this.adapter_.deregisterResizeHandler(this.resizeHandler_);
  7789. }
  7790.  
  7791. setupTrackMarker() {
  7792. if (this.isDiscrete_ && this.hasTrackMarker_&& this.getStep() != 0) {
  7793. const min = this.getMin();
  7794. const max = this.getMax();
  7795. const step = this.getStep();
  7796. let numMarkers = (max - min) / step;
  7797.  
  7798. // In case distance between max & min is indivisible to step,
  7799. // we place the secondary to last marker proportionally at where thumb
  7800. // could reach and place the last marker at max value
  7801. const indivisible = Math.ceil(numMarkers) !== numMarkers;
  7802. if (indivisible) {
  7803. numMarkers = Math.ceil(numMarkers);
  7804. }
  7805.  
  7806. this.adapter_.removeTrackMarkers();
  7807. this.adapter_.appendTrackMarkers(numMarkers);
  7808.  
  7809. if (indivisible) {
  7810. const lastStepRatio = (max - numMarkers * step) / step + 1;
  7811. const flex = Object(animation["b" /* getCorrectPropertyName */])(window, 'flex');
  7812. this.adapter_.setLastTrackMarkersStyleProperty(flex, String(lastStepRatio));
  7813. }
  7814. }
  7815. }
  7816.  
  7817. layout() {
  7818. this.rect_ = this.adapter_.computeBoundingRect();
  7819. this.updateUIForCurrentValue_();
  7820. }
  7821.  
  7822. /** @return {number} */
  7823. getValue() {
  7824. return this.value_;
  7825. }
  7826.  
  7827. /** @param {number} value */
  7828. setValue(value) {
  7829. this.setValue_(value, false);
  7830. }
  7831.  
  7832. /** @return {number} */
  7833. getMax() {
  7834. return this.max_;
  7835. }
  7836.  
  7837. /** @param {number} max */
  7838. setMax(max) {
  7839. if (max < this.min_) {
  7840. throw new Error('Cannot set max to be less than the slider\'s minimum value');
  7841. }
  7842. this.max_ = max;
  7843. this.setValue_(this.value_, false, true);
  7844. this.adapter_.setAttribute(strings.ARIA_VALUEMAX, String(this.max_));
  7845. this.setupTrackMarker();
  7846. }
  7847.  
  7848. /** @return {number} */
  7849. getMin() {
  7850. return this.min_;
  7851. }
  7852.  
  7853. /** @param {number} min */
  7854. setMin(min) {
  7855. if (min > this.max_) {
  7856. throw new Error('Cannot set min to be greater than the slider\'s maximum value');
  7857. }
  7858. this.min_ = min;
  7859. this.setValue_(this.value_, false, true);
  7860. this.adapter_.setAttribute(strings.ARIA_VALUEMIN, String(this.min_));
  7861. this.setupTrackMarker();
  7862. }
  7863.  
  7864. /** @return {number} */
  7865. getStep() {
  7866. return this.step_;
  7867. }
  7868.  
  7869. /** @param {number} step */
  7870. setStep(step) {
  7871. if (step < 0) {
  7872. throw new Error('Step cannot be set to a negative number');
  7873. }
  7874. if (this.isDiscrete_ && (typeof(step) !== 'number' || step < 1)) {
  7875. step = 1;
  7876. }
  7877. this.step_ = step;
  7878. this.setValue_(this.value_, false, true);
  7879. this.setupTrackMarker();
  7880. }
  7881.  
  7882. /** @return {boolean} */
  7883. isDisabled() {
  7884. return this.disabled_;
  7885. }
  7886.  
  7887. /** @param {boolean} disabled */
  7888. setDisabled(disabled) {
  7889. this.disabled_ = disabled;
  7890. this.toggleClass_(cssClasses.DISABLED, this.disabled_);
  7891. if (this.disabled_) {
  7892. this.savedTabIndex_ = this.adapter_.getTabIndex();
  7893. this.adapter_.setAttribute(strings.ARIA_DISABLED, 'true');
  7894. this.adapter_.removeAttribute('tabindex');
  7895. } else {
  7896. this.adapter_.removeAttribute(strings.ARIA_DISABLED);
  7897. if (!isNaN(this.savedTabIndex_)) {
  7898. this.adapter_.setAttribute('tabindex', String(this.savedTabIndex_));
  7899. }
  7900. }
  7901. }
  7902.  
  7903. /**
  7904. * Called when the user starts interacting with the slider
  7905. * @param {!Event} evt
  7906. * @private
  7907. */
  7908. handleDown_(evt) {
  7909. if (this.disabled_) {
  7910. return;
  7911. }
  7912.  
  7913. this.preventFocusState_ = true;
  7914. this.setInTransit_(!this.handlingThumbTargetEvt_);
  7915. this.handlingThumbTargetEvt_ = false;
  7916. this.setActive_(true);
  7917.  
  7918. const moveHandler = (evt) => {
  7919. this.handleMove_(evt);
  7920. };
  7921.  
  7922. // Note: upHandler is [de]registered on ALL potential pointer-related release event types, since some browsers
  7923. // do not always fire these consistently in pairs.
  7924. // (See https://github.com/material-components/material-components-web/issues/1192)
  7925. const upHandler = () => {
  7926. this.handleUp_();
  7927. this.adapter_.deregisterBodyInteractionHandler(MOVE_EVENT_MAP[evt.type], moveHandler);
  7928. UP_EVENTS.forEach((evtName) => this.adapter_.deregisterBodyInteractionHandler(evtName, upHandler));
  7929. };
  7930.  
  7931. this.adapter_.registerBodyInteractionHandler(MOVE_EVENT_MAP[evt.type], moveHandler);
  7932. UP_EVENTS.forEach((evtName) => this.adapter_.registerBodyInteractionHandler(evtName, upHandler));
  7933. this.setValueFromEvt_(evt);
  7934. }
  7935.  
  7936. /**
  7937. * Called when the user moves the slider
  7938. * @param {!Event} evt
  7939. * @private
  7940. */
  7941. handleMove_(evt) {
  7942. evt.preventDefault();
  7943. this.setValueFromEvt_(evt);
  7944. }
  7945.  
  7946. /**
  7947. * Called when the user's interaction with the slider ends
  7948. * @private
  7949. */
  7950. handleUp_() {
  7951. this.setActive_(false);
  7952. this.adapter_.notifyChange();
  7953. }
  7954.  
  7955. /**
  7956. * Returns the pageX of the event
  7957. * @param {!Event} evt
  7958. * @return {number}
  7959. * @private
  7960. */
  7961. getPageX_(evt) {
  7962. if (evt.targetTouches && evt.targetTouches.length > 0) {
  7963. return evt.targetTouches[0].pageX;
  7964. }
  7965. return evt.pageX;
  7966. }
  7967.  
  7968. /**
  7969. * Sets the slider value from an event
  7970. * @param {!Event} evt
  7971. * @private
  7972. */
  7973. setValueFromEvt_(evt) {
  7974. const pageX = this.getPageX_(evt);
  7975. const value = this.computeValueFromPageX_(pageX);
  7976. this.setValue_(value, true);
  7977. }
  7978.  
  7979. /**
  7980. * Computes the new value from the pageX position
  7981. * @param {number} pageX
  7982. * @return {number}
  7983. */
  7984. computeValueFromPageX_(pageX) {
  7985. const {max_: max, min_: min} = this;
  7986. const xPos = pageX - this.rect_.left;
  7987. let pctComplete = xPos / this.rect_.width;
  7988. if (this.adapter_.isRTL()) {
  7989. pctComplete = 1 - pctComplete;
  7990. }
  7991. // Fit the percentage complete between the range [min,max]
  7992. // by remapping from [0, 1] to [min, min+(max-min)].
  7993. return min + pctComplete * (max - min);
  7994. }
  7995.  
  7996. /**
  7997. * Handles keydown events
  7998. * @param {!Event} evt
  7999. */
  8000. handleKeydown_(evt) {
  8001. const keyId = this.getKeyId_(evt);
  8002. const value = this.getValueForKeyId_(keyId);
  8003. if (isNaN(value)) {
  8004. return;
  8005. }
  8006.  
  8007. // Prevent page from scrolling due to key presses that would normally scroll the page
  8008. evt.preventDefault();
  8009. this.adapter_.addClass(cssClasses.FOCUS);
  8010. this.setValue_(value, true);
  8011. this.adapter_.notifyChange();
  8012. }
  8013.  
  8014. /**
  8015. * Returns the computed name of the event
  8016. * @param {!Event} kbdEvt
  8017. * @return {string}
  8018. */
  8019. getKeyId_(kbdEvt) {
  8020. if (kbdEvt.key === KEY_IDS.ARROW_LEFT || kbdEvt.keyCode === 37) {
  8021. return KEY_IDS.ARROW_LEFT;
  8022. }
  8023. if (kbdEvt.key === KEY_IDS.ARROW_RIGHT || kbdEvt.keyCode === 39) {
  8024. return KEY_IDS.ARROW_RIGHT;
  8025. }
  8026. if (kbdEvt.key === KEY_IDS.ARROW_UP || kbdEvt.keyCode === 38) {
  8027. return KEY_IDS.ARROW_UP;
  8028. }
  8029. if (kbdEvt.key === KEY_IDS.ARROW_DOWN || kbdEvt.keyCode === 40) {
  8030. return KEY_IDS.ARROW_DOWN;
  8031. }
  8032. if (kbdEvt.key === KEY_IDS.HOME || kbdEvt.keyCode === 36) {
  8033. return KEY_IDS.HOME;
  8034. }
  8035. if (kbdEvt.key === KEY_IDS.END || kbdEvt.keyCode === 35) {
  8036. return KEY_IDS.END;
  8037. }
  8038. if (kbdEvt.key === KEY_IDS.PAGE_UP || kbdEvt.keyCode === 33) {
  8039. return KEY_IDS.PAGE_UP;
  8040. }
  8041. if (kbdEvt.key === KEY_IDS.PAGE_DOWN || kbdEvt.keyCode === 34) {
  8042. return KEY_IDS.PAGE_DOWN;
  8043. }
  8044.  
  8045. return '';
  8046. }
  8047.  
  8048. /**
  8049. * Computes the value given a keyboard key ID
  8050. * @param {string} keyId
  8051. * @return {number}
  8052. */
  8053. getValueForKeyId_(keyId) {
  8054. const {max_: max, min_: min, step_: step} = this;
  8055. let delta = step || (max - min) / 100;
  8056. const valueNeedsToBeFlipped = this.adapter_.isRTL() && (
  8057. keyId === KEY_IDS.ARROW_LEFT || keyId === KEY_IDS.ARROW_RIGHT
  8058. );
  8059. if (valueNeedsToBeFlipped) {
  8060. delta = -delta;
  8061. }
  8062.  
  8063. switch (keyId) {
  8064. case KEY_IDS.ARROW_LEFT:
  8065. case KEY_IDS.ARROW_DOWN:
  8066. return this.value_ - delta;
  8067. case KEY_IDS.ARROW_RIGHT:
  8068. case KEY_IDS.ARROW_UP:
  8069. return this.value_ + delta;
  8070. case KEY_IDS.HOME:
  8071. return this.min_;
  8072. case KEY_IDS.END:
  8073. return this.max_;
  8074. case KEY_IDS.PAGE_UP:
  8075. return this.value_ + delta * numbers.PAGE_FACTOR;
  8076. case KEY_IDS.PAGE_DOWN:
  8077. return this.value_ - delta * numbers.PAGE_FACTOR;
  8078. default:
  8079. return NaN;
  8080. }
  8081. }
  8082.  
  8083. handleFocus_() {
  8084. if (this.preventFocusState_) {
  8085. return;
  8086. }
  8087. this.adapter_.addClass(cssClasses.FOCUS);
  8088. }
  8089.  
  8090. handleBlur_() {
  8091. this.preventFocusState_ = false;
  8092. this.adapter_.removeClass(cssClasses.FOCUS);
  8093. }
  8094.  
  8095. /**
  8096. * Sets the value of the slider
  8097. * @param {number} value
  8098. * @param {boolean} shouldFireInput
  8099. * @param {boolean=} force
  8100. */
  8101. setValue_(value, shouldFireInput, force = false) {
  8102. if (value === this.value_ && !force) {
  8103. return;
  8104. }
  8105.  
  8106. const {min_: min, max_: max} = this;
  8107. const valueSetToBoundary = value === min || value === max;
  8108. if (this.step_ && !valueSetToBoundary) {
  8109. value = this.quantize_(value);
  8110. }
  8111. if (value < min) {
  8112. value = min;
  8113. } else if (value > max) {
  8114. value = max;
  8115. }
  8116. this.value_ = value;
  8117. this.adapter_.setAttribute(strings.ARIA_VALUENOW, String(this.value_));
  8118. this.updateUIForCurrentValue_();
  8119.  
  8120. if (shouldFireInput) {
  8121. this.adapter_.notifyInput();
  8122. if (this.isDiscrete_) {
  8123. this.adapter_.setMarkerValue(value);
  8124. }
  8125. }
  8126. }
  8127.  
  8128. /**
  8129. * Calculates the quantized value
  8130. * @param {number} value
  8131. * @return {number}
  8132. */
  8133. quantize_(value) {
  8134. const numSteps = Math.round(value / this.step_);
  8135. const quantizedVal = numSteps * this.step_;
  8136. return quantizedVal;
  8137. }
  8138.  
  8139. updateUIForCurrentValue_() {
  8140. const {max_: max, min_: min, value_: value} = this;
  8141. const pctComplete = (value - min) / (max - min);
  8142. let translatePx = pctComplete * this.rect_.width;
  8143. if (this.adapter_.isRTL()) {
  8144. translatePx = this.rect_.width - translatePx;
  8145. }
  8146.  
  8147. const transformProp = Object(animation["b" /* getCorrectPropertyName */])(window, 'transform');
  8148. const transitionendEvtName = Object(animation["a" /* getCorrectEventName */])(window, 'transitionend');
  8149.  
  8150. if (this.inTransit_) {
  8151. const onTransitionEnd = () => {
  8152. this.setInTransit_(false);
  8153. this.adapter_.deregisterThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd);
  8154. };
  8155. this.adapter_.registerThumbContainerInteractionHandler(transitionendEvtName, onTransitionEnd);
  8156. }
  8157.  
  8158. this.updateUIFrame_ = requestAnimationFrame(() => {
  8159. // NOTE(traviskaufman): It would be nice to use calc() here,
  8160. // but IE cannot handle calcs in transforms correctly.
  8161. // See: https://goo.gl/NC2itk
  8162. // Also note that the -50% offset is used to center the slider thumb.
  8163. this.adapter_.setThumbContainerStyleProperty(transformProp, `translateX(${translatePx}px) translateX(-50%)`);
  8164. this.adapter_.setTrackStyleProperty(transformProp, `scaleX(${pctComplete})`);
  8165. });
  8166. }
  8167.  
  8168. /**
  8169. * Toggles the active state of the slider
  8170. * @param {boolean} active
  8171. */
  8172. setActive_(active) {
  8173. this.active_ = active;
  8174. this.toggleClass_(cssClasses.ACTIVE, this.active_);
  8175. }
  8176.  
  8177. /**
  8178. * Toggles the inTransit state of the slider
  8179. * @param {boolean} inTransit
  8180. */
  8181. setInTransit_(inTransit) {
  8182. this.inTransit_ = inTransit;
  8183. this.toggleClass_(cssClasses.IN_TRANSIT, this.inTransit_);
  8184. }
  8185.  
  8186. /**
  8187. * Conditionally adds or removes a class based on shouldBePresent
  8188. * @param {string} className
  8189. * @param {boolean} shouldBePresent
  8190. */
  8191. toggleClass_(className, shouldBePresent) {
  8192. if (shouldBePresent) {
  8193. this.adapter_.addClass(className);
  8194. } else {
  8195. this.adapter_.removeClass(className);
  8196. }
  8197. }
  8198. }
  8199.  
  8200. /* harmony default export */ var slider_foundation = (foundation_MDCSliderFoundation);
  8201.  
  8202. // CONCATENATED MODULE: ./node_modules/@material/slider/index.js
  8203. /**
  8204. * @license
  8205. * Copyright 2017 Google Inc.
  8206. *
  8207. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8208. * of this software and associated documentation files (the "Software"), to deal
  8209. * in the Software without restriction, including without limitation the rights
  8210. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8211. * copies of the Software, and to permit persons to whom the Software is
  8212. * furnished to do so, subject to the following conditions:
  8213. *
  8214. * The above copyright notice and this permission notice shall be included in
  8215. * all copies or substantial portions of the Software.
  8216. *
  8217. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8218. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8219. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8220. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8221. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8222. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8223. * THE SOFTWARE.
  8224. */
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232. /**
  8233. * @extends MDCComponent<!MDCSliderFoundation>
  8234. */
  8235. class slider_MDCSlider extends component["a" /* default */] {
  8236. static attachTo(root) {
  8237. return new slider_MDCSlider(root);
  8238. }
  8239.  
  8240. constructor(...args) {
  8241. super(...args);
  8242. /** @type {?Element} */
  8243. this.thumbContainer_;
  8244. /** @type {?Element} */
  8245. this.track_;
  8246. /** @type {?Element} */
  8247. this.pinValueMarker_;
  8248. /** @type {?Element} */
  8249. this.trackMarkerContainer_;
  8250. }
  8251.  
  8252. /** @return {number} */
  8253. get value() {
  8254. return this.foundation_.getValue();
  8255. }
  8256.  
  8257. /** @param {number} value */
  8258. set value(value) {
  8259. this.foundation_.setValue(value);
  8260. }
  8261.  
  8262. /** @return {number} */
  8263. get min() {
  8264. return this.foundation_.getMin();
  8265. }
  8266.  
  8267. /** @param {number} min */
  8268. set min(min) {
  8269. this.foundation_.setMin(min);
  8270. }
  8271.  
  8272. /** @return {number} */
  8273. get max() {
  8274. return this.foundation_.getMax();
  8275. }
  8276.  
  8277. /** @param {number} max */
  8278. set max(max) {
  8279. this.foundation_.setMax(max);
  8280. }
  8281.  
  8282. /** @return {number} */
  8283. get step() {
  8284. return this.foundation_.getStep();
  8285. }
  8286.  
  8287. /** @param {number} step */
  8288. set step(step) {
  8289. this.foundation_.setStep(step);
  8290. }
  8291.  
  8292. /** @return {boolean} */
  8293. get disabled() {
  8294. return this.foundation_.isDisabled();
  8295. }
  8296.  
  8297. /** @param {boolean} disabled */
  8298. set disabled(disabled) {
  8299. this.foundation_.setDisabled(disabled);
  8300. }
  8301.  
  8302. initialize() {
  8303. this.thumbContainer_ = this.root_.querySelector(strings.THUMB_CONTAINER_SELECTOR);
  8304. this.track_ = this.root_.querySelector(strings.TRACK_SELECTOR);
  8305. this.pinValueMarker_ = this.root_.querySelector(strings.PIN_VALUE_MARKER_SELECTOR);
  8306. this.trackMarkerContainer_ = this.root_.querySelector(strings.TRACK_MARKER_CONTAINER_SELECTOR);
  8307. }
  8308.  
  8309. /**
  8310. * @return {!MDCSliderFoundation}
  8311. */
  8312. getDefaultFoundation() {
  8313. return new slider_foundation(
  8314. /** @type {!MDCSliderAdapter} */ ({
  8315. hasClass: (className) => this.root_.classList.contains(className),
  8316. addClass: (className) => this.root_.classList.add(className),
  8317. removeClass: (className) => this.root_.classList.remove(className),
  8318. getAttribute: (name) => this.root_.getAttribute(name),
  8319. setAttribute: (name, value) => this.root_.setAttribute(name, value),
  8320. removeAttribute: (name) => this.root_.removeAttribute(name),
  8321. computeBoundingRect: () => this.root_.getBoundingClientRect(),
  8322. getTabIndex: () => this.root_.tabIndex,
  8323. registerInteractionHandler: (type, handler) => {
  8324. this.root_.addEventListener(type, handler);
  8325. },
  8326. deregisterInteractionHandler: (type, handler) => {
  8327. this.root_.removeEventListener(type, handler);
  8328. },
  8329. registerThumbContainerInteractionHandler: (type, handler) => {
  8330. this.thumbContainer_.addEventListener(type, handler);
  8331. },
  8332. deregisterThumbContainerInteractionHandler: (type, handler) => {
  8333. this.thumbContainer_.removeEventListener(type, handler);
  8334. },
  8335. registerBodyInteractionHandler: (type, handler) => {
  8336. document.body.addEventListener(type, handler);
  8337. },
  8338. deregisterBodyInteractionHandler: (type, handler) => {
  8339. document.body.removeEventListener(type, handler);
  8340. },
  8341. registerResizeHandler: (handler) => {
  8342. window.addEventListener('resize', handler);
  8343. },
  8344. deregisterResizeHandler: (handler) => {
  8345. window.removeEventListener('resize', handler);
  8346. },
  8347. notifyInput: () => {
  8348. this.emit(strings.INPUT_EVENT, this);
  8349. },
  8350. notifyChange: () => {
  8351. this.emit(strings.CHANGE_EVENT, this);
  8352. },
  8353. setThumbContainerStyleProperty: (propertyName, value) => {
  8354. this.thumbContainer_.style.setProperty(propertyName, value);
  8355. },
  8356. setTrackStyleProperty: (propertyName, value) => {
  8357. this.track_.style.setProperty(propertyName, value);
  8358. },
  8359. setMarkerValue: (value) => {
  8360. this.pinValueMarker_.innerText = value;
  8361. },
  8362. appendTrackMarkers: (numMarkers) => {
  8363. const frag = document.createDocumentFragment();
  8364. for (let i = 0; i < numMarkers; i++) {
  8365. const marker = document.createElement('div');
  8366. marker.classList.add('mdc-slider__track-marker');
  8367. frag.appendChild(marker);
  8368. }
  8369. this.trackMarkerContainer_.appendChild(frag);
  8370. },
  8371. removeTrackMarkers: () => {
  8372. while (this.trackMarkerContainer_.firstChild) {
  8373. this.trackMarkerContainer_.removeChild(this.trackMarkerContainer_.firstChild);
  8374. }
  8375. },
  8376. setLastTrackMarkersStyleProperty: (propertyName, value) => {
  8377. // We remove and append new nodes, thus, the last track marker must be dynamically found.
  8378. const lastTrackMarker = this.root_.querySelector(strings.LAST_TRACK_MARKER_SELECTOR);
  8379. lastTrackMarker.style.setProperty(propertyName, value);
  8380. },
  8381. isRTL: () => getComputedStyle(this.root_).direction === 'rtl',
  8382. })
  8383. );
  8384. }
  8385.  
  8386. initialSyncWithDOM() {
  8387. const origValueNow = parseFloat(this.root_.getAttribute(strings.ARIA_VALUENOW));
  8388. this.min = parseFloat(this.root_.getAttribute(strings.ARIA_VALUEMIN)) || this.min;
  8389. this.max = parseFloat(this.root_.getAttribute(strings.ARIA_VALUEMAX)) || this.max;
  8390. this.step = parseFloat(this.root_.getAttribute(strings.STEP_DATA_ATTR)) || this.step;
  8391. this.value = origValueNow || this.value;
  8392. this.disabled = (
  8393. this.root_.hasAttribute(strings.ARIA_DISABLED) &&
  8394. this.root_.getAttribute(strings.ARIA_DISABLED) !== 'false'
  8395. );
  8396. this.foundation_.setupTrackMarker();
  8397. }
  8398.  
  8399. layout() {
  8400. this.foundation_.layout();
  8401. }
  8402.  
  8403. /** @param {number=} amount */
  8404. stepUp(amount = (this.step || 1)) {
  8405. this.value += amount;
  8406. }
  8407.  
  8408. /** @param {number=} amount */
  8409. stepDown(amount = (this.step || 1)) {
  8410. this.value -= amount;
  8411. }
  8412. }
  8413.  
  8414.  
  8415.  
  8416.  
  8417. /***/ }),
  8418. /* 74 */
  8419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8420.  
  8421. "use strict";
  8422. // ESM COMPAT FLAG
  8423. __webpack_require__.r(__webpack_exports__);
  8424.  
  8425. // EXPORTS
  8426. __webpack_require__.d(__webpack_exports__, "MDCIconButtonToggle", function() { return /* binding */ icon_button_MDCIconButtonToggle; });
  8427. __webpack_require__.d(__webpack_exports__, "MDCIconButtonToggleFoundation", function() { return /* reexport */ icon_button_foundation; });
  8428.  
  8429. // EXTERNAL MODULE: ./node_modules/@material/base/component.js
  8430. var component = __webpack_require__(2);
  8431.  
  8432. // EXTERNAL MODULE: ./node_modules/@material/base/foundation.js
  8433. var foundation = __webpack_require__(1);
  8434.  
  8435. // CONCATENATED MODULE: ./node_modules/@material/icon-button/adapter.js
  8436. /**
  8437. * @license
  8438. * Copyright 2018 Google Inc.
  8439. *
  8440. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8441. * of this software and associated documentation files (the "Software"), to deal
  8442. * in the Software without restriction, including without limitation the rights
  8443. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8444. * copies of the Software, and to permit persons to whom the Software is
  8445. * furnished to do so, subject to the following conditions:
  8446. *
  8447. * The above copyright notice and this permission notice shall be included in
  8448. * all copies or substantial portions of the Software.
  8449. *
  8450. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8451. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8452. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8453. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8454. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8455. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8456. * THE SOFTWARE.
  8457. */
  8458.  
  8459. /* eslint no-unused-vars: [2, {"args": "none"}] */
  8460.  
  8461. /**
  8462. * Adapter for MDC Icon Button Toggle. Provides an interface for managing
  8463. * - classes
  8464. * - dom
  8465. * - inner text
  8466. * - event handlers
  8467. * - event dispatch
  8468. *
  8469. * Additionally, provides type information for the adapter to the Closure
  8470. * compiler.
  8471. *
  8472. * Implement this adapter for your framework of choice to delegate updates to
  8473. * the component in your framework of choice. See architecture documentation
  8474. * for more details.
  8475. * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
  8476. *
  8477. * @record
  8478. */
  8479.  
  8480. class MDCIconButtonToggleAdapter {
  8481. /** @param {string} className */
  8482. addClass(className) {}
  8483.  
  8484. /** @param {string} className */
  8485. removeClass(className) {}
  8486.  
  8487. /**
  8488. * @param {string} className
  8489. * @return {boolean}
  8490. * */
  8491. hasClass(className) {}
  8492.  
  8493. /**
  8494. * @param {string} attrName
  8495. * @param {string} attrValue
  8496. */
  8497. setAttr(attrName, attrValue) {}
  8498.  
  8499. /** @param {!IconButtonToggleEvent} evtData */
  8500. notifyChange(evtData) {}
  8501. }
  8502.  
  8503. /**
  8504. * @typedef {{
  8505. * isOn: boolean,
  8506. * }}
  8507. */
  8508. let IconButtonToggleEvent;
  8509.  
  8510.  
  8511.  
  8512. // CONCATENATED MODULE: ./node_modules/@material/icon-button/constants.js
  8513. /**
  8514. * @license
  8515. * Copyright 2018 Google Inc.
  8516. *
  8517. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8518. * of this software and associated documentation files (the "Software"), to deal
  8519. * in the Software without restriction, including without limitation the rights
  8520. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8521. * copies of the Software, and to permit persons to whom the Software is
  8522. * furnished to do so, subject to the following conditions:
  8523. *
  8524. * The above copyright notice and this permission notice shall be included in
  8525. * all copies or substantial portions of the Software.
  8526. *
  8527. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8528. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8529. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8530. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8531. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8532. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8533. * THE SOFTWARE.
  8534. */
  8535.  
  8536. /** @enum {string} */
  8537. const cssClasses = {
  8538. ROOT: 'mdc-icon-button',
  8539. ICON_BUTTON_ON: 'mdc-icon-button--on',
  8540. };
  8541.  
  8542. /** @enum {string} */
  8543. const strings = {
  8544. ARIA_PRESSED: 'aria-pressed',
  8545. ARIA_LABEL: 'aria-label',
  8546. CHANGE_EVENT: 'MDCIconButtonToggle:change',
  8547. };
  8548.  
  8549.  
  8550.  
  8551. // CONCATENATED MODULE: ./node_modules/@material/icon-button/foundation.js
  8552. /**
  8553. * @license
  8554. * Copyright 2018 Google Inc.
  8555. *
  8556. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8557. * of this software and associated documentation files (the "Software"), to deal
  8558. * in the Software without restriction, including without limitation the rights
  8559. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8560. * copies of the Software, and to permit persons to whom the Software is
  8561. * furnished to do so, subject to the following conditions:
  8562. *
  8563. * The above copyright notice and this permission notice shall be included in
  8564. * all copies or substantial portions of the Software.
  8565. *
  8566. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8567. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8568. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8569. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8570. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8571. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8572. * THE SOFTWARE.
  8573. */
  8574.  
  8575.  
  8576. /* eslint-disable no-unused-vars */
  8577.  
  8578.  
  8579.  
  8580. /**
  8581. * @extends {MDCFoundation<!MDCIconButtonToggleAdapter>}
  8582. */
  8583. class foundation_MDCIconButtonToggleFoundation extends foundation["a" /* default */] {
  8584. static get cssClasses() {
  8585. return cssClasses;
  8586. }
  8587.  
  8588. static get strings() {
  8589. return strings;
  8590. }
  8591.  
  8592. static get defaultAdapter() {
  8593. return {
  8594. addClass: () => {},
  8595. removeClass: () => {},
  8596. hasClass: () => {},
  8597. setAttr: () => {},
  8598. notifyChange: () => {},
  8599. };
  8600. }
  8601.  
  8602. constructor(adapter) {
  8603. super(Object.assign(foundation_MDCIconButtonToggleFoundation.defaultAdapter, adapter));
  8604.  
  8605. /** @private {boolean} */
  8606. this.disabled_ = false;
  8607. }
  8608.  
  8609. init() {
  8610. this.adapter_.setAttr(strings.ARIA_PRESSED, `${this.isOn()}`);
  8611. }
  8612.  
  8613. handleClick() {
  8614. this.toggle();
  8615. this.adapter_.notifyChange(/** @type {!IconButtonToggleEvent} */ ({isOn: this.isOn()}));
  8616. }
  8617.  
  8618. /** @return {boolean} */
  8619. isOn() {
  8620. return this.adapter_.hasClass(cssClasses.ICON_BUTTON_ON);
  8621. }
  8622.  
  8623. /** @param {boolean=} isOn */
  8624. toggle(isOn = !this.isOn()) {
  8625. if (isOn) {
  8626. this.adapter_.addClass(cssClasses.ICON_BUTTON_ON);
  8627. } else {
  8628. this.adapter_.removeClass(cssClasses.ICON_BUTTON_ON);
  8629. }
  8630.  
  8631. this.adapter_.setAttr(strings.ARIA_PRESSED, `${isOn}`);
  8632. }
  8633. }
  8634.  
  8635. /** @record */
  8636. class IconButtonToggleState {}
  8637.  
  8638. /* harmony default export */ var icon_button_foundation = (foundation_MDCIconButtonToggleFoundation);
  8639.  
  8640. // EXTERNAL MODULE: ./node_modules/@material/ripple/index.js + 4 modules
  8641. var _material_ripple = __webpack_require__(22);
  8642.  
  8643. // CONCATENATED MODULE: ./node_modules/@material/icon-button/index.js
  8644. /**
  8645. * @license
  8646. * Copyright 2018 Google Inc.
  8647. *
  8648. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8649. * of this software and associated documentation files (the "Software"), to deal
  8650. * in the Software without restriction, including without limitation the rights
  8651. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8652. * copies of the Software, and to permit persons to whom the Software is
  8653. * furnished to do so, subject to the following conditions:
  8654. *
  8655. * The above copyright notice and this permission notice shall be included in
  8656. * all copies or substantial portions of the Software.
  8657. *
  8658. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8659. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8660. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8661. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8662. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8663. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8664. * THE SOFTWARE.
  8665. */
  8666.  
  8667.  
  8668.  
  8669.  
  8670.  
  8671. /**
  8672. * @extends {MDCComponent<!MDCIconButtonToggleFoundation>}
  8673. */
  8674. class icon_button_MDCIconButtonToggle extends component["a" /* default */] {
  8675. static attachTo(root) {
  8676. return new icon_button_MDCIconButtonToggle(root);
  8677. }
  8678.  
  8679. constructor(...args) {
  8680. super(...args);
  8681.  
  8682. /** @private {!MDCRipple} */
  8683. this.ripple_ = this.initRipple_();
  8684. /** @private {!Function} */
  8685. this.handleClick_;
  8686. }
  8687.  
  8688. /**
  8689. * @return {!MDCRipple}
  8690. * @private
  8691. */
  8692. initRipple_() {
  8693. const ripple = new _material_ripple["MDCRipple"](this.root_);
  8694. ripple.unbounded = true;
  8695. return ripple;
  8696. }
  8697.  
  8698. destroy() {
  8699. this.root_.removeEventListener('click', this.handleClick_);
  8700. this.ripple_.destroy();
  8701. super.destroy();
  8702. }
  8703.  
  8704. /** @return {!MDCIconButtonToggleFoundation} */
  8705. getDefaultFoundation() {
  8706. return new icon_button_foundation({
  8707. addClass: (className) => this.root_.classList.add(className),
  8708. removeClass: (className) => this.root_.classList.remove(className),
  8709. hasClass: (className) => this.root_.classList.contains(className),
  8710. setAttr: (attrName, attrValue) => this.root_.setAttribute(attrName, attrValue),
  8711. notifyChange: (evtData) => this.emit(icon_button_foundation.strings.CHANGE_EVENT, evtData),
  8712. });
  8713. }
  8714.  
  8715. initialSyncWithDOM() {
  8716. this.handleClick_ = this.foundation_.handleClick.bind(this.foundation_);
  8717. this.root_.addEventListener('click', this.handleClick_);
  8718. }
  8719.  
  8720. /** @return {!MDCRipple} */
  8721. get ripple() {
  8722. return this.ripple_;
  8723. }
  8724.  
  8725. /** @return {boolean} */
  8726. get on() {
  8727. return this.foundation_.isOn();
  8728. }
  8729.  
  8730. /** @param {boolean} isOn */
  8731. set on(isOn) {
  8732. this.foundation_.toggle(isOn);
  8733. }
  8734. }
  8735.  
  8736.  
  8737.  
  8738.  
  8739. /***/ }),
  8740. /* 75 */
  8741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8742.  
  8743. "use strict";
  8744. // ESM COMPAT FLAG
  8745. __webpack_require__.r(__webpack_exports__);
  8746.  
  8747. // EXPORTS
  8748. __webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; });
  8749.  
  8750. // CONCATENATED MODULE: ./node_modules/@typed/compose/lib.es2015/compose.js
  8751. function compose() {
  8752. switch (arguments.length) {
  8753. case 1: return _compose1(arguments[0]);
  8754. case 2: return _compose2(arguments[0], arguments[1]);
  8755. case 3: return _compose3(arguments[0], arguments[1], arguments[2]);
  8756. case 4: return _compose4(arguments[0], arguments[1], arguments[2], arguments[3]);
  8757. case 5: return _compose5(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
  8758. }
  8759. ;
  8760. }
  8761. function _compose1(f) {
  8762. return function compose1Fn(a) {
  8763. return f(a);
  8764. };
  8765. }
  8766. function _compose2(g, f) {
  8767. return function compose2Fn(a) {
  8768. return g(f(a));
  8769. };
  8770. }
  8771. function _compose3(h, g, f) {
  8772. return function compose3Fn(a) {
  8773. return h(g(f(a)));
  8774. };
  8775. }
  8776. function _compose4(i, h, g, f) {
  8777. return function compose3Fn(a) {
  8778. return i(h(g(f(a))));
  8779. };
  8780. }
  8781. function _compose5(j, i, h, g, f) {
  8782. return function compose5Fn(a) {
  8783. return j(i(h(g(f(a)))));
  8784. };
  8785. }
  8786. //# sourceMappingURL=compose.js.map
  8787. // CONCATENATED MODULE: ./node_modules/@typed/compose/lib.es2015/index.js
  8788.  
  8789. //# sourceMappingURL=index.js.map
  8790.  
  8791. /***/ })
  8792. /******/ ]);