hypothesis 1.1040.0 → 1.1041.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";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?7d20c7","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?dc7bc7","styles/annotator.css":"styles/annotator.css?d5ef09","styles/annotator.css.map":"styles/annotator.css.map?081a1e","styles/highlights.css":"styles/highlights.css?5dd56a","styles/highlights.css.map":"styles/highlights.css.map?f623a8","styles/katex.min.css":"styles/katex.min.css?ac2365","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?203ad9","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?ed2cb3","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?13b830","styles/sidebar.css":"styles/sidebar.css?a6e87b","styles/sidebar.css.map":"styles/sidebar.css.map?8395ca","styles/ui-playground.css":"styles/ui-playground.css?073684","styles/ui-playground.css.map":"styles/ui-playground.css.map?48ad36","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?48099a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?a348e9","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?7a970c"};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.1040.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/.")}();
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?28972b","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?dc7bc7","styles/annotator.css":"styles/annotator.css?d5ef09","styles/annotator.css.map":"styles/annotator.css.map?081a1e","styles/highlights.css":"styles/highlights.css?5dd56a","styles/highlights.css.map":"styles/highlights.css.map?f623a8","styles/katex.min.css":"styles/katex.min.css?ac2365","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?ed2cb3","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?13b830","styles/sidebar.css":"styles/sidebar.css?a6e87b","styles/sidebar.css.map":"styles/sidebar.css.map?8395ca","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?203ad9","styles/ui-playground.css.map":"styles/ui-playground.css.map?48ad36","styles/ui-playground.css":"styles/ui-playground.css?073684","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?ff911f","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?48099a","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?f1a12c"};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.1041.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/.")}();
@@ -1,20 +1,20 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?7d20c7",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?28972b",
3
3
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?dc7bc7",
4
4
  "styles/annotator.css": "styles/annotator.css?d5ef09",
5
5
  "styles/annotator.css.map": "styles/annotator.css.map?081a1e",
6
6
  "styles/highlights.css": "styles/highlights.css?5dd56a",
7
7
  "styles/highlights.css.map": "styles/highlights.css.map?f623a8",
8
8
  "styles/katex.min.css": "styles/katex.min.css?ac2365",
9
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?203ad9",
10
9
  "styles/katex.min.css.map": "styles/katex.min.css.map?4daef7",
11
10
  "styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?ed2cb3",
12
11
  "styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?13b830",
13
12
  "styles/sidebar.css": "styles/sidebar.css?a6e87b",
14
13
  "styles/sidebar.css.map": "styles/sidebar.css.map?8395ca",
15
- "styles/ui-playground.css": "styles/ui-playground.css?073684",
14
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?203ad9",
16
15
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?48ad36",
16
+ "styles/ui-playground.css": "styles/ui-playground.css?073684",
17
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?ff911f",
17
18
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?48099a",
18
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a348e9",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?7a970c"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?f1a12c"
20
20
  }
@@ -104,7 +104,7 @@ this._listeners.add(this.element,"mouseout",(()=>{this._highlightsVisible&&this.
104
104
  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=Oo(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})));if(!this._annotations.has(t.$tag))return[];for(let t of n)e(t)
105
105
  ;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),Io(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ke(e.highlights,n)}
