t.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}) {
all: unset;
- background-color: color-mix(in srgb, ${Vt.get(c)||c}, white 50%) !important;
+ background-color: color-mix(in srgb, ${Ut.get(c)||c}, white 50%) !important;
color: black;
}
:root {
- --highlight-${s}-top: ${(100/document.documentElement.scrollHeight*(window.scrollY+f.top-10)).toFixed(2)}%;
+ --highlight-${s}-top: ${(100/document.documentElement.scrollHeight*(window.scrollY+d.top-10)).toFixed(2)}%;
}
- `);for(const h of r[o])h.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 si(){var t;(t=document.getElementById(At))==null||t.remove()}function li(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 ai(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 ui(t){const e=document.body.querySelectorAll(`.${Ct}`);if(!t.length&&!e.length)return;e.forEach(s=>s.outerHTML=s.innerText);const n=[],r=Or(t.map(({text:s})=>s||""));for(const s in t){const{_id:c,color:v}=t[s];for(const f of r[s]){const h=document.createElement("mark");h.className=Ct,h.setAttribute("data-id",String(c)),h.append(f.extractContents()),f.insertNode(h),f.detach()}n.push(`
+ `);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(`
.${Ct}[data-id="${c}"] {
all: unset;
display: inline-block;
- background-color: ${hi(Vt.get(v)||v,.5)} !important;
+ background-color: ${gi(Ut.get(h)||h,.5)} !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 ci(){var t;document.body.querySelectorAll(`.${Ct}`).forEach(e=>e.outerHTML=e.innerText),(t=document.getElementById(Ct))==null||t.remove()}function fi(t){const e=document.body.querySelector(`.${Ct}[data-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"start"})}function di(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 hi(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 Ae(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var pi=typeof global=="object"&&global&&global.Object===Object&&global,vi=typeof self=="object"&&self&&self.Object===Object&&self,Lr=pi||vi||Function("return this")(),Ge=function(){return Lr.Date.now()},gi=/\s/;function mi(t){for(var e=t.length;e--&&gi.test(t.charAt(e)););return e}var _i=/^\s+/;function yi(t){return t&&t.slice(0,mi(t)+1).replace(_i,"")}var De=Lr.Symbol,jr=Object.prototype,bi=jr.hasOwnProperty,wi=jr.toString,ee=De?De.toStringTag:void 0;function Ei(t){var e=bi.call(t,ee),n=t[ee];try{t[ee]=void 0;var r=!0}catch{}var o=wi.call(t);return r&&(e?t[ee]=n:delete t[ee]),o}var Ci=Object.prototype,ki=Ci.toString;function xi(t){return ki.call(t)}var Ti="[object Null]",$i="[object Undefined]",Xn=De?De.toStringTag:void 0;function Si(t){return t==null?t===void 0?$i:Ti:Xn&&Xn in Object(t)?Ei(t):xi(t)}function zi(t){return t!=null&&typeof t=="object"}var Ni="[object Symbol]";function Ai(t){return typeof t=="symbol"||zi(t)&&Si(t)==Ni}var Gn=NaN,Di=/^[-+]0x[0-9a-f]+$/i,Oi=/^0b[01]+$/i,Li=/^0o[0-7]+$/i,ji=parseInt;function Kn(t){if(typeof t=="number")return t;if(Ai(t))return Gn;if(Ae(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ae(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=yi(t);var n=Oi.test(t);return n||Li.test(t)?ji(t.slice(2),n?2:8):Di.test(t)?Gn:+t}var Mi="Expected a function",Ri=Math.max,Ii=Math.min;function Fi(t,e,n){var r,o,s,c,v,f,h=0,m=!1,_=!1,E=!0;if(typeof t!="function")throw new TypeError(Mi);e=Kn(e)||0,Ae(n)&&(m=!!n.leading,_="maxWait"in n,s=_?Ri(Kn(n.maxWait)||0,e):s,E="trailing"in n?!!n.trailing:E);function y(k){var $=r,L=o;return r=o=void 0,h=k,c=t.apply(L,$),c}function C(k){return h=k,v=setTimeout(O,e),m?y(k):c}function S(k){var $=k-f,L=k-h,j=e-$;return _?Ii(j,s-L):j}function z(k){var $=k-f,L=k-h;return f===void 0||$>=e||$<0||_&&L>=s}function O(){var k=Ge();if(z(k))return T(k);v=setTimeout(O,S(k))}function T(k){return v=void 0,E&&r?y(k):(r=o=void 0,c)}function x(){v!==void 0&&clearTimeout(v),h=0,r=f=o=v=void 0}function A(){return v===void 0?c:T(Ge())}function K(){var k=Ge(),$=z(k);if(r=arguments,o=this,f=k,$){if(v===void 0)return C(f);if(_)return clearTimeout(v),v=setTimeout(O,e),y(f)}return v===void 0&&(v=setTimeout(O,e)),c}return K.cancel=x,K.flush=A,K}var Hi="Expected a function";function Mr(t,e,n){var r=!0,o=!0;if(typeof t!="function")throw new TypeError(Hi);return Ae(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Fi(t,e,{leading:r,maxWait:e,trailing:o})}function Rr(t){return Fe?ii(t):ui(t)}const Pi=Mr(Rr,500);function Ke(t){return t.length?Pi(t):Rr(t)}function qi(){return Fe?si():ci()}function Ir(t){return Fe?li(t):fi(t)}function Fr(){const t=document.getSelection();if(t!=null&&t.rangeCount)return t.getRangeAt(0)}function re(){const t=document.getSelection();t!=null&&t.rangeCount&&t.removeAllRanges()}function Bi(t){return Fe?ai(t):di(t)}function Jn(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 Yi(t,e,n){let r=nt(st([])),o=nt(!1),s=nt(!1),c=nt(void 0);function v(y){const C=Bi(y);if(C)return D(r).find(z=>z._id==C);if(Jn(y).trim())return{text:Jn(y).trim(),color:"yellow"}}function f(y){const C={...y._id?{_id:y._id}:{},...y.text?{text:y.text}:{},...y.note?{note:y.note}:{},...y.color?{color:y.color}:{}};if(!C.text)return;const S=D(r).findIndex(z=>{var O,T;return z._id==C._id||((O=z.text)==null?void 0:O.toLocaleLowerCase().trim())===((T=C.text)==null?void 0:T.toLocaleLowerCase().trim())});S!=-1?(D(r)[S]=C,e(C)):(D(r).push(C),t(C))}function h({_id:y}){P(r,st(D(r).filter(C=>C._id!=y))),n({_id:y})}function m(y){P(c,st(JSON.parse(JSON.stringify(y))))}function _(){D(c)&&(f(D(c)),P(c,void 0))}function E(){P(c,void 0)}return{get highlights(){return D(r)},set highlights(y){P(r,st(y))},get pro(){return D(o)},set pro(y){P(o,st(y))},get nav(){return D(s)},set nav(y){P(s,st(y))},get draft(){return D(c)},find:v,upsert:f,remove:h,setDraft:m,draftSubmit:_,draftCancel:E}}const Wi="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wi);function cn(){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 Ui=ht(''),Vi=ht(''),Xi=ht(''),Gi=ht('');function Hr(t,e){de(e,!0);let n=Re(e,"store",7),r,o=nt(void 0),s=nt(!1);function c(k){if(!D(o))return;const $=k.currentTarget.returnValue;switch(k.currentTarget.returnValue="",$){case"add":e.store.upsert(D(o)),re();break;case"note":e.store.setDraft(D(o)),re();break;case"remove":e.store.remove(D(o)),re();break;default:if(Vt.has($)){e.store.upsert({...D(o),color:$}),re();return}break}}function v(){P(s,!0)}function f(){P(s,!1),h()}function h(){if(D(s)){r==null||r.close();return}requestAnimationFrame(()=>{const k=Fr(),$=k&&e.store.find(k);if(!k||!($!=null&&$._id)&&!k.toString().trim()){r==null||r.close();return}P(o,st($)),r.inert=!0,r==null||r.show(),r.inert=!1;const L=k.getBoundingClientRect(),j=Math.max(L.x,10)+window.scrollX,F=window.innerWidth-Math.max(L.x,10)-window.scrollX-L.width,V=Math.max(L.y,40)+window.scrollY+L.height+4,J=window.innerHeight-Math.max(L.y,40)-window.scrollY+4,ut=jr=k,()=>r),mt(()=>oe(_,"mobile",cn()));var E=lt(_),y=lt(E);ue(y,()=>{var k;return(k=D(o))==null?void 0:k._id},k=>{var $=zr(),L=Me($);En(L,71,()=>Vt,(j,F)=>Q(Q(j))[0],(j,F,V)=>{let J=()=>Q(Q(F))[0],ut=()=>Q(Q(F))[1];var B=Ui(),ot=lt(B);mt(()=>{Zo(B,J()),ft(ot,"style",`--color: ${ut()??""}`),oe(ot,"active",J()==D(o).color)}),et(j,B)}),et(k,$)},k=>{var $=Vi();et(k,$)});var C=I(I(y,!0)),S=lt(C),z=lt(S),O=lt(z),T=I(O),x=I(T),A=I(x),K=I(I(C,!0));return ue(K,()=>{var k;return(k=D(o))==null?void 0:k._id},k=>{var $=Xi();et(k,$)}),mt(()=>{var k,$,L,j,F,V;oe(_,"new",!((k=D(o))!=null&&k._id)),ft(O,"fill",($=D(o))!=null&&$.note?"currentColor":"none"),ft(O,"stroke-width",(L=D(o))!=null&&L.note?"0":void 0),ft(T,"fill",(j=D(o))!=null&&j.note?"none":"currentColor"),ft(x,"fill",(F=D(o))!=null&&F.note?"none":"currentColor"),ft(A,"fill",(V=D(o))!=null&&V.note?"none":"currentColor")}),gt("close",_,c,!1),et(t,_),wn(t,"svelte-1iojgl7",`
+`)}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",`
.svelte-1iojgl7 {
user-select: none;
-webkit-user-select: none;
@@ -189,7 +189,7 @@
transform: translateY(-3px);
}
}
-`),he({get store(){return n()},set store(k){n(k),Rt()}})}Ie(Hr,{store:{}},[],[],!0);function Ki(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 Ji=(t,e)=>P(e,!1),Zi=ht(''),Qi=ht(''),ts=ht('
',1),es=ht('');function Pr(t,e){de(e,!0);const n=[];let r=Re(e,"store",7),o,s,c=nt(!0);rn(()=>{e.store.draft?(P(c,!0),o==null||o.showModal()):o==null||o.close()});function v(T){const x=T.currentTarget.returnValue;T.currentTarget.returnValue="",setTimeout(x?e.store.draftSubmit:e.store.draftCancel,200)}function f(T){var x;cn()||(T.stopImmediatePropagation(),T.stopPropagation(),T.key=="Enter"&&!T.shiftKey&&(T.preventDefault(),s&&((x=T.currentTarget.closest("form"))==null||x.requestSubmit(s))))}var h=es();un(h,T=>o=T,()=>o),h.__mousedown=[Ki],mt(()=>oe(h,"mobile",cn()));var m=lt(h),_=lt(m),E=I(I(m,!0)),y=lt(E);ue(y,()=>e.store.draft,T=>{var x=ts(),A=Me(x);A.__click=[Ji,c];var K=lt(A);mt(()=>{var j,F;return Ve(K,((F=(j=e.store.draft)==null?void 0:j.text)==null?void 0:F.trim())||"")});var k=I(I(A,!0));En(k,73,()=>Vt,Wo,(j,F,V)=>{let J=()=>Q(Q(F))[0],ut=()=>Q(Q(F))[1];var B=Zi();Jo(B);var ot;mt(()=>{ot!==(ot=J())&&(B.value=(B.__value=J())==null?"":J()),ft(B,"style",`--color: ${ut()??""}`)}),ti(n,[],B,()=>(J(),e.store.draft.color),St=>e.store.draft.color=St),et(j,B)});var $=I(I(k,!0));Ko($),Go($),$.__keydown=f;var L=I(I($,!0));ue(L,()=>!e.store.pro,j=>{var F=Qi();et(j,F)}),mt(()=>{oe(A,"compact",D(c)),$.disabled=!e.store.pro}),Qo($,()=>e.store.draft.note,j=>e.store.draft.note=j),et(T,x)});var C=I(I(y,!0)),S=lt(C),z=I(I(S,!0));un(z,T=>s=T,()=>s);var O=lt(z);return mt(()=>{var T,x;Ve(_,`${((T=e.store.draft)!=null&&T._id?"Edit":"New")??""} highlight`),Ve(O,`${((x=e.store.draft)!=null&&x._id?"Update":"Create")??""} `)}),gt("close",h,v,!1),et(t,h),wn(t,"svelte-2yzs5z",`
+`),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(''),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",`
.svelte-2yzs5z {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
@@ -433,7 +433,7 @@
to { opacity: 1; }
}
}
-`),he({get store(){return r()},set store(T){r(T),Rt()}})}kr(["mousedown","click","keydown"]);Ie(Pr,{store:{}},[],[],!0);const ns=(t,e)=>{const n=t.target.getAttribute("data-highlight");n&&(t.preventDefault(),e(n))};var rs=ht(''),os=ht('');function qr(t,e){de(e,!0);let n=Re(e,"store",7);var r=zr(),o=Me(r);return ue(o,()=>e.store.nav,s=>{var c=os();c.__click=[ns,Ir],En(c,77,()=>e.store.highlights,(v,f)=>Q(v)._id,(v,f,h)=>{var m=rs();mt(()=>ft(m,"style",`top: var(--highlight-${Q(f)._id??""}-top); --color: ${(Vt.get(Q(f).color)||Q(f).color)??""}`)),mt(()=>ft(m,"data-highlight",Q(f)._id)),et(v,m)}),et(s,c)}),et(t,r),wn(t,"svelte-1t9y4ki",`
+`),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",`
nav.svelte-1t9y4ki {
all: unset;
}
@@ -458,4 +458,4 @@
width: 100%;
background: var(--color);
}
-`),he({get store(){return n()},set store(s){n(s),Rt()}})}kr(["click"]);Ie(qr,{store:{}},[],[],!0);var is=ht(" ",1);function ss(t,e){de(e,!0);let n=Re(e,"store",7);rn(()=>{Ke(e.store.highlights)});let r;function o(){Ke(e.store.highlights),clearTimeout(r),r=setTimeout(()=>Ke(e.store.highlights),3e3)}rn(()=>qi);var s=is();gt("load",ze,o,!1),gt("popstate",ze,o,!1);var c=Me(s);Hr(c,{get store(){return e.store}});var v=I(I(c,!0));Pr(v,{get store(){return e.store}});var f=I(I(v,!0));return qr(f,{get store(){return e.store}}),et(t,s),he({get store(){return n()},set store(h){n(h),Rt()}})}customElements.define("rdh-ui",Ie(ss,{store:{}},[],[],!0));function ls(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 as(t){let e=!1;const n=new Set,r=ls(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 ne=document.createElement("rdh-ui");(async()=>{const t=await as(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(ne)||document.body.appendChild(ne):document.body.contains(ne)&&document.body.removeChild(ne));break;case"RDH_SCROLL":typeof n.payload._id=="string"&&Ir(n.payload._id);break;case"RDH_ADD_SELECTION":const r=Fr();if(!r)return;const o=e.find(r);if(!o)return;e.upsert(o),re();break;case"RDH_NOTE_SELECTION":console.log("not implemented yet");break}}),e=Yi(n=>t({type:"RDH_ADD",payload:n}),n=>t({type:"RDH_UPDATE",payload:n}),({_id:n})=>t({type:"RDH_REMOVE",payload:{_id:n}}));ne.store=e,t({type:"RDH_READY",payload:{url:location.href}})})();
+`),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}})})();