diff --git a/build/common.js b/build/common.js index 529754ce..8e4aa22c 100644 --- a/build/common.js +++ b/build/common.js @@ -108,8 +108,8 @@ module.exports = ({ production, filename='[name].[contenthash]', sentry={} }, { new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(production?'production':'development'), - 'process.env.SENTRY_RELEASE': JSON.stringify(process.env.SENTRY_RELEASE), - RAINDROP_ENVIRONMENT: JSON.stringify('browser') + RAINDROP_ENVIRONMENT: JSON.stringify('browser'), + 'process.env.SENTRY_RELEASE': JSON.stringify(production && !sentry?.disabled? process.env.SENTRY_RELEASE : undefined) }), //HTML diff --git a/package.json b/package.json index 45382dbf..beaa7e93 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "5.6.39", + "version": "5.6.41", "description": "All-in-one bookmark manager", "author": "Rustem Mussabekov", "license": "MIT", diff --git a/src/config/csp.js b/src/config/csp.js index a01adb41..af0a58e2 100644 --- a/src/config/csp.js +++ b/src/config/csp.js @@ -1,3 +1,3 @@ module.exports = { - hosts: 'https://app.raindrop.io https://*.sentry.io https://sentry.io https://raindrop.onfastspring.com' + hosts: 'https://app.raindrop.io https://raindrop.onfastspring.com '+(process.env.SENTRY_RELEASE ? 'https://*.sentry.io https://sentry.io' : '') } \ No newline at end of file diff --git a/src/config/vendors.js b/src/config/vendors.js index be781603..5d83a7c3 100644 --- a/src/config/vendors.js +++ b/src/config/vendors.js @@ -1,5 +1,8 @@ -export default { - sentry: { +const vendors = {} + +if (process.env.SENTRY_RELEASE) + vendors.sentry = { dsn: 'https://c647a147102b4de68dd9dd8690e06840@o199199.ingest.sentry.io/5264532' } -} \ No newline at end of file + +export default vendors \ No newline at end of file diff --git a/src/data/sagas/common.js b/src/data/sagas/common.js index 665fe042..e649f94d 100755 --- a/src/data/sagas/common.js +++ b/src/data/sagas/common.js @@ -1,4 +1,3 @@ -import * as Sentry from '@sentry/minimal' import { put, takeEvery } from 'redux-saga/effects' import ApiError from '../modules/error' @@ -29,7 +28,9 @@ function* checkAuth(action={}) { //Send additional info to 3rd-party scripts function thirdPartyUserUpdate({ user: { _id, email } }) { - Sentry.configureScope(scope => { - scope.setUser({ id: _id, email }) - }) + if (RAINDROP_ENVIRONMENT != 'browser' || process.env.SENTRY_RELEASE) { + require('@sentry/minimal').configureScope(scope => { + scope.setUser({ id: _id, email }) + }) + } } \ No newline at end of file diff --git a/src/data/sagas/index.js b/src/data/sagas/index.js index 9e8c7fad..f348c77b 100755 --- a/src/data/sagas/index.js +++ b/src/data/sagas/index.js @@ -1,6 +1,5 @@ import { all, spawn, delay, call } from 'redux-saga/effects' import ApiError from '../modules/error' -import * as Sentry from '@sentry/minimal' import common from './common' import user from './user' @@ -28,7 +27,9 @@ function* failSafe(saga) { if (typeof e != 'object' || e instanceof ApiError == false) - Sentry.captureException(e) + if (RAINDROP_ENVIRONMENT != 'browser' || process.env.SENTRY_RELEASE) { + require('@sentry/minimal').captureException(e) + } yield delay(1000) } diff --git a/src/modules/vendors/sentry.js b/src/modules/vendors/sentry.js deleted file mode 100644 index b221ffb9..00000000 --- a/src/modules/vendors/sentry.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react' -import * as Sentry from '@sentry/react' -import config from '~config' -import pkg from '../../../package.json' -import { target } from '~target' - -//Firefox sending errors without sourcemap, so just ignore them at all -if (process.env.NODE_ENV !== 'development' && - process.env.SENTRY_RELEASE) { - Sentry.init({ - ...config.vendors.sentry, - release: process.env.SENTRY_RELEASE, - ignoreErrors: [ - 'ResizeObserver loop', - 'Non-Error promise rejection captured with keys: message', //happen when extension background page crash - 'The string did not match the expected pattern', //weird safari error - 'call screen.orientation.lock', //weird android chrome error - 'Actions may not have an undefined "type" property. Have you misspelled a constant?', //if redux action have undefined field in it, can be safely ignored - 'Refused to evaluate a string as JavaScript because \'unsafe-eval\'', - 'Cannot read property \'Sortable', //https://sentry.io/organizations/oblako-corp/issues/2170103500 - ], - environment: `${target}-${process.env.NODE_ENV}` - }) - Sentry.setTag('version', pkg.version) -} - -export default class MySentry extends React.Component { - render() { - return ( - - {this.props.children} - - ) - } -} \ No newline at end of file diff --git a/src/modules/vendors/sentry/component.js b/src/modules/vendors/sentry/component.js new file mode 100644 index 00000000..16e1eb5c --- /dev/null +++ b/src/modules/vendors/sentry/component.js @@ -0,0 +1,31 @@ +import React from 'react' +import * as Sentry from '@sentry/react' +import config from '~config' +import pkg from '../../../../package.json' +import { target } from '~target' + +Sentry.init({ + ...config.vendors.sentry, + release: process.env.SENTRY_RELEASE, + ignoreErrors: [ + 'ResizeObserver loop', + 'Non-Error promise rejection captured with keys: message', //happen when extension background page crash + 'The string did not match the expected pattern', //weird safari error + 'call screen.orientation.lock', //weird android chrome error + 'Actions may not have an undefined "type" property. Have you misspelled a constant?', //if redux action have undefined field in it, can be safely ignored + 'Refused to evaluate a string as JavaScript because \'unsafe-eval\'', + 'Cannot read property \'Sortable', //https://sentry.io/organizations/oblako-corp/issues/2170103500 + ], + environment: `${target}-${process.env.NODE_ENV}` +}) +Sentry.setTag('version', pkg.version) + +export default class MySentry extends React.Component { + render() { + return ( + + {this.props.children} + + ) + } +} \ No newline at end of file diff --git a/src/modules/vendors/sentry/index.js b/src/modules/vendors/sentry/index.js new file mode 100644 index 00000000..1bef0dee --- /dev/null +++ b/src/modules/vendors/sentry/index.js @@ -0,0 +1,5 @@ +let Component = process.env.SENTRY_RELEASE ? + require('./component').default : + function({children}) { return children } + +export default Component \ No newline at end of file diff --git a/src/target/extension/background/highlights/highlight.js b/src/target/extension/background/highlights/highlight.js index ccffe186..70e17592 100644 --- a/src/target/extension/background/highlights/highlight.js +++ b/src/target/extension/background/highlights/highlight.js @@ -1,22 +1,24 @@ -"use strict";var Zr=Object.defineProperty;var On=t=>{throw TypeError(t)};var Qr=(t,e,n)=>e in t?Zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ct=(t,e,n)=>Qr(t,typeof e!="symbol"?e+"":e,n),Ln=(t,e,n)=>e.has(t)||On("Cannot "+n);var Q=(t,e,n)=>(Ln(t,e,"read from private field"),n?n.call(t):e.get(t)),Be=(t,e,n)=>e.has(t)?On("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ye=(t,e,n,r)=>(Ln(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);(function(){var t=window.Document.prototype.createElement,e=window.Document.prototype.createElementNS,n=window.Document.prototype.importNode,r=window.Document.prototype.prepend,o=window.Document.prototype.append,s=window.DocumentFragment.prototype.prepend,c=window.DocumentFragment.prototype.append,h=window.Node.prototype.cloneNode,d=window.Node.prototype.appendChild,p=window.Node.prototype.insertBefore,_=window.Node.prototype.removeChild,b=window.Node.prototype.replaceChild,E=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),m=window.Element.prototype.attachShadow,z=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),x=window.Element.prototype.getAttribute,T=window.Element.prototype.setAttribute,O=window.Element.prototype.removeAttribute,k=window.Element.prototype.toggleAttribute,$=window.Element.prototype.getAttributeNS,A=window.Element.prototype.setAttributeNS,K=window.Element.prototype.removeAttributeNS,C=window.Element.prototype.insertAdjacentElement,S=window.Element.prototype.insertAdjacentHTML,q=window.Element.prototype.prepend,L=window.Element.prototype.append,M=window.Element.prototype.before,V=window.Element.prototype.after,Z=window.Element.prototype.replaceWith,et=window.Element.prototype.remove,nt=window.HTMLElement,ot=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ht=window.HTMLElement.prototype.insertAdjacentElement,Kt=window.HTMLElement.prototype.insertAdjacentHTML,En=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(i){return En.add(i)});function Cn(i){var l=En.has(i);return i=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(i),!l&&i}var Yr=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);function F(i){var l=i.isConnected;if(l!==void 0)return l;if(Yr(i))return!0;for(;i&&!(i.__CE_isImportDocument||i instanceof Document);)i=i.parentNode||(window.ShadowRoot&&i instanceof ShadowRoot?i.host:void 0);return!(!i||!(i.__CE_isImportDocument||i instanceof Document))}function Ie(i){var l=i.children;if(l)return Array.prototype.slice.call(l);for(l=[],i=i.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&l.push(i);return l}function Fe(i,l){for(;l&&l!==i&&!l.nextSibling;)l=l.parentNode;return l&&l!==i?l.nextSibling:null}function He(i,l,u){for(var v=i;v;){if(v.nodeType===Node.ELEMENT_NODE){var a=v;l(a);var f=a.localName;if(f==="link"&&a.getAttribute("rel")==="import"){if(v=a.import,u===void 0&&(u=new Set),v instanceof Node&&!u.has(v))for(u.add(v),v=v.firstChild;v;v=v.nextSibling)He(v,l,u);v=Fe(i,a);continue}else if(f==="template"){v=Fe(i,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)He(a,l,u)}v=v.firstChild?v.firstChild:Fe(i,v)}}function pe(){var i=!(vt==null||!vt.noDocumentConstructionObserver),l=!(vt==null||!vt.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=l,this.I=!i}function Jt(i,l,u,v){var a=window.ShadyDOM;if(i.shadyDomFastWalk&&a&&a.inUse){if(l.nodeType===Node.ELEMENT_NODE&&u(l),l.querySelectorAll)for(i=a.nativeMethods.querySelectorAll.call(l,"*"),l=0;lr[e]),s=o.s.get(e)),s!==void 0&&H(s,st(n,o.i,o));const c=o.a,h=!(e in t);if(c&&e==="length")for(let d=n;d"u"?t=>setTimeout(t,1):requestIdleCallback;let $e=!1,ke=!1,Ze=[],Qe=[];function lr(){$e=!1;const t=Ze.slice();Ze=[],sr(t)}function ar(){ke=!1;const t=Qe.slice();Qe=[],sr(t)}function le(t){$e||($e=!0,queueMicrotask(lr)),Ze.push(t)}function So(t){ke||(ke=!0,To(ar)),Qe.push(t)}function zo(){$e&&lr(),ke&&ar()}function No(t){let e=Ot|_t;j===null&&(e|=St);const n={deps:null,deriveds:null,equals:ir,f:e,first:null,fn:t,last:null,reactions:null,v:null,version:0};if(P!==null&&P.f&Ot){var r=P;r.deriveds===null?r.deriveds=[n]:r.deriveds.push(n)}return n}function ur(t){hn(t);var e=t.deriveds;if(e!==null){t.deriveds=null;for(var n=0;nt.version)return!0;!qt&&!((b=p==null?void 0:p.reactions)!=null&&b.includes(t))&&(p.reactions??(p.reactions=[])).push(t)}else{if(t.f&_t)return!0;o&&(_>t.version&&(n=!0),h=p.reactions,h===null?p.reactions=[t]:h.includes(t)||h.push(t))}}r||ut(t,dt),o&&(t.f^=we)}return n}function Mo(t,e,n){throw t}function hr(t){const e=W,n=Y,r=xt,o=P,s=qt;W=null,Y=0,xt=null,P=t.f&(yt|cn)?null:t,qt=!Bt&&(t.f&St)!==0;try{let c=(0,t.fn)(),h=t.deps;if(W!==null){let d;if(h!==null){const p=h.length,_=Y===0?W:h.slice(0,Y).concat(W),E=_.length>16&&p-Y>1?new Set(_):null;for(d=Y;d0)for(h.length=Y+W.length,d=0;d1e3&&(Yt=0,wo()),Yt++}function gr(t){var e=t.length;if(e!==0){vr();var n=Bt;Bt=!0;try{for(var r=0;r1001)return;const t=Nt;Nt=[],gr(t),ie||(Yt=0)}function Le(t){me===fr&&(ie||(ie=!0,queueMicrotask(jo)));for(var e=t;e.parent!==null;){e=e.parent;var n=e.f;if(n&yt){if(!(n&dt))return;ut(e,Lt)}}Nt.push(e)}function mr(t,e){var n=t.first,r=[];t:for(;n!==null;){var o=n.f,s=(o&(Xt|Mt))===0,c=o&yt,h=(o&dt)!==0,d=n.first;if(s&&(!c||!h)){if(c&&ut(n,dt),o&Vt){if(!c&&ae(n)&&(Oe(n),d=n.first),d!==null){n=d;continue}}else if(o&rr)if(c||h){if(d!==null){n=d;continue}}else r.push(n)}var p=n.next;if(p===null){let E=n.parent;for(;E!==null;){if(t===E)break t;var _=E.next;if(_!==null){n=_;continue t}E=E.parent}}n=p}for(var b=0;b0||s.length>0)&&Rt(),Yt=0,o}finally{me=n,Nt=r}}function D(t){const e=t.f;if(e&Xt)return t.v;if(P!==null){const n=(P.f&St)!==0,r=P.deps;W===null&&r!==null&&r[Y]===t&&!(n&&j!==null)?Y++:(r===null||Y===0||r[Y-1]!==t)&&(W===null?W=[t]:W[W.length-1]!==t&&W.push(t)),xt!==null&&j!==null&&j.f&dt&&!(j.f&yt)&&xt.includes(t)&&(ut(j,_t),Le(j))}return e&Ot&&ae(t)&&cr(t),t.v}function pn(t,e,n){var r=t.reactions;if(r!==null)for(var o=tn(),s=r.length,c=0;c{de(e)}}function gn(t){return Gt(rr,t,!1)}function fe(t){return Gt(Vt,t,!0)}function mt(t){return fe(t)}function br(t,e=0){return Gt(Vt|or|e,t,!0)}function se(t){return Gt(Vt|yt,t,!0)}function wr(t){var e=t.teardown;if(e!==null){const n=dn,r=P;In(!0),Fn(null);try{e.call(null)}finally{In(n),Fn(r)}}}function de(t,e=!0){var n=t.dom;if(n!==null&&e&&vn(n),hn(t,e),De(t,0),ut(t,Xt),t.transitions)for(const o of t.transitions)o.stop();wr(t);var r=t.parent;r!==null&&t.f&yt&&r.first!==null&&Er(t),t.next=t.prev=t.teardown=t.ctx=t.dom=t.deps=t.parent=t.fn=null}function Er(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function nn(t,e){var n=[];mn(t,n,!0),Cr(n,()=>{de(t),e&&e()})}function Cr(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var o of t)o.out(r)}else e()}function mn(t,e,n){if(!(t.f&Mt)){if(t.f^=Mt,t.transitions!==null)for(const c of t.transitions)(c.is_global||n)&&e.push(c);for(var r=t.first;r!==null;){var o=r.next,s=(r.f&fn)!==0||(r.f&yt)!==0;mn(r,e,s?n:!1),r=o}}}function xe(t){$r(t,!0)}function $r(t,e){if(t.f&Mt){t.f^=Mt,ae(t)&&Oe(t);for(var n=t.first;n!==null;){var r=n.next,o=(n.f&fn)!==0||(n.f&yt)!==0;$r(n,o?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}var Te,zt;function kr(){if(Te===void 0){Te=window,zt=document;var t=Element.prototype;t.__click=void 0,t.__className="",t.__attributes=null,t.__e=void 0,Text.prototype.__t=void 0}}function he(){return document.createTextNode("")}function lt(t){const e=t.firstChild;return G?e===null?t.appendChild(he()):Wt(e):e}function _n(t,e){return G?Wt(Tt):t.firstChild}function I(t,e=!1){var n=t.nextSibling;if(!G)return n;var r=n.nodeType;if(r===8&&n.data===io)return I(n,e);if(e&&r!==3){var o=he(),s=j.dom;return s.unshift(o),n==null||n.before(o),o}return Wt(n)}function yn(t){t.textContent=""}function qo(t){return document.createElement(t)}function Bo(t,e,n,r){function o(s){if(r.capture||rn(e,s),!s.cancelBubble)return n.call(this,s)}return t.startsWith("pointer")||t==="wheel"?le(()=>{e.addEventListener(t,o,r)}):e.addEventListener(t,o,r),o}function gt(t,e,n,r,o){var s={capture:r,passive:o},c=Bo(t,e,n,s);(e===document.body||e===window||e===document)&&yr(()=>{e.removeEventListener(t,c,s)})}function xr(t){for(var e=0;e{throw O});throw _}}finally{e.__root=t,s=t}}}const Tr=new Set,on=new Set;function We(t,e){(t.__t??(t.__t=t.nodeValue))!==e&&(t.nodeValue=t.__t=e)}function Sr(t,e){const n=e.anchor??e.target.appendChild(he());return Rt(()=>zr(t,{...e,anchor:n}),!1)}function Yo(t,e){const n=e.target,r=jt;try{return Rt(()=>{$t(!0);for(var o=n.firstChild;o&&(o.nodeType!==8||o.data!==ye);)o=o.nextSibling;if(!o)throw Ke;const s=Wt(o),c=zr(t,{...e,anchor:s});return $t(!1),c},!1)}catch(o){if(o===Ke)return e.recover===!1&&Eo(),kr(),yn(n),$t(!1),Sr(t,e);throw o}finally{$t(!!r),lo(r)}}function zr(t,{target:e,anchor:n,props:r={},events:o,context:s,intro:c=!1}){kr();const h=new Set,d=rn.bind(null,e),p=rn.bind(null,document),_=m=>{for(let z=0;z(se(()=>{if(s){ue({});var m=U;m.c=s}o&&(r.$$events=o),b=t(n,r)||{},s&&ce()}),()=>{for(const m of h)e.removeEventListener(m,d),document.removeEventListener(m,d);on.delete(_),sn.delete(b)}));return sn.set(b,E),b}let sn=new WeakMap;function Wo(t){const e=sn.get(t);e==null||e()}async function bn(t,e,n){await Promise.resolve();const r=Uo(t);if(!r.getElementById(e)){const o=qo("style");o.id=e,o.textContent=n,(r.head||r).appendChild(o)}}function Uo(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Se(t,e,n,r=null,o=!1){var s=null,c=null,h=null,d=o?fn:0;br(()=>{if(h===(h=!!e()))return;let p=!1;if(G){const _=t.data===er;h===_&&(vn(jt),$t(!1),p=!0)}h?(s?xe(s):s=se(()=>n(t)),c&&nn(c,()=>{c=null})):(c?xe(c):r&&(c=se(()=>r(t))),s&&nn(s,()=>{s=null})),p&&$t(!0)},d)}let Ue=null;function Vo(t,e){return e}function Xo(t,e,n){for(var r=[],o=t.length,s=0;s0&&r.length===0&&e!==null;if(c){var h=e.parentNode;yn(h),h.append(e),n.clear(),kt(t[0].prev,t[o-1].next)}Cr(r,()=>{for(var d=0;d{var _=n(),b=Dt(_)?_:_==null?[]:Array.from(_),E=b.length,m=c.flags;m&Ge&&!nr(b)&&!(X in b)&&(m^=Ge,m&to&&!(m&re)&&(m^=re));let z=!1;if(G){var x=t.data===er;(x!==(E===0)||Tt===void 0)&&(vn(jt),$t(!1),z=!0)}if(G){for(var T=Tt,O=c,k,$=0;$0)for(;T!==t;){var C=T.nextSibling;T.remove(),T=C}}G||Go(b,c,t,o,m,r),s!==null&&(E===0?p?xe(p):p=se(()=>s(t)):p!==null&&nn(p,()=>{p=null})),z&&$t(!0)})}function Go(t,e,n,r,o,s){var et,nt,ot,ht;var c=(o&eo)!==0,h=(o&(re|un))!==0,d=t.length,p=e.items,_=e.next,b=_,E=new Set,m=e,z=new Set,x=[],T=[],O,k,$,A;if(c)for(A=0;A0){var Z=o&Qn&&d===0?n:null;if(c){for(A=0;A{var Kt;for($ of z)(Kt=$.a)==null||Kt.apply()})}function Ko(t,e,n,r){r&re&&H(t.v,e),r&un?H(t.i,n):t.i=n}function Nr(t,e,n,r,o,s,c,h){var d=Ue;try{var p=(h&re)!==0,_=(h&Ge)===0,b=p?_?Ee(r):tt(r):r,E=h&un?tt(s):s,m={i:E,v:b,k:o,a:null,e:null,prev:e,next:n};return e.next=m,n!==null&&(n.prev=m),Ue=m,m.e=se(()=>c(t,b,E)),m}finally{Ue=d}}function qn(t,e){if(t.nodeType===3&&t.data===""||t.nodeType===8){for(var n=e.first,r;n!==null&&(r=n.first,n.dom===null);){if(r===null)return t.previousSibling;n=r}return ee(n)}return t}function ee(t){var e=t.dom;return Dt(e)?qn(e[0],t):qn(e,t)}function Bn(t,e,n){for(var r=t.next?ee(t.next.e):n,o=e?ee(e.e):n,s=ee(t.e);s!==r;){var c=s.nextSibling;o.before(s),s=c}}function kt(t,e){t.next=e,e!==null&&(e.prev=t)}function ze(t,e=j){var n=e.dom;return n===null?e.dom=t:(Dt(n)||(n=e.dom=[n]),Dt(t)?n.push(...t):n.push(t)),t}function bt(t,e){var n=(e&ro)!==0,r=(e&oo)!==0,o;return()=>{if(G)return ze(n?jt:Tt),Tt;o||(o=Fo(t),n||(o=o.firstChild));var s=r?document.importNode(o,!0):o.cloneNode(!0);return ze(n?[...s.childNodes]:s),s}}function Jo(){if(G)return ze(jt),Tt;var t=document.createDocumentFragment(),e=he();return t.append(e),ze([e]),t}function at(t,e){G||t.before(e)}function Zo(t,e){{const n=document.body;t.autofocus=!0,le(()=>{document.activeElement===n&&t.focus()})}}function Qo(t){G&&t.firstChild!==null&&yn(t)}let Yn=!1;function Ar(){Yn||(Yn=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n.__on_r)==null||e.call(n)})},{capture:!0}))}function ti(t){if(G){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;ft(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var o=t.checked;ft(t,"checked",null),t.checked=o}}};t.__on_r=n,So(n),Ar()}}function ei(t,e){var n=t.__attributes??(t.__attributes={});n.value!==(n.value=e)&&(t.value=e)}function ft(t,e,n){n=n==null?null:n+"";var r=t.__attributes??(t.__attributes={});G&&(r[e]=t.getAttribute(e),e==="src"||e==="href"||e==="srcset")||r[e]!==(r[e]=n)&&(e==="loading"&&(t[vo]=n),n===null?t.removeAttribute(e):t.setAttribute(e,n))}function ne(t,e,n){n?t.classList.add(e):t.classList.remove(e)}function Dr(t,e,n,r=n){t.addEventListener(e,n);const o=t.__on_r;o?t.__on_r=()=>{o(),r()}:t.__on_r=r,Ar()}function ni(t,e,n){Dr(t,"input",()=>{n(Un(t)?Vn(t.value):t.value)}),fe(()=>{var r=e();if(G&&t.defaultValue!==t.value){n(t.value);return}Un(t)&&r===Vn(t.value)||t.type==="date"&&!r&&!t.value||(t.value=r??"")})}function ri(t,e,n,r,o){var s=n.getAttribute("type")==="checkbox",c=t;let h=!1;if(e!==null)for(var d of e){var p=c;c=p[d],c===void 0&&(c=p[d]=[])}c.push(n),Dr(n,"change",()=>{var _=n.__value;s&&(_=Wn(c,_,n.checked)),o(_)},()=>o(s?[]:null)),fe(()=>{var _=r();if(G&&n.defaultChecked!==n.checked){h=!0;return}s?(_=_||[],n.checked=Ce(_).includes(Ce(n.__value))):n.checked=xo(n.__value,_)}),yr(()=>{var _=c.indexOf(n);_!==-1&&c.splice(_,1)}),le(()=>{if(c.sort((E,m)=>E.compareDocumentPosition(m)===4?-1:1),h){var _;if(s)_=Wn(c,_,n.checked);else{var b=c.find(E=>E.checked);_=b==null?void 0:b.__value}o(_)}})}function Wn(t,e,n){for(var r=new Set,o=0;o{var o,s;return fe(()=>{o=s,s=[],_r(()=>{t!==n(...s)&&(e(t,...s),o&&Xn(n(...o),t)&&e(null,...o))})}),()=>{le(()=>{s&&Xn(n(...s),t)&&e(null,...s)})}})}function Me(t,e,n,r){var z;var o=(n&no)!==0,s=t[e],c=(z=Je(t,e))==null?void 0:z.set,h=r,d=()=>h;s===void 0&&r!==void 0&&(c&&o&&Co(),s=d(),c&&c(s));var p;if(p=()=>{var x=t[e];return x===void 0?d():x},c){var _=t.$$legacy;return function(x,T){return arguments.length>0?((!T||_)&&c(T?p():x),x):p()}}var b=!1,E=Ee(s),m=No(()=>{var x=p(),T=D(E);return b?(b=!1,T):E.v=x});return function(x,T){var O=D(m);if(arguments.length>0){const k=T?D(m):x;return m.equals(k)||(b=!0,H(E,k),D(m)),x}return O}}function oi(t){return new ii(t)}var Et,it;class ii{constructor(e){Be(this,Et);Be(this,it);const n=st({...e.props||{},$$events:{}},!1);Ye(this,it,(e.hydrate?Yo:Sr)(e.component,{target:e.target,props:n,context:e.context,intro:e.intro,recover:e.recover})),Ye(this,Et,n.$$events);for(const r of Object.keys(Q(this,it)))r==="$set"||r==="$destroy"||r==="$on"||oe(this,r,{get(){return Q(this,it)[r]},set(o){Q(this,it)[r]=o},enumerable:!0});Q(this,it).$set=r=>{Object.assign(n,r)},Q(this,it).$destroy=()=>{Wo(Q(this,it))}}$set(e){Q(this,it).$set(e)}$on(e,n){Q(this,Et)[e]=Q(this,Et)[e]||[];const r=(...o)=>n.call(this,...o);return Q(this,Et)[e].push(r),()=>{Q(this,Et)[e]=Q(this,Et)[e].filter(o=>o!==r)}}$destroy(){Q(this,it).$destroy()}}Et=new WeakMap,it=new WeakMap;let Or;typeof HTMLElement=="function"&&(Or=class extends HTMLElement{constructor(e,n,r){super();ct(this,"$$ctor");ct(this,"$$s");ct(this,"$$c");ct(this,"$$cn",!1);ct(this,"$$d",{});ct(this,"$$r",!1);ct(this,"$$p_d",{});ct(this,"$$l",{});ct(this,"$$l_u",new Map);ct(this,"$$me");this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){const o=this.$$c.$on(e,n);this.$$l_u.set(n,o)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){const o=this.$$l_u.get(n);o&&(o(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return s=>{const c=document.createElement("slot");o!=="default"&&(c.name=o),at(s,c)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=si(this);for(const o of this.$$s)o in r&&(o==="default"&&!this.$$d.children?(this.$$d.children=e(o),n.default=!0):n[o]=e(o));for(const o of this.attributes){const s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=_e(s,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=oi({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=fe(()=>{var o;this.$$r=!0;for(const s of be(this.$$c)){if(!((o=this.$$p_d[s])!=null&&o.reflect))continue;this.$$d[s]=this.$$c[s];const c=_e(s,this.$$d[s],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,c)}this.$$r=!1});for(const o in this.$$l)for(const s of this.$$l[o]){const c=this.$$c.$on(o,s);this.$$l_u.set(s,c)}this.$$l={}}}attributeChangedCallback(e,n,r){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=_e(e,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),de(this.$$me),this.$$c=void 0)})}$$g_p(e){return be(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function _e(t,e,n,r){var s;const o=(s=n[t])==null?void 0:s.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function si(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function je(t,e,n,r,o,s){let c=class extends Or{constructor(){super(t,n,o),this.$$p_d=e}static get observedAttributes(){return be(e).map(h=>(e[h].attribute||h).toLowerCase())}};return be(e).forEach(h=>{oe(c.prototype,h,{get(){return this.$$c&&h in this.$$c?this.$$c[h]:this.$$d[h]},set(d){var p;d=_e(h,d,e),this.$$d[h]=d,(p=this.$$c)==null||p.$set({[h]:d})}})}),r.forEach(h=>{oe(c.prototype,h,{get(){var d;return(d=this.$$c)==null?void 0:d[h]}})}),t.element=c,c}const Ut=new Map([["yellow","#F8B920"],["red","#FF4646"],["blue","#0064FF"],["green","#00C564"]]),li=["SCRIPT","STYLE","NOSCRIPT","TEXTAREA","OPTION"];function Lr(t){const e=t.map(c=>c.trim().toLocaleLowerCase()),n=e.map(()=>({start:null,end:null,shift:0})),r=e.map(()=>[]),o=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,c=>{var h,d;return li.includes((h=c.parentNode)==null?void 0:h.tagName)||!((d=c.parentNode)!=null&&d.checkVisibility())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let s;for(;s=o.nextNode();)if(s!=null&&s.nodeValue)for(let c=0;c{var b;for(;d[n[p].shift]&&!d[n[p].shift].trim();)n[p].shift++;let _=d[n[p].shift]===h;if(!_&&n[p].shift&&(n[p].shift=0,_=d[n[p].shift]===h),_&&(n[p].shift||(n[p].start=[s,c]),n[p].end=[s,c],n[p].shift++),n[p].shift>=d.length){const E=document.createRange();E.setStart(n[p].start[0],n[p].start[1]),E.setEnd(n[p].end[0],n[p].end[1]+1),!E.collapsed&&((b=E.commonAncestorContainer.parentElement)!=null&&b.checkVisibility())?r[p].push(E):E.detach(),_=!1}_||(n[p].shift=0,n[p].start=null,n[p].end=null)})}return r}const At=`rh-${new Date().getTime()}-`,Re="highlights"in CSS;function ai(t){if(!t.length&&!CSS.highlights.size)return;const e=[];if(CSS.highlights.clear(),t.length){const r=Lr(t.map(({text:o})=>o||""));for(const o in t){if(!r[o].length)continue;const{_id:s,color:c}=t[o],h=`${At}${s}`;CSS.highlights.set(h,new Highlight(...r[o]));const d=r[o][0].getBoundingClientRect();e.push(` - ::highlight(${h}) { +"use strict";var Ir=Object.defineProperty;var Sn=t=>{throw TypeError(t)};var qr=(t,e,n)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ct=(t,e,n)=>qr(t,typeof e!="symbol"?e+"":e,n),Nn=(t,e,n)=>e.has(t)||Sn("Cannot "+n);var Z=(t,e,n)=>(Nn(t,e,"read from private field"),n?n.call(t):e.get(t)),Ie=(t,e,n)=>e.has(t)?Sn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),qe=(t,e,n,r)=>(Nn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);(function(){var t=window.Document.prototype.createElement,e=window.Document.prototype.createElementNS,n=window.Document.prototype.importNode,r=window.Document.prototype.prepend,o=window.Document.prototype.append,s=window.DocumentFragment.prototype.prepend,c=window.DocumentFragment.prototype.append,v=window.Node.prototype.cloneNode,p=window.Node.prototype.appendChild,d=window.Node.prototype.insertBefore,y=window.Node.prototype.removeChild,w=window.Node.prototype.replaceChild,E=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),g=window.Element.prototype.attachShadow,z=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),T=window.Element.prototype.getAttribute,k=window.Element.prototype.setAttribute,O=window.Element.prototype.removeAttribute,$=window.Element.prototype.toggleAttribute,C=window.Element.prototype.getAttributeNS,D=window.Element.prototype.setAttributeNS,ut=window.Element.prototype.removeAttributeNS,S=window.Element.prototype.insertAdjacentElement,N=window.Element.prototype.insertAdjacentHTML,J=window.Element.prototype.prepend,M=window.Element.prototype.append,L=window.Element.prototype.before,W=window.Element.prototype.after,G=window.Element.prototype.replaceWith,tt=window.Element.prototype.remove,et=window.HTMLElement,rt=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ht=window.HTMLElement.prototype.insertAdjacentElement,Jt=window.HTMLElement.prototype.insertAdjacentHTML,_n=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(i){return _n.add(i)});function yn(i){var l=_n.has(i);return i=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(i),!l&&i}var Or=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);function F(i){var l=i.isConnected;if(l!==void 0)return l;if(Or(i))return!0;for(;i&&!(i.__CE_isImportDocument||i instanceof Document);)i=i.parentNode||(window.ShadowRoot&&i instanceof ShadowRoot?i.host:void 0);return!(!i||!(i.__CE_isImportDocument||i instanceof Document))}function Re(i){var l=i.children;if(l)return Array.prototype.slice.call(l);for(l=[],i=i.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&l.push(i);return l}function He(i,l){for(;l&&l!==i&&!l.nextSibling;)l=l.parentNode;return l&&l!==i?l.nextSibling:null}function je(i,l,u){for(var h=i;h;){if(h.nodeType===Node.ELEMENT_NODE){var a=h;l(a);var f=a.localName;if(f==="link"&&a.getAttribute("rel")==="import"){if(h=a.import,u===void 0&&(u=new Set),h instanceof Node&&!u.has(h))for(u.add(h),h=h.firstChild;h;h=h.nextSibling)je(h,l,u);h=He(i,a);continue}else if(f==="template"){h=He(i,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)je(a,l,u)}h=h.firstChild?h.firstChild:He(i,h)}}function pe(){var i=!(vt==null||!vt.noDocumentConstructionObserver),l=!(vt==null||!vt.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=l,this.I=!i}function Gt(i,l,u,h){var a=window.ShadyDOM;if(i.shadyDomFastWalk&&a&&a.inUse){if(l.nodeType===Node.ELEMENT_NODE&&u(l),l.querySelectorAll)for(i=a.nativeMethods.querySelectorAll.call(l,"*"),l=0;lr[e]),s=o.s.get(e)),s!==void 0&&P(s,it(n,o.i,o));const c=o.a,v=!(e in t);if(c&&e==="length")for(let p=n;p"u"?t=>setTimeout(t,1):requestIdleCallback;let $e=!1,ke=!1,Ke=[],Je=[];function tr(){$e=!1;const t=Ke.slice();Ke=[],Qn(t)}function er(){ke=!1;const t=Je.slice();Je=[],Qn(t)}function le(t){$e||($e=!0,queueMicrotask(tr)),Ke.push(t)}function _o(t){ke||(ke=!0,go(er)),Je.push(t)}function yo(){$e&&tr(),ke&&er()}function wo(t){let e=Ot|_t;R===null&&(e|=zt);const n={deps:null,deriveds:null,equals:Zn,f:e,first:null,fn:t,last:null,reactions:null,v:null,version:0};if(I!==null&&I.f&Ot){var r=I;r.deriveds===null?r.deriveds=[n]:r.deriveds.push(n)}return n}function nr(t){un(t);var e=t.deriveds;if(e!==null){t.deriveds=null;for(var n=0;nt.version)return!0;!Bt&&!((w=d==null?void 0:d.reactions)!=null&&w.includes(t))&&(d.reactions??(d.reactions=[])).push(t)}else{if(t.f&_t)return!0;o&&(y>t.version&&(n=!0),v=d.reactions,v===null?d.reactions=[t]:v.includes(t)||v.push(t))}}r||at(t,dt),o&&(t.f^=be)}return n}function ko(t,e,n){throw t}function sr(t){const e=Y,n=B,r=xt,o=I,s=Bt;Y=null,B=0,xt=null,I=t.f&(yt|sn)?null:t,Bt=!Yt&&(t.f&zt)!==0;try{let c=(0,t.fn)(),v=t.deps;if(Y!==null){let p;if(v!==null){const d=v.length,y=B===0?Y:v.slice(0,B).concat(Y),E=y.length>16&&d-B>1?new Set(y):null;for(p=B;p0)for(v.length=B+Y.length,p=0;p1e3&&(Vt=0,co()),Vt++}function ur(t){var e=t.length;if(e!==0){ar();var n=Yt;Yt=!0;try{for(var r=0;r1001)return;const t=Nt;Nt=[],ur(t),ie||(Vt=0)}function De(t){ge===or&&(ie||(ie=!0,queueMicrotask(xo)));for(var e=t;e.parent!==null;){e=e.parent;var n=e.f;if(n&yt){if(!(n&dt))return;at(e,Lt)}}Nt.push(e)}function cr(t,e){var n=t.first,r=[];t:for(;n!==null;){var o=n.f,s=(o&(Xt|Mt))===0,c=o&yt,v=(o&dt)!==0,p=n.first;if(s&&(!c||!v)){if(c&&at(n,dt),o&Ut){if(!c&&ae(n)&&(Ae(n),p=n.first),p!==null){n=p;continue}}else if(o&Jn)if(c||v){if(p!==null){n=p;continue}}else r.push(n)}var d=n.next;if(d===null){let E=n.parent;for(;E!==null;){if(t===E)break t;var y=E.next;if(y!==null){n=y;continue t}E=E.parent}}n=d}for(var w=0;w0||s.length>0)&&jt(),Vt=0,o}finally{ge=n,Nt=r}}function A(t){const e=t.f;if(e&Xt)return t.v;if(I!==null){const n=(I.f&zt)!==0,r=I.deps;Y===null&&r!==null&&r[B]===t&&!(n&&R!==null)?B++:(r===null||B===0||r[B-1]!==t)&&(Y===null?Y=[t]:Y[Y.length-1]!==t&&Y.push(t)),xt!==null&&R!==null&&R.f&dt&&!(R.f&yt)&&xt.includes(t)&&(at(R,_t),De(R))}return e&Ot&&ae(t)&&rr(t),t.v}function cn(t,e,n){var r=t.reactions;if(r!==null)for(var o=Ge(),s=r.length,c=0;c{de(e)}}function dn(t){return Kt(Jn,t,!1)}function fe(t){return Kt(Ut,t,!0)}function gt(t){return fe(t)}function hr(t,e=0){return Kt(Ut|Gn|e,t,!0)}function se(t){return Kt(Ut|yt,t,!0)}function pr(t){var e=t.teardown;if(e!==null){const n=an,r=I;On(!0),Ln(null);try{e.call(null)}finally{On(n),Ln(r)}}}function de(t,e=!0){var n=t.dom;if(n!==null&&e&&fn(n),un(t,e),Ne(t,0),at(t,Xt),t.transitions)for(const o of t.transitions)o.stop();pr(t);var r=t.parent;r!==null&&t.f&yt&&r.first!==null&&vr(t),t.next=t.prev=t.teardown=t.ctx=t.dom=t.deps=t.parent=t.fn=null}function vr(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Qe(t,e){var n=[];hn(t,n,!0),mr(n,()=>{de(t),e&&e()})}function mr(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var o of t)o.out(r)}else e()}function hn(t,e,n){if(!(t.f&Mt)){if(t.f^=Mt,t.transitions!==null)for(const c of t.transitions)(c.is_global||n)&&e.push(c);for(var r=t.first;r!==null;){var o=r.next,s=(r.f&ln)!==0||(r.f&yt)!==0;hn(r,e,s?n:!1),r=o}}}function xe(t){gr(t,!0)}function gr(t,e){if(t.f&Mt){t.f^=Mt,ae(t)&&Ae(t);for(var n=t.first;n!==null;){var r=n.next,o=(n.f&ln)!==0||(n.f&yt)!==0;gr(n,o?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}var Te,St;function _r(){if(Te===void 0){Te=window,St=document;var t=Element.prototype;t.__click=void 0,t.__className="",t.__attributes=null,t.__e=void 0,Text.prototype.__t=void 0}}function he(){return document.createTextNode("")}function st(t){const e=t.firstChild;return X?e===null?t.appendChild(he()):Wt(e):e}function pn(t,e){return X?Wt(Tt):t.firstChild}function j(t,e=!1){var n=t.nextSibling;if(!X)return n;var r=n.nodeType;if(r===8&&n.data===Xr)return j(n,e);if(e&&r!==3){var o=he(),s=R.dom;return s.unshift(o),n==null||n.before(o),o}return Wt(n)}function vn(t){t.textContent=""}function Do(t){return document.createElement(t)}function Oo(t,e,n,r){function o(s){if(r.capture||Qt.call(e,s),!s.cancelBubble)return n.call(this,s)}return t.startsWith("pointer")||t==="wheel"?le(()=>{e.addEventListener(t,o,r)}):e.addEventListener(t,o,r),o}function mt(t,e,n,r,o){var s={capture:r,passive:o},c=Oo(t,e,n,s);(e===document.body||e===window||e===document)&&dr(()=>{e.removeEventListener(t,c,s)})}function yr(t){for(var e=0;e{throw O});throw y}}finally{t.__root=e,s=e}}}const wr=new Set,tn=new Set;function Be(t,e){(t.__t??(t.__t=t.nodeValue))!==e&&(t.nodeValue=t.__t=e)}function br(t,e){const n=e.anchor??e.target.appendChild(he());return jt(()=>Er(t,{...e,anchor:n}),!1)}function Lo(t,e){const n=e.target,r=Ht;try{return jt(()=>{$t(!0);for(var o=n.firstChild;o&&(o.nodeType!==8||o.data!==ye);)o=o.nextSibling;if(!o)throw Ue;const s=Wt(o),c=Er(t,{...e,anchor:s});return $t(!1),c},!1)}catch(o){if(o===Ue)return e.recover===!1&&fo(),_r(),vn(n),$t(!1),br(t,e);throw o}finally{$t(!!r),Gr(r)}}function Er(t,{target:e,anchor:n,props:r={},events:o,context:s,intro:c=!1}){_r();const v=new Set,p=w=>{for(let E=0;E(se(()=>{if(s){ue({});var w=V;w.c=s}o&&(r.$$events=o),d=t(n,r)||{},s&&ce()}),()=>{for(const w of v)e.removeEventListener(w,Qt),document.removeEventListener(w,Qt);tn.delete(p),en.delete(d)}));return en.set(d,y),d}let en=new WeakMap;function Mo(t){const e=en.get(t);e==null||e()}async function mn(t,e,n){await Promise.resolve();const r=Ro(t);if(!r.getElementById(e)){const o=Do("style");o.id=e,o.textContent=n,(r.head||r).appendChild(o)}}function Ro(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function ze(t,e,n,r=null,o=!1){var s=null,c=null,v=null,p=o?ln:0;hr(()=>{if(v===(v=!!e()))return;let d=!1;if(X){const y=t.data===Xn;v===y&&(fn(Ht),$t(!1),d=!0)}v?(s?xe(s):s=se(()=>n(t)),c&&Qe(c,()=>{c=null})):(c?xe(c):r&&(c=se(()=>r(t))),s&&Qe(s,()=>{s=null})),d&&$t(!0)},p)}let Ye=null;function Ho(t,e){return e}function jo(t,e,n){for(var r=[],o=t.length,s=0;s0&&r.length===0&&e!==null;if(c){var v=e.parentNode;vn(v),v.append(e),n.clear(),kt(t[0].prev,t[o-1].next)}mr(r,()=>{for(var p=0;p{var y=n(),w=Dt(y)?y:y==null?[]:Array.from(y),E=w.length,g=c.flags;g&We&&!Kn(w)&&!(U in w)&&(g^=We,g&Br&&!(g&re)&&(g^=re));let z=!1;if(X){var T=t.data===Xn;(T!==(E===0)||Tt===void 0)&&(fn(Ht),$t(!1),z=!0)}if(X){for(var k=Tt,O=c,$,C=0;C0)for(;k!==t;){var S=k.nextSibling;k.remove(),k=S}}X||Fo(w,c,t,o,g,r),s!==null&&(E===0?d?xe(d):d=se(()=>s(t)):d!==null&&Qe(d,()=>{d=null})),z&&$t(!0)})}function Fo(t,e,n,r,o,s){var tt,et,rt,ht;var c=(o&Yr)!==0,v=(o&(re|on))!==0,p=t.length,d=e.items,y=e.next,w=y,E=new Set,g=e,z=new Set,T=[],k=[],O,$,C,D;if(c)for(D=0;D0){var G=o&Wn&&p===0?n:null;if(c){for(D=0;D{var Jt;for(C of z)(Jt=C.a)==null||Jt.apply()})}function Po(t,e,n,r){r&re&&P(t.v,e),r&on?P(t.i,n):t.i=n}function Cr(t,e,n,r,o,s,c,v){var p=Ye;try{var d=(v&re)!==0,y=(v&We)===0,w=d?y?Ee(r):Q(r):r,E=v&on?Q(s):s,g={i:E,v:w,k:o,a:null,e:null,prev:e,next:n};return e.next=g,n!==null&&(n.prev=g),Ye=g,g.e=se(()=>c(t,w,E)),g}finally{Ye=p}}function Hn(t,e){if(t.nodeType===3&&t.data===""||t.nodeType===8){for(var n=e.first,r;n!==null&&(r=n.first,n.dom===null);){if(r===null)return t.previousSibling;n=r}return ee(n)}return t}function ee(t){var e=t.dom;return Dt(e)?Hn(e[0],t):Hn(e,t)}function jn(t,e,n){for(var r=t.next?ee(t.next.e):n,o=e?ee(e.e):n,s=ee(t.e);s!==r;){var c=s.nextSibling;o.before(s),s=c}}function kt(t,e){t.next=e,e!==null&&(e.prev=t)}function Se(t,e=R){var n=e.dom;return n===null?e.dom=t:(Dt(n)||(n=e.dom=[n]),Dt(t)?n.push(...t):n.push(t)),t}function wt(t,e){var n=(e&Wr)!==0,r=(e&Ur)!==0,o;return()=>{if(X)return Se(n?Ht:Tt),Tt;o||(o=So(t),n||(o=o.firstChild));var s=r?document.importNode(o,!0):o.cloneNode(!0);return Se(n?[...s.childNodes]:s),s}}function Io(){if(X)return Se(Ht),Tt;var t=document.createDocumentFragment(),e=he();return t.append(e),Se([e]),t}function lt(t,e){X||t.before(e)}function qo(t,e){{const n=document.body;t.autofocus=!0,le(()=>{document.activeElement===n&&t.focus()})}}function Bo(t){X&&t.firstChild!==null&&vn(t)}let Fn=!1;function $r(){Fn||(Fn=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n.__on_r)==null||e.call(n)})},{capture:!0}))}function Yo(t){if(X){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;ft(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var o=t.checked;ft(t,"checked",null),t.checked=o}}};t.__on_r=n,_o(n),$r()}}function Vo(t,e){var n=t.__attributes??(t.__attributes={});n.value!==(n.value=e)&&(t.value=e)}function ft(t,e,n){n=n==null?null:n+"";var r=t.__attributes??(t.__attributes={});X&&(r[e]=t.getAttribute(e),e==="src"||e==="href"||e==="srcset")||r[e]!==(r[e]=n)&&(e==="loading"&&(t[oo]=n),n===null?t.removeAttribute(e):t.setAttribute(e,n))}function ne(t,e,n){n?t.classList.add(e):t.classList.remove(e)}function kr(t,e,n,r=n){t.addEventListener(e,n);const o=t.__on_r;o?t.__on_r=()=>{o(),r()}:t.__on_r=r,$r()}function Wo(t,e,n){kr(t,"input",()=>{n(In(t)?qn(t.value):t.value)}),fe(()=>{var r=e();if(X&&t.defaultValue!==t.value){n(t.value);return}In(t)&&r===qn(t.value)||t.type==="date"&&!r&&!t.value||(t.value=r??"")})}function Uo(t,e,n,r,o){var s=n.getAttribute("type")==="checkbox",c=t;let v=!1;if(e!==null)for(var p of e){var d=c;c=d[p],c===void 0&&(c=d[p]=[])}c.push(n),kr(n,"change",()=>{var y=n.__value;s&&(y=Pn(c,y,n.checked)),o(y)},()=>o(s?[]:null)),fe(()=>{var y=r();if(X&&n.defaultChecked!==n.checked){v=!0;return}s?(y=y||[],n.checked=Ce(y).includes(Ce(n.__value))):n.checked=mo(n.__value,y)}),dr(()=>{var y=c.indexOf(n);y!==-1&&c.splice(y,1)}),le(()=>{if(c.sort((E,g)=>E.compareDocumentPosition(g)===4?-1:1),v){var y;if(s)y=Pn(c,y,n.checked);else{var w=c.find(E=>E.checked);y=w==null?void 0:w.__value}o(y)}})}function Pn(t,e,n){for(var r=new Set,o=0;o{var o,s;return fe(()=>{o=s,s=[],fr(()=>{t!==n(...s)&&(e(t,...s),o&&Bn(n(...o),t)&&e(null,...o))})}),()=>{le(()=>{s&&Bn(n(...s),t)&&e(null,...s)})}})}function Oe(t,e,n,r){var z;var o=(n&Vr)!==0,s=t[e],c=(z=Xe(t,e))==null?void 0:z.set,v=r,p=()=>v;s===void 0&&r!==void 0&&(c&&o&&ho(),s=p(),c&&c(s));var d;if(d=()=>{var T=t[e];return T===void 0?p():T},c){var y=t.$$legacy;return function(T,k){return arguments.length>0?((!k||y)&&c(k?d():T),T):d()}}var w=!1,E=Ee(s),g=wo(()=>{var T=d(),k=A(E);return w?(w=!1,k):E.v=T});return function(T,k){var O=A(g);if(arguments.length>0){const $=k?A(g):T;return g.equals($)||(w=!0,P(E,$),A(g)),T}return O}}function Xo(t){return new Ko(t)}var Et,ot;class Ko{constructor(e){Ie(this,Et);Ie(this,ot);const n=it({...e.props||{},$$events:{}},!1);qe(this,ot,(e.hydrate?Lo:br)(e.component,{target:e.target,props:n,context:e.context,intro:e.intro,recover:e.recover})),qe(this,Et,n.$$events);for(const r of Object.keys(Z(this,ot)))r==="$set"||r==="$destroy"||r==="$on"||oe(this,r,{get(){return Z(this,ot)[r]},set(o){Z(this,ot)[r]=o},enumerable:!0});Z(this,ot).$set=r=>{Object.assign(n,r)},Z(this,ot).$destroy=()=>{Mo(Z(this,ot))}}$set(e){Z(this,ot).$set(e)}$on(e,n){Z(this,Et)[e]=Z(this,Et)[e]||[];const r=(...o)=>n.call(this,...o);return Z(this,Et)[e].push(r),()=>{Z(this,Et)[e]=Z(this,Et)[e].filter(o=>o!==r)}}$destroy(){Z(this,ot).$destroy()}}Et=new WeakMap,ot=new WeakMap;let xr;typeof HTMLElement=="function"&&(xr=class extends HTMLElement{constructor(e,n,r){super();ct(this,"$$ctor");ct(this,"$$s");ct(this,"$$c");ct(this,"$$cn",!1);ct(this,"$$d",{});ct(this,"$$r",!1);ct(this,"$$p_d",{});ct(this,"$$l",{});ct(this,"$$l_u",new Map);ct(this,"$$me");this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){const o=this.$$c.$on(e,n);this.$$l_u.set(n,o)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){const o=this.$$l_u.get(n);o&&(o(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(o){return s=>{const c=document.createElement("slot");o!=="default"&&(c.name=o),lt(s,c)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const n={},r=Jo(this);for(const o of this.$$s)o in r&&(o==="default"&&!this.$$d.children?(this.$$d.children=e(o),n.default=!0):n[o]=e(o));for(const o of this.attributes){const s=this.$$g_p(o.name);s in this.$$d||(this.$$d[s]=_e(s,o.value,this.$$p_d,"toProp"))}for(const o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=Xo({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$host:this}}),this.$$me=fe(()=>{var o;this.$$r=!0;for(const s of we(this.$$c)){if(!((o=this.$$p_d[s])!=null&&o.reflect))continue;this.$$d[s]=this.$$c[s];const c=_e(s,this.$$d[s],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,c)}this.$$r=!1});for(const o in this.$$l)for(const s of this.$$l[o]){const c=this.$$c.$on(o,s);this.$$l_u.set(s,c)}this.$$l={}}}attributeChangedCallback(e,n,r){var o;this.$$r||(e=this.$$g_p(e),this.$$d[e]=_e(e,r,this.$$p_d,"toProp"),(o=this.$$c)==null||o.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),de(this.$$me),this.$$c=void 0)})}$$g_p(e){return we(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function _e(t,e,n,r){var s;const o=(s=n[t])==null?void 0:s.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Jo(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function Le(t,e,n,r,o,s){let c=class extends xr{constructor(){super(t,n,o),this.$$p_d=e}static get observedAttributes(){return we(e).map(v=>(e[v].attribute||v).toLowerCase())}};return we(e).forEach(v=>{oe(c.prototype,v,{get(){return this.$$c&&v in this.$$c?this.$$c[v]:this.$$d[v]},set(p){var d;p=_e(v,p,e),this.$$d[v]=p,(d=this.$$c)==null||d.$set({[v]:p})}})}),r.forEach(v=>{oe(c.prototype,v,{get(){var p;return(p=this.$$c)==null?void 0:p[v]}})}),t.element=c,c}const Rt=new Map([["yellow","#F8B920"],["red","#FF4646"],["blue","#0064FF"],["green","#00C564"]]),Go=["SCRIPT","STYLE","NOSCRIPT","TEXTAREA","OPTION"];function Tr(t){const e=t.map(c=>c.trim().toLocaleLowerCase()),n=e.map(()=>({start:null,end:null,shift:0})),r=e.map(()=>[]),o=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,c=>{var v,p;return Go.includes((v=c.parentNode)==null?void 0:v.tagName)||!((p=c.parentNode)!=null&&p.checkVisibility())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let s;for(;s=o.nextNode();)if(s!=null&&s.nodeValue)for(let c=0;c{var w;for(;p[n[d].shift]&&!p[n[d].shift].trim();)n[d].shift++;let y=p[n[d].shift]===v;if(!y&&n[d].shift&&(n[d].shift=0,y=p[n[d].shift]===v),y&&(n[d].shift||(n[d].start=[s,c]),n[d].end=[s,c],n[d].shift++),n[d].shift>=p.length){const E=document.createRange();E.setStart(n[d].start[0],n[d].start[1]),E.setEnd(n[d].end[0],n[d].end[1]+1),!E.collapsed&&((w=E.commonAncestorContainer.parentElement)!=null&&w.checkVisibility())?r[d].push(E):E.detach(),y=!1}y||(n[d].shift=0,n[d].start=null,n[d].end=null)})}return r}const At=`rh-${new Date().getTime()}-`,Me="highlights"in CSS;function Zo(t){if(!t.length&&!CSS.highlights.size)return;const e=[];if(CSS.highlights.clear(),t.length){const r=Tr(t.map(({text:o})=>o||""));for(const o in t){if(!r[o].length)continue;const{_id:s,color:c}=t[o],v=`${At}${s}`;CSS.highlights.set(v,new Highlight(...r[o]));const p=r[o][0].getBoundingClientRect();e.push(` + ::highlight(${v}) { all: unset; - background-color: color-mix(in srgb, ${Ut.get(c)||c}, white 50%) !important; + background-color: color-mix(in srgb, ${Rt.get(c)||c}, white 50%) !important; color: black; } :root { - --highlight-${s}-top: ${(100/document.documentElement.scrollHeight*(window.scrollY+d.top-10)).toFixed(2)}%; + --highlight-${s}-top: ${(100/document.documentElement.scrollHeight*(window.scrollY+p.top-10)).toFixed(2)}%; } - `);for(const p of r[o])p.detach()}}const n=(()=>{let r=document.getElementById(At);return r||(r=document.createElement("style"),r.id=At,document.head.appendChild(r)),r})();n.innerHTML=e.join(` -`)}function ui(){var t;(t=document.getElementById(At))==null||t.remove()}function ci(t){var e;for(const[n,r]of CSS.highlights){const o=n.replace(At,"");if(t==o)for(const s of r){(e=s.startContainer.parentElement)==null||e.scrollIntoView({behavior:"smooth",block:"start"});break}}}function fi(t){let e;for(const[n,r]of CSS.highlights)for(const o of r){const s=t.compareBoundaryPoints(Range.START_TO_START,o),c=t.compareBoundaryPoints(Range.END_TO_END,o);(s==0&&c==0||t!=null&&t.collapsed&&s>=0&&c<=0)&&(e=[n.replace(At,""),o])}if(e)return e[0].replace(At,"")}const Ct=`rh-${new Date().getTime()}`;function di(t){const e=document.body.querySelectorAll(`.${Ct}`);if(!t.length&&!e.length)return;e.forEach(s=>s.outerHTML=s.innerText);const n=[],r=Lr(t.map(({text:s})=>s||""));for(const s in t){const{_id:c,color:h}=t[s];for(const d of r[s]){const p=document.createElement("mark");p.className=Ct,p.setAttribute("data-id",String(c)),p.append(d.extractContents()),d.insertNode(p),d.detach()}n.push(` + `);for(const d of r[o])d.detach()}}const n=(()=>{let r=document.getElementById(At);return r||(r=document.createElement("style"),r.id=At,document.head.appendChild(r)),r})();n.innerHTML=e.join(` +`)}function Qo(){var t;(t=document.getElementById(At))==null||t.remove()}function ti(t){var e;for(const[n,r]of CSS.highlights){const o=n.replace(At,"");if(t==o)for(const s of r){(e=s.startContainer.parentElement)==null||e.scrollIntoView({behavior:"smooth",block:"start"});break}}}function ei(t){let e;for(const[n,r]of CSS.highlights)for(const o of r){const s=t.compareBoundaryPoints(Range.START_TO_START,o),c=t.compareBoundaryPoints(Range.END_TO_END,o);(s==0&&c==0||t!=null&&t.collapsed&&s>=0&&c<=0)&&(e=[n.replace(At,""),o])}if(e)return e[0].replace(At,"")}const Ct=`rh-${new Date().getTime()}`;function ni(t){const e=document.body.querySelectorAll(`.${Ct}`);if(!t.length&&!e.length)return;e.forEach(s=>s.outerHTML=s.innerText);const n=[],r=Tr(t.map(({text:s})=>s||""));for(const s in t){const{_id:c,color:v}=t[s];for(const p of r[s]){const d=document.createElement("mark");d.className=Ct,d.setAttribute("data-id",String(c)),d.append(p.extractContents()),p.insertNode(d),p.detach()}n.push(` .${Ct}[data-id="${c}"] { all: unset; - display: inline-block; - background-color: ${gi(Ut.get(h)||h,.5)} !important; + display: inline-block !important; + background-color: white !important; + background-image: linear-gradient(to bottom, ${Yn(Rt.get(v)||v,.4)} 0, ${Yn(Rt.get(v)||v,.4)} 100%) !important; + color: black !important; } `)}const o=(()=>{let s=document.getElementById(Ct);return s||(s=document.createElement("style"),s.id=Ct,document.head.appendChild(s)),s})();o.innerHTML=n.join(` -`)}function hi(){var t;document.body.querySelectorAll(`.${Ct}`).forEach(e=>e.outerHTML=e.innerText),(t=document.getElementById(Ct))==null||t.remove()}function pi(t){const e=document.body.querySelector(`.${Ct}[data-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"start"})}function vi(t){const e=t.commonAncestorContainer.nodeType==Node.ELEMENT_NODE?t.commonAncestorContainer:t.commonAncestorContainer.parentElement;if((e==null?void 0:e.className)==Ct){if(!t.collapsed){const n=new Range;n.selectNodeContents(t.commonAncestorContainer);const r=t.compareBoundaryPoints(Range.START_TO_START,n),o=t.compareBoundaryPoints(Range.END_TO_END,n);if(n.detach(),r!=0||o!=0)return}return e.getAttribute("data-id")||void 0}}function gi(t,e){if(!t)return t;const n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${n}, ${r}, ${o}, ${e})`}function Ne(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var mi=typeof global=="object"&&global&&global.Object===Object&&global,_i=typeof self=="object"&&self&&self.Object===Object&&self,Mr=mi||_i||Function("return this")(),Ve=function(){return Mr.Date.now()},yi=/\s/;function bi(t){for(var e=t.length;e--&&yi.test(t.charAt(e)););return e}var wi=/^\s+/;function Ei(t){return t&&t.slice(0,bi(t)+1).replace(wi,"")}var Ae=Mr.Symbol,jr=Object.prototype,Ci=jr.hasOwnProperty,$i=jr.toString,Zt=Ae?Ae.toStringTag:void 0;function ki(t){var e=Ci.call(t,Zt),n=t[Zt];try{t[Zt]=void 0;var r=!0}catch{}var o=$i.call(t);return r&&(e?t[Zt]=n:delete t[Zt]),o}var xi=Object.prototype,Ti=xi.toString;function Si(t){return Ti.call(t)}var zi="[object Null]",Ni="[object Undefined]",Gn=Ae?Ae.toStringTag:void 0;function Ai(t){return t==null?t===void 0?Ni:zi:Gn&&Gn in Object(t)?ki(t):Si(t)}function Di(t){return t!=null&&typeof t=="object"}var Oi="[object Symbol]";function Li(t){return typeof t=="symbol"||Di(t)&&Ai(t)==Oi}var Kn=NaN,Mi=/^[-+]0x[0-9a-f]+$/i,ji=/^0b[01]+$/i,Ri=/^0o[0-7]+$/i,Ii=parseInt;function Jn(t){if(typeof t=="number")return t;if(Li(t))return Kn;if(Ne(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ne(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ei(t);var n=ji.test(t);return n||Ri.test(t)?Ii(t.slice(2),n?2:8):Mi.test(t)?Kn:+t}var Fi="Expected a function",Hi=Math.max,Pi=Math.min;function qi(t,e,n){var r,o,s,c,h,d,p=0,_=!1,b=!1,E=!0;if(typeof t!="function")throw new TypeError(Fi);e=Jn(e)||0,Ne(n)&&(_=!!n.leading,b="maxWait"in n,s=b?Hi(Jn(n.maxWait)||0,e):s,E="trailing"in n?!!n.trailing:E);function m(C){var S=r,q=o;return r=o=void 0,p=C,c=t.apply(q,S),c}function z(C){return p=C,h=setTimeout(O,e),_?m(C):c}function x(C){var S=C-d,q=C-p,L=e-S;return b?Pi(L,s-q):L}function T(C){var S=C-d,q=C-p;return d===void 0||S>=e||S<0||b&&q>=s}function O(){var C=Ve();if(T(C))return k(C);h=setTimeout(O,x(C))}function k(C){return h=void 0,E&&r?m(C):(r=o=void 0,c)}function $(){h!==void 0&&clearTimeout(h),p=0,r=d=o=h=void 0}function A(){return h===void 0?c:k(Ve())}function K(){var C=Ve(),S=T(C);if(r=arguments,o=this,d=C,S){if(h===void 0)return z(d);if(b)return clearTimeout(h),h=setTimeout(O,e),m(d)}return h===void 0&&(h=setTimeout(O,e)),c}return K.cancel=$,K.flush=A,K}var Bi="Expected a function";function Rr(t,e,n){var r=!0,o=!0;if(typeof t!="function")throw new TypeError(Bi);return Ne(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),qi(t,e,{leading:r,maxWait:e,trailing:o})}function Ir(t){return Re?ai(t):di(t)}const Yi=Rr(Ir,500);function Xe(t){return t.length?Yi(t):Ir(t)}function Wi(){return Re?ui():hi()}function Fr(t){return Re?ci(t):pi(t)}function Hr(){const t=document.getSelection();if(t!=null&&t.rangeCount)return t.getRangeAt(0)}function te(){const t=document.getSelection();t!=null&&t.rangeCount&&t.removeAllRanges()}function Ui(t){return Re?fi(t):vi(t)}function Zn(t){if(!t)return"";var e=document.createElement("div");e.appendChild(t.cloneContents().cloneNode(!0)),document.body.appendChild(e);const n=e.innerText;return document.body.removeChild(e),e=void 0,n}function Vi(t,e,n){let r=tt(st([])),o=tt(!1),s=tt(!1),c=tt(void 0);function h(m){const z=Ui(m);if(z)return D(r).find(T=>T._id==z);if(Zn(m).trim())return{text:Zn(m).trim()}}function d(m){const z={...m._id?{_id:m._id}:{},...m.text?{text:m.text}:{},...m.note?{note:m.note}:{},color:m.color||"yellow"};if(!z.text)return;const x=D(r).findIndex(T=>{var O,k;return T._id==z._id||((O=T.text)==null?void 0:O.toLocaleLowerCase().trim())===((k=z.text)==null?void 0:k.toLocaleLowerCase().trim())});x!=-1?(D(r)[x]=z,e(z)):(D(r).push(z),t(z))}function p({_id:m}){H(r,st(D(r).filter(z=>z._id!=m))),n({_id:m})}function _(m){H(c,st(JSON.parse(JSON.stringify(m))))}function b(){D(c)&&(d(D(c)),H(c,void 0))}function E(){H(c,void 0)}return{get highlights(){return D(r)},set highlights(m){H(r,st(m))},get pro(){return D(o)},set pro(m){H(o,st(m))},get nav(){return D(s)},set nav(m){H(s,st(m))},get draft(){return D(c)},find:h,upsert:d,remove:p,setDraft:_,draftSubmit:b,draftCancel:E}}const Xi="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xi);function an(){var t;return(t=navigator==null?void 0:navigator.userAgentData)!=null&&t.mobile?!0:/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)}var Gi=bt(''),Ki=bt(''),Ji=bt('
');function Pr(t,e){ue(e,!0);let n=Me(e,"store",7),r,o=tt(void 0),s=tt(!1);function c(C){if(!D(o))return;const S=C.currentTarget.returnValue;switch(C.currentTarget.returnValue="",S){case"add":n().upsert(D(o)),te();break;case"note":n().setDraft(D(o)),te();break;case"remove":n().remove(D(o)),te();break;default:if(Ut.has(S)){n().upsert({...D(o),color:S}),te();return}break}}function h(){H(s,!0)}function d(){H(s,!1),setTimeout(p)}function p(){if(D(s)){r==null||r.close();return}requestAnimationFrame(()=>{const C=Hr(),S=C&&n().find(C);if(!C||!(S!=null&&S._id)&&!C.toString().trim()){r==null||r.close();return}H(o,st(S)),r.inert=!0,r==null||r.show(),r.inert=!1;const q=256,L=10,M=C.getBoundingClientRect(),V=Math.min(Math.max(M.x,L)+window.scrollX,window.innerWidth+window.scrollX-q-L),Z=Math.min(window.innerWidth-Math.max(M.x,L)-window.scrollX-M.width,window.innerWidth-window.scrollX-q-L),et=Math.max(M.y,40)+window.scrollY+M.height+4,nt=window.innerHeight-Math.max(M.y,40)-window.scrollY+4,ot=Vr=C,()=>r),mt(()=>ne(b,"mobile",an()));var E=lt(b),m=lt(E);wn(m,71,()=>Ut,(C,S)=>J(J(C))[0],(C,S,q)=>{let L=()=>J(J(S))[0],M=()=>J(J(S))[1];var V=Gi(),Z=lt(V);mt(()=>{var et;ei(V,L()),ft(Z,"style",`--color: ${M()??""}`),ne(Z,"active",L()==((et=D(o))==null?void 0:et.color))}),at(C,V)});var z=I(I(m,!0)),x=lt(z),T=lt(x),O=lt(T),k=I(O),$=I(k),A=I($),K=I(I(z,!0));return Se(K,()=>{var C;return(C=D(o))==null?void 0:C._id},C=>{var S=Ki();at(C,S)}),mt(()=>{var C,S,q,L,M,V;ne(b,"new",!((C=D(o))!=null&&C._id)),ft(O,"fill",(S=D(o))!=null&&S.note?"currentColor":"none"),ft(O,"stroke-width",(q=D(o))!=null&&q.note?"0":void 0),ft(k,"fill",(L=D(o))!=null&&L.note?"none":"currentColor"),ft($,"fill",(M=D(o))!=null&&M.note?"none":"currentColor"),ft(A,"fill",(V=D(o))!=null&&V.note?"none":"currentColor")}),gt("close",b,c,!1),at(t,b),bn(t,"svelte-1iojgl7",` +`)}function ri(){var t;document.body.querySelectorAll(`.${Ct}`).forEach(e=>e.outerHTML=e.innerText),(t=document.getElementById(Ct))==null||t.remove()}function oi(t){const e=document.body.querySelector(`.${Ct}[data-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"start"})}function ii(t){const e=t.commonAncestorContainer.nodeType==Node.ELEMENT_NODE?t.commonAncestorContainer:t.commonAncestorContainer.parentElement;if((e==null?void 0:e.className)==Ct){if(!t.collapsed){const n=new Range;n.selectNodeContents(t.commonAncestorContainer);const r=t.compareBoundaryPoints(Range.START_TO_START,n),o=t.compareBoundaryPoints(Range.END_TO_END,n);if(n.detach(),r!=0||o!=0)return}return e.getAttribute("data-id")||void 0}}function Yn(t,e){if(!t)return t;const n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${n}, ${r}, ${o}, ${e})`}function si(t){return Me?Zo(t):ni(t)}function Ve(t){return si(t)}function li(){return Me?Qo():ri()}function zr(t){return Me?ti(t):oi(t)}function Sr(){var n,r;const t=document.getSelection();if(!(t!=null&&t.rangeCount))return;const e=t.getRangeAt(0);if(!((r=(n=e==null?void 0:e.commonAncestorContainer)==null?void 0:n.parentElement)!=null&&r.hasAttribute("contenteditable")))return e}function te(){const t=document.getSelection();t!=null&&t.rangeCount&&t.removeAllRanges()}function ai(t){return Me?ei(t):ii(t)}function Vn(t){if(!t)return"";var e=document.createElement("div");e.appendChild(t.cloneContents().cloneNode(!0)),document.body.appendChild(e);const n=e.innerText;return document.body.removeChild(e),e=void 0,n}function ui(t,e,n){let r=Q(it([])),o=Q(!1),s=Q(!1),c=Q(void 0);function v(g){const z=ai(g);if(z)return A(r).find(k=>k._id==z);if(Vn(g).trim())return{text:Vn(g).trim()}}function p(g){const z={...g._id?{_id:g._id}:{},...g.text?{text:g.text}:{},...g.note?{note:g.note}:{},color:g.color||"yellow"};if(!z.text)return;const T=A(r).findIndex(k=>{var O,$;return k._id==z._id||((O=k.text)==null?void 0:O.toLocaleLowerCase().trim())===(($=z.text)==null?void 0:$.toLocaleLowerCase().trim())});T!=-1?(A(r)[T]=z,e(z)):(A(r).push(z),t(z))}function d({_id:g}){P(r,it(A(r).filter(z=>z._id!=g))),n({_id:g})}function y(g){P(c,it(JSON.parse(JSON.stringify(g))))}function w(){A(c)&&(p(A(c)),P(c,void 0))}function E(){P(c,void 0)}return{get highlights(){return A(r)},set highlights(g){P(r,it(g))},get pro(){return A(o)},set pro(g){P(o,it(g))},get nav(){return A(s)},set nav(g){P(s,it(g))},get draft(){return A(c)},find:v,upsert:p,remove:d,setDraft:y,draftSubmit:w,draftCancel:E}}const ci="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ci);function fi(t,e){let n=null,r=!0;return function(...s){n||(r?(t(...s),r=!1):(clearTimeout(n),n=setTimeout(()=>{t(...s),clearTimeout(n),n=null},e)))}}function rn(){var t;return(t=navigator==null?void 0:navigator.userAgentData)!=null&&t.mobile?!0:/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)}var di=wt(''),hi=wt(''),pi=wt('
');function Nr(t,e){ue(e,!0);let n=Oe(e,"store",7),r,o=Q(void 0),s=Q(!1);function c(S){if(!A(o))return;const N=S.currentTarget.returnValue;switch(S.currentTarget.returnValue="",N){case"add":n().upsert(A(o)),te();break;case"note":n().setDraft(A(o)),te();break;case"remove":n().remove(A(o)),te();break;default:if(Rt.has(N)){n().upsert({...A(o),color:N}),te();return}break}}function v(){P(s,!0)}function p(){P(s,!1),setTimeout(d)}function d(){if(A(s)){r==null||r.close();return}requestAnimationFrame(()=>{const S=Sr(),N=S&&n().find(S);if(!S||!(N!=null&&N._id)&&!S.toString().trim()){r==null||r.close();return}P(o,it(N)),r.inert=!0,r==null||r.show(),r.inert=!1;const J=256,M=10,L=S.getBoundingClientRect(),W=Math.min(Math.max(L.x,M)+window.scrollX,window.innerWidth+window.scrollX-J-M),G=Math.min(window.innerWidth-Math.max(L.x,M)-window.scrollX-L.width,window.innerWidth-window.scrollX-J-M),tt=Math.max(L.y,40)+window.scrollY+L.height+4,et=window.innerHeight-Math.max(L.y,40)-window.scrollY+4,rt=Wr=S,()=>r),gt(()=>ne(w,"mobile",rn()));var E=st(w),g=st(E);gn(g,71,()=>Rt,(S,N)=>K(K(S))[0],(S,N,J)=>{let M=()=>K(K(N))[0],L=()=>K(K(N))[1];var W=di(),G=st(W);gt(()=>{var tt;Vo(W,M()),ft(G,"style",`--color: ${L()??""}`),ne(G,"active",M()==((tt=A(o))==null?void 0:tt.color))}),lt(S,W)});var z=j(j(g,!0)),T=st(z),k=st(T),O=st(k),$=j(O),C=j($),D=j(C),ut=j(j(z,!0));return ze(ut,()=>{var S;return(S=A(o))==null?void 0:S._id},S=>{var N=hi();lt(S,N)}),gt(()=>{var S,N,J,M,L,W;ne(w,"new",!((S=A(o))!=null&&S._id)),ft(O,"fill",(N=A(o))!=null&&N.note?"currentColor":"none"),ft(O,"stroke-width",(J=A(o))!=null&&J.note?"0":void 0),ft($,"fill",(M=A(o))!=null&&M.note?"none":"currentColor"),ft(C,"fill",(L=A(o))!=null&&L.note?"none":"currentColor"),ft(D,"fill",(W=A(o))!=null&&W.note?"none":"currentColor")}),mt("close",w,c,!1),lt(t,w),mn(t,"svelte-1iojgl7",` .svelte-1iojgl7 { user-select: none; -webkit-user-select: none; @@ -189,7 +191,7 @@ transform: translateY(-3px); } } -`),ce({get store(){return n()},set store(C){n(C),Rt()}})}je(Pr,{store:{}},[],[],!0);function Zi(t){const e=t.currentTarget.getBoundingClientRect();e.top<=t.clientY&&t.clientY<=e.top+e.height&&e.left<=t.clientX&&t.clientX<=e.left+e.width||(t.preventDefault(),t.currentTarget.close())}var Qi=(t,e)=>H(e,!1),ts=bt(''),es=bt('
Upgrade to Pro to unlock annotation
'),ns=bt('
',1),rs=bt('
');function qr(t,e){ue(e,!0);const n=[];let r=Me(e,"store",7),o,s,c=tt(!0);en(()=>{r().draft?(H(c,!0),o==null||o.showModal()):o==null||o.close()});function h(k){const $=k.currentTarget.returnValue;k.currentTarget.returnValue="",setTimeout($?r().draftSubmit:r().draftCancel,200)}function d(k){var $;an()||(k.stopImmediatePropagation(),k.stopPropagation(),k.key=="Enter"&&!k.shiftKey&&(k.preventDefault(),s&&(($=k.currentTarget.closest("form"))==null||$.requestSubmit(s))))}var p=rs();ln(p,k=>o=k,()=>o),p.__mousedown=[Zi],mt(()=>ne(p,"mobile",an()));var _=lt(p),b=lt(_),E=I(I(_,!0)),m=lt(E);Se(m,()=>r().draft,k=>{var $=ns(),A=_n($);A.__click=[Qi,c];var K=lt(A);mt(()=>{var L,M;return We(K,((M=(L=r().draft)==null?void 0:L.text)==null?void 0:M.trim())||"")});var C=I(I(A,!0));wn(C,73,()=>Ut,Vo,(L,M,V)=>{let Z=()=>J(J(M))[0],et=()=>J(J(M))[1];var nt=ts();ti(nt);var ot;mt(()=>{ot!==(ot=Z())&&(nt.value=(nt.__value=Z())==null?"":Z()),ft(nt,"style",`--color: ${et()??""}`)}),ri(n,[],nt,()=>(Z(),r().draft.color),ht=>r().draft.color=ht),at(L,nt)});var S=I(I(C,!0));Qo(S),Zo(S),S.__keydown=d;var q=I(I(S,!0));Se(q,()=>!r().pro,L=>{var M=es();at(L,M)}),mt(()=>{ne(A,"compact",D(c)),S.disabled=!r().pro}),ni(S,()=>r().draft.note,L=>r().draft.note=L),at(k,$)});var z=I(I(m,!0)),x=lt(z),T=I(I(x,!0));ln(T,k=>s=k,()=>s);var O=lt(T);return mt(()=>{var k,$;We(b,`${((k=r().draft)!=null&&k._id?"Edit":"New")??""} highlight`),We(O,`${(($=r().draft)!=null&&$._id?"Update":"Create")??""} `)}),gt("close",p,h,!1),at(t,p),bn(t,"svelte-2yzs5z",` +`),ce({get store(){return n()},set store(S){n(S),jt()}})}Le(Nr,{store:{}},[],[],!0);function vi(t){const e=t.currentTarget.getBoundingClientRect();e.top<=t.clientY&&t.clientY<=e.top+e.height&&e.left<=t.clientX&&t.clientX<=e.left+e.width||(t.preventDefault(),t.currentTarget.close())}var mi=(t,e)=>P(e,!1),gi=wt(''),_i=wt('
Upgrade to Pro to unlock annotation
'),yi=wt('
',1),wi=wt('
');function Ar(t,e){ue(e,!0);const n=[];let r=Oe(e,"store",7),o,s,c=Q(!0);Ze(()=>{r().draft?(P(c,!0),o==null||o.showModal()):o==null||o.close()});function v($){const C=$.currentTarget.returnValue;$.currentTarget.returnValue="",setTimeout(C?r().draftSubmit:r().draftCancel,200)}function p($){var C;rn()||($.stopImmediatePropagation(),$.stopPropagation(),$.key=="Enter"&&!$.shiftKey&&($.preventDefault(),s&&((C=$.currentTarget.closest("form"))==null||C.requestSubmit(s))))}var d=wi();nn(d,$=>o=$,()=>o),d.__mousedown=[vi],gt(()=>ne(d,"mobile",rn()));var y=st(d),w=st(y),E=j(j(y,!0)),g=st(E);ze(g,()=>r().draft,$=>{var C=yi(),D=pn(C);D.__click=[mi,c];var ut=st(D);gt(()=>{var M,L;return Be(ut,((L=(M=r().draft)==null?void 0:M.text)==null?void 0:L.trim())||"")});var S=j(j(D,!0));gn(S,73,()=>Rt,Ho,(M,L,W)=>{let G=()=>K(K(L))[0],tt=()=>K(K(L))[1];var et=gi();Yo(et);var rt;gt(()=>{rt!==(rt=G())&&(et.value=(et.__value=G())==null?"":G()),ft(et,"style",`--color: ${tt()??""}`)}),Uo(n,[],et,()=>(G(),r().draft.color),ht=>r().draft.color=ht),lt(M,et)});var N=j(j(S,!0));Bo(N),qo(N),N.__keydown=p;var J=j(j(N,!0));ze(J,()=>!r().pro,M=>{var L=_i();lt(M,L)}),gt(()=>{ne(D,"compact",A(c)),N.disabled=!r().pro}),Wo(N,()=>r().draft.note,M=>r().draft.note=M),lt($,C)});var z=j(j(g,!0)),T=st(z),k=j(j(T,!0));nn(k,$=>s=$,()=>s);var O=st(k);return gt(()=>{var $,C;Be(w,`${(($=r().draft)!=null&&$._id?"Edit":"New")??""} highlight`),Be(O,`${((C=r().draft)!=null&&C._id?"Update":"Create")??""} `)}),mt("close",d,v,!1),lt(t,d),mn(t,"svelte-2yzs5z",` .svelte-2yzs5z { box-sizing: border-box; -webkit-tap-highlight-color: transparent; @@ -433,7 +435,7 @@ to { opacity: 1; } } } -`),ce({get store(){return r()},set store(k){r(k),Rt()}})}xr(["mousedown","click","keydown"]);je(qr,{store:{}},[],[],!0);const os=(t,e)=>{const n=t.target.getAttribute("data-highlight");n&&(t.preventDefault(),e(n))};var is=bt('
'),ss=bt('');function Br(t,e){ue(e,!0);let n=Me(e,"store",7);var r=Jo(),o=_n(r);return Se(o,()=>n().nav,s=>{var c=ss();c.__click=[os,Fr],wn(c,77,()=>n().highlights,(h,d)=>J(h)._id,(h,d,p)=>{var _=is();mt(()=>ft(_,"style",`top: var(--highlight-${J(d)._id??""}-top); --color: ${(Ut.get(J(d).color)||J(d).color)??""}`)),mt(()=>ft(_,"data-highlight",J(d)._id)),at(h,_)}),at(s,c)}),at(t,r),bn(t,"svelte-1t9y4ki",` +`),ce({get store(){return r()},set store($){r($),jt()}})}yr(["mousedown","click","keydown"]);Le(Ar,{store:{}},[],[],!0);const bi=(t,e)=>{const n=t.target.getAttribute("data-highlight");n&&(t.preventDefault(),e(n))};var Ei=wt('
'),Ci=wt('');function Dr(t,e){ue(e,!0);let n=Oe(e,"store",7);var r=Io(),o=pn(r);return ze(o,()=>n().nav,s=>{var c=Ci();c.__click=[bi,zr],gn(c,77,()=>n().highlights,(v,p)=>K(v)._id,(v,p,d)=>{var y=Ei();gt(()=>ft(y,"style",`top: var(--highlight-${K(p)._id??""}-top); --color: ${(Rt.get(K(p).color)||K(p).color)??""}`)),gt(()=>ft(y,"data-highlight",K(p)._id)),lt(v,y)}),lt(s,c)}),lt(t,r),mn(t,"svelte-1t9y4ki",` nav.svelte-1t9y4ki { all: unset; } @@ -458,4 +460,4 @@ width: 100%; background: var(--color); } -`),ce({get store(){return n()},set store(s){n(s),Rt()}})}xr(["click"]);je(Br,{store:{}},[],[],!0);var ls=bt(" ",1);function as(t,e){ue(e,!0);let n=Me(e,"store",7);en(()=>{Xe(n().highlights)});let r;function o(){Xe(n().highlights),clearTimeout(r),r=setTimeout(()=>Xe(n().highlights),3e3)}en(()=>Wi);var s=ls();gt("load",Te,o,!1),gt("popstate",Te,o,!1);var c=_n(s);Pr(c,{get store(){return n()}});var h=I(I(c,!0));qr(h,{get store(){return n()}});var d=I(I(h,!0));return Br(d,{get store(){return n()}}),at(t,s),ce({get store(){return n()},set store(p){n(p),Rt()}})}customElements.define("rdh-ui",je(as,{store:{}},[],[],!0));function us(t){if(typeof chrome=="object"&&chrome.runtime&&chrome.runtime.onMessage||typeof browser=="object"&&browser.runtime&&browser.runtime.onMessage){const{runtime:e}=typeof browser=="object"?browser:chrome,n=(r,o)=>{o.id==e.id&&typeof r.type=="string"&&t(r)};return e.onMessage.removeListener(n),e.onMessage.addListener(n),r=>e.sendMessage(null,r)}if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.rdh)return window.rdhSend=t,e=>window.webkit.messageHandlers.rdh.postMessage(e);if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron){const{ipcRenderer:e}=require("electron"),n=(r,o)=>t(o);return e.removeListener("RDH",n),e.on("RDH",n),r=>e.sendToHost("RDH",r)}if("ReactNativeWebView"in window)return window.ReactNativeWebViewSendMessage=t,e=>window.ReactNativeWebView.postMessage(JSON.stringify(e));if(window.self!==window.top){const e=({data:n,source:r})=>{r!==window.parent||typeof n!="object"||typeof n.type!="string"||t(n)};return window.removeEventListener("message",e),window.addEventListener("message",e),n=>window.parent.postMessage(n,"*")}throw new Error("unsupported platform")}async function cs(t){let e=!1;const n=new Set,r=us(o=>{if(!e){n.add(o);return}t(o)});await new Promise(o=>{function s(){window.removeEventListener("DOMContentLoaded",s),o()}document.readyState=="loading"?(window.removeEventListener("DOMContentLoaded",s),window.addEventListener("DOMContentLoaded",s,{once:!0})):o()}),e=!0;for(const o of n)t(o),n.delete(o);return r}const Qt=document.createElement("rdh-ui");(async()=>{const t=await cs(n=>{switch(n.type){case"RDH_APPLY":Array.isArray(n.payload)&&(e.highlights=n.payload);break;case"RDH_CONFIG":typeof n.payload.pro=="boolean"&&(e.pro=n.payload.pro),typeof n.payload.nav=="boolean"&&(e.nav=n.payload.nav),typeof n.payload.enabled=="boolean"&&(n.payload.enabled===!0?document.body.contains(Qt)||document.body.appendChild(Qt):document.body.contains(Qt)&&document.body.removeChild(Qt));break;case"RDH_SCROLL":typeof n.payload._id=="string"&&Fr(n.payload._id);break;case"RDH_ADD_SELECTION":const r=Hr();if(!r)return;const o=e.find(r);if(!o)return;e.upsert(o),te();break;case"RDH_NOTE_SELECTION":console.log("not implemented yet");break}}),e=Vi(n=>t({type:"RDH_ADD",payload:n}),n=>t({type:"RDH_UPDATE",payload:n}),({_id:n})=>t({type:"RDH_REMOVE",payload:{_id:n}}));Qt.store=e,t({type:"RDH_READY",payload:{url:location.href}})})(); +`),ce({get store(){return n()},set store(s){n(s),jt()}})}yr(["click"]);Le(Dr,{store:{}},[],[],!0);var $i=wt(" ",1);function ki(t,e){ue(e,!0);let n=Oe(e,"store",7);Ze(()=>{Ve(n().highlights)});let r;function o(){Ve(n().highlights),clearTimeout(r),r=setTimeout(()=>Ve(n().highlights),3e3)}Ze(()=>li);var s=$i();mt("load",Te,o,!1),mt("popstate",Te,o,!1);var c=pn(s);Nr(c,{get store(){return n()}});var v=j(j(c,!0));Ar(v,{get store(){return n()}});var p=j(j(v,!0));return Dr(p,{get store(){return n()}}),lt(t,s),ce({get store(){return n()},set store(d){n(d),jt()}})}customElements.define("rdh-ui",Le(ki,{store:{}},[],[],!0));function xi(t){if(typeof chrome=="object"&&chrome.runtime&&chrome.runtime.onMessage||typeof browser=="object"&&browser.runtime&&browser.runtime.onMessage){const{runtime:e}=typeof browser=="object"?browser:chrome,n=(r,o)=>{o.id==e.id&&typeof r.type=="string"&&t(r)};return e.onMessage.removeListener(n),e.onMessage.addListener(n),r=>e.sendMessage(null,r)}if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.rdh)return window.rdhSend=t,e=>window.webkit.messageHandlers.rdh.postMessage(e);if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron){const{ipcRenderer:e}=require("electron"),n=(r,o)=>t(o);return e.removeListener("RDH",n),e.on("RDH",n),r=>e.sendToHost("RDH",r)}if("ReactNativeWebView"in window)return window.ReactNativeWebViewSendMessage=t,e=>window.ReactNativeWebView.postMessage(JSON.stringify(e));if(window.self!==window.top){const e=({data:n,source:r})=>{r!==window.parent||typeof n!="object"||typeof n.type!="string"||t(n)};return window.removeEventListener("message",e),window.addEventListener("message",e),n=>window.parent.postMessage(n,"*")}throw new Error("unsupported platform")}async function Ti(t){let e=!1;const n=new Set,r=xi(o=>{if(!e){n.add(o);return}t(o)});await new Promise(o=>{function s(){window.removeEventListener("DOMContentLoaded",s),o()}document.readyState=="loading"?(window.removeEventListener("DOMContentLoaded",s),window.addEventListener("DOMContentLoaded",s,{once:!0})):o()}),e=!0;for(const o of n)t(o),n.delete(o);return r}const Zt=document.createElement("rdh-ui");(async()=>{const t=await Ti(n=>{switch(n.type){case"RDH_APPLY":Array.isArray(n.payload)&&(e.highlights=n.payload);break;case"RDH_CONFIG":typeof n.payload.pro=="boolean"&&(e.pro=n.payload.pro),typeof n.payload.nav=="boolean"&&(e.nav=n.payload.nav),typeof n.payload.enabled=="boolean"&&(n.payload.enabled===!0?document.body.contains(Zt)||document.body.appendChild(Zt):document.body.contains(Zt)&&document.body.removeChild(Zt));break;case"RDH_SCROLL":typeof n.payload._id=="string"&&zr(n.payload._id);break;case"RDH_ADD_SELECTION":const r=Sr();if(!r)return;const o=e.find(r);if(!o)return;e.upsert(o),te();break;case"RDH_NOTE_SELECTION":console.log("not implemented yet");break}}),e=ui(n=>t({type:"RDH_ADD",payload:n}),n=>t({type:"RDH_UPDATE",payload:n}),({_id:n})=>t({type:"RDH_REMOVE",payload:{_id:n}}));Zt.store=e,t({type:"RDH_READY",payload:{url:location.href}})})(); diff --git a/src/target/extension/background/highlights/logic.js b/src/target/extension/background/highlights/logic.js index fa7785bd..a9c12dbf 100644 --- a/src/target/extension/background/highlights/logic.js +++ b/src/target/extension/background/highlights/logic.js @@ -162,7 +162,7 @@ async function send(tab, type, payload) { async function isInjected(tab) { if (!await browser.permissions.contains({ permissions: ['scripting'], - origins: [tab.url] + ...(tab?.url ? {origins: [tab.url]} : {}) })) return false