UNPKG

react-darkreader-2

Version:

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

10 lines 129 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactDarkreader2={})}(this,(function(e){"use strict";function t(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}function n(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(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 o(e){for(var t=1;arguments.length>t;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function s(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,s,a,i=[],c=!0,l=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=s.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e,n)||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.")}()}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function a(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")} /** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */()}},n.exports),n.exports}var i=Symbol.for("react.element"),c=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.iterator;var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function v(e,t,n){this.props=e,this.context=t,this.refs=S,this.updater=n||w}function _(){}function E(e,t,n){this.props=e,this.context=t,this.refs=S,this.updater=n||w}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},_.prototype=v.prototype;var C=E.prototype=new _;C.constructor=E,k(C,v.prototype),C.isPureReactComponent=!0;var $=Array.isArray,x=Object.prototype.hasOwnProperty,M={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function R(e,t,n){var r,o={},s=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)x.call(t,r)&&!T.hasOwnProperty(r)&&(o[r]=t[r]);var c=arguments.length-2;if(1===c)o.children=n;else if(c>1){for(var l=Array(c),u=0;c>u;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(r in c=e.defaultProps)void 0===o[r]&&(o[r]=c[r]);return{$$typeof:i,type:e,key:s,ref:a,props:o,_owner:M.current}}function A(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var D=/\/+/g;function O(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function L(e,t,n,r,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var a=!1;if(null===e)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case i:case c:a=!0}}if(a)return o=o(a=e),e=""===r?"."+O(a,0):r,$(o)?(n="",null!=e&&(n=e.replace(D,"$&/")+"/"),L(o,t,n,"",(function(e){return e}))):null!=o&&(A(o)&&(o=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(D,"$&/")+"/")+e)),t.push(o)),1;if(a=0,r=""===r?".":r+":",$(e))for(var l=0;e.length>l;l++){var u=r+O(s=e[l],l);a+=L(s,t,n,u,o)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=y&&e[y]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),l=0;!(s=e.next()).done;)a+=L(s=s.value,t,n,u=r+O(s,l++),o);else if("object"===s)throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(t=e+"")?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function P(e,t,n){if(null==e)return e;var r=[],o=0;return L(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function V(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I={current:null},j={transition:null};function N(){throw Error("act(...) is not supported in production builds of React.")}var W={map:P,forEach:function(e,t,n){P(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!A(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},F={Children:W,Component:v,Fragment:l,Profiler:d,PureComponent:E,StrictMode:u,Suspense:m,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:I,ReactCurrentBatchConfig:j,ReactCurrentOwner:M},act:N,cloneElement:function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=k({},e.props),o=e.key,s=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,a=M.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)x.call(t,l)&&!T.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=n;else if(l>1){c=Array(l);for(var u=0;l>u;u++)c[u]=arguments[u+2];r.children=c}return{$$typeof:i,type:e.type,key:o,ref:s,props:r,_owner:a}},createContext:function(e){return(e={$$typeof:f,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:h,_context:e},e.Consumer=e},createElement:R,createFactory:function(e){var t=R.bind(null,e);return t.type=e,t},createRef:function(){return{current:null}},forwardRef:function(e){return{$$typeof:p,render:e}},isValidElement:A,lazy:function(e){return{$$typeof:b,_payload:{_status:-1,_result:e},_init:V}},memo:function(e,t){return{$$typeof:g,type:e,compare:void 0===t?null:t}},startTransition:function(e){var t=j.transition;j.transition={};try{e()}finally{j.transition=t}},unstable_act:N,useCallback:function(e,t){return I.current.useCallback(e,t)},useContext:function(e){return I.current.useContext(e)},useDebugValue:function(){},useDeferredValue:function(e){return I.current.useDeferredValue(e)},useEffect:function(e,t){return I.current.useEffect(e,t)},useId:function(){return I.current.useId()},useImperativeHandle:function(e,t,n){return I.current.useImperativeHandle(e,t,n)},useInsertionEffect:function(e,t){return I.current.useInsertionEffect(e,t)},useLayoutEffect:function(e,t){return I.current.useLayoutEffect(e,t)},useMemo:function(e,t){return I.current.useMemo(e,t)},useReducer:function(e,t,n){return I.current.useReducer(e,t,n)},useRef:function(e){return I.current.useRef(e)},useState:function(e){return I.current.useState(e)},useSyncExternalStore:function(e,t,n){return I.current.useSyncExternalStore(e,t,n)},useTransition:function(){return I.current.useTransition()},version:"18.3.1"},H=(a((function(e,t){})),a((function(e){e.exports=F}))),U=a((function(e,t){!function(e){var t,n,r,o,s,a,i,c,l;(function(e){e.GET_DATA="ui-bg-get-data",e.GET_DEVTOOLS_DATA="ui-bg-get-devtools-data",e.SUBSCRIBE_TO_CHANGES="ui-bg-subscribe-to-changes",e.UNSUBSCRIBE_FROM_CHANGES="ui-bg-unsubscribe-from-changes",e.CHANGE_SETTINGS="ui-bg-change-settings",e.SET_THEME="ui-bg-set-theme",e.TOGGLE_ACTIVE_TAB="ui-bg-toggle-active-tab",e.MARK_NEWS_AS_READ="ui-bg-mark-news-as-read",e.MARK_NEWS_AS_DISPLAYED="ui-bg-mark-news-as-displayed",e.LOAD_CONFIG="ui-bg-load-config",e.APPLY_DEV_DYNAMIC_THEME_FIXES="ui-bg-apply-dev-dynamic-theme-fixes",e.RESET_DEV_DYNAMIC_THEME_FIXES="ui-bg-reset-dev-dynamic-theme-fixes",e.APPLY_DEV_INVERSION_FIXES="ui-bg-apply-dev-inversion-fixes",e.RESET_DEV_INVERSION_FIXES="ui-bg-reset-dev-inversion-fixes",e.APPLY_DEV_STATIC_THEMES="ui-bg-apply-dev-static-themes",e.RESET_DEV_STATIC_THEMES="ui-bg-reset-dev-static-themes",e.COLOR_SCHEME_CHANGE="ui-bg-color-scheme-change",e.HIDE_HIGHLIGHTS="ui-bg-hide-highlights"})(t||(t={})),function(e){e.CHANGES="bg-ui-changes"}(n||(n={})),function(e){e.CSS_UPDATE="debug-bg-ui-css-update",e.UPDATE="debug-bg-ui-update"}(r||(r={})),function(e){e.ADD_CSS_FILTER="bg-cs-add-css-filter",e.ADD_DYNAMIC_THEME="bg-cs-add-dynamic-theme",e.ADD_STATIC_THEME="bg-cs-add-static-theme",e.ADD_SVG_FILTER="bg-cs-add-svg-filter",e.CLEAN_UP="bg-cs-clean-up",e.FETCH_RESPONSE="bg-cs-fetch-response",e.UNSUPPORTED_SENDER="bg-cs-unsupported-sender"}(o||(o={})),function(e){e.RELOAD="debug-bg-cs-reload"}(s||(s={})),function(e){e.COLOR_SCHEME_CHANGE="cs-bg-color-scheme-change",e.DARK_THEME_DETECTED="cs-bg-dark-theme-detected",e.DARK_THEME_NOT_DETECTED="cs-bg-dark-theme-not-detected",e.FETCH="cs-bg-fetch",e.DOCUMENT_CONNECT="cs-bg-document-connect",e.DOCUMENT_FORGET="cs-bg-document-forget",e.DOCUMENT_FREEZE="cs-bg-document-freeze",e.DOCUMENT_RESUME="cs-bg-document-resume"}(a||(a={})),function(e){e.LOG="debug-cs-bg-log"}(i||(i={})),function(e){e.EXPORT_CSS_RESPONSE="cs-ui-export-css-response"}(c||(c={})),function(e){e.EXPORT_CSS="ui-cs-export-css"}(l||(l={}));const u="undefined"!=typeof navigator,d=u?navigator.userAgentData&&Array.isArray(navigator.userAgentData.brands)?navigator.userAgentData.brands.map((e=>`${e.brand.toLowerCase()} ${e.version}`)).join(" "):navigator.userAgent.toLowerCase():"some useragent",h=u?navigator.userAgentData&&"string"==typeof navigator.userAgentData.platform?navigator.userAgentData.platform.toLowerCase():navigator.platform.toLowerCase():"some platform",f=d.includes("chrome")||d.includes("chromium"),p=d.includes("firefox")||d.includes("thunderbird")||d.includes("librewolf"),m=d.includes("safari")&&!f,g=h.startsWith("win"),b=h.startsWith("mac");u&&navigator.userAgentData?navigator:d.includes("mobile");const y="function"==typeof ShadowRoot,w="function"==typeof MediaQueryList&&"function"==typeof MediaQueryList.prototype.addEventListener,k="function"==typeof CSSLayerBlockRule;d.match(/chrom(?:e|ium)(?:\/| )([^ ]+)/),d.match(/(?:firefox|librewolf)(?:\/| )([^ ]+)/);const S=(()=>{try{return document.querySelector(":defined"),!0}catch(e){return!1}})(),v=(()=>{try{if("undefined"==typeof document)return!1;const e=document.createElement("div");return!(!e||"object"!=typeof e.style||"string"!=typeof e.style.colorScheme&&(e.setAttribute("style","color-scheme: dark"),"dark"!==e.style.colorScheme))}catch(e){return!1}})();async function _(e,t,n){const r=await fetch(e,{cache:"force-cache",credentials:"omit",referrer:n});if(p&&"text/css"===t&&e.startsWith("moz-extension://")&&e.endsWith(".css"))return r;if(t&&!r.headers.get("Content-Type").startsWith(t))throw Error("Mime type mismatch when loading "+e);if(!r.ok)throw Error(`Unable to load ${e} ${r.status} ${r.statusText}`);return r}async function E(e,t){const n=await _(e,t);return await $(n)}async function C(e,t){const n=await _(e,t);return await n.blob()}async function $(e){const t=await e.blob();return await new Promise((e=>{const n=new FileReader;n.onloadend=()=>e(n.result),n.readAsDataURL(t)}))}async function x(e,t,n){const r=await _(e,t,n);return await r.text()}const M=async e=>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(" ")));let T=M;function R(e){T=e||M}async function A(e){return await T(e)}window.chrome||(window.chrome={}),chrome.runtime||(chrome.runtime={});const D=new Set;async function O(...e){if(e[0]&&e[0].type===a.FETCH){const{id:t}=e[0];try{const{url:n,responseType:r}=e[0].data,s=await A(n);let a;a="data-url"===r?await $(s):await s.text(),D.forEach((e=>e({type:o.FETCH_RESPONSE,data:a,error:null,id:t})))}catch(e){console.error(e),D.forEach((n=>n({type:o.FETCH_RESPONSE,data:null,error:e,id:t})))}}}function L(e){D.add(e)}if("function"==typeof chrome.runtime.sendMessage){const e=chrome.runtime.sendMessage;chrome.runtime.sendMessage=(...t)=>{O(...t),e.apply(chrome.runtime,t)}}else chrome.runtime.sendMessage=O;if(chrome.runtime.onMessage||(chrome.runtime.onMessage={}),"function"==typeof chrome.runtime.onMessage.addListener){const e=chrome.runtime.onMessage.addListener;chrome.runtime.onMessage.addListener=(...t)=>{L(t[0]),e.apply(chrome.runtime.onMessage,t)}}else chrome.runtime.onMessage.addListener=(...e)=>L(e[0]);var P,V;(function(e){e.cssFilter="cssFilter",e.svgFilter="svgFilter",e.staticTheme="staticTheme",e.dynamicTheme="dynamicTheme"})(P||(P={})),function(e){e.NONE="",e.TIME="time",e.SYSTEM="system",e.LOCATION="location"}(V||(V={}));const I={darkScheme:{background:"#181a1b",text:"#e8e6e3"},lightScheme:{background:"#dcdad7",text:"#181a1b"}},j={mode:1,brightness:100,contrast:100,grayscale:0,sepia:0,useFont:!1,fontFamily:b?"Helvetica Neue":g?"Segoe UI":"Open Sans",textStroke:0,engine:P.dynamicTheme,stylesheet:"",darkSchemeBackgroundColor:I.darkScheme.background,darkSchemeTextColor:I.darkScheme.text,lightSchemeBackgroundColor:I.lightScheme.background,lightSchemeTextColor:I.lightScheme.text,scrollbarColor:"",selectionColor:"auto",styleSystemControls:!v,lightColorScheme:"Default",darkColorScheme:"Default",immediateModify:!1};function N(e){return null!=e.length}function W(e,t){if(N(e))for(let n=0,r=e.length;r>n;n++)t(e[n]);else for(const n of e)t(n)}function F(e,t){W(t,(t=>e.push(t)))}function H(e){const t=[];for(let n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function U(...e){}function B(...e){}function q(e){let t,n=!1,r=null;return Object.assign(((...o)=>{t=o,r?n=!0:(e(...t),r=requestAnimationFrame((()=>{r=null,n&&(e(...t),n=!1)})))}),{cancel:()=>{cancelAnimationFrame(r),n=!1,r=null}})}function z(){const e=[];let t=null;function n(){let n;for(;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}}["*.officeapps.live.com","*.sharepoint.com","docs.google.com","onedrive.live.com"].map((e=>{const t=f?P.svgFilter:P.cssFilter;return{url:[e],theme:{...j,engine:t},builtIn:!0}}));const G=new Set;function K(e,t){G.has(e)||(G.add(e),requestAnimationFrame((()=>{G.delete(e),t()})))}function X(e){let 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 Q(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Y(e,t,n=Function.prototype){const r=10,o=X({seconds:2}),s=X({seconds:10}),a=e.previousSibling;let i=e.parentNode;if(!i)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");let c=0,l=null,u=null;const d=q((()=>{if(u)return;c++;const f=Date.now();if(null==l)l=f;else if(c>=r){if(s>f-l)return void(u=setTimeout((()=>{l=null,c=0,u=null,d()}),o));l=f,c=1}if("head"===t&&a&&a.parentNode!==i)p();else{if("prev-sibling"===t){if(null==a.parentNode)return void p();a.parentNode!==i&&g(a.parentNode)}"head"!==t||i.isConnected||(i=document.head),i.insertBefore(e,a&&a.isConnected?a.nextSibling:i.firstChild),h.takeRecords(),n&&n()}})),h=new MutationObserver((()=>{("head"===t&&(e.parentNode!==i||!e.parentNode.isConnected)||"prev-sibling"===t&&e.previousSibling!==a)&&d()})),f=()=>{h.observe(i,{childList:!0})},p=()=>{clearTimeout(u),h.disconnect(),d.cancel()},m=()=>{h.takeRecords()},g=e=>{i=e,p(),f()};return f(),{run:f,stop:p,skip:m}}function Z(e,t){if(null==e)return;const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>null==e.shadowRoot?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});for(let r=e.shadowRoot?n.currentNode:n.nextNode();null!=r;r=n.nextNode())r.classList.contains("surfingkeys_hints_host")||(t(r),Z(r.shadowRoot,t))}let J=()=>"complete"===document.readyState||"interactive"===document.readyState;function ee(e){J=e}const te=new Set;function ne(e){J()?e():te.add(e)}function re(e){te.delete(e)}function oe(){return"complete"===document.readyState}const se=new Set;function ae(e){oe()?e():se.add(e)}function ie(){se.clear()}if(!J()){const e=()=>{J()&&(te.forEach((e=>e())),te.clear(),oe()&&(document.removeEventListener("readystatechange",e),se.forEach((e=>e())),se.clear()))};document.addEventListener("readystatechange",e)}const ce=1e3;function le(e){if(e.length>ce)return!0;let t=0;for(let n=0;e.length>n;n++)if(t+=e[n].addedNodes.length,t>ce)return!0;return!1}function ue(e){const t=new Set,n=new Set,r=new Set;e.forEach((e=>{W(e.addedNodes,(e=>{e instanceof Element&&e.isConnected&&t.add(e)})),W(e.removedNodes,(e=>{e instanceof Element&&(e.isConnected?(r.add(e),t.delete(e)):n.add(e))}))}));const o=[],s=[];return t.forEach((e=>{t.has(e.parentElement)&&o.push(e)})),n.forEach((e=>{n.has(e.parentElement)&&s.push(e)})),o.forEach((e=>t.delete(e))),s.forEach((e=>n.delete(e))),{additions:t,moves:r,deletions:n}}const de=new Map,he=new WeakMap;function fe(e,t){let n,r,o;if(de.has(e))n=de.get(e),r=he.get(n);else{let t=!1,s=!1;n=new MutationObserver((n=>{if(le(n))!t||J()?r.forEach((({onHugeMutations:t})=>t(e))):s||(o=()=>r.forEach((({onHugeMutations:t})=>t(e))),ne(o),s=!0),t=!0;else{const t=ue(n);r.forEach((({onMinorMutations:n})=>n(e,t)))}})),n.observe(e,{childList:!0,subtree:!0}),de.set(e,n),r=new Set,he.set(n,r)}return r.add(t),{disconnect(){r.delete(t),o&&re(o),0===r.size&&(n.disconnect(),he.delete(n),de.delete(e))}}}function pe(e,t,n=0){const r=[];let o;for(;o=e.exec(t);)r.push(o[n]);return r}function me(e){const t=e.length;let n=0;for(let r=0;t>r;r++)n=(n<<5)-n+e.charCodeAt(r)&4294967295;return n}function ge(e){return e.replaceAll(/[\^$.*+?\(\)\[\]{}|\-\\]/g,"\\$&")}function be(e,t=0){return ye(e,t,"(",")",[])}function ye(e,t,n,r,o){let s;s=0===o.length?(t,n)=>e.indexOf(t,n):(t,n)=>we(e,t,n,o);const{length:a}=e;let i=0,c=-1;for(let e=t;a>e;e++)if(0===i){const t=s(n,e);if(0>t)break;c=t,i++,e=t}else{const t=s(r,e);if(0>t)break;const o=s(n,e);if(0>o||o>=t){if(i--,0===i)return{start:c,end:t+1};e=t}else i++,e=o}return null}function we(e,t,n,r){const o=e.indexOf(t,n),s=r.find((e=>o>=e.start&&e.end>o));return s?we(e,t,s.end,r):o}function ke(e,t,n){const r=[];let o=-1,s=0;for(;(o=we(e,t,s,n))>=0;)r.push(e.substring(s,o).trim()),s=o+1;return r.push(e.substring(s).trim()),r}let Se;const ve=new Map;function _e(e){return Se||(Se=document.createElement("a")),Se.href=e,Se.href}function Ee(e,t=null){const n=`${e}${t?";"+t:""}`;if(ve.has(n))return ve.get(n);if(t){const r=new URL(e,_e(t));return ve.set(n,r),r}const r=new URL(_e(e));return ve.set(e,r),r}function Ce(e,t){if(t.match(/^data\\?\:/))return t;if(/^\/\//.test(t))return`${location.protocol}${t}`;const n=Ee(e);return Ee(t,n.href).href}function $e(e){if(e.startsWith("data:"))return!0;const t=Ee(e);return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port&&t.pathname===location.pathname}function xe(e,t,n){W(e,(e=>{if(Be(e))t(e);else if(qe(e))try{xe(e.styleSheet.cssRules,t,n)}catch(e){n?.()}else if(ze(e)){const r=Array.from(e.media),o=r.some((e=>e.startsWith("screen")||e.startsWith("all")||e.startsWith("("))),s=r.some((e=>e.startsWith("print")||e.startsWith("speech")));!o&&s||xe(e.cssRules,t,n)}else Ge(e)?CSS.supports(e.conditionText)&&xe(e.cssRules,t,n):Ke(e)&&xe(e.cssRules,t,n)}))}const Me=["background","border","border-color","border-bottom","border-left","border-right","border-top","outline","outline-color"],Te=m?Me.map((e=>[e,RegExp(e+":\\s*(.*?)\\s*;")])):null;function Re(e,t){W(e,(n=>{const r=e.getPropertyValue(n).trim();r&&t(n,r)}));const n=e.cssText;n.includes("var(")&&(m?Te.forEach((([e,r])=>{const o=n.match(r);if(o&&o[1]){const n=o[1].trim();t(e,n)}})):Me.forEach((n=>{const r=e.getPropertyValue(n);r&&r.includes("var(")&&t(n,r)}))),n.includes("background-color: ;")&&!e.getPropertyValue("background")&&Ae("background",e,t),n.includes("border-")&&n.includes("-color: ;")&&!e.getPropertyValue("border")&&Ae("border",e,t)}function Ae(e,t,n){const r=t.parentRule;if(Be(r)){const t=r.parentStyleSheet?.ownerNode?.textContent;if(t){let o=ge(r.selectorText);o=o.replaceAll(/\s+/g,"\\s*"),o=o.replaceAll(/::/g,"::?");const s=RegExp(`${o}\\s*{[^}]*${e}:\\s*([^;}]+)`),a=t.match(s);a&&n(e,a[1])}else"background"===e&&n("background-color","#ffffff")}}const De=/url\((('.*?')|(".*?")|([^\)]*?))\)/g,Oe=/@import\s*(url\()?(('.+?')|(".+?")|([^\)]*?))\)? ?(screen)?;?/gi;function Le(e){return e.trim().replace(/[\n\r\\]+/g,"").replace(/^url\((.*)\)$/,"$1").trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1").replace(/(?:\\(.))/g,"$1")}function Pe(e){const t=Ee(e);return`${t.origin}${t.pathname.replace(/\?.*$/,"").replace(/(\/)([^\/]+)$/i,"$1")}`}function Ve(e,t){return e.replace(De,(e=>{try{const n=Le(e),r=Ce(t,n);return`url('${r.replaceAll("'","\\'")}')`}catch(t){return e}}))}const Ie=/@font-face\s*{[^}]*}/g;function je(e){return e.replace(Ie,"")}const Ne=new WeakSet,We=new WeakSet,Fe=new WeakSet,He=new WeakSet,Ue=new WeakSet;function Be(e){return!(!e||!Ne.has(e)&&(!e.selectorText||(Ne.add(e),0)))}function qe(e){return!(!e||Ne.has(e)||!We.has(e)&&(!e.href||(We.add(e),0)))}function ze(e){return!(!e||Ne.has(e)||!Fe.has(e)&&(!e.media||(Fe.add(e),0)))}function Ge(e){return!!e&&!Ne.has(e)&&(!!He.has(e)||e instanceof CSSSupportsRule&&(He.add(e),!0))}function Ke(e){return!(!e||Ne.has(e)||!Ue.has(e)&&(!(k&&e instanceof CSSLayerBlockRule)||(Ue.add(e),0)))}function Xe(e){const t=[],n=[];let r;for(let o=0,s=e.length;s>o;o++){const s=e[o];if(s&&" "!==s){if(Ye.has(s)){const e=Ye.get(s);for(;n.length;){const r=Ye.get(n[0]);if(!r)break;if(!e.lessOrEqualThan(r))break;t.push(n.shift())}n.unshift(s)}else!r||Ye.has(r)?t.push(s):t[t.length-1]+=s;r=s}}t.push(...n);const o=[];for(let e=0,n=t.length;n>e;e++){const n=Ye.get(t[e]);if(n){const e=o.splice(0,2);o.push(n.exec(e[1],e[0]))}else o.unshift(parseFloat(t[e]))}return o[0]}class Qe{constructor(e,t){this.precendce=e,this.execMethod=t}exec(e,t){return this.execMethod(e,t)}lessOrEqualThan(e){return e.precendce>=this.precendce}}const Ye=new Map([["+",new Qe(1,((e,t)=>e+t))],["-",new Qe(1,((e,t)=>e-t))],["*",new Qe(2,((e,t)=>e*t))],["/",new Qe(2,((e,t)=>e/t))]]),Ze=()=>matchMedia("(prefers-color-scheme: dark)").matches,Je=new Map,et=new Map;function tt(e){if(e=e.trim(),et.has(e))return et.get(e);e.includes("calc(")&&(e=Ct(e));const t=ft(e);return t&&et.set(e,t),t}function nt(e){if(Je.has(e))return Je.get(e);const t=tt(e);if(!t)return null;const n=st(t);return Je.set(e,n),n}function rt(){Je.clear(),et.clear()}function ot({h:e,s:t,l:n,a:r=1}){if(0===t){const[e,t,o]=[n,n,n].map((e=>Math.round(255*e)));return{r:e,g:o,b:t,a:r}}const o=(1-Math.abs(2*n-1))*t,s=o*(1-Math.abs(e/60%2-1)),a=n-o/2,[i,c,l]=(60>e?[o,s,0]:120>e?[s,o,0]:180>e?[0,o,s]:240>e?[0,s,o]:300>e?[s,0,o]:[o,0,s]).map((e=>Math.round(255*(e+a))));return{r:i,g:c,b:l,a:r}}function st({r:e,g:t,b:n,a:r=1}){const o=e/255,s=t/255,a=n/255,i=Math.max(o,s,a),c=Math.min(o,s,a),l=i-c,u=(i+c)/2;if(0===l)return{h:0,s:0,l:u,a:r};let d=60*(i===o?(s-a)/l%6:i===s?(a-o)/l+2:(o-s)/l+4);return 0>d&&(d+=360),{h:d,s:l/(1-Math.abs(2*u-1)),l:u,a:r}}function at(e,t=0){const n=e.toFixed(t);if(0===t)return n;const r=n.indexOf(".");if(r>=0){const e=n.match(/0+$/);if(e)return n.substring(0,e.index===r+1?r:e.index)}return n}function it(e){const{r:t,g:n,b:r,a:o}=e;return null!=o&&1>o?`rgba(${at(t)}, ${at(n)}, ${at(r)}, ${at(o,2)})`:`rgb(${at(t)}, ${at(n)}, ${at(r)})`}function ct({r:e,g:t,b:n,a:r}){return"#"+(null!=r&&1>r?[e,t,n,Math.round(255*r)]:[e,t,n]).map((e=>`${16>e?"0":""}${e.toString(16)}`)).join("")}function lt(e){const{h:t,s:n,l:r,a:o}=e;return null!=o&&1>o?`hsla(${at(t)}, ${at(100*n)}%, ${at(100*r)}%, ${at(o,2)})`:`hsl(${at(t)}, ${at(100*n)}%, ${at(100*r)}%)`}const ut=/^rgba?\([^\(\)]+\)$/,dt=/^hsla?\([^\(\)]+\)$/,ht=/^#[0-9a-f]+$/i;function ft(e){const t=e.trim().toLowerCase();if(t.match(ut))return yt(t);if(t.match(dt))return St(t);if(t.match(ht))return vt(t);if($t.has(t))return _t(t);if(xt.has(t))return Et(t);if("transparent"===e)return{r:0,g:0,b:0,a:0};if((t.startsWith("color(")||t.startsWith("color-mix("))&&t.endsWith(")"))return At(t);if(t.startsWith("light-dark(")&&t.endsWith(")")){const e=t.match(/^light-dark\(\s*([a-z]+(\(.*\))?),\s*([a-z]+(\(.*\))?)\s*\)$/);if(e)return ft(Ze()?e[3]:e[1])}return null}function pt(e){const t=[];let n=0,r=!1;const o=e.indexOf("(");e=e.substring(o+1,e.length-1);for(let o=0;e.length>o;o++){const s=e[o];s>="0"&&"9">=s||"."===s||"+"===s||"-"===s?r=!0:!r||" "!==s&&","!==s&&"/"!==s?r||(n=o+1):(t.push(e.substring(n,o)),r=!1,n=o+1)}return r&&t.push(e.substring(n,e.length)),t}function mt(e,t,n){const r=pt(e),o=Object.entries(n),s=r.map((e=>e.trim())).map(((e,n)=>{let r;const s=o.find((([t])=>e.endsWith(t)));return r=s?parseFloat(e.substring(0,e.length-s[0].length))/s[1]*t[n]:parseFloat(e),t[n]>1?Math.round(r):r}));return s}const gt=[255,255,255,1],bt={"%":100};function yt(e){const[t,n,r,o=1]=mt(e,gt,bt);return{r:t,g:n,b:r,a:o}}const wt=[360,1,1,1],kt={"%":100,deg:360,rad:2*Math.PI,turn:1};function St(e){const[t,n,r,o=1]=mt(e,wt,kt);return ot({h:t,s:n,l:r,a:o})}function vt(e){const t=e.substring(1);switch(t.length){case 3:case 4:{const[e,n,r]=[0,1,2].map((e=>parseInt(`${t[e]}${t[e]}`,16)));return{r:e,g:n,b:r,a:3===t.length?1:parseInt(`${t[3]}${t[3]}`,16)/255}}case 6:case 8:{const[e,n,r]=[0,2,4].map((e=>parseInt(t.substring(e,e+2),16)));return{r:e,g:n,b:r,a:6===t.length?1:parseInt(t.substring(6,8),16)/255}}}return null}function _t(e){const t=$t.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}function Et(e){const t=xt.get(e);return{r:t>>16&255,g:t>>8&255,b:t>>0&255,a:1}}function Ct(e){let t=0;const n=(t,n,r)=>{e=e.substring(0,t)+r+e.substring(n)};for(;-1!==(t=e.indexOf("calc("));){const r=be(e,t);if(!r)break;let o=e.slice(r.start+1,r.end-1);const s=o.includes("%");o=o.split("%").join("");const a=Math.round(Xe(o));n(r.start-4,r.end,a+(s?"%":""))}return e}const $t=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})),xt=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((([e,t])=>[e.toLowerCase(),t])));function Mt(e,t,n){return(.2126*e+.7152*t+.0722*n)/255}let Tt,Rt;function At(e){Rt||(Tt=document.createElement("canvas"),Tt.width=1,Tt.height=1,Rt=Tt.getContext("2d",{willReadFrequently:!0})),Rt.fillStyle=e,Rt.fillRect(0,0,1,1);const t=Rt.getImageData(0,0,1,1).data;return yt(`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${(t[3]/255).toFixed(2)})`)}function Dt(e,t,n,r,o){return(e-t)*(o-r)/(n-t)+r}function Ot(e,t,n){return Math.min(n,Math.max(t,e))}function Lt(e,t){const n=[];for(let r=0,o=e.length;o>r;r++){n[r]=[];for(let o=0,s=t[0].length;s>o;o++){let s=0;for(let n=0,a=e[0].length;a>n;n++)s+=e[r][n]*t[n][o];n[r][o]=s}}return n}function Pt(e){let t=It.identity();return 0!==e.sepia&&(t=Lt(t,It.sepia(e.sepia/100))),0!==e.grayscale&&(t=Lt(t,It.grayscale(e.grayscale/100))),100!==e.contrast&&(t=Lt(t,It.contrast(e.contrast/100))),100!==e.brightness&&(t=Lt(t,It.brightness(e.brightness/100))),1===e.mode&&(t=Lt(t,It.invertNHue())),t}function Vt([e,t,n],r){const o=Lt(r,[[e/255],[t/255],[n/255],[1],[1]]);return[0,1,2].map((e=>Ot(Math.round(255*o[e][0]),0,255)))}const It={identity:()=>[[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:()=>[[.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:e=>[[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(e){const 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:e=>[[.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:e=>[[.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 jt(e){return e[1===e.mode?"darkSchemeBackgroundColor":"lightSchemeBackgroundColor"]}function Nt(e){return e[1===e.mode?"darkSchemeTextColor":"lightSchemeTextColor"]}const Wt=new Map;function Ft(){Wt.clear()}const Ht=["r","g","b","a"],Ut=["mode","brightness","contrast","grayscale","sepia","darkSchemeBackgroundColor","darkSchemeTextColor","lightSchemeBackgroundColor","lightSchemeTextColor"];function Bt(e,t){let n="";return Ht.forEach((t=>{n+=e[t]+";"})),Ut.forEach((e=>{n+=t[e]+";"})),n}function qt(e,t,n,r,o){let s;Wt.has(n)?s=Wt.get(n):(s=new Map,Wt.set(n,s));const a=Bt(e,t);if(s.has(a))return s.get(a);const i=n(st(e),null==r?null:nt(r),null==o?null:nt(o)),{r:c,g:l,b:u,a:d}=ot(i),h=Pt(t),[f,p,m]=Vt([c,l,u],h),g=1===d?ct({r:f,g:p,b:m}):it({r:f,g:p,b:m,a:d});return s.set(a,g),g}function zt(e,t){const n=jt(t);return qt(e,t,Gt,Nt(t),n)}function Gt({h:e,s:t,l:n,a:r},o,s){const a=.5>n;let i;if(a)i=.2>n||.12>t;else{const r=e>200&&280>e;i=.24>t||n>.8&&r}let c=e,l=n;return i&&(a?(c=o.h,l=o.s):(c=s.h,l=s.s)),{h:c,s:l,l:Dt(n,0,1,o.l,s.l),a:r}}const Kt=.4;function Xt({h:e,s:t,l:n,a:r},o){const s=.12>t||n>.8&&e>200&&280>e;if(.5>n){const a=Dt(n,0,.5,0,Kt);return s?{h:o.h,s:o.s,l:a,a:r}:{h:e,s:t,l:a,a:r}}let a=Dt(n,.5,1,Kt,o.l);if(s)return{h:o.h,s:o.s,l:a,a:r};let i=e;return e>60&&180>e&&(i=e>120?Dt(e,120,180,135,180):Dt(e,60,120,60,105)),i>40&&80>i&&(a*=.75),{h:i,s:t,l:a,a:r}}function Qt(e,t){if(0===t.mode)return zt(e,t);const n=jt(t);return qt(e,{...t,mode:0},Xt,n)}const Yt=.55;function Zt(e){return Dt(e,205,245,205,220)}function Jt({h:e,s:t,l:n,a:r},o){const s=.2>n||.24>t,a=!s&&e>205&&245>e;if(n>.5){const i=Dt(n,.5,1,Yt,o.l);if(s)return{h:o.h,s:o.s,l:i,a:r};let c=e;return a&&(c=Zt(e)),{h:c,s:t,l:i,a:r}}if(s)return{h:o.h,s:o.s,l:Dt(n,0,.5,o.l,Yt),a:r};let i,c=e;return a?(c=Zt(e),i=Dt(n,0,.5,o.l,Math.min(1,Yt+.05))):i=Dt(n,0,.5,o.l,Yt),{h:c,s:t,l:i,a:r}}function en(e,t){if(0===t.mode)return zt(e,t);const n=Nt(t);return qt(e,{...t,mode:0},Jt,n)}function tn({h:e,s:t,l:n,a:r},o,s){let a=e,i=t;return(.2>n||.24>t)&&(.5>n?(a=o.h,i=o.s):(a=s.h,i=s.s)),{h:a,s:i,l:Dt(n,0,1,.5,.2),a:r}}function nn(e,t){if(0===t.mode)return zt(e,t);const n=Nt(t),r=jt(t);return qt(e,{...t,mode:0},tn,n,r)}function rn(e,t){return Qt(e,t)}function on(e,t){return Qt(e,t)}const sn=["pre","pre *","code",'[aria-hidden="true"]','[class*="fa-"]',".fa",".fab",".fad",".fal",".far",".fas",".fass",".fasr",".fat",".icofont",'[style*="font-"]','[class*="icon"i]','[class*="symbol"i]',".glyphicon",'[class*="material-symbol"]','[class*="material-icon"]',"mu",'[class*="mu-"]',".typcn",'[class*="vjs-"]'];function an(e){const t=[];return t.push(`*:not(${sn.join(", ")}) {`),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")}var cn;function ln(e){const t=[];return e.mode===cn.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 un(e){return e.slice(0,4).map((e=>e.map((e=>e.toFixed(3))).join(" "))).join(" ")}function dn(e){return un(Pt(e))}function hn(e){return(16>e?"0":"")+e.toString(16)}function fn(){if("randomUUID"in crypto){const e=crypto.randomUUID();return e.substring(0,8)+e.substring(9,13)+e.substring(14,18)+e.substring(19,23)+e.substring(24)}return"getRandomValues"in crypto?Array.from(crypto.getRandomValues(new Uint8Array(16))).map((e=>hn(e))).join(""):Math.floor(Math.random()*2**55).toString(36)}!function(e){e[e.light=0]="light",e[e.dark=1]="dark"}(cn||(cn={}));const pn=new Map,mn=new Map;async function gn(e){return window.DarkReader?.Plugins?.fetch?window.DarkReader.Plugins.fetch(e):new Promise(((t,n)=>{const r=fn();pn.set(r,t),mn.set(r,n),chrome.runtime.sendMessage({type:a.FETCH,data:e,id:r})}))}chrome.runtime.onMessage.addListener((({type:e,data:t,error:n,id:r})=>{if(e===o.FETCH_RESPONSE){const e=pn.get(r),o=mn.get(r);pn.delete(r),mn.delete(r),n?o&&o(n):e&&e(t)}}));const bn=1e3/60;class yn{constructor(){this.queue=[],this.timerId=null}addTask(e){this.queue.push(e),this.scheduleFrame()}stop(){null!==this.timerId&&(cancelAnimationFrame(this.timerId),this.timerId=null),this.queue=[]}scheduleFrame(){this.timerId||(this.timerId=requestAnimationFrame((()=>{this.timerId=null;const e=Date.now();let t;for(;t=this.queue.shift();)if(t(),Date.now()-e>=bn){this.scheduleFrame();break}})))}}const wn=new yn;async function kn(e){return new Promise((async(t,n)=>{try{const n=e.startsWith("data:")?e:await Sn(e),r=qn(n)??await C(e);let o;o=n.startsWith("data:image/svg+xml")?await Cn(n):await vn(r)??await Cn(n),wn.addTask((()=>{const r=Dn(o);t({src:e,dataURL:r.isLarge?"":n,width:o.width,height:o.height,...r})}))}catch(e){n(e)}}))}async function Sn(e){return new URL(e).origin===location.origin?await E(e):await gn({url:e,responseType:"data-url"})}async function vn(e){try{return await createImageBitmap(e)}catch(t){return B(`Unable to create image bitmap for type ${e.type}: ${t+""}`),null}}const _n=256;let En=0;async function Cn(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n("Unable to load image "+e),++En<=_n||oe()?r.src=e:ae((()=>r.src=e))}))}const $n=1024;let xn,Mn;function Tn(){const e=$n,t=$n;xn=document.createElement("canvas"),xn.width=e,xn.height=t,Mn=xn.getContext("2d",{willReadFrequently:!0}),Mn.imageSmoothingEnabled=!1}function Rn(){xn=null,Mn=null}const An=262144;function Dn(e){let t,n;if(xn||Tn(),e instanceof HTMLImageElement?(t=e.naturalWidth,n=e.naturalHeight):(t=e.width,n=e.height),0===t||0===n)return{isDark:!1,isLight:!1,isTransparent:!1,isLarge:!1};const r=t*n>An,o=Math.min(1,Math.sqrt($n/(t*n))),s=Math.ceil(t*o),a=Math.ceil(n*o);Mn.clearRect(0,0,s,a),Mn.drawImage(e,0,0,t,n,0,0,s,a);const i=Mn.getImageData(0,0,s,a).data,c=.05,l=.4,u=.7;let d,h,f,p,m,g,b,y,w=0,k=0,S=0;for(f=0;a>f;f++)for(h=0;s>h;h++)d=4*(f*s+h),p=i[d+0],m=i[d+1],g=i[d+2],b=i[d+3],c>b/255?w++:(y=Mt(p,m,g),l>y&&k++,y>u&&S++);const v=s*a,_=v-w;return{isDark:k/_>=.7,isLight:S/_>=.7,isTransparent:w/v>=.1,isLarge:r}}let On=null,Ln=!1,Pn=!1;const Vn=[];async function In(){if(Ln){if(Pn)return await new Promise((e=>Vn.push(e)));Pn=!0,await new Promise((e=>{document.addEventListener("__darkreader__blobURLCheckResponse",(t=>{On=t.detail.blobURLAllowed,e(),Vn.forEach((e=>e())),Vn.splice(0)}),{once:!0}),document.dispatchEvent(new CustomEvent("__darkreader__blobURLCheckRequest"))}))}}function jn(){return null!=On||!Ln}function Nn(e){"blob"===e.blockedURI&&(On=!1,document.removeEventListener("securitypolicyviolation",Nn))}document.addEventListener("__darkreader__inlineScriptsAllowed",(()=>Ln=!0),{once:!0}),document.addEventListener("securitypolicyviolation",Nn);const Wn=new Set;function Fn({dataURL:e,width:t,height:n},r){e.startsWith("data:image/svg+xml")&&(e=Un(e));const o=`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${t}" height="${n}"><defs><filter id="darkreader-image-filter"><feColorMatrix type="matrix" values="${dn(r)}" /></filter></defs><image width="${t}" height="${n}" filter="url(#darkreader-image-filter)" xlink:href="${e}" /></svg>`;if(!On)return"data:image/svg+xml;base64,"+btoa(o);const s=new Uint8Array(o.length);for(let e=0;o.length>e;e++)s[e]=o.charCodeAt(e);const a=new Blob([s],{type:"image/svg+xml"}),i=URL.createObjectURL(a);return Wn.add(i),i}const Hn={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"};function Un(e){return e.replace(/[<>&'"]/g,(e=>Hn[e]??e))}const Bn=new Map;function qn(e){const t=e.indexOf(":"),n=e.indexOf(";",t+1),r=e.indexOf(",",n+1),o=e.substring(n+1,r).toLocaleLowerCase(),s=e.substring(t+1,n);if("base64"!==o||!s)return null;const a=atob(e.substring(r+1)),i=new Uint8Array(a.length);for(let e=0;a.length>e;e++)i[e]=a.charCodeAt(e);return new Blob([i],{type:s})}async function zn(e){if(!On)return null;const t=me(e);let n=Bn.get(t);if(n)return n;let r=qn(e);if(!r){const t=await fetch(e);r=await t.blob()}return n=URL.createObjectURL(r),Bn.set(t,n),n}function Gn(){wn&&wn.stop(),Rn(),Wn.forEach((e=>URL.revokeObjectURL(e))),Wn.clear(),Bn.forEach((e=>URL.revokeObjectURL(e))),Bn.clear()}const Kn=8,Xn="conic-",Qn=Xn.length,Yn="radial-",Zn="linear-";function Jn(e){const t=[];let n=0,r=Xn.length;for(;-1!==(n=e.indexOf("gradient",r));){let o;if([Zn,Yn,Xn].find((t=>{if(n-t.length>=0&&e.substring(n-t.length,n)===t)return"repeating"===e.slice(n-t.length-10,n-t.length-1)?(o=`repeating-${t}gradient`,!0):"-webkit"===e.slice(n-t.length-8,n-t.length-1)?(o=`-webkit-${t}gradient`,!0):(o=t+"gradient",!0)})),!o)break;const{start:s,end:a}=be(e,n+Kn),i=e.substring(s+1,a-1);r=a+1+Qn,t.push({typeGradient:o,match:i,offset:o.length+2,index:n-o.length+Kn,hasComma:!0})}return t.length&&(t[t.length-1].hasComma=!1),t}function er(e,t){return!(!e||!e.getPropertyPriority(t))}function tr(e,t,n,r,o,s){let a=null;if(e.startsWith("--"))a=kr(r,e,t,n,o,s);else if(t.includes("var("))a=Sr(r,e,t);else if("color-scheme"===e)a=wr();else if("scrollbar-color"===e)a=yr(t);else if(e.includes("color")&&"-webkit-print-color-adjust"!==e||"fill"===e||"stroke"===e||"stop-color"===e)if(e.startsWith("border")&&"border-color"!==e&&"initial"===t){const r=e.substring(0,e.length-6),o=n.style.getPropertyValue(r);o.startsWith("0px")||"none"===o?(e=r,a=o):a=t}else a=dr(e,t,n);else"background-image"===e||"list-style-image"===e?a=mr(t,n,o,s):e.includes("shadow")&&(a=br(t));return a?{property:e,value:a,important:er(n.style,e),sourceValue:t}:null}function nr(...e){return e.filter(Boolean).join(", ")}const rr=["calendar.google.com"];function or(e,t,n){const r=[];t||(r.push("html {"),r.push(` background-color: ${Qt({r:255,g:255,b:255},e)} !important;`),r.push("}")),v&&1===e.mode&&(r.push("html {"),r.push(" color-scheme: dark !important;"),r.push("}"),r.push("iframe {"),r.push(" color-scheme: dark !important;"),r.push("}"));const o=nr(t?"":"html, body",n?"input, textarea, select, button, dialog":"");return o&&(r.push(o+" {"),r.push(` background-color: ${Qt({r:255,g:255,b:255},e)};`),r.push("}")),r.push(nr("html, body",n?"input, textarea, select, button":"")+" {"),r.push(` border-color: ${nn({r:76,g:76,b:76},e)};`),r.push(` color: ${en({r:0,g:0,b:0},e)};`),r.push("}"),r.push("a {"),r.push(` color: ${en({r:0,g:64,b:255},e)};`),r.push("}"),r.push("table {"),r.push(` border-color: ${nn({r:128,g:128,b:128},e)};`),r.push("}"),r.push("mark {"),r.push(` color: ${en({r:0,g:0,b:0},e)};`),r.push("}"),r.push("::placeholder {"),r.push(` color: ${en({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: ${Qt({r:250,g:255,b:189},e)} !important;`),r.push(` color: ${en({r:0,g:0,b:0},e)} !important;`),r.push("}"),e.scrollbarColor&&!rr.includes(location.hostname)&&r.push(ir(e)),e.selectionColor&&r.push(ar(e)),k&&(r.unshift("@layer {"),r.push("}")),r.join("\n")}function sr(e){let t,n;if("auto"===e.selectionColor)t=Qt({r:0,g:96,b:212},{...e,grayscale:0}),n=en({r:255,g:255,b:255},{...e,grayscale:0});else{const r=st(tt(e.selectionColor));t=e.selectionColor,n=.5>r.l?"#FFF":"#000"}return{backgroundColorSelection:t,foregroundColorSelection:n}}function ar(e){const t=[],n=sr(e),r=n.backgroundColorSelection,o=n.foregroundColorSelection;return["::selection","::-moz-selection"].forEach((e=>{t.push(e+" {"),t.push(` background-color: ${r} !important;`),t.push(` color: ${o} !important;`),t.push("}")})),t.join("\n")}function ir(e){let t,n;if("auto"===e.scrollbarColor)t=Qt({r:241,g:241,b:241},e),n=Qt({r:176,g:176,b:176},e);else{const o=st(tt(e.scrollbarColor));t=lt((r=.4,{...o,l:Ot(o.l-r,0,1)})),n=lt(o)}var r;return["* {",` scrollbar-color: ${n} ${t};`,"}"].join("\n")}function cr(e,{strict:t}){return lr(e,{strict:t})}function lr(e,{strict:t}){const n=[];return n.push(`html, body, ${t?"body :not(iframe)":"body > :not(iframe)"} {`),n.push(` background-color: ${Qt({r:255,g:255,b:255},e)} !important;`),n.push(` border-color: ${nn({r:64,g:64,b:64},e)} !important;`),n.push(` color: ${en({r:0,g:0,b:0},e)} !important;`),n.push("}"),n.push('div[style*="background-color: rgb(135, 135, 135)"] {'),n.push(" background-color: #878787 !important;"),n.push("}"),n.join("\n")}const ur=new Set(["inherit","transparent","initial","currentcolor","none","unset","auto"]);function dr(e,t,n){if(ur.has(t.toLowerCase()))return t;const r=tt(t);return r?e.includes("background")?n.style.webkitMaskImage&&"none"!==n.style.webkitMaskImage||n.style.webkitMask&&!n.style.webkitMask.startsWith("none")||n.style.mask&&"none"!==n.style.mask||n.style.getPropertyValue("mask-image")&&"none"!==n.style.getPropertyValue("mask-image")?e=>en(r,e):e=>Qt(r,e):e.includes("border")||e.includes("outline")?e=>nn(r,e):e=>en(r,e):null}const hr=new Map,fr=new Map;function pr(e,t){if(!e||0===t.length)return!1;if(t.some((e=>"*"===e)))return!0;const n=e.split(/,\s*/g);for(let e=0;t.length>e;e++){const r=t[e];if(n.some((e=>e===r)))return!0}return!1}function mr(e,t,n,r){try{if(pr(t.selectorText,n))return e;const o=Jn(e),s=pe(De,e);if(0===s.length&&0===o.length)return e;const a=t=>{let n=0;return t.map((t=>{const r=e.indexOf(t,n);return n=r+t.length,{match:t,index:r}}))},i=o.map((e=>({type:"gradient",...e}))).concat(a(s).map((e=>({type:"url",offset:0,...e})))).sort(((e,t)=>e.index>t.index?1:-1)),c=e=>{const{typeGradient:t,match:n,hasComma:r}=e,o=/^(from|color-stop|to)\(([^\(\)]*?,\s*)?(.*?)\)$/,s=pe(/([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?([^\(\), ]|( (?!calc)))*),?/g,n,1).map((e=>{let t=tt(e=e.trim());if(t)return e=>on(t,e);const n=e.lastIndexOf(" ");if(t=tt(e.substring(0,n)),t)return r=>`${on(t,r)} ${e.substring(n+1)}`;const r=e.match(o);return r&&(t=tt(r[3]),t)?e=>`${r[1]}(${r[2]?r[2]+", ":""}${on(t,e)})`:()=>e}));return e=>`${t}(${s.map((t=>t(e))).join(", ")})${r?", ":""}`},l=e=>{let n=Le(e);const o=0===n.length,{parentStyleSheet:s}=t,a=s&&s.href?Pe(s.href):s?.ownerNode?.baseURI||location.origin;return n=Ce(a,n),async e=>{if(o)return"url('')";let t=null;if(hr.has(n))t=hr.get(n);else try{if(jn()||await In(),fr.has(n)){const e=fr.get(n);if(t=await new Promise((t=>e.push(t))),!t)return null}else fr.set(n,[]),t=await kn(n),hr.set(n,t),fr.get(n).forEach((e=>e(t))),fr.delete(n);if(r())return null}catch(e){B(e),fr.has(n)&&(fr.get(n).forEach((e=>e(null))),fr.delete(n))}if(t){const n=u(t,e);if(n)return n}if(n.startsWith("data:")){const e=await zn(n);if(e)return`url("${e}")`}return`url("${n}")`}},u=(e,t)=>{const{isDark:n,isLight:r,isTransparent:o,isLarge:s,width:a}=e;let i;const c=e.src.startsWith("data:")?"data:":e.src;return s&&r&&!o&&1===t.mode?(U("Hiding large light image "+c),i="none"):n&&o&&1===t.mode&&a>2?(U("Inverting dark image "+c),i=`url("${Fn(e,{...t,sepia:Ot(t.sepia+10,0,100)})}")`):r&&!o&&1===t.mode?(U("Dimming light image "+c),i=`url("${Fn(e,t)}")`):0===t.mode&&r?(U("Applying filter to image "+c),i=`url("${Fn(e,{...t,brightness:Ot(t.brightness-10,5,200),sepia:Ot(t.sepia+10,0,100)})}")`):(U("Not modifying the image "+c),i=null),i},d=[];let h=0,f=!1;return i.forEach((({type:t,match:n,index:r,typeGradient:o,hasComma:s,offset:a},u)=>{const p=r,m=h,g=p+n.length+a;h=g,m!==p&&d.push(f?()=>{let t=e.substring(m,p);return","===t[0]&&(t=t.substring(1)),t}:()=>e.substring(m,p)),f=s||!1,"url"===t?d.push(l(n)):"gradient"===t&&d.push(c({match:n,index:r,typeGradient:o,hasComma:s||!1,offset:a})),u===i.length-1&&d.push((()=>e.substring(g)))})),e=>{const t=d.filter(Boolean).map((t=>t(e)));if(t.some((e=>e instanceof Promise)))return Promise.all(t).then((e=>e.filter(Boolean).join("")));const n=t.join("");return n.endsWith(", initial")?n.slice(0,-9):n}}catch(e){return null}}function gr(e){try{let t=0;const n=pe(/(^|\s)(?!calc)([a-z]+\(.+?\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/gi,e,2);let r=0;const o=n.map(((o,s)=>{const a=t,i=e.indexOf(o,t),c=i+o.length;t=c;const l=tt(o);return l?t=>`${e.substring(a,i)}${rn(l,t)}${s===n.length-1?e.substring(c):""}`:(r++,()=>e.substring(a,c))}));return e=>{const t=o.map((t=>t(e))).join("");return{matchesLength:n.length,unparseableMatchesLength:r,result:t}}}catch(e){return null}}function br(e){const t=gr(e);return t?e=>t(e).result:null}function yr(e){const t=e.match(/^\s*([a-z]+(\(.*\))?)\s+([a-z]+(\(.*\))?)\s*$/);if(!t)return e;const n=tt(t[1]),r=tt(t[3]);return n&&r?e=>`${en(n,e)} ${Qt(n,e)}`:null}function wr(){return e=>0===e.mode?"dark light":"dark"}function kr(e,t,n,r