hypothesis 1.1251.0 → 1.1252.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?4790a3","styles/annotator.css":"styles/annotator.css?ce2a96","styles/annotator.css.map":"styles/annotator.css.map?db785c","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?a06c2b","styles/sidebar.css.map":"styles/sidebar.css.map?e814a9","styles/ui-playground.css":"styles/ui-playground.css?536cd0","styles/ui-playground.css.map":"styles/ui-playground.css.map?1b4f14","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?a27c18","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?39d57a","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?5464ef","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?30df62","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?173823"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,t(r),s.head.appendChild(r)}function r(s,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.esModule,o=void 0===n||n,a=r.forceReload,i=void 0!==a&&a,l=s.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function n(s,e,r,n){var o=s.createElement("link");o.rel=e,o.href=n,o.type="application/annotator+".concat(r),t(o),s.head.appendChild(o)}function o(s,e,r){var n=s.createElement("link");n.rel="preload",n.as=e,n.href=r,"fetch"===e&&(n.crossOrigin="anonymous"),t(n),s.head.appendChild(n)}function a(s,t){return s.assetRoot+"build/"+s.manifest[t]}function i(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?i(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=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<e.length;r++){var n=void 0;try{n=JSON.parse(e[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),n={}}Object.assign(t,n)}return t}(document),u=p(c.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1251.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var n=0,i=["scripts/sidebar.bundle.js"];n<i.length;n++)r(s,a(t,i[n]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)e(s,a(t,p[l]))}(document,{assetRoot:u,manifest:s,apiUrl:c.apiUrl})}else{var d=c,h=p(d.notebookAppUrl||"https://hypothes.is/notebook"),y=p(d.profileAppUrl||"https://hypothes.is/user-profile"),f=p(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",t.sidebarAppUrl),n(s,"notebook","html",t.notebookAppUrl),n(s,"profile","html",t.profileAppUrl),o(s,"style",a(t,"styles/annotator.css")),n(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)r(s,a(t,l[i]),{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,a(t,u[c]))}}(document,{assetRoot:u,manifest:s,notebookAppUrl:h,profileAppUrl:y,sidebarAppUrl:f})}}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/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?468eaf","styles/annotator.css":"styles/annotator.css?ce2a96","styles/annotator.css.map":"styles/annotator.css.map?db785c","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?a06c2b","styles/sidebar.css.map":"styles/sidebar.css.map?e814a9","styles/ui-playground.css":"styles/ui-playground.css?536cd0","styles/ui-playground.css.map":"styles/ui-playground.css.map?1b4f14","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?01a06e","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?afee26","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?5464ef","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?30df62","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?173823"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,t(r),s.head.appendChild(r)}function r(s,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.esModule,o=void 0===n||n,a=r.forceReload,i=void 0!==a&&a,l=s.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function n(s,e,r,n){var o=s.createElement("link");o.rel=e,o.href=n,o.type="application/annotator+".concat(r),t(o),s.head.appendChild(o)}function o(s,e,r){var n=s.createElement("link");n.rel="preload",n.as=e,n.href=r,"fetch"===e&&(n.crossOrigin="anonymous"),t(n),s.head.appendChild(n)}function a(s,t){return s.assetRoot+"build/"+s.manifest[t]}function i(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?i(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=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<e.length;r++){var n=void 0;try{n=JSON.parse(e[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),n={}}Object.assign(t,n)}return t}(document),u=p(c.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1252.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var n=0,i=["scripts/sidebar.bundle.js"];n<i.length;n++)r(s,a(t,i[n]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)e(s,a(t,p[l]))}(document,{assetRoot:u,manifest:s,apiUrl:c.apiUrl})}else{var d=c,h=p(d.notebookAppUrl||"https://hypothes.is/notebook"),y=p(d.profileAppUrl||"https://hypothes.is/user-profile"),f=p(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",t.sidebarAppUrl),n(s,"notebook","html",t.notebookAppUrl),n(s,"profile","html",t.profileAppUrl),o(s,"style",a(t,"styles/annotator.css")),n(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)r(s,a(t,l[i]),{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,a(t,u[c]))}}(document,{assetRoot:u,manifest:s,notebookAppUrl:h,profileAppUrl:y,sidebarAppUrl:f})}}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/.")}();
@@ -1,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?4790a3",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?468eaf",
3
3
  "styles/annotator.css": "styles/annotator.css?ce2a96",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?db785c",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
