hypothesis 1.1254.0 → 1.1256.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.
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?225ece","styles/annotator.css":"styles/annotator.css?540e64","styles/annotator.css.map":"styles/annotator.css.map?347677","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e9b69c","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?781567","styles/sidebar.css.map":"styles/sidebar.css.map?2bb612","styles/ui-playground.css":"styles/ui-playground.css?dfd411","styles/ui-playground.css.map":"styles/ui-playground.css.map?12072a","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3f9caf","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?c46d8d","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?5a8f1f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?4e76f2","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?52a4d0"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function l(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function p(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=l(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var c,u,d=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),h=!(null===(c=window.chrome)||void 0===c||null===(u=c.runtime)||void 0===u||!u.id);if(!Object.keys(d).length&&h)throw new Error("Could not start Hypothesis extension as configuration is missing");var y=p(d.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1256.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)e(s,i(t,p[l]))}(document,{assetRoot:y,manifest:s,apiUrl:d.apiUrl})}else{var f=d,m=p(f.notebookAppUrl||"https://hypothes.is/notebook"),b=p(f.profileAppUrl||"https://hypothes.is/user-profile"),g=p(f.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var p=[];void 0!==window.PDFViewerApplication&&p.push("styles/pdfjs-overrides.css"),p.push("styles/highlights.css");for(var c=0,u=p;c<u.length;c++)e(s,i(t,u[c]))}}(document,{assetRoot:y,manifest:s,notebookAppUrl:m,profileAppUrl:b,sidebarAppUrl:g})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?225ece",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?540e64",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?347677",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?2bb612",
|
|
13
13
|
"styles/ui-playground.css": "styles/ui-playground.css?dfd411",
|
|
14
14
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?12072a",
|
|
15
|
-
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
15
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?3f9caf",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?c46d8d",
|
|
17
17
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?5a8f1f",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?4e76f2",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?52a4d0"
|
|
20
20
|
}
|
|
@@ -45,13 +45,13 @@ columnNumber:5},this)};const Re=function({children:t,classes:e,elementRef:n,unst
|
|
|
45
45
|
"before:ml-[-13px] before:border-[13px] before:border-b-[6px] before:border-b-grey-3":"up"===s,"after:ml-[-12px] after:border-[12px] after:border-b-[5px] after:border-b-white":"up"===s},{"z-1 rounded-t-px rounded-b-px-sm":"down"===s,"before:top-full before:left-1/2 after:top-full after:left-1/2":"down"===s,"before:ml-[-13px] before:border-[13px] before:border-t-[6px] before:border-t-grey-3":"down"===s,"after:ml-[-12px] after:border-[12px] after:border-t-[5px] after:border-t-white":"down"===s},e),expanded:i,pressed:o,title:r,children:t},void 0,0,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/PointerButton.tsx",lineNumber:52,columnNumber:5},this)};function Pe({badgeCount:t}){return Wt("span",{className:be("rounded px-1 py-0.5","bg-current"),children:Wt("span",{className:"font-bold text-color-text-inverted",children:t})})}function Oe({arrowDirection:t}){return Wt("div",{className:be("absolute left-1/2 -translate-x-1/2 z-2","fill-white text-grey-3",{
|
|
46
46
|
"top-0 -translate-y-full":"up"===t}),children:Wt("up"===t?fe:ue,{})})}function Le({badgeCount:t,icon:e,label:n,onClick:i,shortcut:o}){Vt(o,i);const r=o?`${n} (${o})`:n;return Wt(xe,{classes:be("flex-col gap-y-1 py-2.5 px-2","text-annotator-sm leading-none","text-grey-7","group-hover:text-grey-5","hover:group-hover:text-grey-9"),onClick:i,title:r,children:[e&&Wt(e,{className:"text-annotator-lg",title:r}),"number"==typeof t&&Wt(Pe,{badgeCount:t}),Wt("span",{children:n})]})}function Me({annotationCount:t,isVisible:e}){return Wt("div",{className:"sr-only",children:[Wt("span",{"aria-live":"polite","aria-atomic":"true",role:"status","data-testid":"annotation-count-announce",children:t>0&&Wt("span",{children:[t," ",1===t?"annotation":"annotations"," for this selection."]})}),Wt("ul",{"aria-live":"polite","data-testid":"annotate-shortcuts-announce",children:e&&Wt($,{children:[t>0&&Wt("li",{children:["Press ","'S'"," to show annotations."]}),Wt("li",{children:["Press ","'A'"," to annotate."]}),Wt("li",{
|
|
47
47
|
children:["Press ","'H'"," to highlight."]})]})})]})}function Ie({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:i=0}){const o=e?"a":null,r=e?"h":null,s=e?"s":null;return Vt(e?"Escape":null,(()=>n("hide"))),Wt("div",{className:be("all-initial","border border-solid border-grey-3","absolute select-none bg-white rounded shadow-adder-toolbar","opacity-5",{"animate-adder-pop-up":"up"===t&&e,"animate-adder-pop-down":"down"===t&&e}),"data-component":"AdderToolbar",dir:"ltr",style:{visibility:e?"visible":"hidden"},children:[Wt("div",{className:be("flex group"),children:[Wt(Le,{icon:$t,onClick:()=>n("annotate"),label:"Annotate",shortcut:o}),Wt(Le,{icon:ae,onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),i>0&&Wt($,{children:[Wt("div",{className:be("m-1.5 border-r border-grey-4 border-solid")}),Wt(Le,{badgeCount:i,onClick:()=>n("show"),label:"Show",shortcut:s})]})]}),Wt(Oe,{arrowDirection:t}),Wt(Me,{annotationCount:i,isVisible:e})]})}function Fe(t){const e=t.attachShadow({mode:"open"});!function(t){
|
|
48
|
-
var e;const n=null===(e=document.querySelector('link[rel="preload"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const i=document.createElement("link");i.rel="stylesheet",i.href=n,t.appendChild(i)}(e);const n=window.applyFocusVisiblePolyfill;var i;return n&&n(e),(i=e).addEventListener("mouseup",(t=>t.stopPropagation())),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0}),e}let De
|
|
48
|
+
var e;const n=null===(e=document.querySelector('link[rel="preload"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const i=document.createElement("link");i.rel="stylesheet",i.href=n,t.appendChild(i)}(e);const n=window.applyFocusVisiblePolyfill;var i;return n&&n(e),(i=e).addEventListener("mouseup",(t=>t.stopPropagation())),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0}),e}let De=function(t){return t[t.DOWN=1]="DOWN",t[t.UP=2]="UP",t}({});function Be(t){return t.toString()+"px"}class He{constructor(t,n){e(this,"_outerContainer",void 0),e(this,"_shadowRoot",void 0),e(this,"_view",void 0),e(this,"_isVisible",void 0),e(this,"_arrowDirection",void 0),e(this,"_onAnnotate",void 0),e(this,"_onHighlight",void 0),e(this,"_onShowAnnotations",void 0),e(this,"_annotationsForSelection",void 0),this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),
|
|
49
49
|
this._shadowRoot=Fe(this._outerContainer),Object.assign(this._outerContainer.style,{position:"absolute",top:0,left:0}),this._view=t.ownerDocument.defaultView,this._isVisible=!1,this._arrowDirection="up",this._annotationsForSelection=[],this._onAnnotate=n.onAnnotate,this._onHighlight=n.onHighlight,this._onShowAnnotations=n.onShowAnnotations,this._render()}get annotationsForSelection(){return this._annotationsForSelection}set annotationsForSelection(t){this._annotationsForSelection=t,this._render()}hide(){this._isVisible=!1,this._render(),Object.assign(this._outerContainer.style,{top:0,left:0})}destroy(){ut(null,this._shadowRoot),this._outerContainer.remove()}show(t,e){const{left:n,top:i,arrowDirection:o}=this._calculateTarget(t,e);this._showAt(n,i),this._isVisible=!0,this._arrowDirection=o===De.UP?"up":"down",this._render()}_width(){return this._shadowRoot.firstChild.getBoundingClientRect().width}_height(){return this._shadowRoot.firstChild.getBoundingClientRect().height}_calculateTarget(t,e){let n,i,o
|
|
50
50
|
;n=e&&!Ut()?De.DOWN:De.UP;const r=Math.min(20,t.width),s=this._width(),a=Ut()?10:0,l=this._height();return o=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-l<0&&n===De.DOWN?n=De.UP:t.top+l>this._view.innerHeight&&(n=De.DOWN),i=n===De.UP?t.top+t.height+10+a:t.top-l-10,o=Math.max(o,0),o=Math.min(o,this._view.innerWidth-s),i=Math.max(i,0),i=Math.min(i,this._view.innerHeight-l),{top:i,left:o,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),i=this._height(),o=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+i),...document.elementsFromPoint(t+n/2,e+i/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+i)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return o.push(0),Math.max(...o)+1}_showAt(t,e){const n=function(t){let e=t.parentElement;for(;e.parentElement&&"static"===getComputedStyle(e).position;)e=e.parentElement;return e
|
|
51
|
-
}(this._outerContainer).getBoundingClientRect(),i=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:Be(t-n.left),top:Be(e-n.top),zIndex:i})}_render(){ut(Wt(Ie,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this._onAnnotate(),this.hide();break;case"highlight":this._onHighlight(),this.hide();break;case"show":this._onShowAnnotations(this.annotationsForSelection);break;case"hide":this.hide()}},annotationCount:this.annotationsForSelection.length}),this._shadowRoot)}}var Ve;function Ue(t,e,n){const i=n===Ve.Forwards?e:e-1;if(""!==t.charAt(i).trim())return e;let o,r;if(n===Ve.Backwards?(o=t.substring(0,e),r=o.trimEnd()):(o=t.substring(e),r=o.trimStart()),!r.length)return-1;const s=o.length-r.length;return n===Ve.Backwards?e-s:e+s}function qe(t,e){
|
|
51
|
+
}(this._outerContainer).getBoundingClientRect(),i=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:Be(t-n.left),top:Be(e-n.top),zIndex:i})}_render(){ut(Wt(Ie,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this._onAnnotate(),this.hide();break;case"highlight":this._onHighlight(),this.hide();break;case"show":this._onShowAnnotations(this.annotationsForSelection);break;case"hide":this.hide()}},annotationCount:this.annotationsForSelection.length}),this._shadowRoot)}}var Ve=function(t){return t[t.Forwards=1]="Forwards",t[t.Backwards=2]="Backwards",t}(Ve||{});function Ue(t,e,n){const i=n===Ve.Forwards?e:e-1;if(""!==t.charAt(i).trim())return e;let o,r;if(n===Ve.Backwards?(o=t.substring(0,e),r=o.trimEnd()):(o=t.substring(e),r=o.trimStart()),!r.length)return-1;const s=o.length-r.length;return n===Ve.Backwards?e-s:e+s}function qe(t,e){
|
|
52
52
|
const n=t.commonAncestorContainer.ownerDocument.createNodeIterator(t.commonAncestorContainer,NodeFilter.SHOW_TEXT),i=e===Ve.Forwards?t.startContainer:t.endContainer,o=e===Ve.Forwards?t.endContainer:t.startContainer;let r=n.nextNode();for(;r&&r!==i;)r=n.nextNode();e===Ve.Backwards&&(r=n.previousNode());let s=-1;const a=()=>{if(r=e===Ve.Forwards?n.nextNode():n.previousNode(),r){const t=r.textContent,n=e===Ve.Forwards?0:t.length;s=Ue(t,n,e)}};for(;r&&-1===s&&r!==o;)a();if(r&&s>=0)return{node:r,offset:s};throw new RangeError("No text nodes with non-whitespace text found in range")}function We(t){var e,n;switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return null!==(e=null===(n=t.textContent)||void 0===n?void 0:n.length)&&void 0!==e?e:0;default:return 0}}function ze(t){let e=t.previousSibling,n=0;for(;e;)n+=We(e),e=e.previousSibling;return n}function $e(t,...e){let n=e.shift();const i=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),o=[];let r,s=i.nextNode(),a=0;for(;void 0!==n&&s;)r=s,
|
|
53
|
-
a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}let je
|
|
54
|
-
|
|
53
|
+
a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}let je=function(t){return t[t.FORWARDS=1]="FORWARDS",t[t.BACKWARDS=2]="BACKWARDS",t}({});class Xe{constructor(t,n){if(e(this,"element",void 0),e(this,"offset",void 0),n<0)throw new Error("Offset is invalid");this.element=t,this.offset=n}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,n=this.offset;for(;e!==t;)n+=ze(e),e=e.parentElement;return new Xe(e,n)}resolve(t={}){try{return $e(this.element,this.offset)[0]}catch(e){if(0===this.offset&&void 0!==t.direction){const n=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);n.currentNode=this.element;const i=t.direction===je.FORWARDS,o=i?n.nextNode():n.previousNode();if(!o)throw e;return{node:o,offset:i?0:o.data.length}}
|
|
54
|
+
throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return Xe.fromPoint(t,e);case Node.ELEMENT_NODE:return new Xe(t,e);default:throw new Error("Node is not an element or text node")}}static fromPoint(t,e){switch(t.nodeType){case Node.TEXT_NODE:{if(e<0||e>t.data.length)throw new Error("Text node offset is out of range");if(!t.parentElement)throw new Error("Text node has no parent");const n=ze(t)+e;return new Xe(t.parentElement,n)}case Node.ELEMENT_NODE:{if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let i=0;i<e;i++)n+=We(t.childNodes[i]);return new Xe(t,n)}default:throw new Error("Point is not in an element or text node")}}}class Ye{constructor(t,n){e(this,"start",void 0),e(this,"end",void 0),this.start=t,this.end=n}relativeTo(t){return new Ye(this.start.relativeTo(t),this.end.relativeTo(t))}toRange(){let t,e
|
|
55
55
|
;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[t,e]=$e(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:je.FORWARDS}),e=this.end.resolve({direction:je.BACKWARDS}));const n=new Range;return n.setStart(t.node,t.offset),n.setEnd(e.node,e.offset),n}static fromRange(t){const e=Xe.fromPoint(t.startContainer,t.startOffset),n=Xe.fromPoint(t.endContainer,t.endOffset);return new Ye(e,n)}static fromOffsets(t,e,n){return new Ye(new Xe(t,e),new Xe(t,n))}static trimmedRange(t){return function(t){if(!t.toString().trim().length)throw new RangeError("Range contains no non-whitespace text");if(t.startContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range startContainer is not a text node");if(t.endContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range endContainer is not a text node");const e=t.cloneRange();let n=!1,i=!1;const o={start:Ue(t.startContainer.textContent,t.startOffset,Ve.Forwards),
|
|
56
56
|
end:Ue(t.endContainer.textContent,t.endOffset,Ve.Backwards)};if(o.start>=0&&(e.setStart(t.startContainer,o.start),n=!0),o.end>0&&(e.setEnd(t.endContainer,o.end),i=!0),n&&i)return e;if(!n){const{node:t,offset:n}=qe(e,Ve.Forwards);t&&n>=0&&e.setStart(t,n)}if(!i){const{node:t,offset:n}=qe(e,Ve.Backwards);t&&n>0&&e.setEnd(t,n)}return e}(Ye.fromRange(t).toRange())}}const Ze=".annotator-placeholder";function Ge(t){return!!t.parentElement&&null!==t.parentElement.closest(Ze)}function Ke(t){if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function Qe(t,e){try{var n,i;const o=null!==(n=null===(i=e.nodeValue)||void 0===i?void 0:i.length)&&void 0!==n?n:e.childNodes.length;return t.comparePoint(e,0)<=0&&t.comparePoint(e,o)>=0}catch(t){return!1}}function Je(t,e){const n=t.commonAncestorContainer,i=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let o;for(;o=i.nextNode();)Qe(t,o)&&e(o)}function tn(t){const e=[];return Je(t,(t=>{(function(t){
|
|
57
57
|
return t.nodeType===Node.TEXT_NODE})(t)&&!t.textContent.match(/^\s*$/)&&e.push(t)})),e.flatMap((e=>{const n=e.ownerDocument.createRange();if(n.selectNodeContents(e),e===t.startContainer&&n.setStart(e,t.startOffset),e===t.endContainer&&n.setEnd(e,t.endOffset),n.collapsed)return[];const i=Array.from(n.getClientRects());return n.detach(),i}))}const en="http://www.w3.org/2000/svg",nn=["user-annotations","user-highlights","other-content"];function on(t,e){const n=function(t){if(t.collapsed)return[];let e=t.commonAncestorContainer;if(e&&e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentElement),!e)return[];const n=[],i=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let o;for(;o=i.nextNode();){if(!Qe(t,o))continue;const e=o;e===t.startContainer&&t.startOffset>0?e.splitText(t.startOffset):(e===t.endContainer&&t.endOffset<e.data.length&&e.splitText(t.endOffset),n.push(e))}return n}(t),i=n.length>0&&Ge(n[0]);let o=[],r=null,s=null;n.forEach((t=>{r&&r.nextSibling===t?s.push(t):(s=[t],o.push(s)),r=t}))
|
|
@@ -120,7 +120,7 @@ this._hostRPC.on("close",(()=>this.emit("hostDisconnected")));const e=await this
|
|
|
120
120
|
if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Ye.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&sn(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[]
|
|
121
121
|
;const n=await this.getDocumentInfo(),i=this.element,r=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),s={uri:n.uri,document:n.metadata,target:r,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+o(8)};return this._sidebarRPC.call("createAnnotation",s),this.anchor(s),Ao(),s}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);an(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=ln(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){
|
|
122
122
|
const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Ke(n),o=function(t){if(t.isCollapsed)return null;const e=tn(t.getRangeAt(0));return 0===e.length?null:Ke(t)?e[0]:e[e.length-1]}(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=So(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}
|
|
123
|
-
get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function ko(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function To(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
123
|
+
get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function ko(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function To(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1256.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),
|
|
124
124
|
t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function Po({config:t,groupId:e}){return Wt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:ko(t.notebookAppUrl,{...To(t.notebookAppUrl,t),group:e})})}function Oo({eventBus:t,config:e}){const[n,i]=Nt(0),[o,r]=Nt(!0),[s,a]=Nt(null),l=Rt(""),c=Rt(null);At((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),At((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),At((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:Wt("div",{className:be("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ae,{
|
|
125
125
|
title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt(Po,{config:e,groupId:s},n)]})})}class Lo{constructor(t,n,i){e(this,"_outerContainer",void 0),e(this,"_shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this._shadowRoot=Fe(this._outerContainer),ut(Wt(Oo,{eventBus:n,config:i}),this._shadowRoot)}destroy(){ut(null,this._shadowRoot),this._outerContainer.remove()}}function Mo({eventBus:t,config:e}){const[n,i]=Nt(!0),o=Rt(null);At((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:Wt("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"profile-inner",
|
|
126
126
|
children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ae,{title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class Io{constructor(t,n,i){e(this,"_outerContainer",void 0),e(this,"shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-profile"),t.appendChild(this._outerContainer),this.shadowRoot=Fe(this._outerContainer),ut(Wt(Mo,{eventBus:n,config:i}),this.shadowRoot)}destroy(){ut(null,this.shadowRoot),this._outerContainer.remove()}}var Fo={},Do={get exports(){return Fo},set exports(t){Fo=t}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){
|