UNPKG

tsreact-darkreader

Version:

A Custom React Hook for adding a dark / night mode to your site inspired by darkreader

16 lines (14 loc) 148 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).tsreactDarkreader={},e.React,e._jsxRuntime)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=o(t),a=r(t),s=r(n);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);t>n;n++)r[n]=e[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function p(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}function m(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}var g=p((function(e,t){!function(e){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function n(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&o[3]>i[1])){a.label=i[1];break}if(6===i[0]&&o[1]>a.label){a.label=o[1],o=i;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function a(){for(var e=[],t=0;arguments.length>t;t++)e=e.concat(i(arguments[t]));return e}var s="undefined"==typeof navigator?"some useragent":navigator.userAgent.toLowerCase(),c="undefined"==typeof navigator?"some platform":navigator.platform.toLowerCase(),u=s.includes("chrome")||s.includes("chromium"),l=s.includes("thunderbird"),d=s.includes("firefox")||l,f=(s.includes("vivaldi"),s.includes("yabrowser"),s.includes("opr")||s.includes("opera"),s.includes("edg"),s.includes("safari")&&!u),h=c.startsWith("win"),p=c.startsWith("mac"),m=(s.includes("mobile"),"function"==typeof ShadowRoot),g="function"==typeof MediaQueryList&&"function"==typeof MediaQueryList.prototype.addEventListener,v=(s.match(/chrom[e|ium]\/([^ ]+)/),function(){try{return document.querySelector(":defined"),!0}catch(e){return!1}}()),y=function(){try{return new CSSStyleSheet,!0}catch(e){return!1}}();function b(e,t){return n(this,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return[4,fetch(e,{cache:"force-cache",credentials:"omit"})];case 1:if(n=r.sent(),d&&"text/css"===t&&e.startsWith("moz-extension://")&&e.endsWith(".css"))return[2,n];if(t&&!n.headers.get("Content-Type").startsWith(t))throw Error("Mime type mismatch when loading "+e);if(!n.ok)throw Error("Unable to load "+e+" "+n.status+" "+n.statusText);return[2,n]}}))}))}function k(e,t){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,b(e,t)];case 1:return[4,w(n.sent())];case 2:return[2,n.sent()]}}))}))}function w(e){return n(this,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return[4,e.blob()];case 1:return t=n.sent(),[4,new Promise((function(e){var n=new FileReader;n.onloadend=function(){return e(n.result)},n.readAsDataURL(t)}))];case 2:return[2,n.sent()]}}))}))}var S=function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,Promise.reject(Error(["Embedded Dark Reader cannot access a cross-origin resource",e,"Overview your URLs and CORS policies or use `DarkReader.setFetchMethod(fetch: (url) => Promise<Response>))`. See if using `DarkReader.setFetchMethod(window.fetch)` before `DarkReader.enable()` works."].join(" ")))]}))}))},x=S;function _(e){x=e||S}function C(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,x(e)];case 1:return[2,t.sent()]}}))}))}window.chrome||(window.chrome={}),chrome.runtime||(chrome.runtime={});var E=new Set;function $(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,n,o,i,a,s;return r(this,(function(r){switch(r.label){case 0:if(!e[0]||"fetch"!==e[0].type)return[3,8];t=e[0].id,r.label=1;case 1:return r.trys.push([1,7,,8]),o=(n=e[0].data).responseType,[4,C(n.url)];case 2:return i=r.sent(),"data-url"!==o?[3,4]:[4,w(i)];case 3:return a=r.sent(),[3,6];case 4:return[4,i.text()];case 5:a=r.sent(),r.label=6;case 6:return E.forEach((function(e){return e({type:"fetch-response",data:a,error:null,id:t})})),[3,8];case 7:return s=r.sent(),console.error(s),E.forEach((function(e){return e({type:"fetch-response",data:null,err:s,id:t})})),[3,8];case 8:return[2]}}))}))}function M(e){E.add(e)}if("function"==typeof chrome.runtime.sendMessage){var O=chrome.runtime.sendMessage;chrome.runtime.sendMessage=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];$.apply(void 0,a(e)),O.apply(chrome.runtime,e)}}else chrome.runtime.sendMessage=$;if(chrome.runtime.onMessage||(chrome.runtime.onMessage={}),"function"==typeof chrome.runtime.onMessage.addListener){var T=chrome.runtime.onMessage.addListener;chrome.runtime.onMessage.addListener=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];M.apply(void 0,a(e)),T.apply(chrome.runtime.onMessage,e)}}else chrome.runtime.onMessage.addListener=M;var P,A={cssFilter:"cssFilter",svgFilter:"svgFilter",staticTheme:"staticTheme",dynamicTheme:"dynamicTheme"},R={darkScheme:{background:"#181a1b",text:"#e8e6e3"},lightScheme:{background:"#dcdad7",text:"#181a1b"}},j={mode:1,brightness:100,contrast:100,grayscale:0,sepia:0,useFont:!1,fontFamily:p?"Helvetica Neue":h?"Segoe UI":"Open Sans",textStroke:0,engine:A.dynamicTheme,stylesheet:"",darkSchemeBackgroundColor:R.darkScheme.background,darkSchemeTextColor:R.darkScheme.text,lightSchemeBackgroundColor:R.lightScheme.background,lightSchemeTextColor:R.lightScheme.text,scrollbarColor:p?"":"auto",selectionColor:"auto",styleSystemControls:!0};function L(e){return null!=e.length}function I(e,t){var n,r;if(L(e))for(var i=0,a=e.length;a>i;i++)t(e[i]);else try{for(var s=o(e),c=s.next();!c.done;c=s.next())t(c.value)}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function D(e,t){I(t,(function(t){return e.push(t)}))}function z(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}var N=new Map;function H(e){return P||(P=document.createElement("a")),P.href=e,P.href}function B(e,t){void 0===t&&(t=null);var n=e+(t?";"+t:"");if(N.has(n))return N.get(n);if(t){var r=new URL(e,H(t));return N.set(n,r),r}var o=new URL(H(e));return N.set(e,o),o}function W(e,t){if(t.match(/^data\:/))return t;var n=B(e);return B(t,n.href).href}function F(e){var t=new URL(e);return t.host?t.host:t.protocol}function U(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t]}function q(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t]}function V(e,t){I(e,(function(e){if(e instanceof CSSMediaRule){var n=Array.from(e.media);(n.includes("screen")||n.includes("all")||!n.includes("print")&&!n.includes("speech"))&&V(e.cssRules,t)}else if(e instanceof CSSStyleRule)t(e);else if(e instanceof CSSImportRule)try{V(e.styleSheet.cssRules,t)}catch(e){q(e)}else e instanceof CSSSupportsRule?CSS.supports(e.conditionText)&&V(e.cssRules,t):q("CSSRule type not supported",e)}))}function G(e,t){I(e,(function(n){var r=e.getPropertyValue(n).trim();r&&t(n,r)}))}function K(e){return e.startsWith("--")&&!e.startsWith("--darkreader")}function X(e){var t=new Map;return e&&V(e,(function(e){e.style&&G(e.style,(function(e,n){K(e)&&t.set(e,n)}))})),t}function Y(e){var t=new Map;return G(e.style,(function(e,n){K(e)&&t.set(e,n)})),t}var Z=/url\((('.+?')|(".+?")|([^\)]*?))\)/g,Q=/@import\s*(url\()?(('.+?')|(".+?")|([^\)]*?))\)?;?/g;function J(e){return e.replace(/^url\((.*)\)$/,"$1").replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function ee(e){var t=B(e);return""+t.origin+t.pathname.replace(/\?.*$/,"").replace(/(\/)([^\/]+)$/i,"$1")}function te(e,t){return e.replace(Z,(function(e){var n=J(e);return'url("'+W(t,n)+'")'}))}var ne=/\/\*[\s\S]*?\*\//g;function re(e){return e.replace(ne,"")}var oe=/@font-face\s*{[^}]*}/g;function ie(e){return e.replace(oe,"")}var ae=/var\((--[^\s,\(\)]+),?\s*([^\(\)]*(\([^\(\)]*\)[^\(\)]*)*\s*)\)/g;function se(e,t,n){void 0===n&&(n=new Set);var r=!1,o=new Set,i=e.replace(ae,(function(e,i,a){if(n.has(i))return q("Circular reference to variable "+i),a||(r=!0,e);if(t.has(i)){var s=t.get(i);return s.match(ae)&&o.add(i),s}return a||(q("Variable "+i+" not found"),r=!0,e)}));return r?i:i.match(ae)?(o.forEach((function(e){return n.add(e)})),se(i,t,n)):i}function ce(e){var t,n=!1,r=null;return Object.assign((function(){for(var o=[],i=0;arguments.length>i;i++)o[i]=arguments[i];t=o,r?n=!0:(e.apply(void 0,a(t)),r=requestAnimationFrame((function(){r=null,n&&(e.apply(void 0,a(t)),n=!1)})))}),{cancel:function(){cancelAnimationFrame(r),n=!1,r=null}})}function ue(){var e=[],t=null;function n(){for(var n;n=e.shift();)n();t=null}function r(r){e.push(r),t||(t=requestAnimationFrame(n))}function o(){e.splice(0),cancelAnimationFrame(t),t=null}return{add:r,cancel:o}}function le(e){var t=0;return e.seconds&&(t+=1e3*e.seconds),e.minutes&&(t+=60*e.minutes*1e3),e.hours&&(t+=60*e.hours*60*1e3),e.days&&(t+=24*e.days*60*60*1e3),t}function de(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function fe(e,t,n){void 0===n&&(n=Function.prototype);var r=10,o=le({seconds:2}),i=le({seconds:10}),a=e.previousSibling,s=e.parentNode;if(!s)throw Error("Unable to watch for node position: parent element not found");if("prev-sibling"===t&&!a)throw Error("Unable to watch for node position: there is no previous sibling");var c=0,u=null,l=null,d=ce((function(){if(!l){c++;var h=Date.now();if(null==u)u=h;else if(c>=r){if(i>h-u)return q("Node position watcher paused: retry in "+o+"ms",e,a),void(l=setTimeout((function(){u=null,c=0,l=null,d()}),o));u=h,c=1}if("parent"===t&&a&&a.parentNode!==s)return q("Unable to restore node position: sibling parent changed",e,a,s),void p();if("prev-sibling"===t){if(null==a.parentNode)return q("Unable to restore node position: sibling was removed",e,a,s),void p();a.parentNode!==s&&(q("Style was moved to another parent",e,a,s),g(a.parentNode))}q("Restoring node position",e,a,s),s.insertBefore(e,a?a.nextSibling:s.firstChild),f.takeRecords(),n&&n()}})),f=new MutationObserver((function(){("parent"===t&&e.parentNode!==s||"prev-sibling"===t&&e.previousSibling!==a)&&d()})),h=function(){f.observe(s,{childList:!0})},p=function(){clearTimeout(l),f.disconnect(),d.cancel()},m=function(){f.takeRecords()},g=function(e){s=e,p(),h()};return h(),{run:h,stop:p,skip:m}}function he(e,t){if(null!=e)for(var n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return null==e.shadowRoot?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}}),r=e.shadowRoot?n.currentNode:n.nextNode();null!=r;r=n.nextNode())t(r),he(r.shadowRoot,t)}function pe(){return"complete"===document.readyState||"interactive"===document.readyState}var me=new Set;function ge(e){me.add(e)}function ve(e){me.delete(e)}if(!pe()){var ye=function(){pe()&&(document.removeEventListener("readystatechange",ye),me.forEach((function(e){return e()})),me.clear())};document.addEventListener("readystatechange",ye)}var be=1e3;function ke(e){if(e.length>be)return!0;for(var t=0,n=0;e.length>n;n++)if((t+=e[n].addedNodes.length)>be)return!0;return!1}function we(e){var t=new Set,n=new Set,r=new Set;e.forEach((function(e){I(e.addedNodes,(function(e){e instanceof Element&&e.isConnected&&t.add(e)})),I(e.removedNodes,(function(e){e instanceof Element&&(e.isConnected?r.add(e):n.add(e))}))})),r.forEach((function(e){return t.delete(e)}));var o=[],i=[];return t.forEach((function(e){t.has(e.parentElement)&&o.push(e)})),n.forEach((function(e){n.has(e.parentElement)&&i.push(e)})),o.forEach((function(e){return t.delete(e)})),i.forEach((function(e){return n.delete(e)})),{additions:t,moves:r,deletions:n}}var Se=new Map,xe=new WeakMap;function _e(e,t){var n,r,o;if(Se.has(e))n=Se.get(e),r=xe.get(n);else{var i=!1,a=!1;(n=new MutationObserver((function(t){if(ke(t))!i||pe()?r.forEach((function(t){return(0,t.onHugeMutations)(e)})):a||(ge(o=function(){return r.forEach((function(t){return(0,t.onHugeMutations)(e)}))}),a=!0),i=!0;else{var n=we(t);r.forEach((function(e){return(0,e.onMinorMutations)(n)}))}}))).observe(e,{childList:!0,subtree:!0}),Se.set(e,n),r=new Set,xe.set(n,r)}return r.add(t),{disconnect:function(){r.delete(t),o&&ve(o),0===r.size&&(n.disconnect(),xe.delete(n),Se.delete(e))}}}var Ce=null;function Ee(){if(Ce)return Ce;if(y)return Ce=new CSSStyleSheet;var e=document.createElement("style");return document.head.append(e),Ce=e.sheet,document.head.removeChild(e),Ce}function $e(e){var t=e.h,n=e.s,r=e.l,o=e.a,a=void 0===o?1:o;if(0===n){var s=i([r,r,r].map((function(e){return Math.round(255*e)})),3);return{r:s[0],g:s[2],b:s[1],a:a}}var c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(t/60%2-1)),l=r-c/2,d=i((60>t?[c,u,0]:120>t?[u,c,0]:180>t?[0,c,u]:240>t?[0,u,c]:300>t?[u,0,c]:[c,0,u]).map((function(e){return Math.round(255*(e+l))})),3);return{r:d[0],g:d[1],b:d[2],a:a}}function Me(e){var t=e.a,n=void 0===t?1:t,r=e.r/255,o=e.g/255,i=e.b/255,a=Math.max(r,o,i),s=Math.min(r,o,i),c=a-s,u=(a+s)/2;if(0===c)return{h:0,s:0,l:u,a:n};var l=60*(a===r?(o-i)/c%6:a===o?(i-r)/c+2:(r-o)/c+4);return 0>l&&(l+=360),{h:l,s:c/(1-Math.abs(2*u-1)),l:u,a:n}}function Oe(e,t){void 0===t&&(t=0);var n=e.toFixed(t);if(0===t)return n;var r=n.indexOf(".");if(r>=0){var o=n.match(/0+$/);if(o)return n.substring(0,o.index===r+1?r:o.index)}return n}function Te(e){var t=e.r,n=e.g,r=e.b,o=e.a;return null!=o&&1>o?"rgba("+Oe(t)+", "+Oe(n)+", "+Oe(r)+", "+Oe(o,2)+")":"rgb("+Oe(t)+", "+Oe(n)+", "+Oe(r)+")"}function Pe(e){var t=e.r,n=e.g,r=e.b,o=e.a;return"#"+(null!=o&&1>o?[t,n,r,Math.round(255*o)]:[t,n,r]).map((function(e){return(16>e?"0":"")+e.toString(16)})).join("")}function Ae(e){var t=e.h,n=e.s,r=e.l,o=e.a;return null!=o&&1>o?"hsla("+Oe(t)+", "+Oe(100*n)+"%, "+Oe(100*r)+"%, "+Oe(o,2)+")":"hsl("+Oe(t)+", "+Oe(100*n)+"%, "+Oe(100*r)+"%)"}var Re=/^rgba?\([^\(\)]+\)$/,je=/^hsla?\([^\(\)]+\)$/,Le=/^#[0-9a-f]+$/i;function Ie(e){var t=e.trim().toLowerCase();if(t.match(Re))return Be(t);if(t.match(je))return qe(t);if(t.match(Le))return Ve(t);if(Xe.has(t))return Ge(t);if(Ye.has(t))return Ke(t);if("transparent"===e)return{r:0,g:0,b:0,a:0};throw Error("Unable to parse "+e)}function De(e,t,n,r){var o=e.split(t).filter((function(e){return e})),a=Object.entries(r);return o.map((function(e){return e.trim()})).map((function(e,t){var r,o=a.find((function(t){var n=i(t,1);return e.endsWith(n[0])}));return r=o?parseFloat(e.substring(0,e.length-o[0].length))/o[1]*n[t]:parseFloat(e),n[t]>1?Math.round(r):r}))}var ze=/rgba?|\(|\)|\/|,|\s/gi,Ne=[255,255,255,1],He={"%":100};function Be(e){var t=i(De(e,ze,Ne,He),4),n=t[3];return{r:t[0],g:t[1],b:t[2],a:void 0===n?1:n}}var We=/hsla?|\(|\)|\/|,|\s/gi,Fe=[360,1,1,1],Ue={"%":100,deg:360,rad:2*Math.PI,turn:1};function qe(e){var t=i(De(e,We,Fe,Ue),4),n=t[3];return $e({h:t[0],s:t[1],l:t[2],a:void 0===n?1:n})}function Ve(e){var t=e.substring(1);switch(t.length){case 3:case 4:var n=i([0,1,2].map((function(e){return parseInt(""+t[e]+t[e],16)})),3);return{r:n[0],g:n[1],b:n[2],a:3===t.length?1:parseInt(""+t[3]+t[3],16)/255};case 6:case 8:var r=i([0,2,4].map((function(e){return parseInt(t.substring(e,e+2),16)})),3);return{r:r[0],g:r[1],b:r[2],a:6===t.length?1:parseInt(t.substring(6,8),16)/255}}throw Error("Unable to parse "+e)}function Ge(e){var t=Xe.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}function Ke(e){var t=Ye.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}var Xe=new Map(Object.entries({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgrey:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,grey:8421504,green:32768,greenyellow:11403055,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgrey:13882323,lightgreen:9498256,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074})),Ye=new Map(Object.entries({ActiveBorder:3906044,ActiveCaption:0,AppWorkspace:11184810,Background:6513614,ButtonFace:16777215,ButtonHighlight:15329769,ButtonShadow:10461343,ButtonText:0,CaptionText:0,GrayText:8355711,Highlight:11720703,HighlightText:0,InactiveBorder:16777215,InactiveCaption:16777215,InactiveCaptionText:0,InfoBackground:16514245,InfoText:0,Menu:16185078,MenuText:16777215,Scrollbar:11184810,ThreeDDarkShadow:0,ThreeDFace:12632256,ThreeDHighlight:16777215,ThreeDLightShadow:16777215,ThreeDShadow:0,Window:15527148,WindowFrame:11184810,WindowText:0,"-webkit-focus-ring-color":15046400}).map((function(e){var t=i(e,2),n=t[1];return[t[0].toLowerCase(),n]})));function Ze(e,t,n,r,o){return(e-t)*(o-r)/(n-t)+r}function Qe(e,t,n){return Math.min(n,Math.max(t,e))}function Je(e,t){for(var n=[],r=0,o=e.length;o>r;r++){n[r]=[];for(var i=0,a=t[0].length;a>i;i++){for(var s=0,c=0,u=e[0].length;u>c;c++)s+=e[r][c]*t[c][i];n[r][i]=s}}return n}function et(e,t,n){void 0===n&&(n=0);for(var r,o=[];r=e.exec(t);)o.push(r[n]);return o}function tt(e){function t(e){return e.replace(/^\s+/,"")}function n(e){return 0===e?"":" ".repeat(4*e)}for(var r=/[^{}]+{\s*}/g;r.test(e);)e=e.replace(r,"");for(var o=e.replace(/\s{2,}/g," ").replace(/\{/g,"{\n").replace(/\}/g,"\n}\n").replace(/\;(?![^\(|\"]*(\)|\"))/g,";\n").replace(/\,(?![^\(|\"]*(\)|\"))/g,",\n").replace(/\n\s*\n/g,"\n").split("\n"),i=0,a=[],s=0,c=o.length;c>s;s++){var u=o[s]+"\n";u.match(/\{/)?a.push(n(i++)+t(u)):u.match(/\}/)?a.push(n(--i)+t(u)):a.push(n(i)+t(u))}return a.join("").trim()}function nt(e){var t=ot.identity();return 0!==e.sepia&&(t=Je(t,ot.sepia(e.sepia/100))),0!==e.grayscale&&(t=Je(t,ot.grayscale(e.grayscale/100))),100!==e.contrast&&(t=Je(t,ot.contrast(e.contrast/100))),100!==e.brightness&&(t=Je(t,ot.brightness(e.brightness/100))),1===e.mode&&(t=Je(t,ot.invertNHue())),t}function rt(e,t){var n=i(e,3),r=Je(t,[[n[0]/255],[n[1]/255],[n[2]/255],[1],[1]]);return[0,1,2].map((function(e){return Qe(Math.round(255*r[e][0]),0,255)}))}var ot={identity:function(){return[[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1]]},invertNHue:function(){return[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0],[0,0,0,0,1]]},brightness:function(e){return[[e,0,0,0,0],[0,e,0,0,0],[0,0,e,0,0],[0,0,0,1,0],[0,0,0,0,1]]},contrast:function(e){var t=(1-e)/2;return[[e,0,0,0,t],[0,e,0,0,t],[0,0,e,0,t],[0,0,0,1,0],[0,0,0,0,1]]},sepia:function(e){return[[.393+.607*(1-e),.769-.769*(1-e),.189-.189*(1-e),0,0],[.349-.349*(1-e),.686+.314*(1-e),.168-.168*(1-e),0,0],[.272-.272*(1-e),.534-.534*(1-e),.131+.869*(1-e),0,0],[0,0,0,1,0],[0,0,0,0,1]]},grayscale:function(e){return[[.2126+.7874*(1-e),.7152-.7152*(1-e),.0722-.0722*(1-e),0,0],[.2126-.2126*(1-e),.7152+.2848*(1-e),.0722-.0722*(1-e),0,0],[.2126-.2126*(1-e),.7152-.7152*(1-e),.0722+.9278*(1-e),0,0],[0,0,0,1,0],[0,0,0,0,1]]}};function it(e){return e[1===e.mode?"darkSchemeBackgroundColor":"lightSchemeBackgroundColor"]}function at(e){return e[1===e.mode?"darkSchemeTextColor":"lightSchemeTextColor"]}var st=new Map,ct=new Map;function ut(e){if(ct.has(e))return ct.get(e);var t=Me(Ie(e));return ct.set(e,t),t}function lt(){st.clear(),ct.clear()}var dt=["r","g","b","a"],ft=["mode","brightness","contrast","grayscale","sepia","darkSchemeBackgroundColor","darkSchemeTextColor","lightSchemeBackgroundColor","lightSchemeTextColor"];function ht(e,t){return dt.map((function(t){return e[t]})).concat(ft.map((function(e){return t[e]}))).join(";")}function pt(e,t,n,r,o){var a;st.has(n)?a=st.get(n):(a=new Map,st.set(n,a));var s=ht(e,t);if(a.has(s))return a.get(s);var c=$e(n(Me(e),null==r?null:ut(r),null==o?null:ut(o))),u=c.a,l=i(rt([c.r,c.g,c.b],nt(t)),3),d=l[0],f=l[1],h=l[2],p=1===u?Pe({r:d,g:f,b:h}):Te({r:d,g:f,b:h,a:u});return a.set(s,p),p}function mt(e){return e}function gt(e,t){return pt(e,t,mt)}function vt(e,t){var n=it(t);return pt(e,t,yt,at(t),n)}function yt(e,t,n){var r=e.h,o=e.s,i=e.l,a=e.a,s=.5>i,c=r,u=i;return(s?.2>i||.12>o:.24>o||i>.8&&r>200&&280>r)&&(s?(c=t.h,u=t.s):(c=n.h,u=n.s)),{h:c,s:u,l:Ze(i,0,1,t.l,n.l),a:a}}var bt=.4;function kt(e,t){var n=e.h,r=e.s,o=e.l,i=e.a,a=.12>r||o>.8&&n>200&&280>n;if(.5>o){var s=Ze(o,0,.5,0,bt);return a?{h:t.h,s:t.s,l:s,a:i}:{h:n,s:r,l:s,a:i}}var c=Ze(o,.5,1,bt,t.l);if(a)return{h:t.h,s:t.s,l:c,a:i};var u=n;return n>60&&180>n&&(u=n>120?Ze(n,120,180,135,180):Ze(n,60,120,60,105)),{h:u,s:r,l:c,a:i}}function wt(e,n){if(0===n.mode)return vt(e,n);var r=it(n);return pt(e,t(t({},n),{mode:0}),kt,r)}var St,xt=.55;function _t(e){return Ze(e,205,245,205,220)}function Ct(e,t){var n=e.h,r=e.s,o=e.l,i=e.a,a=.2>o||.24>r,s=!a&&n>205&&245>n;if(o>.5){var c=Ze(o,.5,1,xt,t.l);if(a)return{h:t.h,s:t.s,l:c,a:i};var u=n;return s&&(u=_t(n)),{h:u,s:r,l:c,a:i}}if(a)return{h:t.h,s:t.s,l:Ze(o,0,.5,t.l,xt),a:i};var l,d=n;return s?(d=_t(n),l=Ze(o,0,.5,t.l,Math.min(1,xt+.05))):l=Ze(o,0,.5,t.l,xt),{h:d,s:r,l:l,a:i}}function Et(e,n){if(0===n.mode)return vt(e,n);var r=at(n);return pt(e,t(t({},n),{mode:0}),Ct,r)}function $t(e,t,n){var r=e.s,o=e.l,i=e.a,a=e.h,s=r;return(.2>o||.24>r)&&(.5>o?(a=t.h,s=t.s):(a=n.h,s=n.s)),{h:a,s:s,l:Ze(o,0,1,.5,.2),a:i}}function Mt(e,n){if(0===n.mode)return vt(e,n);var r=at(n),o=it(n);return pt(e,t(t({},n),{mode:0}),$t,r,o)}function Ot(e,t){return wt(e,t)}function Tt(e,t){return wt(e,t)}function Pt(e){var t=[];return t.push("*:not(pre) {"),e.useFont&&e.fontFamily&&t.push(" font-family: "+e.fontFamily+" !important;"),e.textStroke>0&&(t.push(" -webkit-text-stroke: "+e.textStroke+"px !important;"),t.push(" text-stroke: "+e.textStroke+"px !important;")),t.push("}"),t.join("\n")}function At(e){var t=[];return e.mode===St.dark&&t.push("invert(100%) hue-rotate(180deg)"),100!==e.brightness&&t.push("brightness("+e.brightness+"%)"),100!==e.contrast&&t.push("contrast("+e.contrast+"%)"),0!==e.grayscale&&t.push("grayscale("+e.grayscale+"%)"),0!==e.sepia&&t.push("sepia("+e.sepia+"%)"),0===t.length?null:t.join(" ")}function Rt(e){return e.slice(0,4).map((function(e){return e.map((function(e){return e.toFixed(3)})).join(" ")})).join(" ")}function jt(e){return Rt(nt(e))}!function(e){e[e.light=0]="light",e[e.dark=1]="dark"}(St||(St={}));var Lt=0,It=new Map,Dt=new Map;function zt(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){return[2,new Promise((function(t,n){var r=++Lt;It.set(r,t),Dt.set(r,n),chrome.runtime.sendMessage({type:"fetch",data:e,id:r})}))]}))}))}function Nt(e){return n(this,void 0,void 0,(function(){var n,o,i;return r(this,(function(r){switch(r.label){case 0:return e.startsWith("data:")?(n=e,[3,3]):[3,1];case 1:return[4,Ht(e)];case 2:n=r.sent(),r.label=3;case 3:return[4,Bt(n)];case 4:return o=r.sent(),i=Gt(o),[2,t({src:e,dataURL:n,width:o.naturalWidth,height:o.naturalHeight},i)]}}))}))}function Ht(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return F(e)!==(location.host||location.protocol)?[3,2]:[4,k(e)];case 1:return[2,t.sent()];case 2:return[4,zt({url:e,responseType:"data-url"})];case 3:return[2,t.sent()]}}))}))}function Bt(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){return[2,new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=function(){return n("Unable to load image "+e)},r.src=e}))]}))}))}chrome.runtime.onMessage.addListener((function(e){var t=e.data,n=e.error,r=e.id;if("fetch-response"===e.type){var o=It.get(r),i=Dt.get(r);It.delete(r),Dt.delete(r),n?i&&i(n):o&&o(t)}}));var Wt,Ft,Ut=1024;function qt(){var e=Ut,t=Ut;(Wt=document.createElement("canvas")).width=e,Wt.height=t,(Ft=Wt.getContext("2d")).imageSmoothingEnabled=!1}function Vt(){Wt=null,Ft=null}function Gt(e){Wt||qt();var t=e.naturalWidth,n=e.naturalHeight;if(0===n||0===t)return q("logWarn(Image is empty "+e.currentSrc+")"),null;var r=t*n,o=Math.min(1,Math.sqrt(Ut/r)),i=Math.ceil(t*o),a=Math.ceil(n*o);Ft.clearRect(0,0,i,a),Ft.drawImage(e,0,0,t,n,0,0,i,a);var s,c,u,l,d=Ft.getImageData(0,0,i,a).data,f=.05,h=.4,p=.7,m=0,g=0,v=0;for(u=0;a>u;u++)for(c=0;i>c;c++)f>d[3+(s=4*(u*i+c))]/255?m++:(h>(l=d[s+0]/255*.2126+d[s+1]/255*.7152+d[s+2]/255*.0722)&&g++,l>p&&v++);var y=i*a,b=y-m;return{isDark:g/b>=.7,isLight:v/b>=.7,isTransparent:m/y>=.1,isLarge:r>=48e4}}var Kt=new Set;function Xt(e,t){for(var n=e.dataURL,r=e.width,o=e.height,i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+r+'" height="'+o+'"><defs><filter id="darkreader-image-filter"><feColorMatrix type="matrix" values="'+jt(t)+'" /></filter></defs><image width="'+r+'" height="'+o+'" filter="url(#darkreader-image-filter)" xlink:href="'+n+'" /></svg>',a=new Uint8Array(i.length),s=0;i.length>s;s++)a[s]=i.charCodeAt(s);var c=new Blob([a],{type:"image/svg+xml"}),u=URL.createObjectURL(c);return Kt.add(u),u}function Yt(){Vt(),Kt.forEach((function(e){return URL.revokeObjectURL(e)})),Kt.clear()}function Zt(e,t,n,r,o){var i=!!(n&&n.style&&n.style.getPropertyPriority(e)),a=t;if(e.startsWith("--"))return null;if(e.indexOf("color")>=0&&"-webkit-print-color-adjust"!==e||"fill"===e||"stroke"===e||"stop-color"===e){if(s=cn(e,t))return{property:e,value:s,important:i,sourceValue:a}}else if("background-image"===e||"list-style-image"===e){if(s=hn(t,n,r,o))return{property:e,value:s,important:i,sourceValue:a}}else if(e.indexOf("shadow")>=0){var s;if(s=pn(t))return{property:e,value:s,important:i,sourceValue:a}}return null}function Qt(e,t,n){var r=[];return t||(r.push("html {"),r.push(" background-color: "+wt({r:255,g:255,b:255},e)+" !important;"),r.push("}")),r.push((t?"":"html, body, ")+(n?"input, textarea, select, button":"")+" {"),r.push(" background-color: "+wt({r:255,g:255,b:255},e)+";"),r.push("}"),r.push("html, body, "+(n?"input, textarea, select, button":"")+" {"),r.push(" border-color: "+Mt({r:76,g:76,b:76},e)+";"),r.push(" color: "+Et({r:0,g:0,b:0},e)+";"),r.push("}"),r.push("a {"),r.push(" color: "+Et({r:0,g:64,b:255},e)+";"),r.push("}"),r.push("table {"),r.push(" border-color: "+Mt({r:128,g:128,b:128},e)+";"),r.push("}"),r.push("::placeholder {"),r.push(" color: "+Et({r:169,g:169,b:169},e)+";"),r.push("}"),r.push("input:-webkit-autofill,"),r.push("textarea:-webkit-autofill,"),r.push("select:-webkit-autofill {"),r.push(" background-color: "+wt({r:250,g:255,b:189},e)+" !important;"),r.push(" color: "+Et({r:0,g:0,b:0},e)+" !important;"),r.push("}"),e.scrollbarColor&&r.push(tn(e)),e.selectionColor&&r.push(en(e)),r.join("\n")}function Jt(e){var n,r;if("auto"===e.selectionColor)n=wt({r:0,g:96,b:212},t(t({},e),{grayscale:0})),r=Et({r:255,g:255,b:255},t(t({},e),{grayscale:0}));else{var o=Me(Ie(e.selectionColor));n=e.selectionColor,r=.5>o.l?"#FFF":"#000"}return{backgroundColorSelection:n,foregroundColorSelection:r}}function en(e){var t=[],n=Jt(e),r=n.backgroundColorSelection,o=n.foregroundColorSelection;return["::selection","::-moz-selection"].forEach((function(e){t.push(e+" {"),t.push(" background-color: "+r+" !important;"),t.push(" color: "+o+" !important;"),t.push("}")})),t.join("\n")}function tn(e){var n,r,o,i,a,s,c=[];if("auto"===e.scrollbarColor)n=wt({r:241,g:241,b:241},e),r=Et({r:96,g:96,b:96},e),o=wt({r:176,g:176,b:176},e),i=wt({r:144,g:144,b:144},e),a=wt({r:96,g:96,b:96},e),s=wt({r:255,g:255,b:255},e);else{var u=Me(Ie(e.scrollbarColor)),l=u.l>.5,f=function(e){return t(t({},u),{l:Qe(u.l+e,0,1)})},h=function(e){return t(t({},u),{l:Qe(u.l-e,0,1)})};n=Ae(h(.4)),r=Ae(l?h(.4):f(.4)),o=Ae(u),i=Ae(f(.1)),a=Ae(f(.2))}return c.push("::-webkit-scrollbar {"),c.push(" background-color: "+n+";"),c.push(" color: "+r+";"),c.push("}"),c.push("::-webkit-scrollbar-thumb {"),c.push(" background-color: "+o+";"),c.push("}"),c.push("::-webkit-scrollbar-thumb:hover {"),c.push(" background-color: "+i+";"),c.push("}"),c.push("::-webkit-scrollbar-thumb:active {"),c.push(" background-color: "+a+";"),c.push("}"),c.push("::-webkit-scrollbar-corner {"),c.push(" background-color: "+s+";"),c.push("}"),d&&(c.push("* {"),c.push(" scrollbar-color: "+o+" "+n+";"),c.push("}")),c.join("\n")}function nn(e,t){var n=[];return n.push("html, body, "+(t.strict?"body :not(iframe)":"body > :not(iframe)")+" {"),n.push(" background-color: "+wt({r:255,g:255,b:255},e)+" !important;"),n.push(" border-color: "+Mt({r:64,g:64,b:64},e)+" !important;"),n.push(" color: "+Et({r:0,g:0,b:0},e)+" !important;"),n.push("}"),n.join("\n")}var rn=new Set(["inherit","transparent","initial","currentcolor","none","unset"]),on=new Map;function an(e){if(e=e.trim(),on.has(e))return on.get(e);var t=Ie(e);return on.set(e,t),t}function sn(e){try{return an(e)}catch(e){return null}}function cn(e,t){if(rn.has(t.toLowerCase()))return t;try{var n=an(t);return 0>e.indexOf("background")?0>e.indexOf("border")&&0>e.indexOf("outline")?function(e){return Et(n,e)}:function(e){return Mt(n,e)}:function(e){return wt(n,e)}}catch(e){return q("Color parse error",e),null}}var un=/[\-a-z]+gradient\(([^\(\)]*(\(([^\(\)]*(\(.*?\)))*[^\(\)]*\))){0,15}[^\(\)]*\)/g,ln=new Map,dn=new Map;function fn(e,t){if(!e||0===t.length)return!1;if(t.some((function(e){return"*"===e})))return!0;for(var n=e.selectorText.split(/,\s*/g),r=function(e){var r=t[e];if(n.some((function(e){return e===r})))return{value:!0}},o=0;t.length>o;o++){var i=r(o);if("object"==typeof i)return i.value}return!1}function hn(e,o,i,a){var s=this;try{var c=et(un,e),u=et(Z,e);if(0===u.length&&0===c.length)return e;var l=function(t){var n=0;return t.map((function(t){var r=e.indexOf(t,n);return n=r+t.length,{match:t,index:r}}))},d=l(u).map((function(e){return t({type:"url"},e)})).concat(l(c).map((function(e){return t({type:"gradient"},e)}))).sort((function(e,t){return e.index-t.index})),f=function(e){var t=e.match(/^(.*-gradient)\((.*)\)$/),n=t[1],r=/^(from|color-stop|to)\(([^\(\)]*?,\s*)?(.*?)\)$/,o=et(/([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?[^\(\),]*),?/g,t[2],1).map((function(e){var t=sn(e=e.trim());if(t)return function(e){return Tt(t,e)};var n=e.lastIndexOf(" ");if(t=sn(e.substring(0,n)))return function(r){return Tt(t,r)+" "+e.substring(n+1)};var o=e.match(r);return o&&(t=sn(o[3]))?function(e){return o[1]+"("+(o[2]?o[2]+", ":"")+Tt(t,e)+")"}:function(){return e}}));return function(e){return n+"("+o.map((function(t){return t(e)})).join(", ")+")"}},h=function(e){var t=J(e);if(o.parentStyleSheet.href){var c=ee(o.parentStyleSheet.href);t=W(c,t)}else t=W(o.parentStyleSheet.ownerNode&&o.parentStyleSheet.ownerNode.baseURI?o.parentStyleSheet.ownerNode.baseURI:location.origin,t);var u='url("'+t+'")';return function(e){return n(s,void 0,void 0,(function(){var n,s;return r(this,(function(r){switch(r.label){case 0:return ln.has(t)?(n=ln.get(t),[3,7]):[3,1];case 1:return r.trys.push([1,6,,7]),fn(o,i)?[2,null]:dn.has(t)?(s=dn.get(t),[4,new Promise((function(e){return s.push(e)}))]):[3,3];case 2:return(n=r.sent())?[3,5]:[2,null];case 3:return dn.set(t,[]),[4,Nt(t)];case 4:n=r.sent(),ln.set(t,n),dn.get(t).forEach((function(e){return e(n)})),dn.delete(t),r.label=5;case 5:return a()?[2,null]:[3,7];case 6:return q(r.sent()),dn.has(t)&&(dn.get(t).forEach((function(e){return e(null)})),dn.delete(t)),[2,u];case 7:return[2,p(n,e)||u]}}))}))}},p=function(e,n){var r,o=e.isLight,i=e.isTransparent,a=e.isLarge;return e.isDark&&i&&1===n.mode&&!a&&e.width>2?(U("Inverting dark image "+e.src),r='url("'+Xt(e,t(t({},n),{sepia:Qe(n.sepia+10,0,100)}))+'")'):o&&!i&&1===n.mode?a?r="none":(U("Dimming light image "+e.src),r='url("'+Xt(e,n)+'")'):0===n.mode&&o&&!a?(U("Applying filter to image "+e.src),r='url("'+Xt(e,t(t({},n),{brightness:Qe(n.brightness-10,5,200),sepia:Qe(n.sepia+10,0,100)}))+'")'):r=null,r},m=[],g=0;return d.forEach((function(t,n){var r=t.match,o=t.type,i=t.index,a=g,s=i+r.length;g=s,m.push((function(){return e.substring(a,i)})),m.push("url"===o?h(r):f(r)),n===d.length-1&&m.push((function(){return e.substring(s)}))})),function(e){var t=m.map((function(t){return t(e)}));return t.some((function(e){return e instanceof Promise}))?Promise.all(t).then((function(e){return e.join("")})):t.join("")}}catch(t){return q("Unable to parse gradient "+e,t),null}}function pn(e){try{var t=0,n=et(/(^|\s)([a-z]+\(.+?\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/gi,e,2),r=n.map((function(r,o){var i=t,a=e.indexOf(r,t),s=a+r.length;t=s;var c=sn(r);return c?function(t){return""+e.substring(i,a)+Ot(c,t)+(o===n.length-1?e.substring(s):"")}:function(){return e.substring(i,s)}}));return function(e){return r.map((function(t){return t(e)})).join("")}}catch(t){return q("Unable to parse shadow "+e,t),null}}function mn(){on.clear(),lt(),ln.clear(),Yt(),dn.clear()}var gn={"background-color":{customProp:"--darkreader-inline-bgcolor",cssProp:"background-color",dataAttr:"data-darkreader-inline-bgcolor"},"background-image":{customProp:"--darkreader-inline-bgimage",cssProp:"background-image",dataAttr:"data-darkreader-inline-bgimage"},"border-color":{customProp:"--darkreader-inline-border",cssProp:"border-color",dataAttr:"data-darkreader-inline-border"},"border-bottom-color":{customProp:"--darkreader-inline-border-bottom",cssProp:"border-bottom-color",dataAttr:"data-darkreader-inline-border-bottom"},"border-left-color":{customProp:"--darkreader-inline-border-left",cssProp:"border-left-color",dataAttr:"data-darkreader-inline-border-left"},"border-right-color":{customProp:"--darkreader-inline-border-right",cssProp:"border-right-color",dataAttr:"data-darkreader-inline-border-right"},"border-top-color":{customProp:"--darkreader-inline-border-top",cssProp:"border-top-color",dataAttr:"data-darkreader-inline-border-top"},"box-shadow":{customProp:"--darkreader-inline-boxshadow",cssProp:"box-shadow",dataAttr:"data-darkreader-inline-boxshadow"},color:{customProp:"--darkreader-inline-color",cssProp:"color",dataAttr:"data-darkreader-inline-color"},fill:{customProp:"--darkreader-inline-fill",cssProp:"fill",dataAttr:"data-darkreader-inline-fill"},stroke:{customProp:"--darkreader-inline-stroke",cssProp:"stroke",dataAttr:"data-darkreader-inline-stroke"},"outline-color":{customProp:"--darkreader-inline-outline",cssProp:"outline-color",dataAttr:"data-darkreader-inline-outline"},"stop-color":{customProp:"--darkreader-inline-stopcolor",cssProp:"stop-color",dataAttr:"data-darkreader-inline-stopcolor"}},vn=Object.values(gn),yn=["style","fill","stop-color","stroke","bgcolor","color"],bn=yn.map((function(e){return"["+e+"]"})).join(", ");function kn(){return vn.map((function(e){return["["+e.dataAttr+"] {"," "+e.cssProp+": var("+e.customProp+") !important;","}"].join("\n")})).join("\n")}function wn(e){var t=[];return e instanceof Element&&e.matches(bn)&&t.push(e),(e instanceof Element||m&&e instanceof ShadowRoot||e instanceof Document)&&D(t,e.querySelectorAll(bn)),t}var Sn=new Map,xn=new Map;function _n(e,t){Cn(document,e,t),he(document.documentElement,(function(n){Cn(n.shadowRoot,e,t)}))}function Cn(e,t,n){Sn.has(e)&&(Sn.get(e).disconnect(),xn.get(e).disconnect());var r=new WeakSet;function o(e){wn(e).forEach((function(e){r.has(e)||(r.add(e),t(e))})),he(e,(function(o){r.has(e)||(r.add(e),n(o.shadowRoot),Cn(o.shadowRoot,t,n))}))}var i=_e(e,{onMinorMutations:function(e){e.additions.forEach((function(e){return o(e)}))},onHugeMutations:function(){o(e)}});Sn.set(e,i);var s=0,c=null,u=le({seconds:10}),l=le({seconds:2}),d=50,f=[],h=null,p=ce((function(e){e.forEach((function(e){yn.includes(e.attributeName)&&t(e.target)}))})),m=new MutationObserver((function(e){if(h)f.push.apply(f,a(e));else{s++;var t=Date.now();if(null==c)c=t;else if(s>=d){if(u>t-c)return h=setTimeout((function(){c=null,s=0,h=null;var e=f;f=[],p(e)}),l),void f.push.apply(f,a(e));c=t,s=1}p(e)}}));m.observe(e,{attributes:!0,attributeFilter:yn.concat(vn.map((function(e){return e.dataAttr}))),subtree:!0}),xn.set(e,m)}function En(){Sn.forEach((function(e){return e.disconnect()})),xn.forEach((function(e){return e.disconnect()})),Sn.clear(),xn.clear()}var $n=new WeakMap,Mn=["brightness","contrast","grayscale","sepia","mode"];function On(e,t){return yn.map((function(t){return t+'="'+e.getAttribute(t)+'"'})).concat(Mn.map((function(e){return e+'="'+t[e]+'"'}))).join(" ")}function Tn(e,t){for(var n=0,r=t.length;r>n;n++)if(e.matches(t[n]))return!0;return!1}function Pn(e,t,n,r){if(On(e,t)!==$n.get(e)){var o=new Set(Object.keys(gn));if(n.length>0&&Tn(e,n))o.forEach((function(t){e.removeAttribute(gn[t].dataAttr)}));else{if(e.hasAttribute("bgcolor")&&(((a=e.getAttribute("bgcolor")).match(/^[0-9a-f]{3}$/i)||a.match(/^[0-9a-f]{6}$/i))&&(a="#"+a),u("background-color","background-color",a)),e.hasAttribute("color")&&(((a=e.getAttribute("color")).match(/^[0-9a-f]{3}$/i)||a.match(/^[0-9a-f]{6}$/i))&&(a="#"+a),u("color","color",a)),e instanceof SVGElement){if(e.hasAttribute("fill")){var i=32,a=e.getAttribute("fill"),s=!1;if(!(e instanceof SVGTextElement)){var c=e.getBoundingClientRect();s=c.width>i||c.height>i}u("fill",s?"background-color":"color",a)}e.hasAttribute("stop-color")&&u("stop-color","background-color",e.getAttribute("stop-color"))}e.hasAttribute("stroke")&&(a=e.getAttribute("stroke"),u("stroke",e instanceof SVGLineElement||e instanceof SVGTextElement?"border-color":"color",a)),e.style&&G(e.style,(function(e,t){("background-image"!==e||0>t.indexOf("url"))&&gn.hasOwnProperty(e)&&u(e,e,t)})),e.style&&e instanceof SVGTextElement&&e.style.fill&&u("fill","color",e.style.getPropertyValue("fill")),I(o,(function(t){e.removeAttribute(gn[t].dataAttr)})),$n.set(e,On(e,t))}}function u(n,i,a){var s=gn[n],c=s.customProp,u=s.dataAttr,l=Zt(i,a,null,r,null);if(l){var d=l.value;"function"==typeof d&&(d=d(t)),e.style.setProperty(c,d),e.hasAttribute(u)||e.setAttribute(u,""),o.delete(n)}}}var An="theme-color",Rn='meta[name="'+An+'"]',jn=null,Ln=null;function In(e,t){jn=jn||e.content;try{var n=Ie(jn);e.content=wt(n,t)}catch(e){q(e)}}function Dn(e){var t=document.querySelector(Rn);t?In(t,e):(Ln&&Ln.disconnect(),(Ln=new MutationObserver((function(t){e:for(var n=0;t.length>n;n++)for(var r=t[n].addedNodes,o=0;r.length>o;o++){var i=r[o];if(i instanceof HTMLMetaElement&&i.name===An){Ln.disconnect(),Ln=null,In(i,e);break e}}}))).observe(document.head,{childList:!0}))}function zn(){Ln&&(Ln.disconnect(),Ln=null);var e=document.querySelector(Rn);e&&jn&&(e.content=jn)}var Nn=["mode","brightness","contrast","grayscale","sepia","darkSchemeBackgroundColor","darkSchemeTextColor","lightSchemeBackgroundColor","lightSchemeTextColor"];function Hn(e){return Nn.map((function(t){return t+":"+e[t]})).join(";")}var Bn=ue();function Wn(){var e=0,t=new Map,n=new Map,r=null;function o(o){var i=o.sourceCSSRules,a=o.theme,s=o.variables,c=o.ignoreImageAnalysis,u=o.force,l=o.prepareSheet,d=o.isAsyncCancelled,f=0===n.size,h=new Set(n.keys()),p=Hn(a),m=p!==r,g=[];if(V(i,(function(e){var r,o=e.cssText,i=!1;h.delete(o),t.has(o)||(t.set(o,o),i=!0);var a=null;if(s.size>0||o.includes("var(")){var u=se(o,s);t.get(o)!==u&&(t.set(o,u),i=!0,(r=Ee()).insertRule(u),a=r.cssRules[0])}if(i){f=!0;var l=[],p=a||e;p&&p.style&&G(p.style,(function(t,n){var r=Zt(t,n,e,c,d);r&&l.push(r)}));var m=null;l.length>0&&g.push(m={selector:e.selectorText,declarations:l,parentRule:e.parentRule}),n.set(o,m),r&&r.deleteRule(0)}else g.push(n.get(o))})),h.forEach((function(e){t.delete(e),n.delete(e)})),r=p,u||f||m){e++;var v=new Map,y=0,b={rule:null,rules:[],isGroup:!0},k=new WeakMap;g.filter((function(e){return e})).forEach((function(t){var n=t.selector,r=t.declarations,o=x(t.parentRule),i={selector:n,declarations:[],isGroup:!1},s=i.declarations;o.rules.push(i),r.forEach((function(t){var n=t.property,r=t.value,o=t.important,i=t.sourceValue;if("function"==typeof r){var c=r(a);if(c instanceof Promise){var u=y++,l={property:n,value:null,important:o,asyncKey:u,sourceValue:i};s.push(l);var f=e;c.then((function(t){t&&!d()&&f===e&&(l.value=t,Bn.add((function(){d()||f!==e||C(u)})))}))}else s.push({property:n,value:c,important:o,sourceValue:i})}else s.push({property:n,value:r,important:o,sourceValue:i})}))}));var w=l();_()}function S(e,t,n){var r=n.declarations;e.insertRule(n.selector+" {}",t);var o=e.cssRules[t].style;r.forEach((function(e){var t=e.value;o.setProperty(e.property,null==t?e.sourceValue:t,e.important?"important":"")}))}function x(e){if(null==e)return b;if(k.has(e))return k.get(e);var t={rule:e,rules:[],isGroup:!0};return k.set(e,t),x(e.parentRule).rules.push(t),t}function _(){function e(e,t){var n=e.rule;if(n instanceof CSSMediaRule){var r=t.cssRules.length;return t.insertRule("@media "+n.media.mediaText+" {}",r),t.cssRules[r]}return t}function t(n,r,o){n.rules.forEach((function(n){n.isGroup?t(n,e(n,r),o):o(n,r)}))}t(b,w,(function(e,t){var n=t.cssRules.length;e.declarations.filter((function(e){return null==e.value})).forEach((function(r){return v.set(r.asyncKey,{rule:e,target:t,index:n})})),S(t,n,e)}))}function C(e){var t=v.get(e),n=t.rule,r=t.target,o=t.index;r.deleteRule(o),S(r,o,n),v.delete(e)}}return{modifySheet:o}}var Fn='style, link[rel*="stylesheet" i]:not([disabled])';function Un(e){return(e instanceof HTMLStyleElement||e instanceof SVGStyleElement||e instanceof HTMLLinkElement&&e.rel&&e.rel.toLowerCase().includes("stylesheet")&&!e.disabled)&&!e.classList.contains("darkreader")&&"print"!==e.media&&!e.classList.contains("stylus")}function qn(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=!0),Un(e)?t.push(e):(e instanceof Element||m&&e instanceof ShadowRoot||e===document)&&(I(e.querySelectorAll(Fn),(function(e){return qn(e,t,!1)})),n&&he(e,(function(e){return qn(e.shadowRoot,t,!1)}))),t}var Vn=new WeakSet,Gn=new WeakSet,Kn=!1;function Xn(e,t){for(var o=t.update,a=t.loadingStart,s=t.loadingEnd,c=[],u=e;(u=u.nextElementSibling)&&u.matches(".darkreader");)c.push(u);var d=c.find((function(e){return e.matches(".darkreader--cors")&&!Gn.has(e)}))||null,h=c.find((function(e){return e.matches(".darkreader--sync")&&!Vn.has(e)}))||null,p=null,m=null,g=!1,v=Wn(),y=new MutationObserver((function(){o()})),b={attributes:!0,childList:!0,subtree:!0,characterData:!0};function k(){return e instanceof HTMLStyleElement&&e.textContent.trim().match(Q)}function w(){return d?d.sheet.cssRules:k()?null:A()}function S(){d?(e.nextSibling!==d&&e.parentNode.insertBefore(d,e.nextSibling),d.nextSibling!==h&&e.parentNode.insertBefore(h,d.nextSibling)):e.nextSibling!==h&&e.parentNode.insertBefore(h,e.nextSibling)}function x(){(h=e instanceof SVGStyleElement?document.createElementNS("http://www.w3.org/2000/svg","style"):document.createElement("style")).classList.add("darkreader"),h.classList.add("darkreader--sync"),h.media="screen",Vn.add(h)}var _=!1,C=!1;function E(){return n(this,void 0,void 0,(function(){var t,n,o,a,s,c,u;return r(this,(function(r){switch(r.label){case 0:if(!(e instanceof HTMLLinkElement))return[3,7];if(o=i(T(),2),a=o[0],(s=o[1])&&q(s),(a||s||f)&&(!f||e.sheet)&&!P(s))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Yn(e)];case 2:return r.sent(),[3,4];case 3:return q(r.sent()),C=!0,[3,4];case 4:if(g)return[2,null];u=i(T(),2),a=u[0],(s=u[1])&&q(s),r.label=5;case 5:r