hypothesis 1.1063.0 → 1.1066.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/README.md +5 -5
- package/build/boot.js +1 -1
- package/build/manifest.json +15 -15
- package/build/scripts/annotator.bundle.js +5 -5
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +83 -84
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/scripts/ui-playground.bundle.js +1 -1
- package/build/scripts/ui-playground.bundle.js.map +1 -1
- package/build/styles/annotator.css +4 -21
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/highlights.css.map +1 -1
- package/build/styles/katex.min.css.map +1 -1
- package/build/styles/pdfjs-overrides.css.map +1 -1
- package/build/styles/sidebar.css +4 -21
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +4 -21
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Hypothesis client
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
[][gha]
|
|
5
5
|
[][npm]
|
|
6
6
|
[][license]
|
|
7
7
|
|
|
8
|
-
[gha]: https://github.com/hypothesis/client/actions?query=branch%
|
|
8
|
+
[gha]: https://github.com/hypothesis/client/actions?query=branch%3Amain
|
|
9
9
|
[npm]: https://www.npmjs.com/package/hypothesis
|
|
10
|
-
[license]: https://github.com/hypothesis/client/blob/
|
|
10
|
+
[license]: https://github.com/hypothesis/client/blob/main/LICENSE
|
|
11
11
|
|
|
12
12
|
The Hypothesis client is a browser-based tool for making annotations on web
|
|
13
13
|
pages. It’s a client for the [Hypothesis web annotation service][service].
|
|
@@ -42,7 +42,7 @@ Please note that this project is released with a [Contributor Code of
|
|
|
42
42
|
Conduct][coc]. By participating in this project you agree to abide by its terms.
|
|
43
43
|
|
|
44
44
|
[ml]: https://groups.google.com/a/list.hypothes.is/g/dev
|
|
45
|
-
[coc]: https://github.com/hypothesis/client/blob/
|
|
45
|
+
[coc]: https://github.com/hypothesis/client/blob/main/CODE_OF_CONDUCT
|
|
46
46
|
|
|
47
47
|
License
|
|
48
48
|
-------
|
|
@@ -53,4 +53,4 @@ components are included. They are subject to their own licenses. All of the
|
|
|
53
53
|
license information can be found in the included [LICENSE][license] file.
|
|
54
54
|
|
|
55
55
|
[bsd2c]: http://www.opensource.org/licenses/BSD-2-Clause
|
|
56
|
-
[license]: https://github.com/hypothesis/client/blob/
|
|
56
|
+
[license]: https://github.com/hypothesis/client/blob/main/LICENSE
|
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?y(e.src):null}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var n=m(e);if(!n)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",n.hostname)).replace("{current_scheme}",n.protocol)}var v={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?y(e.src):null}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var n=m(e);if(!n)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",n.hostname)).replace("{current_scheme}",n.protocol)}var v={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?1126a3","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?71599b","styles/annotator.css":"styles/annotator.css?49e81f","styles/annotator.css.map":"styles/annotator.css.map?dfca24","styles/highlights.css":"styles/highlights.css?5dd56a","styles/highlights.css.map":"styles/highlights.css.map?34b9c1","styles/katex.min.css":"styles/katex.min.css?f17e3e","styles/katex.min.css.map":"styles/katex.min.css.map?010d5b","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?2eeb58","styles/sidebar.css":"styles/sidebar.css?66eeca","styles/sidebar.css.map":"styles/sidebar.css.map?b549f8","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?5740ac","styles/ui-playground.css.map":"styles/ui-playground.css.map?acf0b0","styles/ui-playground.css":"styles/ui-playground.css?452f9d","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?82caa2","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?e43309","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?b87bfa"};if(function(){var t=[function(){return Promise.resolve()},function(){return new Map},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 t.every((function(t){return t()}))}catch(t){return!1}}()){var g=function(e){for(var n={},r=e.querySelectorAll("script.js-hypothesis-config"),s=0;s<r.length;s++){var o=void 0;try{o=JSON.parse(r[s].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(n,o)}return n}(document),j=b(g.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1066.0/");if(document.querySelector("hypothesis-app")){!function(t,e){d(t,"fetch",e.apiUrl),d(t,"fetch",e.apiUrl+"links");var n,o=h(i),a=r([].concat(s(o),["scripts/sidebar.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!0})}catch(t){a.e(t)}finally{a.f()}for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)c(t,f(e,p[l]))}(document,{assetRoot:j,manifest:v,apiUrl:g.apiUrl})}else{var w=g,A=b(w.notebookAppUrl||"https://hypothes.is/notebook"),k=b(w.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){p(t,"sidebar","html",e.sidebarAppUrl),p(t,"notebook","html",e.notebookAppUrl),d(t,"style",f(e,"styles/annotator.css")),p(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var n,o=h(i),a=r([].concat(s(o),["scripts/annotator.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!1})}catch(t){a.e(t)}finally{a.f()}var l=[];void 0!==window.PDFViewerApplication&&l.push("styles/pdfjs-overrides.css"),l.push("styles/highlights.css");for(var y=0,m=l;y<m.length;y++)c(t,f(e,m[y]))}}(document,{assetRoot:j,manifest:v,notebookAppUrl:A,sidebarAppUrl:k})}}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,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
3
|
-
"
|
|
4
|
-
"styles/annotator.css
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?1126a3",
|
|
3
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?71599b",
|
|
4
|
+
"styles/annotator.css": "styles/annotator.css?49e81f",
|
|
5
|
+
"styles/annotator.css.map": "styles/annotator.css.map?dfca24",
|
|
5
6
|
"styles/highlights.css": "styles/highlights.css?5dd56a",
|
|
6
|
-
"styles/highlights.css.map": "styles/highlights.css.map?
|
|
7
|
+
"styles/highlights.css.map": "styles/highlights.css.map?34b9c1",
|
|
7
8
|
"styles/katex.min.css": "styles/katex.min.css?f17e3e",
|
|
8
|
-
"styles/katex.min.css.map": "styles/katex.min.css.map?
|
|
9
|
+
"styles/katex.min.css.map": "styles/katex.min.css.map?010d5b",
|
|
9
10
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
|
|
10
|
-
"
|
|
11
|
-
"styles/
|
|
12
|
-
"styles/sidebar.css.map": "styles/sidebar.css.map?
|
|
13
|
-
"
|
|
14
|
-
"styles/
|
|
15
|
-
"styles/ui-playground.css": "styles/ui-playground.css?
|
|
16
|
-
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
18
|
-
"scripts/
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?e946d3"
|
|
11
|
+
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?2eeb58",
|
|
12
|
+
"styles/sidebar.css": "styles/sidebar.css?66eeca",
|
|
13
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?b549f8",
|
|
14
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?5740ac",
|
|
15
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?acf0b0",
|
|
16
|
+
"styles/ui-playground.css": "styles/ui-playground.css?452f9d",
|
|
17
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?82caa2",
|
|
18
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?e43309",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?b87bfa"
|
|
20
20
|
}
|
|
@@ -10,7 +10,7 @@ null!=d.componentWillUpdate&&d.componentWillUpdate(b,d.__s,x),null!=d.componentD
|
|
|
10
10
|
null!=s)for(;v<s.length;v++)if((h=s[v])&&"setAttribute"in h==!!_&&(_?h.localName===_:3===h.nodeType)){t=h,s[v]=null;break}if(null==t){if(null===_)return document.createTextNode(m);t=r?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,m.is&&m),s=null,l=!1}if(null===_)p===m||l&&t.data===m||(t.data=m);else{if(s=s&&e.call(t.childNodes),d=(p=o.props||a).dangerouslySetInnerHTML,f=m.dangerouslySetInnerHTML,!l){if(null!=s)for(p={},v=0;v<t.attributes.length;v++)p[t.attributes[v].name]=t.attributes[v].value;(f||d)&&(f&&(d&&f.__html==d.__html||f.__html===t.innerHTML)||(t.innerHTML=f&&f.__html||""))}if(function(t,e,n,o,i){var r;for(r in n)"children"===r||"key"===r||r in e||x(t,r,null,n[r],o);for(r in e)i&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||x(t,r,e[r],n[r],o)}(t,m,p,r,l),f)n.__k=[];else if(v=n.props.children,y(t,Array.isArray(v)?v:[v],n,o,i,r&&"foreignObject"!==_,s,c,s?s[0]:o.__k&&g(o,0),l),
|
|
11
11
|
null!=s)for(v=s.length;v--;)null!=s[v]&&u(s[v]);l||("value"in m&&void 0!==(v=m.value)&&(v!==t.value||"progress"===_&&!v||"option"===_&&v!==p.value)&&x(t,"value",v,p.value,!1),"checked"in m&&void 0!==(v=m.checked)&&v!==t.checked&&x(t,"checked",v,p.checked,!1))}return t}function R(t,e,o){try{"function"==typeof t?t(e):t.current=e}catch(t){n.__e(t,o)}}function L(t,e,o){var i,r;if(n.unmount&&n.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||R(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){n.__e(t,e)}i.base=i.__P=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&L(i[r],e,"function"!=typeof t.type);o||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function P(t,e,n){return this.constructor(t,n)}function M(t,o,i){var r,s,c;n.__&&n.__(t,o),s=(r="function"==typeof i)?null:i&&i.__k||o.__k,c=[],T(o,t=(!r&&i||o).__k=function(t,n,o){var i,r,s,a={};for(s in n)"key"==s?i=n[s]:"ref"==s?r=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),
|
|
12
12
|
"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return d(t,a,i,r,null)}(f,null,[t]),s||a,a,void 0!==o.ownerSVGElement,!r&&i?[i]:s?null:o.firstChild?e.call(o.childNodes):null,c,!r&&i?i:s?s.__e:o.firstChild,r),A(c,t)}e=c.slice,n={__e:function(t,e,n,o){for(var i,r,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,o||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},o=0,p.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof t&&(t=t(h({},n),this.props)),t&&h(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),_(this))},p.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),_(this))},p.prototype.render=f,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,v.__r=0,
|
|
13
|
-
"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.7.
|
|
13
|
+
"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.7.3",n,{Fragment:f,Component:p});var N={};function O(t){return t.type===f?"Fragment":"function"==typeof t.type?t.type.displayName||t.type.name:"string"==typeof t.type?t.type:"#text"}var I=[],D=[];function B(){return I.length>0?I[I.length-1]:null}var F=!1;function H(t){return"function"==typeof t.type&&t.type!=f}function V(t){for(var e=[t],n=t;null!=n.__o;)e.push(n.__o),n=n.__o;return e.reduce((function(t,e){t+=" in "+O(e);var n=e.__source;return n?t+=" (at "+n.fileName+":"+n.lineNumber+")":F||(F=!0,console.warn("Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.")),t+"\n"}),"")}var q="function"==typeof WeakMap,U=p.prototype.setState;p.prototype.setState=function(t,e){
|
|
14
14
|
return null==this.__v?null==this.state&&console.warn('Calling "this.setState" inside the constructor of a component is a no-op and might be a bug in your application. Instead, set "this.state = {}" directly.\n\n'+V(B())):null==this.__P&&console.warn('Can\'t call "this.setState" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+V(this.__v)),U.call(this,t,e)};var W=p.prototype.forceUpdate;function z(t){var e=t.props,n=O(t),o="";for(var i in e)if(e.hasOwnProperty(i)&&"children"!==i){var r=e[i];"function"==typeof r&&(r="function "+(r.displayName||r.name)+"() {}"),r=Object(r)!==r||r.toString?r+"":Object.prototype.toString.call(r),o+=" "+i+"="+JSON.stringify(r)}var s=e.children;return"<"+n+o+(s&&s.length?">..</"+n+">":" />")}p.prototype.forceUpdate=function(t){
|
|
15
15
|
return null==this.__v?console.warn('Calling "this.forceUpdate" inside the constructor of a component is a no-op and might be a bug in your application.\n\n'+V(B())):null==this.__P&&console.warn('Can\'t call "this.forceUpdate" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+V(this.__v)),W.call(this,t)},function(){!function(){var t=n.__b,e=n.diffed,o=n.__,i=n.vnode,r=n.__r;n.diffed=function(t){H(t)&&D.pop(),I.pop(),e&&e(t)},n.__b=function(e){H(e)&&I.push(e),t&&t(e)},n.__=function(t,e){D=[],o&&o(t,e)},n.vnode=function(t){t.__o=D.length>0?D[D.length-1]:null,i&&i(t)},n.__r=function(t){H(t)&&D.push(t),r&&r(t)}}();var t=!1,e=n.__b,o=n.diffed,i=n.vnode,r=n.__e,s=n.__,a=n.__h,c=q?{useEffect:new WeakMap,useLayoutEffect:new WeakMap,lazyPropTypes:new WeakMap}:null,l=[];n.__e=function(t,e,n,o){if(e&&e.__c&&"function"==typeof t.then){var i=t
|
|
16
16
|
;t=new Error("Missing Suspense. The throwing component was: "+O(e));for(var s=e;s;s=s.__)if(s.__c&&s.__c.__c){t=i;break}if(t instanceof Error)throw t}try{(o=o||{}).componentStack=V(e),r(t,e,n,o),"function"!=typeof t.then&&setTimeout((function(){throw t}))}catch(t){throw t}},n.__=function(t,e){if(!e)throw new Error("Undefined parent passed to render(), this is the second argument.\nCheck if the element is available in the DOM/has the correct id.");var n;switch(e.nodeType){case 1:case 11:case 9:n=!0;break;default:n=!1}if(!n){var o=O(t);throw new Error("Expected a valid HTML node as a second argument to render.\tReceived "+e+" instead: render(<"+o+" />, "+e+");")}s&&s(t,e)},n.__b=function(n){var o=n.type,i=function t(e){return e?"function"==typeof e.type?t(e.__):e:{}}(n.__);if(t=!0,void 0===o)throw new Error("Undefined component passed to createElement()\n\nYou likely forgot to export your component or might have mixed up default and named imports"+z(n)+"\n\n"+V(n));if(null!=o&&"object"==typeof o){
|
|
@@ -45,7 +45,7 @@ this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),zt(t,"connect");
|
|
|
45
45
|
const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t);let n;function o(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=Gt(e.ignoreOtherConfiguration)?{}:Yt(t.document),{get annotations(){return Kt(n.annotations)||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return Zt(t,"hypothesis-client","javascript")},get group(){return Kt(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return Zt(t,"notebook","html")},get showHighlights(){return function(){const t=o("showHighlights");switch(t){case"always":case"never":case"whenSidebarOpen":return t;default:return"always";case!1:return"never"}}()},get sidebarAppUrl(){return Zt(t,"sidebar","html")},get query(){return Kt(n.query)||function(){
|
|
46
46
|
const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:o}}function Qt(t,e){return t.hostPageSetting(e)}const te={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:Qt},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:Qt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentPartner:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:Gt,getValue:Qt
|
|
47
47
|
},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},services:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.notebookAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:Qt},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt}};function ee(t,e=window){const n=Jt(e),o={};for(let r of function(t){const e={annotator:["clientUrl","contentPartner","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],
|
|
48
|
-
notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t)){const t=te[r],s=void 0!==t.defaultValue,a=!((i=Zt(e,"sidebar","html")).startsWith("http://")||i.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(o[r]=t.defaultValue);continue}const c=t.getValue(n,r);void 0!==c?o[r]=t.coerce?t.coerce(c):c:s&&(o[r]=t.defaultValue)}var i;return o}const ne={alt:1,ctrl:2,meta:4,shift:8};function oe(t,e,{rootElement:n=document.documentElement}){const o=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let o=0,i=null;for(let t of n){const e=ne[t];if(e)o|=e;else{if(null!==i)throw new Error("Multiple non-modifier keys specified");i=t}}if(!i)throw new Error(`Invalid shortcut: ${e}`)
|
|
48
|
+
notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t)){const t=te[r],s=void 0!==t.defaultValue,a=!((i=Zt(e,"sidebar","html")).startsWith("http://")||i.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(o[r]=t.defaultValue);continue}const c=t.getValue(n,r);void 0!==c?o[r]=t.coerce?t.coerce(c):c:s&&(o[r]=t.defaultValue)}var i;return o}const ne={alt:1,ctrl:2,meta:4,shift:8};function oe(t,e,{rootElement:n=document.documentElement}={}){const o=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let o=0,i=null;for(let t of n){const e=ne[t];if(e)o|=e;else{if(null!==i)throw new Error("Multiple non-modifier keys specified");i=t}}if(!i)throw new Error(`Invalid shortcut: ${e}`)
|
|
49
49
|
;return((t.ctrlKey?ne.ctrl:0)|(t.metaKey?ne.meta:0)|(t.altKey?ne.alt:0)|(t.shiftKey?ne.shift:0))===o&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===i})(n,t)&&e(n)};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)}function ie(t,e,{rootElement:n}={}){st((()=>{if(t)return oe(t,e,{rootElement:n})}),[t,e,n])}function re({badgeCount:t}){return mt("span",{className:Z("rounded px-1 py-0.5","text-color-text-inverted font-bold bg-grey-7","dim-bg"),children:t})}function se({arrowDirection:t}){return mt(Et,{name:"pointer",classes:Z("absolute left-1/2 -translate-x-1/2","h-auto w-auto z-2","text-grey-3 fill-white",{"rotate-180":"down"===t,"top-0 -translate-y-full":"up"===t})})}function ae({badgeCount:t,icon:e,label:n,onClick:o,shortcut:i}){ie(i,o);const r=i?`${n} (${i})`:n;return mt(xt,{
|
|
50
50
|
className:Z("flex flex-col gap-y-1 items-center py-2.5 px-2","text-annotator-sm leading-none text-grey-7","transition-colors duration-200","dim-item"),onClick:o,title:r,children:[e&&mt(Et,{classes:"text-annotator-lg",name:e,title:r}),"number"==typeof t&&mt(re,{badgeCount:t}),mt("span",{className:"font-normal",children:n})]})}function ce({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:o=0}){const i=e?"a":null,r=e?"h":null,s=e?"s":null;return ie(e?"Escape":null,(()=>n("hide"))),mt("div",{className:Z("AdderToolbar","absolute select-none bg-white rounded shadow-adder-toolbar","border border-solid border-grey-3","opacity-5",{"animate-adder-pop-up":"up"===t&&e,"animate-adder-pop-down":"down"===t&&e}),dir:"ltr",style:{visibility:e?"visible":"hidden"},children:[mt("div",{className:"flex dim-items-on-hover",children:[mt(ae,{icon:"annotate",onClick:()=>n("annotate"),label:"Annotate",shortcut:i}),mt(ae,{icon:"highlight",onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),o>0&&mt(f,{children:[mt("div",{
|
|
51
51
|
className:Z("m-1.5 border-r border-grey-4 border-solid")}),mt(ae,{badgeCount:o,onClick:()=>n("show"),label:"Show",shortcut:s})]})]}),mt(se,{arrowDirection:t})]})}const le=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function he(t){const e=t.attachShadow({mode:"open"});!function(t){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 o=document.createElement("link");o.rel="stylesheet",o.href=n,t.appendChild(o)}(e);const n=window.applyFocusVisiblePolyfill;var o;return n&&n(e),(o=e).addEventListener("mouseup",(t=>t.stopPropagation())),o.addEventListener("mousedown",(t=>t.stopPropagation())),o.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0}),e}function ue(t){return t.toString()+"px"}class de{constructor(t,e){this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),this._shadowRoot=he(this._outerContainer),
|
|
@@ -60,7 +60,7 @@ if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRa
|
|
|
60
60
|
t.forEach((t=>{if(t.svgHighlight){if(t.svgHighlight.classList.toggle("is-focused",e),e){t.svgHighlight.parentNode.append(t.svgHighlight)}}else t.classList.toggle("hypothesis-highlight-focused",e)}))}function Re(t){const e=t.map((t=>t.getBoundingClientRect()));return e.reduce(((t,e)=>({top:Math.min(t.top,e.top),left:Math.min(t.left,e.left),bottom:Math.max(t.bottom,e.bottom),right:Math.max(t.right,e.right)})))}class Le{constructor({contentContainer:t,hostRPC:e}){this._hostRPC=e,this._updatePending=!1,this._anchors=[],this._listeners=new kt,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(t,"scroll",(()=>this.update()))}destroy(){this._listeners.removeAll()}update(t){t&&(this._anchors=t),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const t=function(t){const e=[];return t.forEach((({annotation:t,highlights:n})=>{if(null==n||!n.length)return;const{top:o,bottom:i}=Re(n);o>=i||e.push({tag:t.$tag,top:o,
|
|
61
61
|
bottom:i})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}let Pe=new Set;function Me(...t){const e=t.join();Pe.has(e)||(console.warn(...t),Pe.add(e))}Me.reset=()=>{Pe.clear()};const Ne=["html_side_by_side"];class Oe extends Dt{constructor(t=Ne){super(),this._flags=new Map,this._knownFlags=t}update(t){this._flags.clear();for(let[e,n]of Object.entries(t))this._flags.set(e,n);this.emit("flagsChanged")}flagEnabled(t){var e;return this._knownFlags.includes(t)?null!==(e=this._flags.get(t))&&void 0!==e&&e:(Me("Looked up unknown feature",t),!1)}allFlags(){return Object.fromEntries(this._flags)}}function Ie(t){return t.split("").reverse().join("")}function De(t){return(t|-t)>>31&1}function Be(t,e,n,o){let i=t.P[n],r=t.M[n];const s=o>>>31,a=e[n]|s,c=a|r,l=(a&i)+i^i|a;let h=r|~(l|i),u=i&l;const d=De(h&t.lastRowMask[n])-De(u&t.lastRowMask[n]);return h<<=1,u<<=1,u|=s,h|=De(o)-s,i=u|~(c|h),r=h&c,t.P[n]=i,t.M[n]=r,d}function Fe(t,e,n){
|
|
62
62
|
if(0===e.length)return[];n=Math.min(n,e.length);const o=[],i=32,r=Math.ceil(e.length/i)-1,s={P:new Uint32Array(r+1),M:new Uint32Array(r+1),lastRowMask:new Uint32Array(r+1)};s.lastRowMask.fill(1<<31),s.lastRowMask[r]=1<<(e.length-1)%i;const a=new Uint32Array(r+1),c=new Map,l=[];for(let t=0;t<256;t++)l.push(a);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(c.has(n))continue;const o=new Uint32Array(r+1);c.set(n,o),n<l.length&&(l[n]=o);for(let t=0;t<=r;t+=1){o[t]=0;for(let r=0;r<i;r+=1){const s=t*i+r;if(s>=e.length)continue;e.charCodeAt(s)===n&&(o[t]|=1<<r)}}}let h=Math.max(0,Math.ceil(n/i)-1);const u=new Uint32Array(r+1);for(let t=0;t<=h;t+=1)u[t]=(t+1)*i;u[r]=e.length;for(let t=0;t<=h;t+=1)s.P[t]=-1,s.M[t]=0;for(let d=0;d<t.length;d+=1){const f=t.charCodeAt(d);let p;f<l.length?p=l[f]:(p=c.get(f),void 0===p&&(p=a));let g=0;for(let t=0;t<=h;t+=1)g=Be(s,p,t,g),u[t]+=g;if(u[h]-g<=n&&h<r&&(1&p[h+1]||g<0)){let t;if(h+=1,s.P[h]=-1,s.M[h]=0,h===r){const n=e.length%i;t=0===n?i:n}else t=i
|
|
63
|
-
;u[h]=u[h-1]+t-g+Be(s,p,h,g)}else for(;h>0&&u[h]>=n+i;)h-=1;h===r&&u[h]<=n&&(u[h]<n&&o.splice(0,o.length),o.push({start:-1,end:d+1,errors:u[h]}),n=u[h])}return o}function He(t,e,n){return function(t,e,n){const o=Ie(e);return n.map((n=>{const i=Math.max(0,n.end-e.length-n.errors);return{start:Fe(Ie(t.slice(i,n.end)),o,n.errors).reduce(((t,e)=>n.end-e.end<t?n.end-e.end:t),n.end),end:n.end,errors:n.errors}}))}(t,e,Fe(t,e,n))}function Ve(t,e,n){let o=0,i=[];for(;-1!==o;)o=t.indexOf(e,o),-1!==o&&(i.push({start:o,end:o+e.length,errors:0}),o+=1);return i.length>0?i:He(t,e,n)}function qe(t,e){if(0===e.length||0===t.length)return 0;return 1-Ve(t,e,e.length)[0].errors/e.length}function Ue(t,e,n){if(0===e.length)return null;const o=Math.min(256,e.length/2),i=Ve(t,e,o);if(0===i.length)return null;const r=o=>{const i=1-o.errors/e.length,r=n.prefix?qe(t.slice(Math.max(0,o.start-n.prefix.length),o.start),n.prefix):1,s=n.suffix?qe(t.slice(o.end,o.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){
|
|
63
|
+
;u[h]=u[h-1]+t-g+Be(s,p,h,g)}else for(;h>0&&u[h]>=n+i;)h-=1;h===r&&u[h]<=n&&(u[h]<n&&o.splice(0,o.length),o.push({start:-1,end:d+1,errors:u[h]}),n=u[h])}return o}function He(t,e,n){return function(t,e,n){const o=Ie(e);return n.map((n=>{const i=Math.max(0,n.end-e.length-n.errors);return{start:Fe(Ie(t.slice(i,n.end)),o,n.errors).reduce(((t,e)=>n.end-e.end<t?n.end-e.end:t),n.end),end:n.end,errors:n.errors}}))}(t,e,Fe(t,e,n))}function Ve(t,e,n){let o=0,i=[];for(;-1!==o;)o=t.indexOf(e,o),-1!==o&&(i.push({start:o,end:o+e.length,errors:0}),o+=1);return i.length>0?i:He(t,e,n)}function qe(t,e){if(0===e.length||0===t.length)return 0;return 1-Ve(t,e,e.length)[0].errors/e.length}function Ue(t,e,n={}){if(0===e.length)return null;const o=Math.min(256,e.length/2),i=Ve(t,e,o);if(0===i.length)return null;const r=o=>{const i=1-o.errors/e.length,r=n.prefix?qe(t.slice(Math.max(0,o.start-n.prefix.length),o.start),n.prefix):1,s=n.suffix?qe(t.slice(o.end,o.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){
|
|
64
64
|
a=1-Math.abs(o.start-n.hint)/t.length}return(50*i+20*r+20*s+2*a)/92},s=i.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function We(t){const e=function(t){const e=t.nodeName.toLowerCase();let n=e;return"#text"===e&&(n="text()"),n}(t),n=function(t){let e=0,n=t;for(;n;)n.nodeName===t.nodeName&&(e+=1),n=n.previousSibling;return e}(t);return`${e}[${n}]`}function ze(t,e){let n="",o=t;for(;o!==e;){if(!o)throw new Error("Node is not a descendant of root");n=We(o)+"/"+n,o=o.parentNode}return n="/"+n,n=n.replace(/\/$/,""),n}function $e(t,e,n){e=e.toUpperCase();let o=-1;for(let i=0;i<t.children.length;i++){const r=t.children[i];if(r.nodeName.toUpperCase()===e&&(++o,o===n))return r}return null}function je(t,e=document.body){try{return function(t,e){if(null===t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+\])?)+$/))throw new Error("Expression is not a simple XPath");const n=t.split("/");let o=e;n.shift();for(let t of n){let e,n;const i=t.indexOf("[");if(-1!==i){e=t.slice(0,i)
|
|
65
65
|
;const o=t.slice(i+1,t.indexOf("]"));if(n=parseInt(o)-1,n<0)return null}else e=t,n=0;const r=$e(o,e,n);if(!r)return null;o=r}return o}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class Xe{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new Xe(t,e)}static fromSelector(t,e){const n=je(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const o=je(e.endContainer,t);if(!o)throw new Error("Failed to resolve endContainer XPath");const i=me.fromCharOffset(n,e.startOffset),r=me.fromCharOffset(o,e.endOffset),s=new _e(i,r).toRange();return new Xe(t,s)}toRange(){return this.range}toSelector(){const t=_e.fromRange(this.range).toRange(),e=_e.fromRange(t),n=ze(e.start.element,this.root),o=ze(e.end.element,this.root);return{type:"RangeSelector",startContainer:n,startOffset:e.start.offset,endContainer:o,endOffset:e.end.offset}}}class Ye{constructor(t,e,n){this.root=t,this.start=e,this.end=n}
|
|
66
66
|
static fromRange(t,e){const n=_e.fromRange(e).relativeTo(t);return new Ye(t,n.start.offset,n.end.offset)}static fromSelector(t,e){return new Ye(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return _e.fromOffsets(this.root,this.start,this.end).toRange()}}class Ge{constructor(t,e,n={}){this.root=t,this.exact=e,this.context=n}static fromRange(t,e){const n=t.textContent,o=_e.fromRange(e).relativeTo(t),i=o.start.offset,r=o.end.offset;return new Ge(t,n.slice(i,r),{prefix:n.slice(Math.max(0,i-32),i),suffix:n.slice(r,Math.min(n.length,r+32))})}static fromSelector(t,e){const{prefix:n,suffix:o}=e;return new Ge(t,e.exact,{prefix:n,suffix:o})}toSelector(){return{type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(t={}){return this.toPositionAnchor(t).toRange()}toPositionAnchor(t={}){const e=Ue(this.root.textContent,this.exact,{...this.context,hint:t.hint});if(!e)throw new Error("Quote not found")
|
|
@@ -96,7 +96,7 @@ e.style.position="absolute",e.style.left=a("x",t.rect.left),e.style.top=a("y",t.
|
|
|
96
96
|
i.style.setProperty("--y-scale",`${n}`)};l(),this.container=i,this._updateTextLayerSize=Un(l,{maxWait:50}),this._listeners=new kt,"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()}}class So{constructor(t,e){this._config=e,this._frameObserver=new wo(t,(t=>Eo(t,e)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function Eo(t,e){if(null!==t.contentDocument.querySelector("script.js-hypothesis-config"))return;await bo(t);const{assetRoot:n,notebookAppUrl:o,sidebarAppUrl:i}=Yt(document),r={...e,assetRoot:n,notebookAppUrl:o,sidebarAppUrl:i,subFrameIdentifier:Lt(10)},s=document.createElement("script")
|
|
97
97
|
;s.className="js-hypothesis-config",s.type="application/json",s.innerText=JSON.stringify(r);const a=document.createElement("script");a.async=!0,a.src=e.clientUrl;const c=t.contentDocument;c.body.appendChild(s),c.body.appendChild(a)}function To(t=document){return t.querySelector("mosaic-book")}function Ao(t=window){var e;if(To(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&To(n)?"content":null}class ko{constructor(t){const e=To();if(!e)throw new Error("Book container element not found");const n=new WeakSet,o=e.shadowRoot,i=()=>{const e=o.querySelector("iframe");e&&!n.has(e)&&(n.add(e),Co(e,((n,o)=>{const i=null==o?void 0:o.body;i&&!i.querySelector("#page-content")&&Eo(e,t)})))};i(),this._frameObserver=new MutationObserver(i),this._frameObserver.observe(o,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}}function Ro(){return document.querySelector("img#pbk-page")}class Lo{constructor(t=document.body){const e=new Oe;e.update({
|
|
98
98
|
html_side_by_side:!0}),this._htmlIntegration=new An({container:t,features:e}),this._listeners=new kt;const n=["mouseup","mousedown","mouseout"];for(let t of n)this._listeners.add(document.documentElement,t,(t=>{t.stopPropagation()}));const o=window.frameElement;o&&function(t){if("no"!==t.getAttribute("scrolling"))return;const e=document.createElement("style");e.textContent="iframe { height: 100% !important; }",t.insertAdjacentElement("beforebegin",e);const n=()=>t.removeAttribute("scrolling");n(),new MutationObserver(n).observe(t,{attributes:!0})}(o);const i=Ro(),r=window.innerPageData;if(i&&r){const t=r.glyphs.glyphs.map((t=>{const e=t.l/100,n=t.r/100,o=t.t/100,i=t.b/100;return new DOMRect(e,o,n-e,i-o)}));this._textLayer=new xo(i,t,r.words),this._textLayer.container.style.zIndex="100"}}canAnnotate(){return!0}destroy(){var t;null===(t=this._textLayer)||void 0===t||t.destroy(),this._listeners.removeAll(),this._htmlIntegration.destroy()}anchor(t,e){return this._htmlIntegration.anchor(t,e)}describe(t,e){
|
|
99
|
-
return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(t){const e=Ro();if(e&&this._textLayer){const n=e.parentElement,o=this._textLayer,i=window.innerWidth-t.width;return gn((()=>{t.expanded&&i>480?(n.style.textAlign="left",e.style.width=`${i}px`):(n.style.textAlign="",e.style.width=""),o.updateSync()})),t.expanded}return this._htmlIntegration.fitSideBySide(t)}async getMetadata(){return{title:document.title,link:[]}}async uri(){const t=new URL(document.location.href);return t.search="",t.toString()}async scrollToAnchor(t){return this._htmlIntegration.scrollToAnchor(t)}}function Po(t,{contentPartner:e}){if("undefined"!=typeof PDFViewerApplication)return new yo(t,{contentPartner:e});return"content"===Ao()?new Lo:new An({features:t.features})}function Mo(t){const e=t.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);return n.collapsed?null:n}class No{constructor(t,e=document){let n=!1;this._pendingCallback=null
|
|
99
|
+
return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(t){const e=Ro();if(e&&this._textLayer){const n=e.parentElement,o=this._textLayer,i=window.innerWidth-t.width;return gn((()=>{t.expanded&&i>480?(n.style.textAlign="left",e.style.width=`${i}px`):(n.style.textAlign="",e.style.width=""),o.updateSync()})),t.expanded}return this._htmlIntegration.fitSideBySide(t)}async getMetadata(){return{title:document.title,link:[]}}async uri(){const t=new URL(document.location.href);return t.search="",t.toString()}async scrollToAnchor(t){return this._htmlIntegration.scrollToAnchor(t)}}function Po(t,{contentPartner:e}={}){if("undefined"!=typeof PDFViewerApplication)return new yo(t,{contentPartner:e});return"content"===Ao()?new Lo:new An({features:t.features})}function Mo(t){const e=t.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);return n.collapsed?null:n}class No{constructor(t,e=document){let n=!1;this._pendingCallback=null
|
|
100
100
|
;const o=(n=10)=>{this._pendingCallback=setTimeout((()=>{t(Mo(e))}),n)},i=t=>{if("mousedown"===t.type&&(n=!0),"mouseup"===t.type&&(n=!1),n)return;this._cancelPendingCallback();const e="mouseup"===t.type?10:100;o(e)};this._document=e,this._listeners=new kt,this._listeners.add(e,"selectionchange",i),this._listeners.add(e.body,"mousedown",i),this._listeners.add(e.body,"mouseup",i),o(1)}disconnect(){this._listeners.removeAll(),this._cancelPendingCallback()}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}}function Oo(){const t=function(t,e){const n=new Set,o=new Set;return Ce(t,(t=>{let i=t;for(;i&&!n.has(i);){n.add(i);const t=e(i);null!=t&&o.add(t),i=i.parentNode}})),[...o]}(window.getSelection().getRangeAt(0),(t=>{var e;return null===(e=t._annotation)||void 0===e?void 0:e.$tag}));return t}function Io(t){const e=function(t){let e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;const n=[]
|
|
101
101
|
;for(;e;)e.classList.contains("hypothesis-highlight")&&n.push(e),e=e.parentElement;return n}(t).map((t=>t._annotation)).filter((t=>void 0!==t)).map((t=>null==t?void 0:t.$tag));return e}function Do(t){if(!t.range)return null;try{return t.range.toRange()}catch{return null}}function Bo(){var t;null===(t=document.getSelection())||void 0===t||t.removeAllRanges()}class Fo{constructor(t,e={},n=window){this.element=t,this._hostFrame=n,this._highlightsVisible=!1,this._isAdderVisible=!1,this._informHostOnNextSelectionClear=!0,this.selectedRanges=[],this._adder=new de(this.element,{onAnnotate:()=>this.createAnnotation(),onHighlight:()=>this.createAnnotation({highlight:!0}),onShowAnnotations:t=>this.selectAnnotations(t)}),this._selectionObserver=new No((t=>{t?this._onSelection(t):this._onClearSelection()})),this.anchors=[],this._annotations=new Set,this._frameIdentifier=e.subFrameIdentifier||null,this._portFinder=new Nt({hostFrame:this._hostFrame,source:"guest"}),this.features=new Oe,this._integration=Po(this,{
|
|
102
102
|
contentPartner:e.contentPartner}),this._hostRPC=new jt,this._connectHost(n),this._sidebarRPC=new jt,this._connectSidebar(),this._bucketBarClient=new Le({contentContainer:this._integration.contentContainer(),hostRPC:this._hostRPC}),this._sideBySideActive=!1,this._listeners=new kt,this._setupElementEvents(),this._focusedAnnotations=new Set}_setupElementEvents(){const t=t=>{this._sideBySideActive||Io(t).length||this._sidebarRPC.call("closeSidebar")};this._listeners.add(this.element,"mouseup",(t=>{const{target:e,metaKey:n,ctrlKey:o}=t,i=Io(e);if(i.length&&this._highlightsVisible){const t=n||o;this.selectAnnotations(i,t)}})),this._listeners.add(this.element,"mousedown",(({target:e})=>{t(e)})),this._listeners.add(this.element,"touchstart",(({target:e})=>{t(e)})),this._listeners.add(this.element,"mouseover",(({target:t})=>{const e=Io(t);e.length&&this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",e)})),this._listeners.add(this.element,"mouseout",(()=>{
|
|
@@ -105,7 +105,7 @@ this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",[])})),this._l
|
|
|
105
105
|
this.getDocumentInfo().then((t=>this._sidebarRPC.call("documentInfoChanged",t)))}destroy(){this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),function(t){Ae(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{const e=Do(t);if(!e)return;const n=Ee(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&ke(n,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const o=await this._integration.anchor(this.element,e.selector),i=_e.fromRange(o);n={annotation:t,target:e,range:i}}catch(o){n={annotation:t,target:e}}return n})))
|
|
106
106
|
;if(!this._annotations.has(t.$tag))return[];for(let 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(let e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&Ae(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Lt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Bo(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){
|
|
107
107
|
const n=t.includes(e.annotation.$tag);ke(e.highlights,n)}this._sidebarRPC.call("focusAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,o=0;for(let r of t){var i;if(null===(i=r.highlights)||void 0===i||!i.length)continue;const t=Re(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>o||"down"===e&&t<o)&&(n=r,o=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=we(e),o=xe(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Oo(),this._isAdderVisible=!0,this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}
|
|
108
|
-
selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Ho(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Vo(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.
|
|
108
|
+
selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Ho(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Vo(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.1066.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),Array.isArray(o.services)&&(null===(n=o.services)||void 0===n?void 0:n.length)>0){const t=o.services[0]
|
|
109
109
|
;t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return o}function qo({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Ho(t.notebookAppUrl,{...Vo(t.notebookAppUrl,t),group:e})})}function Uo({eventBus:t,config:e}){const[n,o]=rt(0),[i,r]=rt(!0),[s,a]=rt(null),c=ct(""),l=ct(null);st((()=>(c.current=document.body.style.overflow,()=>{document.body.style.overflow=c.current})),[]),st((()=>{document.body.style.overflow=i?c.current:"hidden"}),[i]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),l.current=e,()=>{e.destroy()}}),[t]);return null===s?null:mt("div",{className:Z("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:i}),"data-testid":"notebook-outer",
|
|
110
110
|
children:mt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[mt("div",{className:"absolute right-0 text-xl m-3",children:mt(Ct,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=l.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),mt(qo,{config:e,groupId:s},n)]})})}class Wo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=he(this._outerContainer),M(mt(Uo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var zo={exports:{}};!function(t){!function(e,n,o,i){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),c=Math.round,l=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var o;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(o=0;o<t.length;)e.call(n,t[o],o,t),
|
|
111
111
|
o++;else for(o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function p(t,n,o){var i="DEPRECATED METHOD: "+n+"\n"+o+" AT \n";return function(){var n=new Error("get-stack-trace"),o=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,i,o),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===i||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(o!==i&&null!==o)for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var o=Object.keys(e),r=0;r<o.length;)(!n||n&&t[o[r]]===i)&&(t[o[r]]=e[o[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function _(t,e,n){var o,i=e.prototype;(o=t.prototype=Object.create(i)).constructor=t,
|