@recogito/text-annotator 3.1.5 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- (function(b,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("colord"),require("dequal/lite"),require("uuid"),require("@annotorious/core"),require("rbush"),require("hotkeys-js"),require("poll")):typeof define=="function"&&define.amd?define(["exports","colord","dequal/lite","uuid","@annotorious/core","rbush","hotkeys-js","poll"],F):(b=typeof globalThis<"u"?globalThis:b||self,F(b.RecogitoJS={},b.Colord,b.DequalLite,b.UUID,b.AnnotoriousCore,b.RBush,b.HotkeysJs,b.poll))})(this,(function(b,F,ke,te,x,Ne,z,Ie){"use strict";const J="not-annotatable",U=`.${J}`,K=(e,n)=>{var o;return e.contains(n)?!!(n instanceof HTMLElement?n.closest(U):(o=n.parentElement)==null?void 0:o.closest(U)):!0},ne=(e,n)=>{const t=n.commonAncestorContainer;return!K(e,t)},oe=e=>e.addEventListener("click",n=>{!n.target.closest(U)&&!n.target.closest("a")&&n.preventDefault()}),X=e=>({...e,type:e.type,x:e.x,y:e.y,clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,screenX:e.screenX,screenY:e.screenY,isPrimary:e.isPrimary,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,button:e.button,buttons:e.buttons,currentTarget:e.currentTarget,target:e.target,defaultPrevented:e.defaultPrevented,detail:e.detail,eventPhase:e.eventPhase,pointerId:e.pointerId,pointerType:e.pointerType,timeStamp:e.timeStamp}),$=e=>({...e,type:e.type,key:e.key,code:e.code,location:e.location,repeat:e.repeat,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,currentTarget:e.currentTarget,target:e.target,defaultPrevented:e.defaultPrevented,detail:e.detail,timeStamp:e.timeStamp}),se=typeof navigator<"u"&&/mac/i.test(navigator.userAgentData?navigator.userAgentData.platform:navigator.platform),re=e=>{!e.hasAttribute("tabindex")&&e.tabIndex<0&&e.setAttribute("tabindex","-1"),e.classList.add("no-focus-outline")},W=(e,n=10)=>{let t;return((...o)=>{clearTimeout(t),t=setTimeout(()=>e.apply(void 0,o),n)})},Be=function*(e){const n=document.createNodeIterator(e.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,o=>o instanceof HTMLElement&&o.classList.contains(J)&&!o.parentElement.closest(U)&&e.intersectsNode(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let t;for(;t=n.nextNode();)t instanceof HTMLElement&&(yield t)},ie=(e,n)=>{if(!ne(e,n))return[];const t=[];let o=null;for(const s of Be(n)){let r;o?(r=document.createRange(),r.setStartAfter(o),r.setEndBefore(s)):(r=n.cloneRange(),r.setEndBefore(s)),r.collapsed||t.push(r),o=s}if(o){const s=n.cloneRange();s.setStartAfter(o),s.collapsed||t.push(s)}return t.length>0?t:[n]},j=e=>{const n=e.cloneContents();return n.querySelectorAll(U).forEach(t=>t.remove()),n},ae=(e,n,t=10,o)=>{const s=o?e.startContainer.parentElement.closest(o):n,r=document.createRange();r.setStart(s,0),r.setEnd(e.startContainer,e.startOffset);const l=j(r).textContent,u=document.createRange();u.setStart(e.endContainer,e.endOffset),s===document.body?u.setEnd(s,s.childNodes.length):u.setEndAfter(s);const g=j(u).textContent;return{prefix:l.substring(l.length-t),suffix:g.substring(0,t)}},M=e=>e.every(n=>n.range instanceof Range&&!n.range.collapsed),ce=/^\s*$/,le=e=>ce.test(e.toString()),Pe=(e,n)=>{const t=r=>Math.round(r*10)/10,o={top:t(e.top),bottom:t(e.bottom),left:t(e.left),right:t(e.right)},s={top:t(n.top),bottom:t(n.bottom),left:t(n.left),right:t(n.right)};if(Math.abs(o.top-s.top)<.5&&Math.abs(o.bottom-s.bottom)<.5){if(Math.abs(o.left-s.right)<.5||Math.abs(o.right-s.left)<.5)return"inline-adjacent";if(o.left>=s.left&&o.right<=s.right)return"inline-is-contained";if(o.left<=s.left&&o.right>=s.right)return"inline-contains"}else if(o.top<=s.top&&o.bottom>=s.bottom){if(o.left<=s.left&&o.right>=s.right)return"block-contains"}else if(o.top>=s.top&&o.bottom<=s.bottom&&o.left>=s.left&&o.right<=s.right)return"block-is-contained"},Me=(e,n)=>{const t=Math.min(e.left,n.left),o=Math.max(e.right,n.right),s=Math.min(e.top,n.top),r=Math.max(e.bottom,n.bottom);return new DOMRect(t,s,o-t,r-s)},de=e=>e.reduce((n,t)=>{if(t.width===0||t.height===0)return n;let o=[...n],s=!1;for(const r of n){const l=Pe(t,r);if(l==="inline-adjacent"){o=o.map(u=>u===r?Me(t,r):u),s=!0;break}else if(l==="inline-contains"){o=o.map(u=>u===r?t:u),s=!0;break}else if(l==="inline-is-contained"){s=!0;break}else if(l==="block-contains"||l==="block-is-contained"){t.width<r.width&&(o=o.map(u=>u===r?t:u)),s=!0;break}}return s?o:[...o,t]},[]),He=e=>({length:e.length,item:n=>e[n],[Symbol.iterator]:function*(){for(let n=0;n<this.length;n++)yield this.item(n)}}),ue=(e,n,t)=>{const o=document.createRange(),s=t?e.startContainer.parentElement.closest(t):n;o.setStart(s,0),o.setEnd(e.startContainer,e.startOffset);const r=j(o).textContent,l=e.toString(),u=r.length||0,g=u+l.length;return t?{quote:l,start:u,end:g,range:e,offsetReference:s}:{quote:l,start:u,end:g,range:e}},Z=(e,n)=>{var h,d;const{start:t,end:o}=e,s=e.offsetReference||n,r=document.createNodeIterator(n,NodeFilter.SHOW_TEXT,i=>{var T;return(T=i.parentElement)!=null&&T.closest(U)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});let l=0;const u=document.createRange();let g=r.nextNode();g===null&&console.error("Could not revive annotation target. Content missing.");let C=!s;for(;g!==null;){if(C||(C=typeof(s==null?void 0:s.contains)=="function"?s.contains(g):!1),C){const i=((h=g.textContent)==null?void 0:h.length)||0;if(l+i>t){u.setStart(g,t-l);break}l+=i}g=r.nextNode()}for(;g!==null;){const i=((d=g.textContent)==null?void 0:d.length)||0;if(l+i>=o){u.setEnd(g,o-l);break}l+=i,g=r.nextNode()}return{...e,range:u}},V=(e,n)=>M(e.selector)?e:{...e,selector:e.selector.map(t=>t.range instanceof Range&&!t.range.collapsed?t:Z(t,n))},G=(e,n)=>M(e.target.selector)?e:{...e,target:V(e.target,n)},fe=(e,n)=>{const t=e.cloneRange();return n.contains(t.startContainer)||t.setStart(n,0),n.contains(t.endContainer)||t.setEnd(n,n.childNodes.length),t},ge=e=>{if(e===null)return document.scrollingElement;const{overflowY:n}=window.getComputedStyle(e);return n!=="visible"&&n!=="hidden"&&e.scrollHeight>e.clientHeight?e:ge(e.parentElement)},me=(e,n)=>t=>{const o=typeof t=="string"?t:t.id,s=h=>{const d=r.getBoundingClientRect(),i=r.clientHeight,T=r.clientWidth,A=h.selector[0].range.getBoundingClientRect(),{width:R,height:v}=n.getAnnotationBounds(o),a=A.top-d.top,c=A.left-d.left,S=r.parentElement?r.scrollTop:0,y=r.parentElement?r.scrollLeft:0,m=a+S-(i-v)/2,f=c+y-(T-R)/2;r.scroll({top:m,left:f,behavior:"smooth"})},r=ge(e);if(!r)return console.warn(`The scroll parent is missing for the annotation: ${o}`,{container:e}),!1;const l=n.getAnnotation(o);if(!l)return console.warn(`The annotation is missing in the store: ${o}`),!1;const{range:u}=l.target.selector[0];if(u&&!u.collapsed)return s(l.target),!0;const g=V(l.target,e),{range:C}=g.selector[0];return C&&!C.collapsed?(s(g),!0):!1},H={fill:"rgb(0, 128, 255)",fillOpacity:.18},Y={fill:"rgb(0, 128, 255)",fillOpacity:.45},he=(e,n,t,o,s)=>{var l,u;const r=t?typeof t=="function"?t(e.annotation,e.state,s)||((l=e.state)!=null&&l.selected?Y:H):t:(u=e.state)!=null&&u.selected?Y:H;return o&&o.paint(e,n)||r},_e=e=>{const{top:n,left:t}=e.getBoundingClientRect(),{innerWidth:o,innerHeight:s}=window,r=-t,l=-n,u=o-t,g=s-n;return{top:n,left:t,minX:r,minY:l,maxX:u,maxY:g}},Ue=e=>{let n=new Set;return o=>{const s=o.map(r=>r.id);(n.size!==s.length||s.some(r=>!n.has(r)))&&e.set(s),n=new Set(s)}},ee=(e,n,t,o)=>{const{store:s,selection:r,hover:l}=n;let u,g,C;const h=Ue(t),d=O=>{const{x:p,y:w}=e.getBoundingClientRect(),k=s.getAt(O.clientX-p,O.clientY-w,!1,g);k?l.current!==k.id&&(e.classList.add("hovered"),l.set(k.id)):l.current&&(e.classList.remove("hovered"),l.set(null))};e.addEventListener("pointermove",d);const i=(O=!1)=>{C&&C.clear();const p=_e(e),{minX:w,minY:k,maxX:P,maxY:_}=p,B=g?s.getIntersecting(w,k,P,_).filter(({annotation:I})=>g(I)):s.getIntersecting(w,k,P,_),Q=r.selected.map(({id:I})=>I),N=B.map(({annotation:I,rects:q})=>{const D=Q.includes(I.id),Je=I.id===l.current;return{annotation:I,rects:q,state:{selected:D,hovered:Je}}});o.redraw(N,p,u,C,O),setTimeout(()=>h(B.map(({annotation:I})=>I)),1)},T=O=>{C=O,i()},A=O=>{u=O,i()},R=O=>{g=O,i(!1)},v=()=>i();s.observe(v);const a=r.subscribe(()=>i()),c=l.subscribe(()=>i()),S=()=>i(!0);document.addEventListener("scroll",S,{capture:!0,passive:!0});const y=W(()=>{s.recalculatePositions(),C&&C.reset(),i()});window.addEventListener("resize",y);const m=new ResizeObserver(y);m.observe(e);const f={attributes:!0,childList:!0,subtree:!0},E=new MutationObserver(W(O=>{O.every(w=>w.target===e||e.contains(w.target))||i(!0)},150));return E.observe(document.body,f),{destroy:()=>{e.removeEventListener("pointermove",d),o.destroy(),s.unobserve(v),a(),c(),document.removeEventListener("scroll",S),window.removeEventListener("resize",y),m.disconnect(),E.disconnect()},redraw:i,setStyle:A,setFilter:R,setPainter:T,setVisible:o.setVisible}},De=()=>{const e=document.createElement("canvas");return e.width=window.innerWidth,e.height=window.innerHeight,e.className="r6o-canvas-highlight-layer bg",e},Fe=(e,n)=>{e.width=window.innerWidth,e.height=window.innerHeight},Ke=e=>{e.classList.add("r6o-annotatable");const n=De(),t=n.getContext("2d");document.body.appendChild(n);const o=(u,g,C,h)=>requestAnimationFrame(()=>{const{width:d,height:i}=n;t.clearRect(-.5,-.5,d+1,i+1),h&&h.clear();const{top:T,left:A}=g;[...u].sort((v,a)=>{const{annotation:{target:{created:c}}}=v,{annotation:{target:{created:S}}}=a;return c.getTime()-S.getTime()}).forEach(v=>{var y;const a=C?typeof C=="function"?C(v.annotation,v.state):C:(y=v.state)!=null&&y.selected?Y:H,c=h&&h.paint(v,g)||a,S=v.rects.map(({x:m,y:f,width:E,height:L})=>({x:m+A,y:f+T,width:E,height:L}));if(t.fillStyle=c.fill,t.globalAlpha=c.fillOpacity||1,S.forEach(({x:m,y:f,width:E,height:L})=>t.fillRect(m,f,E,L)),c.underlineColor){t.globalAlpha=1,t.strokeStyle=c.underlineColor,t.lineWidth=c.underlineThickness??1;const m=c.underlineOffset??0;S.forEach(({x:f,y:E,width:L,height:O})=>{t.beginPath(),t.moveTo(f,E+O+m),t.lineTo(f+L,E+O+m),t.stroke()})}})}),s=W(()=>{Fe(n)});return window.addEventListener("resize",s),{destroy:()=>{n.remove(),window.removeEventListener("resize",s)},setVisible:u=>{console.log("setVisible not implemented on Canvas renderer")},redraw:o}},pe=(e,n,t)=>ee(e,n,t,Ke(e)),$e=e=>[`background-color:${F.colord((e==null?void 0:e.fill)||H.fill).alpha((e==null?void 0:e.fillOpacity)===void 0?H.fillOpacity:e.fillOpacity).toHex()}`,e!=null&&e.underlineThickness?"text-decoration:underline":void 0,e!=null&&e.underlineColor?`text-decoration-color:${e.underlineColor}`:void 0,e!=null&&e.underlineOffset?`text-underline-offset:${e.underlineOffset}px`:void 0,e!=null&&e.underlineThickness?`text-decoration-thickness:${e.underlineThickness}px`:void 0].filter(Boolean).join(";"),ye=()=>{const e=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(e);let n=new Set;return{destroy:()=>{CSS.highlights.clear(),e.remove()},setVisible:r=>{console.log("setVisible not implemented on CSS Custom Highlights renderer")},redraw:(r,l,u,g)=>{g&&g.clear();const C=new Set(r.map(d=>d.annotation.id));Array.from(n).filter(d=>!C.has(d));const h=r.map(d=>{var A;const i=u?typeof u=="function"?u(d.annotation,d.state):u:(A=d.state)!=null&&A.selected?Y:H,T=g&&g.paint(d,l)||i;return`::highlight(_${d.annotation.id}) { ${$e(T)} }`});e.innerHTML=h.join(`
2
- `),CSS.highlights.clear(),r.forEach(({annotation:d})=>{const i=d.target.selector.map(A=>A.range),T=new Highlight(...i);CSS.highlights.set(`_${d.id}`,T)}),n=C}}},be=(e,n,t)=>ee(e,n,t,ye()),We=(e,n)=>{const t=(r,l)=>r.x<=l.x+l.width&&r.x+r.width>=l.x&&r.y<=l.y+l.height&&r.y+r.height>=l.y,o=r=>r.rects.reduce((l,u)=>l+u.width,0),s=n.filter(({rects:r})=>r.some(l=>t(e,l)));return s.sort((r,l)=>o(l)-o(r)),s.findIndex(r=>r.rects.includes(e))},Ve=e=>{e.classList.add("r6o-annotatable");const n=document.createElement("div");n.className="r6o-span-highlight-layer",e.insertBefore(n,e.firstChild);let t=[];return{destroy:()=>{n.remove()},redraw:(l,u,g,C,h)=>{const i=!(ke.dequal(t,l)&&h);if(!C&&!i)return;i&&(n.innerHTML=""),[...l].sort((A,R)=>{const{annotation:{target:{created:v}}}=A,{annotation:{target:{created:a}}}=R;return v&&a?v.getTime()-a.getTime():0}).forEach(A=>{A.rects.map(R=>{const v=We(R,l),a=he(A,u,g,C,v);if(i){const c=document.createElement("span");c.className="r6o-annotation",c.dataset.annotation=A.annotation.id,c.style.left=`${R.x}px`,c.style.top=`${R.y}px`,c.style.width=`${R.width}px`,c.style.height=`${R.height}px`,c.style.backgroundColor=F.colord((a==null?void 0:a.fill)||H.fill).alpha((a==null?void 0:a.fillOpacity)===void 0?H.fillOpacity:a.fillOpacity).toHex(),a.underlineStyle&&(c.style.borderStyle=a.underlineStyle),a.underlineColor&&(c.style.borderColor=a.underlineColor),a.underlineThickness&&(c.style.borderBottomWidth=`${a.underlineThickness}px`),a.underlineOffset&&(c.style.paddingBottom=`${a.underlineOffset}px`),n.appendChild(c)}})}),t=l},setVisible:l=>{l?n.classList.remove("hidden"):n.classList.add("hidden")}}},Se=(e,n,t)=>ee(e,n,t,Ve(e)),Ye=(e,n)=>({parse:t=>Ce(t),serialize:t=>Ae(t,e,n)}),qe=e=>e.quote!==void 0&&e.start!==void 0&&e.end!==void 0,ze=e=>{const{id:n,creator:t,created:o,modified:s,target:r}=e,l=Array.isArray(r)?r:[r];if(l.length===0)return{error:Error(`No targets found for annotation: ${e.id}`)};const u={creator:x.parseW3CUser(t),created:o?new Date(o):void 0,updated:s?new Date(s):void 0,annotation:n,selector:[],styleClass:"styleClass"in l[0]?l[0].styleClass:void 0};for(const g of l){const h=(Array.isArray(g.selector)?g.selector:[g.selector]).reduce((d,i)=>{switch(i.type){case"TextQuoteSelector":d.quote=i.exact;break;case"TextPositionSelector":d.start=i.start,d.end=i.end;break}return d},{});if(qe(h))u.selector.push({...h,id:g.id,scope:g.scope});else{const d=[h.start?void 0:"TextPositionSelector",h.quote?void 0:"TextQuoteSelector"].filter(Boolean);return{error:Error(`Missing selector types: ${d.join(" and ")} for annotation: ${e.id}`)}}}return{parsed:u}},Ce=e=>{const n=e.id||te.v4(),{creator:t,created:o,modified:s,body:r,...l}=e,u=x.parseW3CBodies(r,n),g=ze(e);return"error"in g?{error:g.error}:{parsed:{...l,id:n,bodies:u,target:g.parsed}}},Ae=(e,n,t)=>{const{bodies:o,target:s,...r}=e,{selector:l,creator:u,created:g,updated:C,...h}=s,d=l.map(i=>{const{id:T,quote:A,start:R,end:v,range:a}=i,c={type:"TextQuoteSelector",exact:A};if(t){const{prefix:y,suffix:m}=ae(a,t);c.prefix=y,c.suffix=m}const S={type:"TextPositionSelector",start:R,end:v};return{...h,id:T,scope:"scope"in i?i.scope:void 0,source:n,selector:[c,S]}});return{...r,"@context":"http://www.w3.org/ns/anno.jsonld",id:e.id,type:"Annotation",body:x.serializeW3CBodies(e.bodies),creator:u,created:g==null?void 0:g.toISOString(),modified:C==null?void 0:C.toISOString(),target:d}},Xe=(e,n)=>{const t=new Ne,o=new Map,s=(a,c)=>{const S=a.selector.flatMap(m=>{const f=M([m])?m.range:Z(m,n).range;return Array.from(f.getClientRects())}),y=de(S).map(({left:m,top:f,right:E,bottom:L})=>new DOMRect(m-c.left,f-c.top,E-m,L-f));return y.map(m=>{const{x:f,y:E,width:L,height:O}=m;return{minX:f,minY:E,maxX:f+L,maxY:E+O,annotation:{id:a.annotation,rects:y}}})},r=()=>[...o.values()],l=()=>{t.clear(),o.clear()},u=a=>{const c=s(a,n.getBoundingClientRect());c.length!==0&&(c.forEach(S=>t.insert(S)),o.set(a.annotation,c))},g=a=>{const c=o.get(a.annotation);c&&(c.forEach(S=>t.remove(S)),o.delete(a.annotation))},C=a=>{g(a),u(a)},h=(a,c=!0)=>{c&&l();const S=n.getBoundingClientRect(),y=a.map(f=>({target:f,rects:s(f,S)}));y.forEach(({target:f,rects:E})=>{E.length>0&&o.set(f.annotation,E)});const m=y.flatMap(({rects:f})=>f);t.load(m)},d=(a,c,S=!1)=>{const y=t.search({minX:a,minY:c,maxX:a,maxY:c}),m=f=>f.annotation.rects.reduce((E,L)=>E+L.width*L.height,0);return y.length>0?(y.sort((f,E)=>m(f)-m(E)),S?y.map(f=>f.annotation.id):[y[0].annotation.id]):[]},i=a=>{const c=T(a);if(c.length===0)return;let S=c[0].left,y=c[0].top,m=c[0].right,f=c[0].bottom;for(let E=1;E<c.length;E++){const L=c[E];S=Math.min(S,L.left),y=Math.min(y,L.top),m=Math.max(m,L.right),f=Math.max(f,L.bottom)}return new DOMRect(S,y,m-S,f-y)},T=a=>{const c=o.get(a);return c?c[0].annotation.rects:[]};return{all:r,clear:l,getAt:d,getAnnotationBounds:i,getAnnotationRects:T,getIntersecting:(a,c,S,y)=>{const m=t.search({minX:a,minY:c,maxX:S,maxY:y}),f=new Set(m.map(E=>E.annotation.id));return Array.from(f).map(E=>({annotation:e.getAnnotation(E),rects:T(E)})).filter(E=>!!E.annotation)},insert:u,recalculate:()=>h(e.all().map(a=>a.target),!0),remove:g,set:h,size:()=>t.all().length,update:C}},Ee=(e,n)=>{const t=x.createStore(),o=Xe(t,e),s=x.createSelectionState(t,n.userSelectAction,n.adapter),r=x.createHoverState(t),l=x.createViewportState(),u=(a,c=x.Origin.LOCAL)=>{const S=G(a,e),y=M(S.target.selector);return y&&t.addAnnotation(S,c),y},g=(a,c=!0,S=x.Origin.LOCAL)=>{const y=a.map(f=>G(f,e)),m=y.filter(f=>!M(f.target.selector));return t.bulkAddAnnotations(y,c,S),m},C=(a,c=x.Origin.LOCAL)=>{const S=a.map(m=>G(m,e)),y=S.filter(m=>!M(m.target.selector));return S.forEach(m=>{t.getAnnotation(m.id)?t.updateAnnotation(m,c):t.addAnnotation(m,c)}),y},h=(a,c=x.Origin.LOCAL)=>{const S=V(a,e);t.updateTarget(S,c)},d=(a,c=x.Origin.LOCAL)=>{const S=a.map(y=>V(y,e));t.bulkUpdateTargets(S,c)};function i(a,c,S,y){const m=S||!!y,f=o.getAt(a,c,m).map(L=>t.getAnnotation(L)),E=y?f.filter(y):f;if(E.length!==0)return S?E:E[0]}const T=a=>{if(o.getAnnotationRects(a).length!==0)return o.getAnnotationBounds(a)},A=(a,c,S,y)=>o.getIntersecting(a,c,S,y),R=a=>o.getAnnotationRects(a),v=()=>o.recalculate();return t.observe(({changes:a})=>{const c=(a.deleted||[]).filter(m=>M(m.target.selector)),S=(a.created||[]).filter(m=>M(m.target.selector)),y=(a.updated||[]).filter(m=>M(m.newValue.target.selector));(c==null?void 0:c.length)>0&&c.forEach(m=>o.remove(m.target)),S.length>0&&o.set(S.map(m=>m.target),!1),(y==null?void 0:y.length)>0&&y.forEach(({newValue:m})=>o.update(m.target))}),{store:{...t,addAnnotation:u,bulkAddAnnotations:g,bulkUpdateTargets:d,bulkUpsertAnnotations:C,getAnnotationBounds:T,getAnnotationRects:R,getIntersecting:A,getAt:i,recalculatePositions:v,updateTarget:h},selection:s,hover:r,viewport:l}},je=()=>{const e=document.createElement("canvas");e.width=2*window.innerWidth,e.height=2*window.innerHeight,e.className="r6o-presence-layer";const n=e.getContext("2d");return n.scale(2,2),n.translate(.5,.5),e},Te=(e,n={})=>{const t=je(),o=t.getContext("2d");document.body.appendChild(t);const s=new Map,r=h=>Array.from(s.entries()).filter(([d,i])=>i.presenceKey===h.presenceKey).map(([d,i])=>d);return e.on("selectionChange",(h,d)=>{r(h).forEach(T=>s.delete(T)),d&&d.forEach(T=>s.set(T,h))}),{clear:()=>{const{width:h,height:d}=t;o.clearRect(-.5,-.5,h+1,d+1)},destroy:()=>{t.remove()},paint:(h,d,i)=>{n.font&&(o.font=n.font);const T=s.get(h.annotation.id);if(T){const{height:A}=h.rects[0],R=h.rects[0].x+d.left,v=h.rects[0].y+d.top;o.fillStyle=T.appearance.color,o.fillRect(R-2,v-2.5,2,A+5);const a=o.measureText(T.appearance.label),c=a.width+6,S=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent+8,y=a.fontBoundingBoxAscent?8:6.5;return o.fillRect(R-2,v-2.5-S,c,S),o.fillStyle="#fff",o.fillText(T.appearance.label,R+1,v-y),{fill:T.appearance.color,fillOpacity:i?.45:.18}}},reset:()=>{t.width=2*window.innerWidth,t.height=2*window.innerHeight;const h=t.getContext("2d");h.scale(2,2),h.translate(.5,.5)}}},we=300,ve=["up","down","left","right"],Re=se?"⌘+a":"ctrl+a",Ge=[...ve.map(e=>`shift+${e}`),Re],Le=(e,n,t)=>{let o;const{annotatingEnabled:s,offsetReferenceSelector:r,selectionMode:l}=t,u=p=>o=p;let g;const C=p=>g=p,{store:h,selection:d}=n;let i,T,A;const R=p=>{T!==!1&&(i=K(e,p.target)?void 0:{annotation:te.v4(),selector:[],creator:o,created:new Date})},v=W(p=>{const w=document.getSelection();if(!(w!=null&&w.anchorNode))return;if(K(e,w.anchorNode)){i=void 0;return}const k=p.timeStamp-((A==null?void 0:A.timeStamp)||p.timeStamp);if((A==null?void 0:A.type)==="pointerdown"&&(k<1e3&&!i||w.isCollapsed&&k<we)&&R(A||p),!i)return;if(w.isCollapsed){h.getAnnotation(i.annotation)&&(d.clear(),h.deleteAnnotation(i.annotation));return}const _=Array.from(Array(w.rangeCount).keys()).map(N=>w.getRangeAt(N)).map(N=>fe(N,e));if(_.every(N=>le(N)))return;const B=_.flatMap(N=>ie(e,N.cloneRange()));(B.length!==i.selector.length||B.some((N,I)=>{var q;return N.toString()!==((q=i.selector[I])==null?void 0:q.quote)}))&&(i={...i,selector:B.map(N=>ue(N,e,r)),updated:new Date},h.getAnnotation(i.annotation)?h.updateTarget(i,x.Origin.LOCAL):d.clear())}),a=p=>{K(e,p.target)||(A=X(p),T=A.button===0)},c=async p=>{if(!T)return;if(K(e,p.target)){t.dismissOnClickOutside&&d.clear();return}const w=()=>{const{x:P,y:_}=e.getBoundingClientRect(),B=p.target instanceof Node&&e.contains(p.target)&&h.getAt(p.clientX-P,p.clientY-_,l==="all",g);if(B){const{selected:Q}=d,N=new Set(Q.map(D=>D.id)),I=Array.isArray(B)?B.map(D=>D.id):[B.id];(N.size!==I.length||!I.every(D=>N.has(D)))&&d.userSelect(I,p)}else d.clear()};if(p.timeStamp-A.timeStamp<we){await S();const P=document.getSelection();if(P!=null&&P.isCollapsed){i=void 0,w();return}}i&&i.selector.length>0&&(L(),d.userSelect(i.annotation,X(p)))},S=async()=>{const p=document.getSelection();let w=!1,k=p==null?void 0:p.isCollapsed;const P=()=>k||w,_=1;return setTimeout(()=>w=!0,50),Ie.poll(()=>k=p==null?void 0:p.isCollapsed,_,P)},y=p=>{const w=document.getSelection();w!=null&&w.isCollapsed||((!i||i.selector.length===0)&&v(p),i&&(L(),d.userSelect(i.annotation,X(p))))},m=p=>{p.key==="Shift"&&i&&(document.getSelection().isCollapsed||(L(),d.userSelect(i.annotation,$(p))))},f=p=>{const w=()=>setTimeout(()=>{(i==null?void 0:i.selector.length)>0&&(d.clear(),h.addAnnotation({id:i.annotation,bodies:[],target:i}),d.userSelect(i.annotation,$(p))),document.removeEventListener("selectionchange",w)},100);document.addEventListener("selectionchange",w),R(p)};z(Ge.join(","),{element:e,keydown:!0,keyup:!1},p=>{p.repeat||(A=$(p))}),z(Re,{keydown:!0,keyup:!1},p=>{A=$(p),f(p)});const E=p=>{p.repeat||p.target!==e&&p.target!==document.body||(i=void 0,d.clear())};z(ve.join(","),{keydown:!0,keyup:!1},E);const L=()=>{const p=h.getAnnotation(i.annotation);if(!p){h.addAnnotation({id:i.annotation,bodies:[],target:i});return}const{target:{updated:w}}=p,{updated:k}=i;(!w||!k||w<k)&&h.updateTarget(i)};return e.addEventListener("pointerdown",a),document.addEventListener("pointerup",c),document.addEventListener("contextmenu",y),s&&(e.addEventListener("keyup",m),e.addEventListener("selectstart",R),document.addEventListener("selectionchange",v)),{destroy:()=>{e.removeEventListener("pointerdown",a),document.removeEventListener("pointerup",c),document.removeEventListener("contextmenu",y),e.removeEventListener("keyup",m),e.removeEventListener("selectstart",R),document.removeEventListener("selectionchange",v),z.unbind()},setFilter:C,setUser:u}},xe=(e,n)=>({...e,annotatingEnabled:e.annotatingEnabled??n.annotatingEnabled,user:e.user||n.user}),Oe="SPANS",Qe=(e,n={})=>{oe(e),re(e);const t=xe(n,{annotatingEnabled:!0,user:x.createAnonymousGuest()}),o=Ee(e,t),{selection:s,viewport:r}=o,l=o.store,u=x.createUndoStack(l),g=x.createLifecycleObserver(o,u,t.adapter);let C=t.user;const h=t.renderer==="CSS_HIGHLIGHTS"?CSS.highlights?"CSS_HIGHLIGHTS":Oe:t.renderer||Oe,d=h==="SPANS"?Se(e,o,r):h==="CSS_HIGHLIGHTS"?be(e,o,r):h==="CANVAS"?pe(e,o,r):void 0;if(!d)throw`Unknown renderer implementation: ${h}`;console.debug(`Using ${h} renderer`),t.style&&d.setStyle(t.style);const i=Le(e,o,t);return i.setUser(C),{...x.createBaseAnnotator(o,u,t.adapter),destroy:()=>{d.destroy(),i.destroy(),u.destroy()},element:e,getUser:()=>C,setFilter:f=>{d.setFilter(f),i.setFilter(f)},setStyle:f=>d.setStyle(f),setUser:f=>{C=f,i.setUser(f)},setSelected:f=>{f?s.setSelected(f):s.clear()},setPresenceProvider:f=>{f&&(d.setPainter(Te(f,t.presence)),f.on("selectionChange",()=>d.redraw()))},setVisible:f=>d.setVisible(f),on:g.on,off:g.off,scrollIntoView:me(e,l),state:o}};Object.defineProperty(b,"Origin",{enumerable:!0,get:()=>x.Origin}),Object.defineProperty(b,"UserSelectAction",{enumerable:!0,get:()=>x.UserSelectAction}),Object.defineProperty(b,"createBody",{enumerable:!0,get:()=>x.createBody}),b.DEFAULT_SELECTED_STYLE=Y,b.DEFAULT_STYLE=H,b.NOT_ANNOTATABLE_CLASS=J,b.NOT_ANNOTATABLE_SELECTOR=U,b.SelectionHandler=Le,b.W3CTextFormat=Ye,b.cancelSingleClickEvents=oe,b.cloneKeyboardEvent=$,b.clonePointerEvent=X,b.createCanvasRenderer=pe,b.createHighlightsRenderer=be,b.createPresencePainter=Te,b.createRenderer=ye,b.createSpansRenderer=Se,b.createTextAnnotator=Qe,b.createTextAnnotatorState=Ee,b.debounce=W,b.fillDefaults=xe,b.getQuoteContext=ae,b.getRangeAnnotatableContents=j,b.isMac=se,b.isNotAnnotatable=K,b.isRangeAnnotatable=ne,b.isRevived=M,b.isWhitespaceOrEmpty=le,b.mergeClientRects=de,b.paint=he,b.parseW3CTextAnnotation=Ce,b.programmaticallyFocusable=re,b.rangeToSelector=ue,b.reviveAnnotation=G,b.reviveSelector=Z,b.reviveTarget=V,b.scrollIntoView=me,b.serializeW3CTextAnnotation=Ae,b.splitAnnotatableRanges=ie,b.toDomRectList=He,b.trimRangeToContainer=fe,b.whitespaceOrEmptyRegex=ce,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(N,Se){typeof exports=="object"&&typeof module<"u"?Se(exports):typeof define=="function"&&define.amd?define(["exports"],Se):(N=typeof globalThis<"u"?globalThis:N||self,Se(N.RecogitoJS={}))})(this,(function(N){"use strict";const Se="not-annotatable",xe=`.${Se}`,Ye=(e,t)=>{var i;return e.contains(t)?!!(t instanceof HTMLElement?t.closest(xe):(i=t.parentElement)==null?void 0:i.closest(xe)):!0},fn=(e,t)=>{const n=t.commonAncestorContainer;return!Ye(e,n)},hn=e=>e.addEventListener("click",t=>{!t.target.closest(xe)&&!t.target.closest("a")&&t.preventDefault()}),ut=e=>({...e,type:e.type,x:e.x,y:e.y,clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,screenX:e.screenX,screenY:e.screenY,isPrimary:e.isPrimary,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,button:e.button,buttons:e.buttons,currentTarget:e.currentTarget,target:e.target,defaultPrevented:e.defaultPrevented,detail:e.detail,eventPhase:e.eventPhase,pointerId:e.pointerId,pointerType:e.pointerType,timeStamp:e.timeStamp}),Ke=e=>({...e,type:e.type,key:e.key,code:e.code,location:e.location,repeat:e.repeat,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,currentTarget:e.currentTarget,target:e.target,defaultPrevented:e.defaultPrevented,detail:e.detail,timeStamp:e.timeStamp});var Bi="2.0.5",kt=500,gn="user-agent",Le="",pn="?",ft="function",be="undefined",ke="object",Mt="string",Q="browser",ue="cpu",ae="device",oe="engine",te="os",Me="result",A="name",g="type",E="vendor",S="version",Z="architecture",Fe="major",y="model",We="console",H="mobile",Y="tablet",z="smarttv",le="wearable",ht="xr",ze="embedded",Ie="inapp",It="brands",Oe="formFactors",_t="fullVersionList",_e="platform",Nt="platformVersion",gt="bitness",we="sec-ch-ua",Ui=we+"-full-version-list",Di=we+"-arch",Hi=we+"-"+gt,Pi=we+"-form-factors",Vi=we+"-"+H,Xi=we+"-"+y,mn=we+"-"+_e,Yi=mn+"-version",bn=[It,_t,H,y,_e,Nt,Z,Oe,gt],pt="Amazon",Ne="Apple",wn="ASUS",yn="BlackBerry",Ce="Google",vn="Huawei",Bt="Lenovo",An="Honor",mt="LG",Ut="Microsoft",Dt="Motorola",Ht="Nvidia",En="OnePlus",Pt="OPPO",$e="Samsung",Sn="Sharp",je="Sony",Vt="Xiaomi",Xt="Zebra",xn="Chrome",On="Chromium",ye="Chromecast",bt="Edge",qe="Firefox",Ge="Opera",Yt="Facebook",Cn="Sogou",Be="Mobile ",Je=" Browser",Kt="Windows",Ki=typeof window!==be,ee=Ki&&window.navigator?window.navigator:void 0,ve=ee&&ee.userAgentData?ee.userAgentData:void 0,Fi=function(e,t){var n={},i=t;if(!yt(t)){i={};for(var o in t)for(var r in t[o])i[r]=t[o][r].concat(i[r]?i[r]:[])}for(var s in e)n[s]=i[s]&&i[s].length%2===0?i[s].concat(e[s]):e[s];return n},wt=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Ft=function(e,t){if(typeof e===ke&&e.length>0){for(var n in e)if(Ae(t)==Ae(e[n]))return!0;return!1}return Ue(e)?Ae(t)==Ae(e):!1},yt=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?yt(e[n]):!1)},Ue=function(e){return typeof e===Mt},Wt=function(e){if(e){for(var t=[],n=De(/\\?\"/g,e).split(","),i=0;i<n.length;i++)if(n[i].indexOf(";")>-1){var o=vt(n[i]).split(";v=");t[i]={brand:o[0],version:o[1]}}else t[i]=vt(n[i]);return t}},Ae=function(e){return Ue(e)?e.toLowerCase():e},zt=function(e){return Ue(e)?De(/[^\d\.]/g,e).split(".")[0]:void 0},fe=function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n==ke&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},De=function(e,t){return Ue(t)?t.replace(e,Le):t},Qe=function(e){return De(/\\?\"/g,e)},vt=function(e,t){if(Ue(e))return e=De(/^\s\s*/,e),typeof t===be?e:e.substring(0,kt)},$t=function(e,t){if(!(!e||!t))for(var n=0,i,o,r,s,a,l;n<t.length&&!a;){var c=t[n],u=t[n+1];for(i=o=0;i<c.length&&!a&&c[i];)if(a=c[i++].exec(e),a)for(r=0;r<u.length;r++)l=a[++o],s=u[r],typeof s===ke&&s.length>0?s.length===2?typeof s[1]==ft?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===ft&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=l?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:s.length==3?this[s[0]]=l?l.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=l?s[3].apply(this,[l.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=l||void 0;n+=2}},ce=function(e,t){for(var n in t)if(typeof t[n]===ke&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(Ft(t[n][i],e))return n===pn?void 0:n}else if(Ft(t[n],e))return n===pn?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},Tn={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},Rn={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Wi={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},Ln={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[S,[A,Be+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[S,[A,bt+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[S,[A,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[A,S],[/opios[\/ ]+([\w\.]+)/i],[S,[A,Ge+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[S,[A,Ge+" GX"]],[/\bopr\/([\w\.]+)/i],[S,[A,Ge]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[S,[A,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[S,[A,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[A,S],[/quark(?:pc)?\/([-\w\.]+)/i],[S,[A,"Quark"]],[/\bddg\/([\w\.]+)/i],[S,[A,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[S,[A,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[S,[A,"WeChat"]],[/konqueror\/([\w\.]+)/i],[S,[A,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[S,[A,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[S,[A,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[S,[A,"Smart "+Bt+Je]],[/(avast|avg)\/([\w\.]+)/i],[[A,/(.+)/,"$1 Secure"+Je],S],[/\bfocus\/([\w\.]+)/i],[S,[A,qe+" Focus"]],[/\bopt\/([\w\.]+)/i],[S,[A,Ge+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[S,[A,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[S,[A,"Dolphin"]],[/coast\/([\w\.]+)/i],[S,[A,Ge+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[S,[A,"MIUI"+Je]],[/fxios\/([\w\.-]+)/i],[S,[A,Be+qe]],[/\bqihoobrowser\/?([\w\.]*)/i],[S,[A,"360"]],[/\b(qq)\/([\w\.]+)/i],[[A,/(.+)/,"$1Browser"],S],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[A,/(.+)/,"$1"+Je],S],[/samsungbrowser\/([\w\.]+)/i],[S,[A,$e+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[S,[A,Cn+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[A,Cn+" Mobile"],S],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[A,S],[/(lbbrowser|rekonq)/i],[A],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[S,A],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[A,Yt],S,[g,Ie]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[A,S,[g,Ie]],[/\bgsa\/([\w\.]+) .*safari\//i],[S,[A,"GSA"],[g,Ie]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[S,[A,"TikTok"],[g,Ie]],[/\[(linkedin)app\]/i],[A,[g,Ie]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[A,/(.+)/,"Zalo"],S,[g,Ie]],[/(chromium)[\/ ]([-\w\.]+)/i],[A,S],[/headlesschrome(?:\/([\w\.]+)| )/i],[S,[A,xn+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[S,[A,bt+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[A,xn+" WebView"],S],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[S,[A,"Android"+Je]],[/chrome\/([\w\.]+) mobile/i],[S,[A,Be+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[A,S],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[S,[A,Be+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[A,Be+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[S,A],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[A,[S,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[A,S],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[A,Be+qe],S],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[A,"Netscape"],S],[/(wolvic|librewolf)\/([\w\.]+)/i],[A,S],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[S,[A,qe+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[A,[S,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[A,[S,/[^\d\.]+./,Le]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Z,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Z,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Z,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Z,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Z,"arm"]],[/ sun4\w[;\)]/i],[[Z,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[Z,/ower/,Le,Ae]],[/winnt.+\[axp/i],[[Z,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[y,[E,$e],[g,Y]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[y,[E,$e],[g,H]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[y,[E,Ne],[g,H]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[y,[E,Ne],[g,Y]],[/(macintosh);/i],[y,[E,Ne]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[y,[E,Sn],[g,H]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[y,[E,An],[g,Y]],[/honor([-\w ]+)[;\)]/i],[y,[E,An],[g,H]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[y,[E,vn],[g,Y]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[y,[E,vn],[g,H]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[y,/_/g," "],[E,Vt],[g,Y]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[y,/_/g," "],[E,Vt],[g,H]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[y,[E,En],[g,H]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[y,[E,Pt],[g,H]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[y,[E,ce,{OnePlus:["203","304","403","404","413","415"],"*":Pt}],[g,Y]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[y,[E,"BLU"],[g,H]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[y,[E,"Vivo"],[g,H]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[y,[E,"Realme"],[g,H]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[y,[E,Bt],[g,Y]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[y,[E,Bt],[g,H]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[y,[E,Dt],[g,H]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[y,[E,Dt],[g,Y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[y,[E,mt],[g,Y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[y,[E,mt],[g,H]],[/(nokia) (t[12][01])/i],[E,y,[g,Y]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[y,/_/g," "],[g,H],[E,"Nokia"]],[/(pixel (c|tablet))\b/i],[y,[E,Ce],[g,Y]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[y,[E,Ce],[g,H]],[/(google) (pixelbook( go)?)/i],[E,y],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[y,[E,je],[g,H]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[y,"Xperia Tablet"],[E,je],[g,Y]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[y,[E,pt],[g,Y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[y,/(.+)/g,"Fire Phone $1"],[E,pt],[g,H]],[/(playbook);[-\w\),; ]+(rim)/i],[y,E,[g,Y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[y,[E,yn],[g,H]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[y,[E,wn],[g,Y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[y,[E,wn],[g,H]],[/(nexus 9)/i],[y,[E,"HTC"],[g,Y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[E,[y,/_/g," "],[g,H]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[y,[E,"TCL"],[g,Y]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[y,[E,"TCL"],[g,H]],[/(itel) ((\w+))/i],[[E,Ae],y,[g,ce,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[y,[E,"Acer"],[g,Y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[y,[E,"Meizu"],[g,H]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[y,[E,"Ulefone"],[g,H]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[y,[E,"Energizer"],[g,H]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[y,[E,"Cat"],[g,H]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[y,[E,"Smartfren"],[g,H]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[y,[E,"Nothing"],[g,H]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[y,[E,"Archos"],[g,Y]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[y,[E,"Archos"],[g,H]],[/; (n159v)/i],[y,[E,"HMD"],[g,H]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[E,y,[g,Y]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[E,y,[g,H]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[E,y,[g,Y]],[/(surface duo)/i],[y,[E,Ut],[g,Y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[y,[E,"Fairphone"],[g,H]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[y,[E,Ht],[g,Y]],[/(sprint) (\w+)/i],[E,y,[g,H]],[/(kin\.[onetw]{3})/i],[[y,/\./g," "],[E,Ut],[g,H]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[y,[E,Xt],[g,Y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[y,[E,Xt],[g,H]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[E,[g,z]],[/hbbtv.+maple;(\d+)/i],[[y,/^/,"SmartTV"],[E,$e],[g,z]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[E,y,[g,z]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[E,mt],[g,z]],[/(apple) ?tv/i],[E,[y,Ne+" TV"],[g,z]],[/crkey.*devicetype\/chromecast/i],[[y,ye+" Third Generation"],[E,Ce],[g,z]],[/crkey.*devicetype\/([^/]*)/i],[[y,/^/,"Chromecast "],[E,Ce],[g,z]],[/fuchsia.*crkey/i],[[y,ye+" Nest Hub"],[E,Ce],[g,z]],[/crkey/i],[[y,ye],[E,Ce],[g,z]],[/(portaltv)/i],[y,[E,Yt],[g,z]],[/droid.+aft(\w+)( bui|\))/i],[y,[E,pt],[g,z]],[/(shield \w+ tv)/i],[y,[E,Ht],[g,z]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[y,[E,Sn],[g,z]],[/(bravia[\w ]+)( bui|\))/i],[y,[E,je],[g,z]],[/(mi(tv|box)-?\w+) bui/i],[y,[E,Vt],[g,z]],[/Hbbtv.*(technisat) (.*);/i],[E,y,[g,z]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[E,/.+\/(\w+)/,"$1",ce,{LG:"lge"}],[y,vt],[g,z]],[/(playstation \w+)/i],[y,[E,je],[g,We]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[y,[E,Ut],[g,We]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[E,y,[g,We]],[/droid.+; (shield)( bui|\))/i],[y,[E,Ht],[g,We]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[y,[E,$e],[g,le]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[E,y,[g,le]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[y,[E,Pt],[g,le]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[y,[E,Ne],[g,le]],[/(opwwe\d{3})/i],[y,[E,En],[g,le]],[/(moto 360)/i],[y,[E,Dt],[g,le]],[/(smartwatch 3)/i],[y,[E,je],[g,le]],[/(g watch r)/i],[y,[E,mt],[g,le]],[/droid.+; (wt63?0{2,3})\)/i],[y,[E,Xt],[g,le]],[/droid.+; (glass) \d/i],[y,[E,Ce],[g,ht]],[/(pico) ([\w ]+) os\d/i],[E,y,[g,ht]],[/(quest( \d| pro)?s?).+vr/i],[y,[E,Yt],[g,ht]],[/mobile vr; rv.+firefox/i],[[g,ht]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[E,[g,ze]],[/(aeobc)\b/i],[y,[E,pt],[g,ze]],[/(homepod).+mac os/i],[y,[E,Ne],[g,ze]],[/windows iot/i],[[g,ze]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[y,[g,z]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[g,z]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[y,[g,ce,{mobile:"Mobile",xr:"VR","*":Y}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,Y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,H]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[y,[E,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[S,[A,bt+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[A,S],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[S,[A,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[A,S],[/ladybird\//i],[[A,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[S,A]],os:[[/(windows nt) (6\.[23]); arm/i],[[A,/N/,"R"],[S,ce,Tn]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[A,S],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[S,/(;|\))/g,"",ce,Tn],[A,Kt]],[/(windows ce)\/?([\d\.]*)/i],[A,S],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[S,/_/g,"."],[A,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[A,"macOS"],[S,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[S,[A,ye+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[S,[A,ye+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[S,[A,ye+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[S,[A,ye+" Linux"]],[/crkey\/([\d\.]+)/i],[S,[A,ye]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[S,A],[/(ubuntu) ([\w\.]+) like android/i],[[A,/(.+)/,"$1 Touch"],S],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[A,S],[/\(bb(10);/i],[S,[A,yn]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[S,[A,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[S,[A,qe+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[S,[A,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[S,ce,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[A,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[S,[A,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[A,"Chrome OS"],S],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[A,S],[/(sunos) ?([\d\.]*)/i],[[A,"Solaris"],S],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[A,S]]},At=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return fe.call(e.init,[[Q,[A,S,Fe,g]],[ue,[Z]],[ae,[g,y,E]],[oe,[A,S]],[te,[A,S]]]),fe.call(e.isIgnore,[[Q,[S,Fe]],[oe,[S]],[te,[S]]]),fe.call(e.isIgnoreRgx,[[Q,/ ?browser$/i],[te,/ ?os$/i]]),fe.call(e.toString,[[Q,[A,S]],[ue,[Z]],[ae,[E,y]],[oe,[A,S]],[te,[A,S]]]),e})(),zi=function(e,t){var n=At.init[t],i=At.isIgnore[t]||0,o=At.isIgnoreRgx[t]||0,r=At.toString[t]||0;function s(){fe.call(this,n)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return ve?ve.getHighEntropyValues(bn).then(function(a){return e.setCH(new kn(a,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Me&&(s.prototype.is=function(a){var l=!1;for(var c in this)if(this.hasOwnProperty(c)&&!Ft(i,c)&&Ae(o?De(o,this[c]):this[c])==Ae(o?De(o,a):a)){if(l=!0,a!=be)break}else if(a==be&&l){l=!l;break}return l},s.prototype.toString=function(){var a=Le;for(var l in r)typeof this[r[l]]!==be&&(a+=(a?" ":Le)+this[r[l]]);return a||be}),ve||(s.prototype.then=function(a){var l=this,c=function(){for(var d in l)l.hasOwnProperty(d)&&(this[d]=l[d])};c.prototype={is:s.prototype.is,toString:s.prototype.toString};var u=new c;return a(u),u}),new s};function kn(e,t){if(e=e||{},fe.call(this,bn),t)fe.call(this,[[It,Wt(e[we])],[_t,Wt(e[Ui])],[H,/\?1/.test(e[Vi])],[y,Qe(e[Xi])],[_e,Qe(e[mn])],[Nt,Qe(e[Yi])],[Z,Qe(e[Di])],[Oe,Wt(e[Pi])],[gt,Qe(e[Hi])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==be&&(this[n]=e[n])}function Mn(e,t,n,i){return this.get=function(o){return o?this.data.hasOwnProperty(o)?this.data[o]:void 0:this.data},this.set=function(o,r){return this.data[o]=r,this},this.setCH=function(o){return this.uaCH=o,this},this.detectFeature=function(){if(ee&&ee.userAgent==this.ua)switch(this.itemType){case Q:ee.brave&&typeof ee.brave.isBrave==ft&&this.set(A,"Brave");break;case ae:!this.get(g)&&ve&&ve[H]&&this.set(g,H),this.get(y)=="Macintosh"&&ee&&typeof ee.standalone!==be&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&this.set(y,"iPad").set(g,Y);break;case te:!this.get(A)&&ve&&ve[_e]&&this.set(A,ve[_e]);break;case Me:var o=this.data,r=function(s){return o[s].getItem().detectFeature().get()};this.set(Q,r(Q)).set(ue,r(ue)).set(ae,r(ae)).set(oe,r(oe)).set(te,r(te))}return this},this.parseUA=function(){return this.itemType!=Me&&$t.call(this.data,this.ua,this.rgxMap),this.itemType==Q&&this.set(Fe,zt(this.get(S))),this},this.parseCH=function(){var o=this.uaCH,r=this.rgxMap;switch(this.itemType){case Q:case oe:var s=o[_t]||o[It],a;if(s)for(var l=0;l<s.length;l++){var c=s[l].brand||s[l],u=s[l].version;this.itemType==Q&&!/not.a.brand/i.test(c)&&(!a||/Chrom/.test(a)&&c!=On||a==bt&&/WebView2/.test(c))&&(c=ce(c,Wi),a=this.get(A),a&&!/Chrom/.test(a)&&/Chrom/.test(c)||this.set(A,c).set(S,u).set(Fe,zt(u)),a=c),this.itemType==oe&&c==On&&this.set(S,u)}break;case ue:var d=o[Z];d&&(d&&o[gt]=="64"&&(d+="64"),$t.call(this.data,d+";",r));break;case ae:if(o[H]&&this.set(g,H),o[y]&&(this.set(y,o[y]),!this.get(g)||!this.get(E))){var v={};$t.call(v,"droid 9; "+o[y]+")",r),!this.get(g)&&v.type&&this.set(g,v.type),!this.get(E)&&v.vendor&&this.set(E,v.vendor)}if(o[Oe]){var b;if(typeof o[Oe]!="string")for(var C=0;!b&&C<o[Oe].length;)b=ce(o[Oe][C++],Rn);else b=ce(o[Oe],Rn);this.set(g,b)}break;case te:var f=o[_e];if(f){var O=o[Nt];f==Kt&&(O=parseInt(zt(O),10)>=13?"11":"10"),this.set(A,f).set(S,O)}this.get(A)==Kt&&o[y]=="Xbox"&&this.set(A,"Xbox").set(S,void 0);break;case Me:var m=this.data,h=function(w){return m[w].getItem().setCH(o).parseCH().get()};this.set(Q,h(Q)).set(ue,h(ue)).set(ae,h(ae)).set(oe,h(oe)).set(te,h(te))}return this},fe.call(this,[["itemType",e],["ua",t],["uaCH",i],["rgxMap",n],["data",zi(this,e)]]),this}function he(e,t,n){if(typeof e===ke?(yt(e,!0)?(typeof t===ke&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===Mt&&!yt(t,!0)&&(n=t,t=void 0),n)if(typeof n.append===ft){var i={};n.forEach(function(u,d){i[String(d).toLowerCase()]=u}),n=i}else{var o={};for(var r in n)n.hasOwnProperty(r)&&(o[String(r).toLowerCase()]=n[r]);n=o}if(!(this instanceof he))return new he(e,t,n).getResult();var s=typeof e===Mt?e:n&&n[gn]?n[gn]:ee&&ee.userAgent?ee.userAgent:Le,a=new kn(n,!0),l=t?Fi(Ln,t):Ln,c=function(u){return u==Me?function(){return new Mn(u,s,l,a).set("ua",s).set(Q,this.getBrowser()).set(ue,this.getCPU()).set(ae,this.getDevice()).set(oe,this.getEngine()).set(te,this.getOS()).get()}:function(){return new Mn(u,s,l[u],a).parseUA().get()}};return fe.call(this,[["getBrowser",c(Q)],["getCPU",c(ue)],["getDevice",c(ae)],["getEngine",c(oe)],["getOS",c(te)],["getResult",c(Me)],["getUA",function(){return s}],["setUA",function(u){return Ue(u)&&(s=u.length>kt?vt(u,kt):u),this}]]).setUA(s),this}he.VERSION=Bi,he.BROWSER=wt([A,S,Fe,g]),he.CPU=wt([Z]),he.DEVICE=wt([y,E,g,We,H,z,Y,le,ze]),he.ENGINE=he.OS=wt([A,S]);const $i=Object.freeze({AIX:"AIX",AMIGA_OS:"Amiga OS",ANDROID:"Android",ANDROID_X86:"Android-x86",ARCAOS:"ArcaOS",ARCH:"Arch",BADA:"Bada",BEOS:"BeOS",BLACKBERRY:"BlackBerry",CENTOS:"CentOS",CHROME_OS:"Chrome OS",CHROMECAST:"Chromecast",CHROMECAST_ANDROID:"Chromecast Android",CHROMECAST_FUCHSIA:"Chromecast Fuchsia",CHROMECAST_LINUX:"Chromecast Linux",CHROMECAST_SMARTSPEAKER:"Chromecast SmartSpeaker",CONTIKI:"Contiki",DEBIAN:"Debian",DEEPIN:"Deepin",DRAGONFLY:"DragonFly",ELEMENTARY_OS:"elementary OS",FEDORA:"Fedora",FIREFOX_OS:"Firefox OS",FREEBSD:"FreeBSD",FUCHSIA:"Fuchsia",GENTOO:"Gentoo",GHOSTBSD:"GhostBSD",GNU:"GNU",HAIKU:"Haiku",HARMONYOS:"HarmonyOS",HP_UX:"HP-UX",HURD:"Hurd",IOS:"iOS",JOLI:"Joli",KAIOS:"KaiOS",KNOPPIX:"Knoppix",KUBUNTU:"Kubuntu",LINPUS:"Linpus",LINSPIRE:"Linspire",LINUX:"Linux",MACOS:"macOS",MAEMO:"Maemo",MAGEIA:"Mageia",MANDRIVA:"Mandriva",MANJARO:"Manjaro",MEEGO:"MeeGo",MINIX:"Minix",MINT:"Mint",MORPH_OS:"Morph OS",NETBSD:"NetBSD",NETRANGE:"NetRange",NETTV:"NetTV",NINTENDO:"Nintendo",OPENHARMONY:"OpenHarmony",OPENBSD:"OpenBSD",OPENVMS:"OpenVMS",OS2:"OS/2",PALM:"Palm",PC_BSD:"PC-BSD",PCLINUXOS:"PCLinuxOS",PICO:"Pico",PLAN9:"Plan9",PLAYSTATION:"PlayStation",QNX:"QNX",RASPBIAN:"Raspbian",REDHAT:"RedHat",RIM_TABLET_OS:"RIM Tablet OS",RISC_OS:"RISC OS",SABAYON:"Sabayon",SAILFISH:"Sailfish",SERENITYOS:"SerenityOS",SERIES40:"Series40",SLACKWARE:"Slackware",SOLARIS:"Solaris",SUSE:"SUSE",SYMBIAN:"Symbian",TIZEN:"Tizen",UBUNTU:"Ubuntu",UBUNTU_TOUCH:"Ubuntu Touch",UNIX:"Unix",VECTORLINUX:"VectorLinux",WATCHOS:"watchOS",WEBOS:"WebOS",WINDOWS:"Windows",WINDOWS_CE:"Windows CE",WINDOWS_IOT:"Windows IoT",WINDOWS_MOBILE:"Windows Mobile",WINDOWS_PHONE:"Windows Phone",WINDOWS_RT:"Windows RT",XBOX:"Xbox",XUBUNTU:"Xubuntu",ZENWALK:"Zenwalk"}),In=he().os.is($i.MACOS),_n=e=>{!e.hasAttribute("tabindex")&&e.tabIndex<0&&e.setAttribute("tabindex","-1"),e.classList.add("no-focus-outline")},Te=(e,t=10)=>{let n;return((...i)=>{clearTimeout(n),n=setTimeout(()=>e.apply(void 0,i),t)})},Nn=e=>{const t=[],n=document.createNodeIterator(e.commonAncestorContainer,NodeFilter.SHOW_TEXT);let i;for(;i=n.nextNode();)e.intersectsNode(i)&&t.push(i);if(t.length<2)return Array.from(e.getClientRects());{const o=t[0],r=t[t.length-1],s=document.createRange();s.selectNode(o),e.startContainer.nodeType===Node.TEXT_NODE?s.setStart(o,e.startOffset):s.setStartAfter(e.startContainer);const a=document.createRange();a.selectNode(r),e.endContainer.nodeType===Node.TEXT_NODE?a.setEnd(r,e.endOffset):a.setEndBefore(e.endContainer);const l=c=>{const u=document.createRange();return u.selectNode(c),Array.from(u.getClientRects())};return[...Array.from(s.getClientRects()),...t.slice(1,-1).flatMap(l),...Array.from(a.getClientRects())]}},ji=function*(e){const t=document.createNodeIterator(e.commonAncestorContainer,NodeFilter.SHOW_ELEMENT,i=>i instanceof HTMLElement&&i.classList.contains(Se)&&!i.parentElement.closest(xe)&&e.intersectsNode(i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP);let n;for(;n=t.nextNode();)n instanceof HTMLElement&&(yield n)},Bn=(e,t)=>{if(!fn(e,t))return[];const n=[];let i=null;for(const o of ji(t)){let r;i?(r=document.createRange(),r.setStartAfter(i),r.setEndBefore(o)):(r=t.cloneRange(),r.setEndBefore(o)),r.collapsed||n.push(r),i=o}if(i){const o=t.cloneRange();o.setStartAfter(i),o.collapsed||n.push(o)}return n.length>0?n:[t]},Et=e=>{const t=e.cloneContents();return t.querySelectorAll(xe).forEach(n=>n.remove()),t},Un=(e,t,n=10,i)=>{const o=i?e.startContainer.parentElement.closest(i):t,r=document.createRange();r.setStart(o,0),r.setEnd(e.startContainer,e.startOffset);const s=Et(r).textContent,a=document.createRange();a.setStart(e.endContainer,e.endOffset),o===document.body?a.setEnd(o,o.childNodes.length):a.setEndAfter(o);const l=Et(a).textContent;return{prefix:s.substring(s.length-n),suffix:l.substring(0,n)}},de=e=>e.every(t=>t.range instanceof Range&&!t.range.collapsed),Dn=/^\s*$/,Hn=e=>Dn.test(e.toString()),qi=(e,t,n,i)=>{const o=a=>Math.round(a*10)/10,r={top:o(e.top),bottom:o(e.bottom),left:o(e.left),right:o(e.right)},s={top:o(t.top),bottom:o(t.bottom),left:o(t.left),right:o(t.right)};if(Math.abs(r.top-s.top)<i&&Math.abs(r.bottom-s.bottom)<i){if(Math.abs(r.left-s.right)<n||Math.abs(r.right-s.left)<n)return"inline-adjacent";if(r.left>=s.left&&r.right<=s.right)return"inline-is-contained";if(r.left<=s.left&&r.right>=s.right)return"inline-contains"}else if(r.top<=s.top&&r.bottom>=s.bottom){if(r.left<=s.left&&r.right>=s.right)return"block-contains"}else if(r.top>=s.top&&r.bottom<=s.bottom&&r.left>=s.left&&r.right<=s.right)return"block-is-contained"},Gi=(e,t)=>{const n=Math.min(e.left,t.left),i=Math.max(e.right,t.right),o=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom);return new DOMRect(n,o,i-n,r-o)},Pn=(e,t=.5,n=.5)=>e.reduce((i,o)=>{if(o.width===0||o.height===0)return i;let r=[...i],s=!1;for(const a of i){const l=qi(o,a,t,n);if(l==="inline-adjacent"){r=r.map(c=>c===a?Gi(o,a):c),s=!0;break}else if(l==="inline-contains"){r=r.map(c=>c===a?o:c),s=!0;break}else if(l==="inline-is-contained"){s=!0;break}else if(l==="block-contains"||l==="block-is-contained"){o.width<a.width&&(r=r.map(c=>c===a?o:c)),o.width===a.width&&o.height<a.width&&(r=r.map(c=>c===a?o:c)),s=!0;break}}return s?r:[...r,o]},[]),Ji=e=>({length:e.length,item:t=>e[t],[Symbol.iterator]:function*(){for(let t=0;t<this.length;t++)yield this.item(t)}}),Vn=(e,t,n)=>{const i=document.createRange(),o=n?e.startContainer.parentElement.closest(n):t;i.setStart(o,0),i.setEnd(e.startContainer,e.startOffset);const r=Et(i).textContent,s=e.toString(),a=r.length||0,l=a+s.length;return n?{quote:s,start:a,end:l,range:e,offsetReference:o}:{quote:s,start:a,end:l,range:e}},jt=(e,t)=>{var u,d;const{start:n,end:i}=e,o=e.offsetReference||t,r=document.createNodeIterator(t,NodeFilter.SHOW_TEXT,v=>{var b;return(b=v.parentElement)!=null&&b.closest(xe)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});let s=0;const a=document.createRange();let l=r.nextNode();l===null&&console.error("Could not revive annotation target. Content missing.");let c=!o;for(;l!==null;){if(c||(c=typeof(o==null?void 0:o.contains)=="function"?o.contains(l):!1),c){const v=((u=l.textContent)==null?void 0:u.length)||0;if(s+v>n){a.setStart(l,n-s);break}s+=v}l=r.nextNode()}for(;l!==null;){const v=((d=l.textContent)==null?void 0:d.length)||0;if(s+v>=i){a.setEnd(l,i-s);break}s+=v,l=r.nextNode()}return{...e,range:a}},Ze=(e,t)=>de(e.selector)?e:{...e,selector:e.selector.map(n=>n.range instanceof Range&&!n.range.collapsed?n:jt(n,t))},St=(e,t)=>de(e.target.selector)?e:{...e,target:Ze(e.target,t)},Xn=(e,t)=>{const n=e.cloneRange();return t.contains(n.startContainer)||n.setStart(t,0),t.contains(n.endContainer)||n.setEnd(t,t.childNodes.length),n},Yn=e=>{if(e===null)return document.scrollingElement;const{overflowY:t}=window.getComputedStyle(e);return t!=="visible"&&t!=="hidden"&&e.scrollHeight>e.clientHeight?e:Yn(e.parentElement)},Kn=(e,t)=>n=>{const i=typeof n=="string"?n:n.id,o=u=>{const d=r.getBoundingClientRect(),v=r.clientHeight,b=r.clientWidth,C=u.selector[0].range.getBoundingClientRect(),{width:f,height:O}=t.getAnnotationBounds(i),m=C.top-d.top,h=C.left-d.left,w=r.parentElement?r.scrollTop:0,R=r.parentElement?r.scrollLeft:0,k=m+w-(v-O)/2,L=h+R-(b-f)/2;r.scroll({top:k,left:L,behavior:"smooth"})},r=Yn(e);if(!r)return console.warn(`The scroll parent is missing for the annotation: ${i}`,{container:e}),!1;const s=t.getAnnotation(i);if(!s)return console.warn(`The annotation is missing in the store: ${i}`),!1;const{range:a}=s.target.selector[0];if(a&&!a.collapsed)return o(s.target),!0;const l=Ze(s.target,e),{range:c}=l.selector[0];return c&&!c.collapsed?(o(l),!0):!1},ge={fill:"rgb(0, 128, 255)",fillOpacity:.18},et={fill:"rgb(0, 128, 255)",fillOpacity:.45},Fn=(e,t,n,i,o)=>{var s,a;const r=n?typeof n=="function"?n(e.annotation,e.state,o)||((s=e.state)!=null&&s.selected?et:ge):n:(a=e.state)!=null&&a.selected?et:ge;return i&&i.paint(e,t)||r},Qi=e=>{const{top:t,left:n}=e.getBoundingClientRect(),{innerWidth:i,innerHeight:o}=window,r=-n,s=-t,a=i-n,l=o-t;return{top:t,left:n,minX:r,minY:s,maxX:a,maxY:l}},Zi=e=>{let t=new Set;return i=>{const o=i.map(r=>r.id);(t.size!==o.length||o.some(r=>!t.has(r)))&&e.set(o),t=new Set(o)}},qt=(e,t,n,i)=>{const{store:o,selection:r,hover:s}=t;let a,l,c;const u=Zi(n),d=Te(B=>{const{x:W,y:_}=e.getBoundingClientRect(),p=o.getAt(B.clientX-W,B.clientY-_,!1,l);p?s.current!==p.id&&(e.classList.add("hovered"),s.set(p.id)):s.current&&(e.classList.remove("hovered"),s.set(null))},10);e.addEventListener("pointermove",d);const v=Te((B=!1)=>requestAnimationFrame(()=>{c&&c.clear();const W=Qi(e),{minX:_,minY:p,maxX:x,maxY:T}=W,M=l?o.getIntersecting(_,p,x,T).filter(({annotation:U})=>l(U)):o.getIntersecting(_,p,x,T),X=r.selected.map(({id:U})=>U),P=M.map(({annotation:U,rects:J})=>{const Ee=X.includes(U.id),Ni=U.id===s.current;return{annotation:U,rects:J,state:{selected:Ee,hovered:Ni}}});i.redraw(P,W,a,c,B),setTimeout(()=>u(M.map(({annotation:U})=>U)),1)}),10),b=B=>{c=B,v()},C=B=>{a=B,v()},f=B=>{l=B,v(!1)},O=()=>v();o.observe(O);const m=r.subscribe(()=>v()),h=s.subscribe(()=>v()),w=()=>v(!0);document.addEventListener("scroll",w,{capture:!0,passive:!0});const R=Te(()=>{o.recalculatePositions(),c&&c.reset(),v()});window.addEventListener("resize",R);const k=new ResizeObserver(R);k.observe(e);const L={attributes:!0,childList:!0,subtree:!0},I=new MutationObserver(Te(B=>{B.every(_=>_.target===e||e.contains(_.target))||v(!0)},150));return I.observe(document.body,L),{destroy:()=>{e.removeEventListener("pointermove",d),i.destroy(),o.unobserve(O),m(),h(),document.removeEventListener("scroll",w),window.removeEventListener("resize",R),k.disconnect(),I.disconnect()},redraw:v,setStyle:C,setFilter:f,setPainter:b,setVisible:i.setVisible}},eo=()=>{const e=document.createElement("canvas");return e.width=window.innerWidth,e.height=window.innerHeight,e.className="r6o-canvas-highlight-layer bg",e},to=(e,t)=>{e.width=window.innerWidth,e.height=window.innerHeight},no=e=>{e.classList.add("r6o-annotatable");const t=eo(),n=t.getContext("2d");document.body.appendChild(t);const i=(a,l,c,u)=>requestAnimationFrame(()=>{const{width:d,height:v}=t;n.clearRect(-.5,-.5,d+1,v+1),u&&u.clear();const{top:b,left:C}=l;[...a].sort((O,m)=>{const{annotation:{target:{created:h}}}=O,{annotation:{target:{created:w}}}=m;return h.getTime()-w.getTime()}).forEach(O=>{var R;const m=c?typeof c=="function"?c(O.annotation,O.state):c:(R=O.state)!=null&&R.selected?et:ge,h=u&&u.paint(O,l)||m,w=O.rects.map(({x:k,y:L,width:I,height:D})=>({x:k+C,y:L+b,width:I,height:D}));if(n.fillStyle=h.fill,n.globalAlpha=h.fillOpacity||1,w.forEach(({x:k,y:L,width:I,height:D})=>n.fillRect(k,L,I,D)),h.underlineColor){n.globalAlpha=1,n.strokeStyle=h.underlineColor,n.lineWidth=h.underlineThickness??1;const k=h.underlineOffset??0;w.forEach(({x:L,y:I,width:D,height:B})=>{n.beginPath(),n.moveTo(L,I+B+k),n.lineTo(L+D,I+B+k),n.stroke()})}})}),o=Te(()=>{to(t)});return window.addEventListener("resize",o),{destroy:()=>{t.remove(),window.removeEventListener("resize",o)},setVisible:a=>{console.log("setVisible not implemented on Canvas renderer")},redraw:i}},Wn=(e,t,n)=>qt(e,t,n,no(e));var io={grad:.9,turn:360,rad:360/(2*Math.PI)},pe=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},$=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},ne=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},zn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},$n=function(e){return{r:ne(e.r,0,255),g:ne(e.g,0,255),b:ne(e.b,0,255),a:ne(e.a)}},Gt=function(e){return{r:$(e.r),g:$(e.g),b:$(e.b),a:$(e.a,3)}},oo=/^#([0-9a-f]{3,8})$/i,xt=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},jn=function(e){var t=e.r,n=e.g,i=e.b,o=e.a,r=Math.max(t,n,i),s=r-Math.min(t,n,i),a=s?r===t?(n-i)/s:r===n?2+(i-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:r?s/r*100:0,v:r/255*100,a:o}},qn=function(e){var t=e.h,n=e.s,i=e.v,o=e.a;t=t/360*6,n/=100,i/=100;var r=Math.floor(t),s=i*(1-n),a=i*(1-(t-r)*n),l=i*(1-(1-t+r)*n),c=r%6;return{r:255*[i,a,s,s,l,i][c],g:255*[l,i,i,a,s,s][c],b:255*[s,s,l,i,i,a][c],a:o}},Gn=function(e){return{h:zn(e.h),s:ne(e.s,0,100),l:ne(e.l,0,100),a:ne(e.a)}},Jn=function(e){return{h:$(e.h),s:$(e.s),l:$(e.l),a:$(e.a,3)}},Qn=function(e){return qn((n=(t=e).s,{h:t.h,s:(n*=((i=t.l)<50?i:100-i)/100)>0?2*n/(i+n)*100:0,v:i+n,a:t.a}));var t,n,i},tt=function(e){return{h:(t=jn(e)).h,s:(o=(200-(n=t.s))*(i=t.v)/100)>0&&o<200?n*i/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,i,o},ro=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,so=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ao=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zn={string:[[function(e){var t=oo.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?$(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?$(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=ao.exec(e)||lo.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:$n({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ro.exec(e)||so.exec(e);if(!t)return null;var n,i,o=Gn({h:(n=t[1],i=t[2],i===void 0&&(i="deg"),Number(n)*(io[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qn(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,i=e.b,o=e.a,r=o===void 0?1:o;return pe(t)&&pe(n)&&pe(i)?$n({r:Number(t),g:Number(n),b:Number(i),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,n=e.s,i=e.l,o=e.a,r=o===void 0?1:o;if(!pe(t)||!pe(n)||!pe(i))return null;var s=Gn({h:Number(t),s:Number(n),l:Number(i),a:Number(r)});return Qn(s)},"hsl"],[function(e){var t=e.h,n=e.s,i=e.v,o=e.a,r=o===void 0?1:o;if(!pe(t)||!pe(n)||!pe(i))return null;var s=(function(a){return{h:zn(a.h),s:ne(a.s,0,100),v:ne(a.v,0,100),a:ne(a.a)}})({h:Number(t),s:Number(n),v:Number(i),a:Number(r)});return qn(s)},"hsv"]]},ei=function(e,t){for(var n=0;n<t.length;n++){var i=t[n][0](e);if(i)return[i,t[n][1]]}return[null,void 0]},co=function(e){return typeof e=="string"?ei(e.trim(),Zn.string):typeof e=="object"&&e!==null?ei(e,Zn.object):[null,void 0]},Jt=function(e,t){var n=tt(e);return{h:n.h,s:ne(n.s+100*t,0,100),l:n.l,a:n.a}},Qt=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},ti=function(e,t){var n=tt(e);return{h:n.h,s:n.s,l:ne(n.l+100*t,0,100),a:n.a}},ni=(function(){function e(t){this.parsed=co(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return $(Qt(this.rgba),2)},e.prototype.isDark=function(){return Qt(this.rgba)<.5},e.prototype.isLight=function(){return Qt(this.rgba)>=.5},e.prototype.toHex=function(){return t=Gt(this.rgba),n=t.r,i=t.g,o=t.b,s=(r=t.a)<1?xt($(255*r)):"","#"+xt(n)+xt(i)+xt(o)+s;var t,n,i,o,r,s},e.prototype.toRgb=function(){return Gt(this.rgba)},e.prototype.toRgbString=function(){return t=Gt(this.rgba),n=t.r,i=t.g,o=t.b,(r=t.a)<1?"rgba("+n+", "+i+", "+o+", "+r+")":"rgb("+n+", "+i+", "+o+")";var t,n,i,o,r},e.prototype.toHsl=function(){return Jn(tt(this.rgba))},e.prototype.toHslString=function(){return t=Jn(tt(this.rgba)),n=t.h,i=t.s,o=t.l,(r=t.a)<1?"hsla("+n+", "+i+"%, "+o+"%, "+r+")":"hsl("+n+", "+i+"%, "+o+"%)";var t,n,i,o,r},e.prototype.toHsv=function(){return t=jn(this.rgba),{h:$(t.h),s:$(t.s),v:$(t.v),a:$(t.a,3)};var t},e.prototype.invert=function(){return re({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),re(Jt(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),re(Jt(this.rgba,-t))},e.prototype.grayscale=function(){return re(Jt(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),re(ti(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),re(ti(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?re({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):$(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=tt(this.rgba);return typeof t=="number"?re({h:t,s:n.s,l:n.l,a:n.a}):$(n.h)},e.prototype.isEqual=function(t){return this.toHex()===re(t).toHex()},e})(),re=function(e){return e instanceof ni?e:new ni(e)};const uo=e=>[`background-color:${re((e==null?void 0:e.fill)||ge.fill).alpha((e==null?void 0:e.fillOpacity)===void 0?ge.fillOpacity:e.fillOpacity).toHex()}`,e!=null&&e.underlineThickness?"text-decoration:underline":void 0,e!=null&&e.underlineColor?`text-decoration-color:${e.underlineColor}`:void 0,e!=null&&e.underlineOffset?`text-underline-offset:${e.underlineOffset}px`:void 0,e!=null&&e.underlineThickness?`text-decoration-thickness:${e.underlineThickness}px`:void 0].filter(Boolean).join(";"),ii=()=>{const e=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(e);let t=new Set;return{destroy:()=>{CSS.highlights.clear(),e.remove()},setVisible:r=>{console.log("setVisible not implemented on CSS Custom Highlights renderer")},redraw:(r,s,a,l)=>{l&&l.clear();const c=new Set(r.map(d=>d.annotation.id));Array.from(t).filter(d=>!c.has(d));const u=r.map(d=>{var C;const v=a?typeof a=="function"?a(d.annotation,d.state):a:(C=d.state)!=null&&C.selected?et:ge,b=l&&l.paint(d,s)||v;return`::highlight(_${d.annotation.id}) { ${uo(b)} }`});e.innerHTML=u.join(`
2
+ `),CSS.highlights.clear(),r.forEach(({annotation:d})=>{const v=d.target.selector.map(C=>C.range),b=new Highlight(...v);CSS.highlights.set(`_${d.id}`,b)}),t=c}}},oi=(e,t,n)=>qt(e,t,n,ii());var ri=Object.prototype.hasOwnProperty;function Zt(e,t){var n,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((i=e.length)===t.length)for(;i--&&Zt(e[i],t[i]););return i===-1}if(!n||typeof e=="object"){i=0;for(n in e)if(ri.call(e,n)&&++i&&!ri.call(t,n)||!(n in t)||!Zt(e[n],t[n]))return!1;return Object.keys(t).length===i}}return e!==e&&t!==t}const fo=(e,t)=>{const n=(r,s)=>r.x<=s.x+s.width&&r.x+r.width>=s.x&&r.y<=s.y+s.height&&r.y+r.height>=s.y,i=r=>r.rects.reduce((s,a)=>s+a.width,0),o=t.filter(({rects:r})=>r.some(s=>n(e,s)));return o.sort((r,s)=>i(s)-i(r)),o.findIndex(r=>r.rects.includes(e))},ho=e=>{e.classList.add("r6o-annotatable");const t=document.createElement("div");t.className="r6o-span-highlight-layer",e.insertBefore(t,e.firstChild);let n=[];return{destroy:()=>{t.remove()},redraw:(s,a,l,c,u)=>{const v=!(Zt(n,s)&&u);if(!c&&!v)return;v&&(t.innerHTML=""),[...s].sort((C,f)=>{const{annotation:{target:{created:O}}}=C,{annotation:{target:{created:m}}}=f;return O&&m?O.getTime()-m.getTime():0}).forEach(C=>{C.rects.map(f=>{const O=fo(f,s),m=Fn(C,a,l,c,O);if(v){const h=document.createElement("span");h.className="r6o-annotation",h.dataset.annotation=C.annotation.id,h.style.left=`${f.x}px`,h.style.top=`${f.y}px`,h.style.width=`${f.width}px`,h.style.height=`${f.height}px`,h.style.backgroundColor=re((m==null?void 0:m.fill)||ge.fill).alpha((m==null?void 0:m.fillOpacity)===void 0?ge.fillOpacity:m.fillOpacity).toHex(),m.underlineStyle&&(h.style.borderStyle=m.underlineStyle),m.underlineColor&&(h.style.borderColor=m.underlineColor),m.underlineThickness&&(h.style.borderBottomWidth=`${m.underlineThickness}px`),m.underlineOffset&&(h.style.paddingBottom=`${m.underlineOffset}px`),t.appendChild(h)}})}),n=s},setVisible:s=>{s?t.classList.remove("hidden"):t.classList.add("hidden")}}},si=(e,t,n)=>qt(e,t,n,ho(e)),j=[];for(let e=0;e<256;++e)j.push((e+256).toString(16).slice(1));function go(e,t=0){return(j[e[t+0]]+j[e[t+1]]+j[e[t+2]]+j[e[t+3]]+"-"+j[e[t+4]]+j[e[t+5]]+"-"+j[e[t+6]]+j[e[t+7]]+"-"+j[e[t+8]]+j[e[t+9]]+"-"+j[e[t+10]]+j[e[t+11]]+j[e[t+12]]+j[e[t+13]]+j[e[t+14]]+j[e[t+15]]).toLowerCase()}let en;const po=new Uint8Array(16);function mo(){if(!en){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");en=crypto.getRandomValues.bind(crypto)}return en(po)}const ai={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function bo(e,t,n){var o;e=e||{};const i=e.random??((o=e.rng)==null?void 0:o.call(e))??mo();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,go(i)}function li(e,t,n){return ai.randomUUID&&!e?ai.randomUUID():bo(e)}var ci=Object.prototype.hasOwnProperty;function Re(e,t){var n,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((i=e.length)===t.length)for(;i--&&Re(e[i],t[i]););return i===-1}if(!n||typeof e=="object"){i=0;for(n in e)if(ci.call(e,n)&&++i&&!ci.call(t,n)||!(n in t)||!Re(e[n],t[n]))return!1;return Object.keys(t).length===i}}return e!==e&&t!==t}function tn(){}function wo(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}const He=[];function nn(e,t=tn){let n;const i=new Set;function o(a){if(wo(e,a)&&(e=a,n)){const l=!He.length;for(const c of i)c[1](),He.push(c,e);if(l){for(let c=0;c<He.length;c+=2)He[c][0](He[c+1]);He.length=0}}}function r(a){o(a(e))}function s(a,l=tn){const c=[a,l];return i.add(c),i.size===1&&(n=t(o,r)||tn),a(e),()=>{i.delete(c),i.size===0&&n&&(n(),n=null)}}return{set:o,update:r,subscribe:s}}const yo=e=>{const{subscribe:t,set:n}=nn();let i;return t(o=>i=o),e.observe(({changes:o})=>{if(i){(o.deleted||[]).some(s=>s.id===i)&&n(void 0);const r=(o.updated||[]).find(({oldValue:s})=>s.id===i);r&&n(r.newValue.id)}}),{get current(){return i},subscribe:t,set:n}};var di=(e=>(e.EDIT="EDIT",e.SELECT="SELECT",e.NONE="NONE",e))(di||{});const Ot={selected:[]},vo=(e,t,n)=>{const{subscribe:i,set:o}=nn(Ot);let r=t,s=Ot;i(f=>s=f);const a=()=>{Re(s,Ot)||o(Ot)},l=()=>{var f;return((f=s.selected)==null?void 0:f.length)===0},c=f=>{if(l())return!1;const O=typeof f=="string"?f:f.id;return s.selected.some(m=>m.id===O)},u=(f,O)=>{let m;if(Array.isArray(f)){if(m=f.map(w=>e.getAnnotation(w)).filter(Boolean),m.length<f.length){console.warn("Invalid selection: "+f.filter(w=>!m.some(R=>R.id===w)));return}}else{const w=e.getAnnotation(f);if(!w){console.warn("Invalid selection: "+f);return}m=[w]}const h=m.reduce((w,R)=>{const k=C(R);return k==="EDIT"?[...w,{id:R.id,editable:!0}]:k==="SELECT"?[...w,{id:R.id}]:w},[]);o({selected:h,event:O})},d=(f,O)=>{const m=Array.isArray(f)?f:[f],h=m.map(w=>e.getAnnotation(w)).filter(w=>!!w);o({selected:h.map(w=>{const R=O===void 0?C(w)==="EDIT":O;return{id:w.id,editable:R}})}),h.length!==m.length&&console.warn("Invalid selection",f)},v=f=>{if(l())return!1;const{selected:O}=s;O.some(({id:m})=>f.includes(m))&&o({selected:O.filter(({id:m})=>!f.includes(m))})},b=f=>{r=f,d(s.selected.map(({id:O})=>O))},C=f=>Ao(f,r,n);return e.observe(({changes:f})=>v((f.deleted||[]).map(O=>O.id))),{get event(){return s?s.event:null},get selected(){return s?[...s.selected]:null},get userSelectAction(){return r},clear:a,evalSelectAction:C,isEmpty:l,isSelected:c,setSelected:d,setUserSelectAction:b,subscribe:i,userSelect:u}},Ao=(e,t,n)=>{const i=n?n.serialize(e):e;return typeof t=="function"?t(i):t||"EDIT"},q=[];for(let e=0;e<256;++e)q.push((e+256).toString(16).slice(1));function Eo(e,t=0){return(q[e[t+0]]+q[e[t+1]]+q[e[t+2]]+q[e[t+3]]+"-"+q[e[t+4]]+q[e[t+5]]+"-"+q[e[t+6]]+q[e[t+7]]+"-"+q[e[t+8]]+q[e[t+9]]+"-"+q[e[t+10]]+q[e[t+11]]+q[e[t+12]]+q[e[t+13]]+q[e[t+14]]+q[e[t+15]]).toLowerCase()}let on;const So=new Uint8Array(16);function xo(){if(!on){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");on=crypto.getRandomValues.bind(crypto)}return on(So)}const Oo=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ui={randomUUID:Oo};function Co(e,t,n){var i;e=e||{};const o=e.random??((i=e.rng)==null?void 0:i.call(e))??xo();if(o.length<16)throw new Error("Random bytes length must be >= 16");return o[6]=o[6]&15|64,o[8]=o[8]&63|128,Eo(o)}function fi(e,t,n){return ui.randomUUID&&!e?ui.randomUUID():Co(e)}const rn=e=>{const t=n=>{const i={...n};return n.created&&typeof n.created=="string"&&(i.created=new Date(n.created)),n.updated&&typeof n.updated=="string"&&(i.updated=new Date(n.updated)),i};return{...e,bodies:(e.bodies||[]).map(t),target:t(e.target)}},To=(e,t,n,i)=>({id:fi(),annotation:typeof e=="string"?e:e.id,created:n||new Date,creator:i,...t}),Ro=(e,t)=>{const n=new Set(e.bodies.map(i=>i.id));return t.bodies.filter(i=>!n.has(i.id))},Lo=(e,t)=>{const n=new Set(t.bodies.map(i=>i.id));return e.bodies.filter(i=>!n.has(i.id))},ko=(e,t)=>t.bodies.map(n=>{const i=e.bodies.find(o=>o.id===n.id);return{newBody:n,oldBody:i&&!Re(i,n)?i:void 0}}).filter(({oldBody:n})=>n).map(({oldBody:n,newBody:i})=>({oldBody:n,newBody:i})),Mo=(e,t)=>!Re(e.target,t.target),hi=(e,t)=>{const n=Ro(e,t),i=Lo(e,t),o=ko(e,t);return{oldValue:e,newValue:t,bodiesCreated:n.length>0?n:void 0,bodiesDeleted:i.length>0?i:void 0,bodiesUpdated:o.length>0?o:void 0,targetUpdated:Mo(e,t)?{oldTarget:e.target,newTarget:t.target}:void 0}};var V=(e=>(e.LOCAL="LOCAL",e.REMOTE="REMOTE",e.SILENT="SILENT",e))(V||{});const Io=(e,t)=>{var n,i;const{changes:o,origin:r}=t;if(!(e.options.origin?e.options.origin===r:r!=="SILENT"))return!1;if(e.options.ignore){const{ignore:s}=e.options,a=l=>l&&l.length>0;if(!(a(o.created)||a(o.deleted))){const l=(n=o.updated)==null?void 0:n.some(u=>a(u.bodiesCreated)||a(u.bodiesDeleted)||a(u.bodiesUpdated)),c=(i=o.updated)==null?void 0:i.some(u=>u.targetUpdated);if(s==="BODY_ONLY"&&l&&!c||s==="TARGET_ONLY"&&c&&!l)return!1}}if(e.options.annotations){const s=new Set([...(o.created||[]).map(a=>a.id),...(o.deleted||[]).map(a=>a.id),...(o.updated||[]).map(({oldValue:a})=>a.id)]);return!!(Array.isArray(e.options.annotations)?e.options.annotations:[e.options.annotations]).find(a=>s.has(a))}else return!0},_o=(e,t)=>{const n=new Set((e.created||[]).map(d=>d.id)),i=new Set((e.updated||[]).map(({newValue:d})=>d.id)),o=new Set((t.created||[]).map(d=>d.id)),r=new Set((t.deleted||[]).map(d=>d.id)),s=new Set((t.updated||[]).map(({oldValue:d})=>d.id)),a=new Set((t.updated||[]).filter(({oldValue:d})=>n.has(d.id)||i.has(d.id)).map(({oldValue:d})=>d.id)),l=[...(e.created||[]).filter(d=>!r.has(d.id)).map(d=>s.has(d.id)?t.updated.find(({oldValue:v})=>v.id===d.id).newValue:d),...t.created||[]],c=[...(e.deleted||[]).filter(d=>!o.has(d.id)),...(t.deleted||[]).filter(d=>!n.has(d.id))],u=[...(e.updated||[]).filter(({newValue:d})=>!r.has(d.id)).map(d=>{const{oldValue:v,newValue:b}=d;if(s.has(b.id)){const C=t.updated.find(f=>f.oldValue.id===b.id).newValue;return hi(v,C)}else return d}),...(t.updated||[]).filter(({oldValue:d})=>!a.has(d.id))];return{created:l,deleted:c,updated:u}},Ct=e=>{const t=e.id===void 0?fi():e.id;return{...e,id:t,bodies:e.bodies===void 0?[]:e.bodies.map(n=>({...n,annotation:t})),target:{...e.target,annotation:t}}},No=e=>e.id!==void 0,Bo=()=>{const e=new Map,t=new Map,n=[],i=(p,x={})=>{n.push({onChange:p,options:x})},o=p=>{const x=n.findIndex(T=>T.onChange==p);x>-1&&n.splice(x,1)},r=(p,x)=>{const T={origin:p,changes:{created:x.created||[],updated:x.updated||[],deleted:x.deleted||[]},state:[...e.values()]};n.forEach(M=>{Io(M,T)&&M.onChange(T)})},s=(p,x=V.LOCAL)=>{if(p.id&&e.get(p.id))throw Error(`Cannot add annotation ${p.id} - exists already`);{const T=Ct(p);e.set(T.id,T),T.bodies.forEach(M=>t.set(M.id,T.id)),r(x,{created:[T]})}},a=(p,x)=>{const T=Ct(typeof p=="string"?x:p),M=typeof p=="string"?p:p.id,X=M&&e.get(M);if(X){const P=hi(X,T);return M===T.id?e.set(M,T):(e.delete(M),e.set(T.id,T)),X.bodies.forEach(U=>t.delete(U.id)),T.bodies.forEach(U=>t.set(U.id,T.id)),P}else console.warn(`Cannot update annotation ${M} - does not exist`)},l=(p,x=V.LOCAL,T=V.LOCAL)=>{const M=No(x)?T:x,X=a(p,x);X&&r(M,{updated:[X]})},c=(p,x=V.LOCAL)=>{e.get(p.id)?l(p,x):s(p,x)},u=(p,x=V.LOCAL)=>{const T=p.reduce((M,X)=>{const P=a(X);return P?[...M,P]:M},[]);T.length>0&&r(x,{updated:T})},d=(p,x=V.LOCAL)=>{const T=p.map(Ct),{toAdd:M,toUpdate:X}=T.reduce((U,J)=>e.get(J.id)?{...U,toUpdate:[...U.toUpdate,J]}:{...U,toAdd:[...U.toAdd,J]},{toAdd:[],toUpdate:[]}),P=X.map(U=>a(U,x)).filter(Boolean);M.forEach(U=>{e.set(U.id,U),U.bodies.forEach(J=>t.set(J.id,U.id))}),r(x,{created:M,updated:P})},v=(p,x=V.LOCAL)=>{const T=e.get(p.annotation);if(T){const M={...T,bodies:[...T.bodies,p]};e.set(T.id,M),t.set(p.id,M.id),r(x,{updated:[{oldValue:T,newValue:M,bodiesCreated:[p]}]})}else console.warn(`Attempt to add body to missing annotation: ${p.annotation}`)},b=()=>[...e.values()],C=(p=V.LOCAL)=>{const x=[...e.values()];e.clear(),t.clear(),r(p,{deleted:x})},f=(p,x=!0,T=V.LOCAL)=>{const M=p.map(Ct);if(x){const X=[...e.values()];e.clear(),t.clear(),M.forEach(P=>{e.set(P.id,P),P.bodies.forEach(U=>t.set(U.id,P.id))}),r(T,{created:M,deleted:X})}else{const X=p.reduce((P,U)=>{const J=U.id&&e.get(U.id);return J?[...P,J]:P},[]);if(X.length>0)throw Error(`Bulk insert would overwrite the following annotations: ${X.map(P=>P.id).join(", ")}`);M.forEach(P=>{e.set(P.id,P),P.bodies.forEach(U=>t.set(U.id,P.id))}),r(T,{created:M})}},O=p=>{const x=typeof p=="string"?p:p.id,T=e.get(x);if(T)return e.delete(x),T.bodies.forEach(M=>t.delete(M.id)),T;console.warn(`Attempt to delete missing annotation: ${x}`)},m=(p,x=V.LOCAL)=>{const T=O(p);T&&r(x,{deleted:[T]})},h=(p,x=V.LOCAL)=>{const T=p.reduce((M,X)=>{const P=O(X);return P?[...M,P]:M},[]);T.length>0&&r(x,{deleted:T})},w=p=>{const x=e.get(p.annotation);if(x){const T=x.bodies.find(M=>M.id===p.id);if(T){t.delete(T.id);const M={...x,bodies:x.bodies.filter(X=>X.id!==p.id)};return e.set(x.id,M),{oldValue:x,newValue:M,bodiesDeleted:[T]}}else console.warn(`Attempt to delete missing body ${p.id} from annotation ${p.annotation}`)}else console.warn(`Attempt to delete body from missing annotation ${p.annotation}`)},R=(p,x=V.LOCAL)=>{const T=w(p);T&&r(x,{updated:[T]})},k=(p,x=V.LOCAL)=>{const T=p.map(M=>w(M)).filter(Boolean);T.length>0&&r(x,{updated:T})},L=p=>{const x=e.get(p);return x?{...x}:void 0},I=p=>{const x=t.get(p);if(x){const T=L(x).bodies.find(M=>M.id===p);if(T)return T;console.error(`Store integrity error: body ${p} in index, but not in annotation`)}else console.warn(`Attempt to retrieve missing body: ${p}`)},D=(p,x)=>{if(p.annotation!==x.annotation)throw"Annotation integrity violation: annotation ID must be the same when updating bodies";const T=e.get(p.annotation);if(T){const M=T.bodies.find(P=>P.id===p.id),X={...T,bodies:T.bodies.map(P=>P.id===M.id?x:P)};return e.set(T.id,X),M.id!==x.id&&(t.delete(M.id),t.set(x.id,X.id)),{oldValue:T,newValue:X,bodiesUpdated:[{oldBody:M,newBody:x}]}}else console.warn(`Attempt to add body to missing annotation ${p.annotation}`)},B=(p,x,T=V.LOCAL)=>{const M=D(p,x);M&&r(T,{updated:[M]})},W=(p,x=V.LOCAL)=>{const T=p.map(M=>D({id:M.id,annotation:M.annotation},M)).filter(Boolean);r(x,{updated:T})},_=p=>{const x=e.get(p.annotation);if(x){const T={...x,target:{...x.target,...p}};return e.set(x.id,T),{oldValue:x,newValue:T,targetUpdated:{oldTarget:x.target,newTarget:p}}}else console.warn(`Attempt to update target on missing annotation: ${p.annotation}`)};return{addAnnotation:s,addBody:v,all:b,bulkAddAnnotations:f,bulkDeleteAnnotations:h,bulkDeleteBodies:k,bulkUpdateAnnotations:u,bulkUpdateBodies:W,bulkUpdateTargets:(p,x=V.LOCAL)=>{const T=p.map(M=>_(M)).filter(Boolean);T.length>0&&r(x,{updated:T})},bulkUpsertAnnotations:d,clear:C,deleteAnnotation:m,deleteBody:R,getAnnotation:L,getBody:I,observe:i,unobserve:o,updateAnnotation:l,updateBody:B,updateTarget:(p,x=V.LOCAL)=>{const T=_(p);T&&r(x,{updated:[T]})},upsertAnnotation:c}};let Uo=()=>({emit(e,...t){for(let n=this.events[e]||[],i=0,o=n.length;i<o;i++)n[i](...t)},events:{},on(e,t){var n;return((n=this.events)[e]||(n[e]=[])).push(t),()=>{var i;this.events[e]=(i=this.events[e])==null?void 0:i.filter(o=>t!==o)}}});const Do=250,Ho=(e,t)=>{const n=Uo(),i=[];let o=-1,r=!1,s=0;const a=C=>{if(!r){const{changes:f}=C,O=performance.now();if(O-s>Do)i.splice(o+1),i.push(f),o=i.length-1;else{const m=i.length-1;i[m]=_o(i[m],f)}s=O}r=!1};e.observe(a,{origin:V.LOCAL});const l=C=>C&&C.length>0&&e.bulkDeleteAnnotations(C),c=C=>C&&C.length>0&&e.bulkAddAnnotations(C,!1),u=C=>C&&C.length>0&&e.bulkUpdateAnnotations(C.map(({oldValue:f})=>f)),d=C=>C&&C.length>0&&e.bulkUpdateAnnotations(C.map(({newValue:f})=>f)),v=C=>C&&C.length>0&&e.bulkAddAnnotations(C,!1),b=C=>C&&C.length>0&&e.bulkDeleteAnnotations(C);return{canRedo:()=>i.length-1>o,canUndo:()=>o>-1,destroy:()=>e.unobserve(a),getHistory:()=>({changes:[...i],pointer:o}),on:(C,f)=>n.on(C,f),redo:()=>{if(i.length-1>o){r=!0;const{created:C,updated:f,deleted:O}=i[o+1];c(C),d(f),b(O),n.emit("redo",i[o+1]),o+=1}},undo:()=>{if(o>-1){r=!0;const{created:C,updated:f,deleted:O}=i[o];l(C),u(f),v(O),n.emit("undo",i[o]),o-=1}}}},Po=()=>{const{subscribe:e,set:t}=nn([]);return{subscribe:e,set:t}},Vo=(e,t,n,i)=>{const{hover:o,selection:r,store:s,viewport:a}=e,l=new Map;let c=[],u;const d=(f,O)=>{l.has(f)?l.get(f).push(O):l.set(f,[O])},v=(f,O)=>{const m=l.get(f);if(m){const h=m.indexOf(O);h!==-1&&m.splice(h,1)}},b=(f,O,m)=>{l.has(f)&&setTimeout(()=>{l.get(f).forEach(h=>{if(n){const w=Array.isArray(O)?O.map(k=>n.serialize(k)):n.serialize(O),R=m?m instanceof PointerEvent?m:n.serialize(m):void 0;h(w,R)}else h(O,m)})},1)};r.subscribe(({selected:f})=>{if(!(c.length===0&&f.length===0)){if(c.length===0&&f.length>0)c=f.map(({id:O})=>s.getAnnotation(O));else if(c.length>0&&f.length===0)c.forEach(O=>{const m=s.getAnnotation(O.id);m&&!Re(m,O)&&b("updateAnnotation",m,O)}),c=[];else{const O=new Set(c.map(h=>h.id)),m=new Set(f.map(({id:h})=>h));c.filter(h=>!m.has(h.id)).forEach(h=>{const w=s.getAnnotation(h.id);w&&!Re(w,h)&&b("updateAnnotation",w,h)}),c=[...c.filter(h=>m.has(h.id)),...f.filter(({id:h})=>!O.has(h)).map(({id:h})=>s.getAnnotation(h))]}b("selectionChanged",c)}}),o.subscribe(f=>{!u&&f?b("mouseEnterAnnotation",s.getAnnotation(f)):u&&!f?b("mouseLeaveAnnotation",s.getAnnotation(u)):u&&f&&(b("mouseLeaveAnnotation",s.getAnnotation(u)),b("mouseEnterAnnotation",s.getAnnotation(f))),u=f}),a==null||a.subscribe(f=>b("viewportIntersect",f.map(O=>s.getAnnotation(O)))),s.observe(f=>{const{created:O,deleted:m}=f.changes;(O||[]).forEach(h=>b("createAnnotation",h)),(m||[]).forEach(h=>b("deleteAnnotation",h)),(f.changes.updated||[]).filter(h=>[...h.bodiesCreated||[],...h.bodiesDeleted||[],...h.bodiesUpdated||[]].length>0).forEach(({oldValue:h,newValue:w})=>{const R=c.find(k=>k.id===h.id)||h;c=c.map(k=>k.id===h.id?w:k),b("updateAnnotation",w,R)})},{origin:V.LOCAL}),s.observe(f=>{if(c){const O=new Set(c.map(h=>h.id)),m=(f.changes.updated||[]).filter(({newValue:h})=>O.has(h.id)).map(({newValue:h})=>h);m.length>0&&(c=c.map(h=>m.find(R=>R.id===h.id)||h))}},{origin:V.REMOTE});const C=f=>O=>{const{updated:m}=O;f?(m||[]).forEach(h=>b("updateAnnotation",h.oldValue,h.newValue)):(m||[]).forEach(h=>b("updateAnnotation",h.newValue,h.oldValue))};return t.on("undo",C(!0)),t.on("redo",C(!1)),{on:d,off:v,emit:b}},Xo=e=>t=>t.reduce((n,i)=>{const{parsed:o,error:r}=e.parse(i);return r?{parsed:n.parsed,failed:[...n.failed,i]}:o?{parsed:[...n.parsed,o],failed:n.failed}:{...n}},{parsed:[],failed:[]}),Yo=(e,t,n)=>{const{store:i,selection:o}=e,r=m=>{if(n){const{parsed:h,error:w}=n.parse(m);h?i.addAnnotation(h,V.REMOTE):console.error(w)}else i.addAnnotation(rn(m),V.REMOTE)},s=()=>o.clear(),a=()=>i.clear(),l=m=>{const h=i.getAnnotation(m);return n&&h?n.serialize(h):h},c=()=>n?i.all().map(n.serialize):i.all(),u=()=>{var m;const h=(((m=o.selected)==null?void 0:m.map(w=>w.id))||[]).map(w=>i.getAnnotation(w)).filter(Boolean);return n?h.map(n.serialize):h},d=(m,h=!0)=>fetch(m).then(w=>w.json()).then(w=>(b(w,h),w)),v=m=>{if(typeof m=="string"){const h=i.getAnnotation(m);if(i.deleteAnnotation(m),h)return n?n.serialize(h):h}else{const h=n?n.parse(m).parsed:m;if(h)return i.deleteAnnotation(h),m}},b=(m,h=!0)=>{if(n){const w=n.parseAll||Xo(n),{parsed:R,failed:k}=w(m);k.length>0&&console.warn(`Discarded ${k.length} invalid annotations`,k),i.bulkAddAnnotations(R,h,V.REMOTE)}else i.bulkAddAnnotations(m.map(rn),h,V.REMOTE)},C=(m,h)=>{m?o.setSelected(m,h):o.clear()},f=m=>{o.setUserSelectAction(m)},O=m=>{if(n){const h=n.parse(m).parsed,w=n.serialize(i.getAnnotation(h.id));return i.updateAnnotation(h),w}else{const h=i.getAnnotation(m.id);return i.updateAnnotation(rn(m)),h}};return{addAnnotation:r,cancelSelected:s,canRedo:t.canRedo,canUndo:t.canUndo,clearAnnotations:a,getAnnotationById:l,getAnnotations:c,getHistory:t.getHistory,getSelected:u,loadAnnotations:d,redo:t.redo,removeAnnotation:v,setAnnotations:b,setSelected:C,setUserSelectAction:f,undo:t.undo,updateAnnotation:O}},Ko="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Fo=e=>crypto.getRandomValues(new Uint8Array(e)),Wo=(e,t,n)=>{let i=(2<<Math.log2(e.length-1))-1,o=-~(1.6*i*t/e.length);return(r=t)=>{let s="";for(;;){let a=n(o),l=o|0;for(;l--;)if(s+=e[a[l]&i]||"",s.length>=r)return s}}},zo=(e,t=21)=>Wo(e,t|0,Fo),$o=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ko[n[e]&63];return t};const jo=()=>({isGuest:!0,id:zo("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",20)()}),qo=e=>{const t=JSON.stringify(e);let n=0;for(let i=0,o=t.length;i<o;i++){let r=t.charCodeAt(i);n=(n<<5)-n+r,n|=0}return`${n}`},gi=e=>e?typeof e=="object"?{...e}:e:void 0,Go=(e,t)=>(Array.isArray(e)?e:[e]).map(n=>{const{id:i,type:o,purpose:r,value:s,created:a,modified:l,creator:c,...u}=n;return{id:i||`temp-${qo(n)}`,annotation:t,type:o,purpose:r,value:s,creator:gi(c),created:a?new Date(a):void 0,updated:l?new Date(l):void 0,...u}}),Jo=e=>e.map(t=>{var n;const{annotation:i,created:o,updated:r,...s}=t,a={...s,created:o==null?void 0:o.toISOString(),modified:r==null?void 0:r.toISOString()};return(n=a.id)!=null&&n.startsWith("temp-")&&delete a.id,a});$o();const Qo=(e,t)=>({parse:n=>pi(n),serialize:n=>mi(n,e,t)}),Zo=e=>e.quote!==void 0&&e.start!==void 0&&e.end!==void 0,er=e=>{const{id:t,creator:n,created:i,modified:o,target:r}=e,s=Array.isArray(r)?r:[r];if(s.length===0)return{error:Error(`No targets found for annotation: ${e.id}`)};const a={creator:gi(n),created:i?new Date(i):void 0,updated:o?new Date(o):void 0,annotation:t,selector:[],styleClass:"styleClass"in s[0]?s[0].styleClass:void 0};for(const l of s){const u=(Array.isArray(l.selector)?l.selector:[l.selector]).reduce((d,v)=>{switch(v.type){case"TextQuoteSelector":d.quote=v.exact;break;case"TextPositionSelector":d.start=v.start,d.end=v.end;break}return d},{});if(Zo(u))a.selector.push({...u,id:l.id,scope:l.scope});else{const d=[u.start?void 0:"TextPositionSelector",u.quote?void 0:"TextQuoteSelector"].filter(Boolean);return{error:Error(`Missing selector types: ${d.join(" and ")} for annotation: ${e.id}`)}}}return{parsed:a}},pi=e=>{const t=e.id||li(),{creator:n,created:i,modified:o,body:r,...s}=e,a=Go(r,t),l=er(e);return"error"in l?{error:l.error}:{parsed:{...s,id:t,bodies:a,target:l.parsed}}},mi=(e,t,n)=>{const{bodies:i,target:o,...r}=e,{selector:s,creator:a,created:l,updated:c,...u}=o,d=s.map(v=>{const{id:b,quote:C,start:f,end:O,range:m}=v,h={type:"TextQuoteSelector",exact:C};if(n){const{prefix:R,suffix:k}=Un(m,n);h.prefix=R,h.suffix=k}const w={type:"TextPositionSelector",start:f,end:O};return{...u,id:b,scope:"scope"in v?v.scope:void 0,source:t,selector:[h,w]}});return{...r,"@context":"http://www.w3.org/ns/anno.jsonld",id:e.id,type:"Annotation",body:Jo(e.bodies),creator:a,created:l==null?void 0:l.toISOString(),modified:c==null?void 0:c.toISOString(),target:d}};function bi(e,t,n=0,i=e.length-1,o=tr){for(;i>n;){if(i-n>600){const l=i-n+1,c=t-n+1,u=Math.log(l),d=.5*Math.exp(2*u/3),v=.5*Math.sqrt(u*d*(l-d)/l)*(c-l/2<0?-1:1),b=Math.max(n,Math.floor(t-c*d/l+v)),C=Math.min(i,Math.floor(t+(l-c)*d/l+v));bi(e,t,b,C,o)}const r=e[t];let s=n,a=i;for(nt(e,n,t),o(e[i],r)>0&&nt(e,n,i);s<a;){for(nt(e,s,a),s++,a--;o(e[s],r)<0;)s++;for(;o(e[a],r)>0;)a--}o(e[n],r)===0?nt(e,n,a):(a++,nt(e,a,i)),a<=t&&(n=a+1),t<=a&&(i=a-1)}}function nt(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function tr(e,t){return e<t?-1:e>t?1:0}class nr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const i=[];if(!Rt(t,n))return i;const o=this.toBBox,r=[];for(;n;){for(let s=0;s<n.children.length;s++){const a=n.children[s],l=n.leaf?o(a):a;Rt(t,l)&&(n.leaf?i.push(a):an(t,l)?this._all(a,i):r.push(a))}n=r.pop()}return i}collides(t){let n=this.data;if(!Rt(t,n))return!1;const i=[];for(;n;){for(let o=0;o<n.children.length;o++){const r=n.children[o],s=n.leaf?this.toBBox(r):r;if(Rt(t,s)){if(n.leaf||an(t,s))return!0;i.push(r)}}n=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Ve([]),this}remove(t,n){if(!t)return this;let i=this.data;const o=this.toBBox(t),r=[],s=[];let a,l,c;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=s.pop(),c=!0),i.leaf){const u=ir(t,i.children,n);if(u!==-1)return i.children.splice(u,1),r.push(i),this._condense(r),this}!c&&!i.leaf&&an(i,o)?(r.push(i),s.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const i=[];for(;t;)t.leaf?n.push(...t.children):i.push(...t.children),t=i.pop();return n}_build(t,n,i,o){const r=i-n+1;let s=this._maxEntries,a;if(r<=s)return a=Ve(t.slice(n,i+1)),Pe(a,this.toBBox),a;o||(o=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,o-1))),a=Ve([]),a.leaf=!1,a.height=o;const l=Math.ceil(r/s),c=l*Math.ceil(Math.sqrt(s));wi(t,n,i,c,this.compareMinX);for(let u=n;u<=i;u+=c){const d=Math.min(u+c-1,i);wi(t,u,d,l,this.compareMinY);for(let v=u;v<=d;v+=l){const b=Math.min(v+l-1,d);a.children.push(this._build(t,v,b,o-1))}}return Pe(a,this.toBBox),a}_chooseSubtree(t,n,i,o){for(;o.push(n),!(n.leaf||o.length-1===i);){let r=1/0,s=1/0,a;for(let l=0;l<n.children.length;l++){const c=n.children[l],u=sn(c),d=sr(t,c)-u;d<s?(s=d,r=u<r?u:r,a=c):d===s&&u<r&&(r=u,a=c)}n=a||n.children[0]}return n}_insert(t,n,i){const o=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(o,this.data,n,r);for(s.children.push(t),ot(s,o);n>=0&&r[n].children.length>this._maxEntries;)this._split(r,n),n--;this._adjustParentBBoxes(o,r,n)}_split(t,n){const i=t[n],o=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,o);const s=this._chooseSplitIndex(i,r,o),a=Ve(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,Pe(i,this.toBBox),Pe(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=Ve([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Pe(this.data,this.toBBox)}_chooseSplitIndex(t,n,i){let o,r=1/0,s=1/0;for(let a=n;a<=i-n;a++){const l=it(t,0,a,this.toBBox),c=it(t,a,i,this.toBBox),u=ar(l,c),d=sn(l)+sn(c);u<r?(r=u,o=a,s=d<s?d:s):u===r&&d<s&&(s=d,o=a)}return o||i-n}_chooseSplitAxis(t,n,i){const o=t.leaf?this.compareMinX:or,r=t.leaf?this.compareMinY:rr,s=this._allDistMargin(t,n,i,o),a=this._allDistMargin(t,n,i,r);s<a&&t.children.sort(o)}_allDistMargin(t,n,i,o){t.children.sort(o);const r=this.toBBox,s=it(t,0,n,r),a=it(t,i-n,i,r);let l=Tt(s)+Tt(a);for(let c=n;c<i-n;c++){const u=t.children[c];ot(s,t.leaf?r(u):u),l+=Tt(s)}for(let c=i-n-1;c>=n;c--){const u=t.children[c];ot(a,t.leaf?r(u):u),l+=Tt(a)}return l}_adjustParentBBoxes(t,n,i){for(let o=i;o>=0;o--)ot(n[o],t)}_condense(t){for(let n=t.length-1,i;n>=0;n--)t[n].children.length===0?n>0?(i=t[n-1].children,i.splice(i.indexOf(t[n]),1)):this.clear():Pe(t[n],this.toBBox)}}function ir(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function Pe(e,t){it(e,0,e.children.length,t,e)}function it(e,t,n,i,o){o||(o=Ve(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let r=t;r<n;r++){const s=e.children[r];ot(o,e.leaf?i(s):s)}return o}function ot(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function or(e,t){return e.minX-t.minX}function rr(e,t){return e.minY-t.minY}function sn(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Tt(e){return e.maxX-e.minX+(e.maxY-e.minY)}function sr(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function ar(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),o=Math.min(e.maxX,t.maxX),r=Math.min(e.maxY,t.maxY);return Math.max(0,o-n)*Math.max(0,r-i)}function an(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Rt(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Ve(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wi(e,t,n,i,o){const r=[t,n];for(;r.length;){if(n=r.pop(),t=r.pop(),n-t<=i)continue;const s=t+Math.ceil((n-t)/i/2)*i;bi(e,s,t,n,o),r.push(t,s,s,n)}}const lr=(e,t,n,i)=>{const o=new nr,r=new Map,s=(w,R)=>{const k=w.selector.flatMap(I=>{const D=de([I])?I.range:jt(I,t).range;return Nn(D)}),L=Pn(k,n,i).map(({left:I,top:D,right:B,bottom:W})=>new DOMRect(I-R.left,D-R.top,B-I,W-D));return L.map(I=>{const{x:D,y:B,width:W,height:_}=I;return{minX:D,minY:B,maxX:D+W,maxY:B+_,annotation:{id:w.annotation,rects:L}}})},a=()=>[...r.values()],l=()=>{o.clear(),r.clear()},c=w=>{const R=s(w,t.getBoundingClientRect());R.length!==0&&(R.forEach(k=>o.insert(k)),r.set(w.annotation,R))},u=w=>{const R=r.get(w.annotation);R&&(R.forEach(k=>o.remove(k)),r.delete(w.annotation))},d=w=>{u(w),c(w)},v=(w,R=!0)=>{R&&l();const k=t.getBoundingClientRect(),L=w.map(D=>({target:D,rects:s(D,k)}));L.forEach(({target:D,rects:B})=>{B.length>0&&r.set(D.annotation,B)});const I=L.flatMap(({rects:D})=>D);o.load(I)},b=(w,R,k=!1)=>{const L=o.search({minX:w,minY:R,maxX:w,maxY:R}),I=D=>D.annotation.rects.reduce((B,W)=>B+W.width*W.height,0);return L.length>0?(L.sort((D,B)=>I(D)-I(B)),k?L.map(D=>D.annotation.id):[L[0].annotation.id]):[]},C=w=>{const R=f(w);if(R.length===0)return;let k=R[0].left,L=R[0].top,I=R[0].right,D=R[0].bottom;for(let B=1;B<R.length;B++){const W=R[B];k=Math.min(k,W.left),L=Math.min(L,W.top),I=Math.max(I,W.right),D=Math.max(D,W.bottom)}return new DOMRect(k,L,I-k,D-L)},f=w=>{const R=r.get(w);return R?R[0].annotation.rects:[]};return{all:a,clear:l,getAt:b,getAnnotationBounds:C,getAnnotationRects:f,getIntersecting:(w,R,k,L)=>{const I=o.search({minX:w,minY:R,maxX:k,maxY:L}),D=new Set(I.map(B=>B.annotation.id));return Array.from(D).map(B=>({annotation:e.getAnnotation(B),rects:f(B)})).filter(B=>!!B.annotation)},insert:c,recalculate:()=>v(e.all().map(w=>w.target),!0),remove:u,set:v,size:()=>o.all().length,update:d}},yi=(e,t)=>{var m,h;const n=Bo(),i=lr(n,e,(m=t.mergeHighlights)==null?void 0:m.horizontalTolerance,(h=t.mergeHighlights)==null?void 0:h.verticalTolerance),o=vo(n,t.userSelectAction,t.adapter),r=yo(n),s=Po(),a=(w,R=V.LOCAL)=>{const k=St(w,e),L=de(k.target.selector);return L&&n.addAnnotation(k,R),L},l=(w,R=!0,k=V.LOCAL)=>{const L=w.map(D=>St(D,e)),I=L.filter(D=>!de(D.target.selector));return n.bulkAddAnnotations(L,R,k),I},c=(w,R=V.LOCAL)=>{const k=w.map(I=>St(I,e)),L=k.filter(I=>!de(I.target.selector));return k.forEach(I=>{n.getAnnotation(I.id)?n.updateAnnotation(I,R):n.addAnnotation(I,R)}),L},u=(w,R=V.LOCAL)=>{const k=Ze(w,e);n.updateTarget(k,R)},d=(w,R=V.LOCAL)=>{const k=w.map(L=>Ze(L,e));n.bulkUpdateTargets(k,R)};function v(w,R,k,L){const I=k||!!L,D=i.getAt(w,R,I).map(W=>n.getAnnotation(W)),B=L?D.filter(L):D;if(B.length!==0)return k?B:B[0]}const b=w=>{if(i.getAnnotationRects(w).length!==0)return i.getAnnotationBounds(w)},C=(w,R,k,L)=>i.getIntersecting(w,R,k,L),f=w=>i.getAnnotationRects(w),O=()=>i.recalculate();return n.observe(({changes:w})=>{const R=(w.deleted||[]).filter(I=>de(I.target.selector)),k=(w.created||[]).filter(I=>de(I.target.selector)),L=(w.updated||[]).filter(I=>de(I.newValue.target.selector));(R==null?void 0:R.length)>0&&R.forEach(I=>i.remove(I.target)),k.length>0&&i.set(k.map(I=>I.target),!1),(L==null?void 0:L.length)>0&&L.forEach(({newValue:I})=>i.update(I.target))}),{store:{...n,addAnnotation:a,bulkAddAnnotations:l,bulkUpdateTargets:d,bulkUpsertAnnotations:c,getAnnotationBounds:b,getAnnotationRects:f,getIntersecting:C,getAt:v,recalculatePositions:O,updateTarget:u},selection:o,hover:r,viewport:s}},cr=()=>{const e=document.createElement("canvas");e.width=2*window.innerWidth,e.height=2*window.innerHeight,e.className="r6o-presence-layer";const t=e.getContext("2d");return t.scale(2,2),t.translate(.5,.5),e},vi=(e,t={})=>{const n=cr(),i=n.getContext("2d");document.body.appendChild(n);const o=new Map,r=u=>Array.from(o.entries()).filter(([d,v])=>v.presenceKey===u.presenceKey).map(([d,v])=>d);return e.on("selectionChange",(u,d)=>{r(u).forEach(b=>o.delete(b)),d&&d.forEach(b=>o.set(b,u))}),{clear:()=>{const{width:u,height:d}=n;i.clearRect(-.5,-.5,u+1,d+1)},destroy:()=>{n.remove()},paint:(u,d,v)=>{t.font&&(i.font=t.font);const b=o.get(u.annotation.id);if(b){const{height:C}=u.rects[0],f=u.rects[0].x+d.left,O=u.rects[0].y+d.top;i.fillStyle=b.appearance.color,i.fillRect(f-2,O-2.5,2,C+5);const m=i.measureText(b.appearance.label),h=m.width+6,w=m.actualBoundingBoxAscent+m.actualBoundingBoxDescent+8,R=m.fontBoundingBoxAscent?8:6.5;return i.fillRect(f-2,O-2.5-w,h,w),i.fillStyle="#fff",i.fillText(b.appearance.label,f+1,O-R),{fill:b.appearance.color,fillOpacity:v?.45:.18}}},reset:()=>{n.width=2*window.innerWidth,n.height=2*window.innerHeight;const u=n.getContext("2d");u.scale(2,2),u.translate(.5,.5)}}},ln=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function cn(e,t,n,i){e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on".concat(t),n)}function rt(e,t,n,i){e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on".concat(t),n)}function Ai(e,t){const n=t.slice(0,t.length-1);for(let i=0;i<n.length;i++)n[i]=e[n[i].toLowerCase()];return n}function Ei(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let n=t.lastIndexOf("");for(;n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function dr(e,t){const n=e.length>=t.length?e:t,i=e.length>=t.length?t:e;let o=!0;for(let r=0;r<n.length;r++)i.indexOf(n[r])===-1&&(o=!1);return o}const st={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":ln?173:189,"=":ln?61:187,";":ln?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},se={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},at={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},G={16:!1,18:!1,17:!1,91:!1},F={};for(let e=1;e<20;e++)st["f".concat(e)]=111+e;let K=[],lt=null,Si="all";const me=new Map,Xe=e=>st[e.toLowerCase()]||se[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),ur=e=>Object.keys(st).find(t=>st[t]===e),fr=e=>Object.keys(se).find(t=>se[t]===e);function xi(e){Si=e||"all"}function ct(){return Si||"all"}function hr(){return K.slice(0)}function gr(){return K.map(e=>ur(e)||fr(e)||String.fromCharCode(e))}function pr(){const e=[];return Object.keys(F).forEach(t=>{F[t].forEach(n=>{let{key:i,scope:o,mods:r,shortcut:s}=n;e.push({scope:o,shortcut:s,mods:r,keys:i.split("+").map(a=>Xe(a))})})}),e}function mr(e){const t=e.target||e.srcElement,{tagName:n}=t;let i=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!t.readOnly)&&(i=!1),i}function br(e){return typeof e=="string"&&(e=Xe(e)),K.indexOf(e)!==-1}function wr(e,t){let n,i;e||(e=ct());for(const o in F)if(Object.prototype.hasOwnProperty.call(F,o))for(n=F[o],i=0;i<n.length;)n[i].scope===e?n.splice(i,1).forEach(s=>{let{element:a}=s;return dn(a)}):i++;ct()===e&&xi(t||"all")}function yr(e){let t=e.keyCode||e.which||e.charCode;e.key&&e.key.toLowerCase()==="capslock"&&(t=Xe(e.key));const n=K.indexOf(t);if(n>=0&&K.splice(n,1),e.key&&e.key.toLowerCase()==="meta"&&K.splice(0,K.length),(t===93||t===224)&&(t=91),t in G){G[t]=!1;for(const i in se)se[i]===t&&(ie[i]=!1)}}function Oi(e){if(typeof e>"u")Object.keys(F).forEach(o=>{Array.isArray(F[o])&&F[o].forEach(r=>Lt(r)),delete F[o]}),dn(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&Lt(o)});else if(typeof e=="object")e.key&&Lt(e);else if(typeof e=="string"){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];let[o,r]=n;typeof o=="function"&&(r=o,o=""),Lt({key:e,scope:o,method:r,splitKey:"+"})}}const Lt=e=>{let{key:t,scope:n,method:i,splitKey:o="+"}=e;Ei(t).forEach(s=>{const a=s.split(o),l=a.length,c=a[l-1],u=c==="*"?"*":Xe(c);if(!F[u])return;n||(n=ct());const d=l>1?Ai(se,a):[],v=[];F[u]=F[u].filter(b=>{const f=(i?b.method===i:!0)&&b.scope===n&&dr(b.mods,d);return f&&v.push(b.element),!f}),v.forEach(b=>dn(b))})};function Ci(e,t,n,i){if(t.element!==i)return;let o;if(t.scope===n||t.scope==="all"){o=t.mods.length>0;for(const r in G)Object.prototype.hasOwnProperty.call(G,r)&&(!G[r]&&t.mods.indexOf(+r)>-1||G[r]&&t.mods.indexOf(+r)===-1)&&(o=!1);(t.mods.length===0&&!G[16]&&!G[18]&&!G[17]&&!G[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(K),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function Ti(e,t){const n=F["*"];let i=e.keyCode||e.which||e.charCode;if(e.key&&e.key.toLowerCase()==="capslock"||!ie.filter.call(this,e))return;if((i===93||i===224)&&(i=91),K.indexOf(i)===-1&&i!==229&&K.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{const l=at[a];e[a]&&K.indexOf(l)===-1?K.push(l):!e[a]&&K.indexOf(l)>-1?K.splice(K.indexOf(l),1):a==="metaKey"&&e[a]&&(K=K.filter(c=>c in at||c===i))}),i in G){G[i]=!0;for(const a in se)if(Object.prototype.hasOwnProperty.call(se,a)){const l=at[se[a]];ie[a]=e[l]}if(!n)return}for(const a in G)Object.prototype.hasOwnProperty.call(G,a)&&(G[a]=e[at[a]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(K.indexOf(17)===-1&&K.push(17),K.indexOf(18)===-1&&K.push(18),G[17]=!0,G[18]=!0);const o=ct();if(n)for(let a=0;a<n.length;a++)n[a].scope===o&&(e.type==="keydown"&&n[a].keydown||e.type==="keyup"&&n[a].keyup)&&Ci(e,n[a],o,t);if(!(i in F))return;const r=F[i],s=r.length;for(let a=0;a<s;a++)if((e.type==="keydown"&&r[a].keydown||e.type==="keyup"&&r[a].keyup)&&r[a].key){const l=r[a],{splitKey:c}=l,u=l.key.split(c),d=[];for(let v=0;v<u.length;v++)d.push(Xe(u[v]));d.sort().join("")===K.sort().join("")&&Ci(e,l,o,t)}}function ie(e,t,n){K=[];const i=Ei(e);let o=[],r="all",s=document,a=0,l=!1,c=!0,u="+",d=!1,v=!1;for(n===void 0&&typeof t=="function"&&(n=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(r=t.scope),t.element&&(s=t.element),t.keyup&&(l=t.keyup),t.keydown!==void 0&&(c=t.keydown),t.capture!==void 0&&(d=t.capture),typeof t.splitKey=="string"&&(u=t.splitKey),t.single===!0&&(v=!0)),typeof t=="string"&&(r=t),v&&Oi(e,r);a<i.length;a++)e=i[a].split(u),o=[],e.length>1&&(o=Ai(se,e)),e=e[e.length-1],e=e==="*"?"*":Xe(e),e in F||(F[e]=[]),F[e].push({keyup:l,keydown:c,scope:r,mods:o,shortcut:i[a],method:n,key:i[a],splitKey:u,element:s});if(typeof s<"u"&&window){if(!me.has(s)){const b=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return Ti(f,s)},C=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;Ti(f,s),yr(f)};me.set(s,{keydownListener:b,keyupListenr:C,capture:d}),cn(s,"keydown",b,d),cn(s,"keyup",C,d)}if(!lt){const b=()=>{K=[]};lt={listener:b,capture:d},cn(window,"focus",b,d)}}}function vr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(F).forEach(n=>{F[n].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function dn(e){const t=Object.values(F).flat();if(t.findIndex(i=>{let{element:o}=i;return o===e})<0){const{keydownListener:i,keyupListenr:o,capture:r}=me.get(e)||{};i&&o&&(rt(e,"keyup",o,r),rt(e,"keydown",i,r),me.delete(e))}if((t.length<=0||me.size<=0)&&(Object.keys(me).forEach(o=>{const{keydownListener:r,keyupListenr:s,capture:a}=me.get(o)||{};r&&s&&(rt(o,"keyup",s,a),rt(o,"keydown",r,a),me.delete(o))}),me.clear(),Object.keys(F).forEach(o=>delete F[o]),lt)){const{listener:o,capture:r}=lt;rt(window,"focus",o,r),lt=null}}const un={getPressedKeyString:gr,setScope:xi,getScope:ct,deleteScope:wr,getPressedKeyCodes:hr,getAllKeyCodes:pr,isPressed:br,filter:mr,trigger:vr,unbind:Oi,keyMap:st,modifier:se,modifierMap:at};for(const e in un)Object.prototype.hasOwnProperty.call(un,e)&&(ie[e]=un[e]);if(typeof window<"u"){const e=window.hotkeys;ie.noConflict=t=>(t&&window.hotkeys===ie&&(window.hotkeys=e),ie),window.hotkeys=ie}async function Ar(e,t,n=(()=>!1)){do{if(await e(),await n())break;const i=t;await new Promise((o=>setTimeout(o,Math.max(0,i))))}while(!await n())}const Ri=300,Li=["up","down","left","right"],ki=In?"⌘+a":"ctrl+a",Er=[...Li.map(e=>`shift+${e}`),ki],Mi=(e,t,n)=>{let i;const{annotatingEnabled:o,offsetReferenceSelector:r,selectionMode:s,dismissOnNotAnnotatable:a="NEVER"}=n,l=_=>i=_;let c;const u=_=>c=_,{store:d,selection:v}=t;let b,C,f;const O=_=>{C!==!1&&(b=Ye(e,_.target)?void 0:{annotation:li(),selector:[],creator:i,created:new Date})},m=Te(_=>{const p=document.getSelection();if(!(p!=null&&p.anchorNode))return;if(Ye(e,p.anchorNode)){b=void 0;return}const x=_.timeStamp-((f==null?void 0:f.timeStamp)||_.timeStamp);if((f==null?void 0:f.type)==="pointerdown"&&(x<1e3&&!b||p.isCollapsed&&x<Ri)&&O(f||_),!b)return;if(p.isCollapsed){d.getAnnotation(b.annotation)&&(v.clear(),d.deleteAnnotation(b.annotation));return}const M=Array.from(Array(p.rangeCount).keys()).map(U=>p.getRangeAt(U)).map(U=>Xn(U,e));if(M.every(U=>Hn(U)))return;const X=M.flatMap(U=>Bn(e,U.cloneRange()));(X.length!==b.selector.length||X.some((U,J)=>{var Ee;return U.toString()!==((Ee=b.selector[J])==null?void 0:Ee.quote)}))&&(b={...b,selector:X.map(U=>Vn(U,e,r)),updated:new Date},d.getAnnotation(b.annotation)?d.updateTarget(b,V.LOCAL):v.clear())}),h=_=>{f=ut(_),C=f.button===0},w=async _=>{if(!C)return;const p=ut(_),x=()=>{const{x:M,y:X}=e.getBoundingClientRect();if(Ye(e,p.target)){(typeof a=="function"?a(p,e):a==="ALWAYS")&&v.clear();return}const P=p.target instanceof Node&&e.contains(p.target)&&d.getAt(p.clientX-M,p.clientY-X,s==="all",c);if(P){const{selected:U}=v,J=new Set(U.map(dt=>dt.id)),Ee=Array.isArray(P)?P.map(dt=>dt.id):[P.id];(J.size!==Ee.length||!Ee.every(dt=>J.has(dt)))&&v.userSelect(Ee,p)}else v.clear()};if(p.timeStamp-f.timeStamp<Ri){await R();const M=document.getSelection();if(M!=null&&M.isCollapsed){b=void 0,x();return}}b&&b.selector.length>0&&(B(),v.userSelect(b.annotation,p))},R=async()=>{const _=document.getSelection();let p=!1,x=_==null?void 0:_.isCollapsed;const T=()=>x||p,M=1;return setTimeout(()=>p=!0,50),Ar(()=>x=_==null?void 0:_.isCollapsed,M,T)},k=_=>{const p=document.getSelection();p!=null&&p.isCollapsed||((!b||b.selector.length===0)&&m(_),b&&(B(),v.userSelect(b.annotation,ut(_))))},L=_=>{_.key==="Shift"&&b&&(document.getSelection().isCollapsed||(B(),v.userSelect(b.annotation,Ke(_))))},I=_=>{const p=()=>setTimeout(()=>{(b==null?void 0:b.selector.length)>0&&(v.clear(),d.addAnnotation({id:b.annotation,bodies:[],target:b}),v.userSelect(b.annotation,Ke(_))),document.removeEventListener("selectionchange",p)},100);document.addEventListener("selectionchange",p),O(_)};ie(Er.join(","),{element:e,keydown:!0,keyup:!1},_=>{_.repeat||(f=Ke(_))}),ie(ki,{keydown:!0,keyup:!1},_=>{f=Ke(_),I(_)});const D=_=>{_.repeat||_.target!==e&&_.target!==document.body||(b=void 0,v.clear())};ie(Li.join(","),{keydown:!0,keyup:!1},D);const B=()=>{const _=d.getAnnotation(b.annotation);if(!_){d.addAnnotation({id:b.annotation,bodies:[],target:b});return}const{target:{updated:p}}=_,{updated:x}=b;(!p||!x||p<x)&&d.updateTarget(b)};return document.addEventListener("pointerdown",h),document.addEventListener("pointerup",w),document.addEventListener("contextmenu",k),o&&(e.addEventListener("keyup",L),e.addEventListener("selectstart",O),document.addEventListener("selectionchange",m)),{destroy:()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("pointerup",w),document.removeEventListener("contextmenu",k),e.removeEventListener("keyup",L),e.removeEventListener("selectstart",O),document.removeEventListener("selectionchange",m),ie.unbind()},setFilter:u,setUser:l}},Ii=(e,t)=>({...e,annotatingEnabled:e.annotatingEnabled??t.annotatingEnabled,user:e.user||t.user}),_i="SPANS",Sr=(e,t={})=>{hn(e),_n(e);const n=Ii(t,{annotatingEnabled:!0,user:jo()}),i=yi(e,n),{selection:o,viewport:r}=i,s=i.store,a=Ho(s),l=Vo(i,a,n.adapter);let c=n.user;const u=n.renderer==="CSS_HIGHLIGHTS"?CSS.highlights?"CSS_HIGHLIGHTS":_i:n.renderer||_i,d=u==="SPANS"?si(e,i,r):u==="CSS_HIGHLIGHTS"?oi(e,i,r):u==="CANVAS"?Wn(e,i,r):void 0;if(!d)throw`Unknown renderer implementation: ${u}`;console.debug(`Using ${u} renderer`),n.style&&d.setStyle(n.style);const v=Mi(e,i,n);return v.setUser(c),{...Yo(i,a,n.adapter),destroy:()=>{d.destroy(),v.destroy(),a.destroy()},element:e,getUser:()=>c,setFilter:L=>{d.setFilter(L),v.setFilter(L)},setStyle:L=>d.setStyle(L),setUser:L=>{c=L,v.setUser(L)},setSelected:L=>{L?o.setSelected(L):o.clear()},setPresenceProvider:L=>{L&&(d.setPainter(vi(L,n.presence)),L.on("selectionChange",()=>d.redraw()))},setVisible:L=>d.setVisible(L),on:l.on,off:l.off,scrollIntoView:Kn(e,s),state:i}};N.DEFAULT_SELECTED_STYLE=et,N.DEFAULT_STYLE=ge,N.NOT_ANNOTATABLE_CLASS=Se,N.NOT_ANNOTATABLE_SELECTOR=xe,N.Origin=V,N.SelectionHandler=Mi,N.UserSelectAction=di,N.W3CTextFormat=Qo,N.cancelSingleClickEvents=hn,N.cloneKeyboardEvent=Ke,N.clonePointerEvent=ut,N.createBody=To,N.createCanvasRenderer=Wn,N.createHighlightsRenderer=oi,N.createPresencePainter=vi,N.createRenderer=ii,N.createSpansRenderer=si,N.createTextAnnotator=Sr,N.createTextAnnotatorState=yi,N.debounce=Te,N.fillDefaults=Ii,N.getHighlightClientRects=Nn,N.getQuoteContext=Un,N.getRangeAnnotatableContents=Et,N.isMac=In,N.isNotAnnotatable=Ye,N.isRangeAnnotatable=fn,N.isRevived=de,N.isWhitespaceOrEmpty=Hn,N.mergeClientRects=Pn,N.paint=Fn,N.parseW3CTextAnnotation=pi,N.programmaticallyFocusable=_n,N.rangeToSelector=Vn,N.reviveAnnotation=St,N.reviveSelector=jt,N.reviveTarget=Ze,N.scrollIntoView=Kn,N.serializeW3CTextAnnotation=mi,N.splitAnnotatableRanges=Bn,N.toDomRectList=Ji,N.trimRangeToContainer=Xn,N.whitespaceOrEmptyRegex=Dn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
3
3
  //# sourceMappingURL=text-annotator.umd.js.map