106
106
  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=Mo(),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}selectAnnotations(t,e=!1){
107
- 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 Bo(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Fo(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.1040.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];t.onLoginRequest&&(t.onLoginRequestProvided=!0),
107
+ 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 Bo(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Fo(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.1041.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];t.onLoginRequest&&(t.onLoginRequestProvided=!0),
108
108
  t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return o}function Ho({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Bo(t.notebookAppUrl,{...Fo(t.notebookAppUrl,t),group:e})})}function Vo({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",children:mt("div",{className:"relative w-full h-full",
109
109
  "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(Ho,{config:e,groupId:s},n)]})})}class qo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=he(this._outerContainer),M(mt(Vo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var Uo={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),o++;else for(o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}
110
110
  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,o._super=i,n&&r(o,n)}function v(t,e){return function(){
@@ -562,7 +562,7 @@ if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTi
562
562
  "font-bold":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:Mo(m,{children:[e,t>0&&!n&&Mo("span",{className:"relative bottom-[3px] left-[2px] text-tiny",children:t})]})})}var pm=wi((function({annotationsService:e,isLoading:t,settings:n}){const r=ki(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return Mo("div",{className:io("space-y-3 pb-[9px]"),children:[Mo("div",{className:"flex gap-x-6 theme-clean:ml-[15px]",role:"tablist",children:[Mo(dm,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),Mo(dm,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),children:"Page Notes"}),s>0&&Mo(dm,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]
563
563
  }),"note"===o&&n.enableExperimentalNewNoteButton&&Mo("div",{className:"flex justify-end",children:Mo(Do,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:bi(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&Mo(jo,{classes:"text-center",children:Mo("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&Mo(jo,{classes:"text-center",children:Mo("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",Mo("br",{}),"Create one by selecting some text and clicking the"," ",Mo(Ko,{classes:"inline m-0.5 -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var mm=wi((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
564
564
  const i=ma(),a=ki(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?ia(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,b=a.directLinkedGroupFetchFailed(),_=y||b,w=!_,x=!_&&!l,k=h&&!u&&!y&&!c,S=bo(s);vo((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),vo((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return vo((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),Mo("div",{children:[Mo("h2",{className:"sr-only",children:"Annotations"}),w&&Mo(tm,{}),Mo(hm,{onLogin:t,onSignUp:n}),y&&Mo(Kp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),b&&Mo(Kp,{
565
- errorType:"group",onLoginRequest:t}),x&&Mo(pm,{isLoading:c}),Mo(Yp,{threads:i.children}),k&&Mo(nm,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var fm=wi((function({api:e,toastMessenger:t}){const n=ki(),r=n.routeParams().q,o=wo((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...Pi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return vo((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),Mo(Yp,{threads:ma().children})}),["api","toastMessenger"]);class gm{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1040.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
565
+ errorType:"group",onLoginRequest:t}),x&&Mo(pm,{isLoading:c}),Mo(Yp,{threads:i.children}),k&&Mo(nm,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var fm=wi((function({api:e,toastMessenger:t}){const n=ki(),r=n.routeParams().q,o=wo((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...Pi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return vo((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),Mo(Yp,{threads:ma().children})}),["api","toastMessenger"]);class gm{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1041.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
566
566
  this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function vm(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function ym({commandName:e,iconName:t}){return Mo("span",{className:"whitespace-nowrap",children:[Mo(Ko,{name:t,classes:io("mx-1 -mt-1","text-color-text-light inline")}),Mo("em",{children:e})]})}var bm=wi((function({settings:e}){const t=!vm(e);return Mo("ol",{className:"list-decimal pl-10 space-y-2",children:[Mo("li",{children:["To create an annotation, select text and then select the"," ",Mo(ym,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),Mo("li",{
567
567
  children:["To create a highlight (",Mo(Xo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",Mo(ym,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&Mo("li",{children:["To annotate in a private group, select the group from the groups dropdown. Don't see your group? Ask the group creator to send a"," ",Mo(Xo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),Mo("li",{children:["To reply to an annotation, select the"," ",Mo(ym,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var _m=wi((function({toastMessenger:e,versionData:t}){return Mo("div",{className:"hyp-u-vertical-spacing",children:[Mo("dl",{className:"VersionInfo",children:[Mo("dt",{className:"VersionInfo__key",children:"Version"}),Mo("dd",{
568
568
  className:"VersionInfo__value",children:t.version}),Mo("dt",{className:"VersionInfo__key",children:"User Agent"}),Mo("dd",{className:"VersionInfo__value",children:t.userAgent}),Mo("dt",{className:"VersionInfo__key",children:"URL"}),Mo("dd",{className:"VersionInfo__value",children:t.urls}),Mo("dt",{className:"VersionInfo__key",children:"Fingerprint"}),Mo("dd",{className:"VersionInfo__value",children:t.fingerprint}),Mo("dt",{className:"VersionInfo__key",children:"Account"}),Mo("dd",{className:"VersionInfo__value",children:t.account}),Mo("dt",{className:"VersionInfo__key",children:"Date"}),Mo("dd",{className:"VersionInfo__value",children:t.timestamp})]}),Mo("div",{className:"hyp-u-layout-row--justify-center",children:Mo(Do,{onClick:()=>{try{Ba(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function wm({children:e,onClick:t}){return Mo(Bo,{
@@ -582,8 +582,8 @@ const n=e.type.charAt(0).toUpperCase()+e.type.slice(1),r="notice"===e.type?"canc
582
582
  },d="private"===t.type?"Copy invite link":"Copy activity link";return Mo(vp,{icon:t.logo||"blank",iconAlt:jm(t),isDisabled:!s,isExpanded:!!a&&e,isSelected:u,isSubmenuVisible:a?e:void 0,label:t.name,onClick:s?()=>{l.clearDirectLinkedGroupFetchFailed(),l.clearDirectLinkedIds(),n.focus(t.id)}:h,onToggleSubmenu:h,submenu:Mo(m,{children:[Mo("ul",{children:[i&&Mo("li",{children:Mo(vp,{href:i,icon:"external",isSubmenuItem:!0,label:"View group activity"})}),i&&Mo("li",{children:Mo(vp,{onClick:()=>(e=>{try{Ba(e),o.success(`Copied link for "${t.name}"`)}catch(e){o.error("Unable to copy link")}})(i),icon:"copy",isSubmenuItem:!0,label:d})}),t.canLeave&&Mo("li",{children:Mo(vp,{icon:"leave",isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await mi({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!s&&Mo("p",{className:"GroupListItem__footer",children:"This group is restricted to specific URLs."})]})})
583
583
  }),["groups","toastMessenger"]);function Gm({expandedGroup:e,onExpandGroup:t,groups:n,heading:r}){return Mo(Um,{heading:r,children:n.map((n=>Mo($m,{isExpanded:n===e,onExpand:e=>t(e?n:null),group:n},n.id)))})}var Vm=wi((function({settings:e}){const t=ki(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=_o((()=>qm(o)),[o]),l=_o((()=>qm(r)),[r]),c=_o((()=>qm(n)),[n]),u=t.defaultAuthority(),h=a&&!vi(a,u),d=t.getLink("groups.new"),[p,m]=fo(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=jm(i)?jm(i):"";f=Mo("span",{className:"GroupList__menu-label",children:[t&&Mo("img",{className:"GroupList__menu-icon",src:t,alt:n}),i.name]})}else f=Mo("span",{children:"…"});return!!vm(e)&&n.length+r.length+o.length<2?f:Mo(fp,{align:"left",contentClass:"GroupList__content",label:f,onOpenChanged:()=>m(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[c.length>0&&Mo(Gm,{
584
584
  expandedGroup:p,onExpandGroup:m,heading:"Currently Viewing",groups:c}),l.length>0&&Mo(Gm,{expandedGroup:p,onExpandGroup:m,heading:"Featured Groups",groups:l}),s.length>0&&Mo(Gm,{expandedGroup:p,onExpandGroup:m,heading:"My Groups",groups:s}),h&&Mo(vp,{icon:"add",href:d,label:"New private group"})]})}),["settings"]);function Wm({alwaysExpanded:e,query:t,onSearch:n}){const r=ki().isLoading(),o=bo(),[i,a]=fo(t),[s,l]=fo(t);return t!==i&&(l(t),a(t)),Mo("form",{action:"#",className:"SearchInput__form",name:"searchForm",onSubmit:e=>{e.preventDefault(),(o.current.value||i)&&n(o.current.value)},children:[Mo("input",{"aria-label":"Search",className:io("SearchInput__input",{"is-expanded":e||t}),dir:"auto",type:"text",name:"query",placeholder:r?"Loading…":"Search…",disabled:r,ref:o,value:s||"",onInput:e=>l(e.target.value)}),!r&&Mo("div",{className:"SearchInput__button-container",children:Mo(Po,{icon:"search",onClick:()=>o.current.focus(),size:"small",title:"Search annotations"})}),r&&Mo("div",{style:"margin:0.5em 0",
585
- children:Mo(si,{size:"small"})})]})}function Ym(){const e=ki(),t=e.sortKey(),n=e.sortKeys().map((n=>Mo(vp,{label:n,onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=Mo("span",{className:"p-1",children:Mo(Ko,{name:"sort"})});return Mo("div",{className:"SortMenu",children:Mo(fp,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}var Km=wi((function({router:e}){return Mo(Wm,{query:ki().routeParams().q,onSearch:t=>{e.navigate("stream",{q:t})},alwaysExpanded:!0})}),["router"]);var Xm=wi((function({auth:e,frameSync:t,onLogout:n,settings:r}){const o=ki(),i=o.defaultAuthority(),a=vi(e.userid,i),s=P(r),l=o.isFeatureEnabled("notebook_launch"),[c,u]=fo(!1),h=e=>s&&!!s[e],d=!a||h("onProfileRequestProvided"),p=!a||h("onLogoutRequestProvided"),m=()=>{t.notifyHost("openNotebook",o.focusedGroupId())},f=()=>a&&t.notifyHost("profileRequested"),g=(()=>{const t={};return d&&(a||(t.href=o.getLink("user",{user:e.username})),t.onClick=f),t})(),v=Mo("span",{className:"p-1",children:Mo(Ko,{name:"profile"})
586
- });return Mo("div",{className:"UserMenu",onKeyDown:e=>{"n"===e.key&&(m(),u(!1))},children:Mo(fp,{label:v,title:e.displayName,align:"right",open:c,onOpenChanged:u,children:[Mo(Um,{children:[Mo(vp,{label:e.displayName,isDisabled:!d,...g}),!a&&Mo(vp,{label:"Account settings",href:o.getLink("account.settings")}),l&&Mo(vp,{label:"Open notebook",onClick:()=>m()})]}),p&&Mo(Um,{children:Mo(vp,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var Zm=wi((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!vm(a),c=bi(["accentColor"],a),u=ki(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations");return Mo("div",{className:io("absolute h-10 left-0 top-0 right-0 z-4","text-grey-7 border-b theme-clean:border-b-0 bg-white"),"data-testid":"top-bar",children:Mo(Dm,{classes:io("flex items-center h-full","px-[9px]","text-xl"),"data-testid":"top-bar-content",children:[Mo(n?Vm:Km,{}),Mo("div",{
585
+ children:Mo(si,{size:"small"})})]})}function Ym(){const e=ki(),t=e.sortKey(),n=e.sortKeys().map((n=>Mo(vp,{label:n,onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=Mo("span",{className:"p-1",children:Mo(Ko,{name:"sort"})});return Mo("div",{className:"SortMenu",children:Mo(fp,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}var Km=wi((function({router:e}){return Mo(Wm,{query:ki().routeParams().q,onSearch:t=>{e.navigate("stream",{q:t})},alwaysExpanded:!0})}),["router"]);var Xm=wi((function({auth:e,frameSync:t,onLogout:n,settings:r}){const o=ki(),i=o.defaultAuthority(),a=vi(e.userid,i),s=P(r),[l,c]=fo(!1),u=e=>s&&!!s[e],h=!a||u("onProfileRequestProvided"),d=!a||u("onLogoutRequestProvided"),p=()=>{t.notifyHost("openNotebook",o.focusedGroupId())},m=()=>a&&t.notifyHost("profileRequested"),f=(()=>{const t={};return h&&(a||(t.href=o.getLink("user",{user:e.username})),t.onClick=m),t})(),g=Mo("span",{className:"p-1",children:Mo(Ko,{name:"profile"})});return Mo("div",{
586
+ "data-testid":"user-menu",onKeyDown:e=>{"n"===e.key&&(p(),c(!1))},children:Mo(fp,{label:g,title:e.displayName,align:"right",open:l,onOpenChanged:c,children:[Mo(Um,{children:[Mo(vp,{label:e.displayName,isDisabled:!h,...f}),!a&&Mo(vp,{label:"Account settings",href:o.getLink("account.settings")}),Mo(vp,{label:"Open notebook",onClick:()=>p()})]}),d&&Mo(Um,{children:Mo(vp,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var Zm=wi((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!vm(a),c=bi(["accentColor"],a),u=ki(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations");return Mo("div",{className:io("absolute h-10 left-0 top-0 right-0 z-4","text-grey-7 border-b theme-clean:border-b-0 bg-white"),"data-testid":"top-bar",children:Mo(Dm,{classes:io("flex items-center h-full","px-[9px]","text-xl"),"data-testid":"top-bar-content",children:[Mo(n?Vm:Km,{}),Mo("div",{
587
587
  className:"grow flex items-center justify-end",children:[n&&Mo(m,{children:[d>0&&Mo(Po,{icon:"refresh",onClick:()=>s.applyPendingUpdates(),size:"small",variant:"primary",title:`Show ${d} new/updated ${1===d?"annotation":"annotations"}`}),Mo(Wm,{query:h||null,onSearch:u.setFilterQuery}),Mo(Ym,{}),l&&Mo(Po,{icon:"share",expanded:f,onClick:()=>{u.toggleSidebarPanel("shareGroupAnnotations")},size:"small",title:"Share annotations on this page"})]}),Mo(Po,{icon:"help",expanded:p,onClick:()=>{const e=P(a);e&&e.onHelpRequestProvided?t.notifyHost("helpRequested"):u.toggleSidebarPanel("help")},size:"small",title:"Help"}),"logged-in"===e.status?Mo(Xm,{auth:e,onLogout:o}):Mo("div",{className:"flex items-center text-lg font-medium space-x-1","data-testid":"login-links",children:["unknown"===e.status&&Mo("span",{children:"⋯"}),"logged-out"===e.status&&Mo(m,{children:[Mo(Bo,{classes:"inline",onClick:i,style:c,variant:"primary",children:"Sign up"}),Mo("div",{children:"/"}),Mo(Bo,{classes:"inline",onClick:r,style:c,
588
588
  variant:"primary",children:"Log in"})]})]})]})]})})}),["frameSync","settings","streamer"]);var Jm=wi((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=ki(),a=i.hasFetchedProfile(),s=i.profile(),l=i.route(),c=_o((()=>a?function(e){const t=fi(e.userid);if(t&&e.userid){let n=t.username;return e.user_info&&e.user_info.display_name&&(n=e.user_info.display_name),{status:"logged-in",displayName:n,userid:e.userid,username:t.username}}return{status:"logged-out"}}(s):{status:"unknown"}),[a,s]),u=_o((()=>bi(["appBackgroundColor"],n)),[n]),h="clean"===n.theme,d="sidebar"===l;vo((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=P(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,s,n)&&i.openSidebarPanel("help")}),[d,s,n,i]);const p=async()=>{if(P(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},m=()=>{
589
589
  P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return Mo("div",{className:io("h-full min-h-full overflow-scroll","p-[9px] lg:pb-16 bg-grey-2","js-thread-list-scroll-root",{"theme-clean":h,"pt-[49px]":"notebook"!==l,"p-4 lg:p-12":"notebook"===l}),"data-testid":"hypothesis-app",style:u,children:["notebook"!==l&&Mo(Zm,{auth:c,onLogin:p,onSignUp:m,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),mi({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),P(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),Mo(Dm,{children:[Mo(Fm,{}),Mo(km,{auth:"logged-in"===c.status?c:{}}),Mo(Pm,{}),l&&Mo("main",{children:["annotation"===l&&Mo(Xp,{onLogin:p
@@ -591,7 +591,7 @@ P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return Mo
591
591
  document:{title:""}},e);return Yi(l)&&(l.permissions=Ia(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Yi(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!$i(n)}),Xi(n)?this._store.selectTab("note"):Zi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._activity.reportActivity("delete",e),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._activity.reportActivity("flag",e),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:$i(e)?Ra(t,e.group):Ia(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],
592
592
  uri:e.uri};this.create(n)}async save(e){let t,n;const r=this._applyDraftChanges(e);let o;qi(e)?(t=this._api.annotation.update({id:e.id},r),n="update"):(t=this._api.annotation.create({},r),n="create"),this._store.annotationSaveStarted(e);try{o=await t,this._activity.reportActivity(n,o)}finally{this._store.annotationSaveFinished(e)}for(let[t,n]of Object.entries(e))if(t.startsWith("$")){o[t]=n}return this._store.removeDraft(e),this._store.addAnnotations([o]),o}}ef.$inject=["annotationActivity","api","store"];class tf{constructor(e){this._rpc=e.rpc,this._reportConfig=e.reportActivity}reportActivity(e,t){if(!this._rpc||!this._reportConfig)return;let n;switch(e){case"create":n=new Date(t.created).toISOString();break;case"update":n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id}};this._reportConfig.events.includes(e)&&q(this._rpc.targetFrame,this._rpc.origin,this._reportConfig.method,[e,r],3e3)}}tf.$inject=["settings"];class nf extends Error{
593
593
  constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),this.url=e,this.response=t,this.reason=n}}async function rf(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new nf(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new nf(e,n,"Failed to parse response")}var o;if(!n.ok)throw new nf(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function of(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function af(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function sf(e){return"url"in e}function lf(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const o=n[t];if(!o||sf(o)){
594
- if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1040.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=of(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await rf(m.toString(),{body:s?JSON.stringify(af(s)):null,headers:u,method:c.method})}finally{i()}}}class cf{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>lf(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={
594
+ if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1041.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=of(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await rf(m.toString(),{body:s?JSON.stringify(af(s)):null,headers:u,method:c.method})}finally{i()}}}class cf{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>lf(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={
595
595
  member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}cf.$inject=["apiRoutes","auth","store"];var uf={};function hf(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var df=hf;hf.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},hf.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},hf.prototype.retry=function(e){
596
596
  if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},hf.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)
597
597
  },hf.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},hf.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},hf.prototype.start=hf.prototype.try,hf.prototype.errors=function(){return this._errors},hf.prototype.attempts=function(){return this._attempts},hf.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=df;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout")
@@ -654,8 +654,8 @@ return e.sortKey}const jv=Ag((e=>e.selectedTab),(e=>{const t=["Newest","Oldest"]
654
654
  CLOSE_SIDEBAR_PANEL(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}};const Uv=yg({activePanelName:null},{namespace:"sidebarPanels",reducers:qv,actionCreators:{openSidebarPanel:function(e){return vg(0,"OPEN_SIDEBAR_PANEL",{panelName:e})},closeSidebarPanel:function(e){return vg(0,"CLOSE_SIDEBAR_PANEL",{panelName:e})},toggleSidebarPanel:function(e,t){return vg(0,"TOGGLE_SIDEBAR_PANEL",{panelName:e,panelState:t})}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),$v={ADD_MESSAGE:(e,t)=>({messages:e.messages.concat({...t.message})}),REMOVE_MESSAGE:(e,t)=>({messages:e.messages.filter((e=>e.id!==t.id))}),UPDATE_MESSAGE:(e,t)=>({messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))})};const Gv=yg({messages:[]},{namespace:"toastMessages",
655
655
  reducers:$v,actionCreators:{addToastMessage:function(e){return vg(0,"ADD_MESSAGE",{message:e})},removeToastMessage:function(e){return vg(0,"REMOVE_MESSAGE",{id:e})},updateToastMessage:function(e){return vg(0,"UPDATE_MESSAGE",{message:e})}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),Vv={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}};const Wv=yg({sidebarHasOpened:!1},{namespace:"viewer",reducers:Vv,actionCreators:{setSidebarOpened:function(e){return vg(0,"SET_SIDEBAR_OPENED",{opened:e})}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function Yv(e){return gg([wg,Ug,Gg,Wg,ev,sv,hv,Sv,xv,Tv,Eg,Hv,mv,Uv,Gv,Wv],[e],[bg])}Yv.$inject=["settings"];class Kv{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){
656
656
  if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{
657
- factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const Xv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),Zv=function(e){const{version:t,origin:n}=R(e.location.href);return"1.1040.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1040.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function Jv(e,t){e.setClientId(t.clientId)}function Qv(e,t,n){e.load(),t.load(),n.sync()}function ey(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function ty(e,t){
658
- "sidebar"===t.route()&&e.connect()}Xv.sentry&&Zv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Br({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1040.0",beforeSend:(e,t)=>{if(Hr>=5)return G("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Hr;try{const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{Jt("host_config",R(window.location.href))}catch(e){}Jt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),jr(((e,t)=>{Zt(e,{tags:{context:t}})}))}(Xv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{
657
+ factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const Xv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),Zv=function(e){const{version:t,origin:n}=R(e.location.href);return"1.1041.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1041.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function Jv(e,t){e.setClientId(t.clientId)}function Qv(e,t,n){e.load(),t.load(),n.sync()}function ey(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function ty(e,t){
658
+ "sidebar"===t.route()&&e.connect()}Xv.sentry&&Zv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Br({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1041.0",beforeSend:(e,t)=>{if(Hr>=5)return G("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Hr;try{const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{Jt("host_config",R(window.location.href))}catch(e){}Jt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),jr(((e,t)=>{Zt(e,{tags:{context:t}})}))}(Xv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{
659
659
  document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{if("string"==typeof e.type){const t=e.props;"dir"in t&&"auto"===t.dir&&(t.dir="")}t&&t(e)}}}(),Jv.$inject=["api","streamer"],Qv.$inject=["groups","session","router"],ey.$inject=["autosaveService","features","persistedDefaults","serviceURL"],ty.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&Lo.clear();for(let[t,n]of Object.entries(e))Lo.set(t,n)}(pi);const ny=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",Z)}(),async function(e,t=window){const n=function(e){const t=R(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:D,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:F(t.origin),ancestorLevel:B(t.ancestorLevel)}}
660
660
  },o={};for(let[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:U(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await q(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=q(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,r)}else o=n;const i={...e,...o};return r&&(i.rpc=r),i.apiUrl=function(e){const t=P(e);if(t){if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}return e.apiUrl}(i),i}(Xv).then((e=>{
661
661
  !function(e,t){const n=new Kv;n.register("annotationsService",ef).register("annotationActivity",tf).register("api",cf).register("apiRoutes",gf).register("auth",bf).register("autosaveService",_f).register("features",kf).register("frameSync",Mf).register("groups",Of).register("loadAnnotationsService",If).register("localStorage",Pf).register("persistedDefaults",qf).register("router",Uf).register("serviceURL",$f).register("session",Gf).register("streamer",Yf).register("streamFilter",Vf).register("tags",Kf).register("threadsService",Xf).register("toastMessenger",Zf).register("store",{factory:Yv}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(ey),n.run(Jv),n.run(Qv),n.run(X),n.run(ty),I(Mo(_i.Provider,{value:n,children:Mo(Jm,{})}),t)}(e,ny)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(Mo(Qm,{error:e}),t)}(e,ny)));