@@ -12,8 +12,8 @@
12
12
  "styles/sidebar.css.map": "styles/sidebar.css.map?e814a9",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?536cd0",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?1b4f14",
15
- "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?a27c18",
16
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?39d57a",
15
+ "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?01a06e",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?afee26",
17
17
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?5464ef",
18
18
  "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?30df62",
19
19
  "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?173823"
@@ -100,8 +100,8 @@ attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWa
100
100
  ;const o=this._pdfViewer.currentScaleValue;return"auto"!==o&&"page-fit"!==o&&"page-width"!==o||(this._pdfViewer.currentScaleValue=o),this._pdfViewer.update(),n}async scrollToAnchor(t){const e=t.annotation,n=ro(t),i=this._anchorOffset(t);if(null!==i&&(await Jn(this.contentContainer(),i),n)){const t=await this._waitForAnnotationToBeAnchored(e,this._reanchoringMaxWait);if(!t)return;const n=this._anchorOffset(t);if(null===n)return;await Jn(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(t,e){var n;const i=Date.now();let o;do{o=this._annotator.anchors.find((e=>e.annotation===t)),o&&!ro(o)||(o=null,await so(20))}while(!o&&Date.now()-i<e);return null!==(n=o)&&void 0!==n?n:null}_anchorOffset(t){if(!t.highlights)return null;return function(t,e){let n=0;for(;t!==e&&e.contains(t);)n+=t.offsetTop,t=t.offsetParent;return n}(t.highlights[0],this.contentContainer())}}function lo(t){const e=function(t){if(!t.includes("["))return t;let e="",n=!1,i=!1
101
101
  ;for(const o of t)n||"^"!==o?(n||"["!==o?!n&&i&&"]"===o?i=!1:i||(e+=o):i=!0,n=!1):n=!0;return e}(t),n=e.indexOf("!");return-1===n?e:e.slice(0,n)}class co{constructor(t,n,i){e(this,"_element",void 0),e(this,"_onFrameAdded",void 0),e(this,"_onFrameRemoved",void 0),e(this,"_annotatableFrames",void 0),e(this,"_isDisconnected",void 0),e(this,"_mutationObserver",void 0),this._element=t,this._onFrameAdded=n,this._onFrameRemoved=i,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(Pi((()=>{this._discoverFrames()}),40)),this._discoverFrames(),this._mutationObserver.observe(this._element,{childList:!0,subtree:!0,attributeFilter:["enable-annotation"]})}disconnect(){this._isDisconnected=!0,this._mutationObserver.disconnect()}async _addFrame(t){this._annotatableFrames.add(t);try{if(await ho(t),this._isDisconnected)return;t.contentWindow.addEventListener("unload",(()=>{this._removeFrame(t)})),this._onFrameAdded(t)}catch(e){
102
102
  console.warn(`Unable to inject the Hypothesis client (from '${document.location.href}' into a cross-origin frame '${t.src}')`)}}_removeFrame(t){this._annotatableFrames.delete(t),this._onFrameRemoved(t)}_discoverFrames(){const t=new Set(this._element.querySelectorAll("iframe[enable-annotation]"));for(const e of t)this._annotatableFrames.has(e)||this._addFrame(e);for(const e of this._annotatableFrames)t.has(e)||this._removeFrame(e)}}function ho(t){return new Promise(((e,n)=>{const i=uo(t,((t,o)=>{i(),o?e(o):n(t)}))}))}function uo(t,e,{pollInterval:n=10}={}){let i,o;const r=new WeakSet,s=()=>{clearTimeout(i),i=void 0},a=()=>{const n=t.contentDocument;if(n){if(!r.has(n)){if(r.add(n),s(),!function(t){var e;return"about:blank"===(null===(e=t.contentDocument)||void 0===e?void 0:e.location.href)&&t.hasAttribute("src")&&"about:blank"!==t.src}(t)){"interactive"===n.readyState||"complete"===n.readyState?e(null,n):n.addEventListener("DOMContentLoaded",(()=>e(null,n)))}var i
103
- ;t.contentDocument&&(null===(i=t.contentWindow)||void 0===i||i.addEventListener("unload",o))}}else{s();const n=t.isConnected?"Frame is cross-origin":"Frame is disconnected";e(new Error(n))}};let l=!1;o=()=>{s(),l||(i=setInterval(a,n))},t.addEventListener("load",a);const c=setTimeout(a,0);return()=>{l=!0,clearTimeout(c),s(),t.removeEventListener("load",a)}}class fo{constructor(t,n){e(this,"_config",void 0),e(this,"_frameObserver",void 0),this._config=n,this._frameObserver=new co(t,(t=>po(t,n)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function po(t,e,n){if(null!==t.contentDocument.querySelector("script.js-hypothesis-config"))return;await ho(t);const{assetRoot:i,notebookAppUrl:r,sidebarAppUrl:s}=C(document),a={...e,assetRoot:i,notebookAppUrl:r,sidebarAppUrl:s,subFrameIdentifier:null!=n?n:o(10)},l=document.createElement("script");l.className="js-hypothesis-config",l.setAttribute("data-remove-on-unload",""),l.type="application/json",l.innerText=JSON.stringify(a)
104
- ;const c=document.createElement("script");c.async=!0,c.src=e.clientUrl;const h=t.contentDocument;h.body.appendChild(l),h.body.appendChild(c)}class mo{constructor(t,i,o){if(e(this,"container",void 0),e(this,"_imageSizeObserver",void 0),e(this,"_listeners",void 0),e(this,"_updateTextLayerSize",void 0),i.length!==o.length)throw new Error("Char boxes length does not match text length");const r=t.parentNode,s=document.createElement("hypothesis-text-layer");r.insertBefore(s,t.nextSibling),r.style.position="relative",s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.color="transparent",s.style.textAlign="left",s.style.mixBlendMode="multiply";const a="sans-serif";s.style.fontSize="16px",s.style.fontFamily=a;const l=document.createElement("canvas").getContext("2d");l.font="16px sans-serif";const c=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,h=function(t,e){const n=[];let i={text:"",rect:new DOMRect};const o=()=>{i.text.length>0&&(n.push(i),i={text:"",rect:new DOMRect})}
103
+ ;t.contentDocument&&(null===(i=t.contentWindow)||void 0===i||i.addEventListener("unload",o))}}else{s();const n=t.isConnected?"Frame is cross-origin":"Frame is disconnected";e(new Error(n))}};let l=!1;o=()=>{s(),l||(i=setInterval(a,n))},t.addEventListener("load",a);const c=setTimeout(a,0);return()=>{l=!0,clearTimeout(c),s(),t.removeEventListener("load",a)}}class fo{constructor(t,n){e(this,"_config",void 0),e(this,"_frameObserver",void 0),this._config=n,this._frameObserver=new co(t,(t=>po(t,n)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function po(t,e,n){if(null!==t.contentDocument.querySelector("script.js-hypothesis-config"))return;await ho(t);const{assetRoot:i,notebookAppUrl:r,profileAppUrl:s,sidebarAppUrl:a}=C(document),l={...e,assetRoot:i,notebookAppUrl:r,profileAppUrl:s,sidebarAppUrl:a,subFrameIdentifier:null!=n?n:o(10)},c=document.createElement("script");c.className="js-hypothesis-config",c.setAttribute("data-remove-on-unload",""),c.type="application/json",c.innerText=JSON.stringify(l)
104
+ ;const h=document.createElement("script");h.async=!0,h.src=e.clientUrl;const u=t.contentDocument;u.body.appendChild(c),u.body.appendChild(h)}class mo{constructor(t,i,o){if(e(this,"container",void 0),e(this,"_imageSizeObserver",void 0),e(this,"_listeners",void 0),e(this,"_updateTextLayerSize",void 0),i.length!==o.length)throw new Error("Char boxes length does not match text length");const r=t.parentNode,s=document.createElement("hypothesis-text-layer");r.insertBefore(s,t.nextSibling),r.style.position="relative",s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.color="transparent",s.style.textAlign="left",s.style.mixBlendMode="multiply";const a="sans-serif";s.style.fontSize="16px",s.style.fontFamily=a;const l=document.createElement("canvas").getContext("2d");l.font="16px sans-serif";const c=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,h=function(t,e){const n=[];let i={text:"",rect:new DOMRect};const o=()=>{i.text.length>0&&(n.push(i),i={text:"",rect:new DOMRect})}
105
105
  ;for(const[n,r]of t.entries()){const t=e[n],s=/\s/.test(t);i.text.length>0&&!ri(i.rect,r)&&o(),i.rect=ai(i.rect,r),i.text+=s?" ":t,s&&o()}o();const r=[];let s={words:[],rect:new DOMRect};const a=()=>{s.words.length>0&&(r.push(s),s={words:[],rect:new DOMRect})};for(const t of n){const e=s.words[s.words.length-1];if(e){const n=li(e.rect),i=li(t.rect).x-n.x;(!ri(e.rect,t.rect)||i<0)&&a()}s.words.push(t),s.rect=ai(s.rect,t.rect)}a();const l=[];let c={lines:[],rect:new DOMRect};const h=()=>{c.lines.length>0&&(l.push(c),c={lines:[],rect:new DOMRect})};for(const t of r){const e=c.lines[c.lines.length-1];if(e){const n=li(e.rect),i=li(t.rect).y-n.y;(!si(e.rect,t.rect)||ri(e.rect,t.rect)||i<0||i>4*t.rect.height)&&h()}c.lines.push(t),c.rect=ai(c.rect,t.rect)}return h(),l}(i,o);for(const t of h){const e=document.createElement("hypothesis-text-column");e.style.display="block",e.style.position="absolute",e.style.left=c("x",t.rect.left),e.style.top=c("y",t.rect.top);let n=null;for(const i of t.lines){
106
106
  const o=document.createElement("hypothesis-text-line");o.style.display="block",o.style.marginLeft=c("x",i.rect.left-t.rect.left),o.style.height=c("y",i.rect.height),n&&(o.style.marginTop=c("y",i.rect.top-n.rect.bottom)),n=i,o.style.whiteSpace="nowrap";let r=null;for(const t of i.words){const e=document.createElement("hypothesis-text-word");e.style.display="inline-block",e.style.transformOrigin="top left",e.textContent=t.text,r&&(e.style.marginLeft=c("x",t.rect.left-r.rect.right)),r=t,e.style.width=c("x",t.rect.width),e.style.height=c("y",t.rect.height),e.style.whiteSpace="pre";const n=l.measureText(t.text),i=c("x",t.rect.width/n.width,""),s=c("y",t.rect.height/16,"");e.style.transform=`scale(${i}, ${s})`,o.append(e)}e.append(o)}s.append(e)}const u=()=>{const{width:e,height:n}=t.getBoundingClientRect();s.style.width=e+"px",s.style.height=n+"px",s.style.setProperty("--x-scale",`${e}`),s.style.setProperty("--y-scale",`${n}`)};u(),this.container=s,this._updateTextLayerSize=Pi(u,{maxWait:50}),
107
107
  this._listeners=new n,"undefined"!=typeof ResizeObserver&&(this._imageSizeObserver=new ResizeObserver((()=>{this._updateTextLayerSize()})),this._imageSizeObserver.observe(t)),this._listeners.add(window,"resize",this._updateTextLayerSize)}updateSync(){this._updateTextLayerSize(),this._updateTextLayerSize.flush()}destroy(){var t;this.container.remove(),this._listeners.removeAll(),this._updateTextLayerSize.cancel(),null===(t=this._imageSizeObserver)||void 0===t||t.disconnect()}}function go(t=document){return t.querySelector("mosaic-book")}function _o(t=window){var e;if(go(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&go(n)?"content":null}class vo{constructor(t){e(this,"_frameObserver",void 0);const n=go();if(!n)throw new Error("Book container element not found");const i=new WeakSet,o=n.shadowRoot,r=()=>{const e=o.querySelector("iframe");e&&!i.has(e)&&(i.add(e),uo(e,((n,i)=>{if(n)return;const o=i.body
@@ -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.1251.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),
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.1252.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){