hypothesis 1.1011.0 → 1.1012.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 s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(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 r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function h(t){return function(t){return t.filter((function(t){var e=s[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 f(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?f(e.src):null}function m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?57c0fa","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?0d185a","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?2cbb43","styles/annotator.css":"styles/annotator.css?170b0c","styles/annotator.css.map":"styles/annotator.css.map?e6cce6","styles/highlights.css":"styles/highlights.css?c308d0","styles/highlights.css.map":"styles/highlights.css.map?5be890","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?e6af07","styles/sidebar.css.map":"styles/sidebar.css.map?7004fc","styles/ui-playground.css":"styles/ui-playground.css?fd3796","styles/ui-playground.css.map":"styles/ui-playground.css.map?7433c6","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?77a187","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?d86fca","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?92855b"};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 v=function(e){for(var s={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(s,o)}return s}(document),g=m(v.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1011.0/");if(document.querySelector("hypothesis-app")){!function(t,e){u(t,"fetch",e.apiUrl),u(t,"fetch",e.apiUrl+"links");var s=h(o);d(t,e,[].concat(n(s),["scripts/sidebar.bundle.js","styles/katex.min.css","styles/sidebar.css"]))}(document,{assetRoot:g,manifest:b,apiUrl:v.apiUrl})}else{var j=v,w=m(j.notebookAppUrl||"https://hypothes.is/notebook"),A=m(j.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){l(t,"sidebar","html",e.sidebarAppUrl),l(t,"notebook","html",e.notebookAppUrl),u(t,"style",p(e,"styles/annotator.css")),l(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var s=h(o),r=[];void 0!==window.PDFViewerApplication&&r.push("styles/pdfjs-overrides.css"),d(t,e,[].concat(n(s),r,["scripts/annotator.bundle.js","styles/highlights.css"]),{forceModuleReload:!0})}}(document,{assetRoot:g,manifest:b,notebookAppUrl:w,sidebarAppUrl:A})}}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 s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(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 r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function h(t){return function(t){return t.filter((function(t){var e=s[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 f(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?f(e.src):null}function m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?6f8a05","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?0d185a","styles/annotator.css":"styles/annotator.css?b0f89a","styles/annotator.css.map":"styles/annotator.css.map?5bcea3","styles/highlights.css":"styles/highlights.css?c308d0","styles/highlights.css.map":"styles/highlights.css.map?5be890","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?ecf77f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?2cbb43","styles/sidebar.css.map":"styles/sidebar.css.map?3c6946","styles/ui-playground.css.map":"styles/ui-playground.css.map?09d0c6","styles/ui-playground.css":"styles/ui-playground.css?ee7ed0","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?398c10","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?77a187","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?d79fa5"};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 v=function(e){for(var s={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(s,o)}return s}(document),g=m(v.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1012.0/");if(document.querySelector("hypothesis-app")){!function(t,e){u(t,"fetch",e.apiUrl),u(t,"fetch",e.apiUrl+"links");var s=h(o);d(t,e,[].concat(n(s),["scripts/sidebar.bundle.js","styles/katex.min.css","styles/sidebar.css"]))}(document,{assetRoot:g,manifest:b,apiUrl:v.apiUrl})}else{var j=v,w=m(j.notebookAppUrl||"https://hypothes.is/notebook"),A=m(j.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){l(t,"sidebar","html",e.sidebarAppUrl),l(t,"notebook","html",e.notebookAppUrl),u(t,"style",p(e,"styles/annotator.css")),l(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var s=h(o),r=[];void 0!==window.PDFViewerApplication&&r.push("styles/pdfjs-overrides.css"),d(t,e,[].concat(n(s),r,["scripts/annotator.bundle.js","styles/highlights.css"]),{forceModuleReload:!0})}}(document,{assetRoot:g,manifest:b,notebookAppUrl:w,sidebarAppUrl:A})}}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?57c0fa",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?6f8a05",
3
3
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?0d185a",
4
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?2cbb43",
5
- "styles/annotator.css": "styles/annotator.css?170b0c",
6
- "styles/annotator.css.map": "styles/annotator.css.map?e6cce6",
4
+ "styles/annotator.css": "styles/annotator.css?b0f89a",
5
+ "styles/annotator.css.map": "styles/annotator.css.map?5bcea3",
7
6
  "styles/highlights.css": "styles/highlights.css?c308d0",
8
7
  "styles/highlights.css.map": "styles/highlights.css.map?5be890",
9
8
  "styles/katex.min.css": "styles/katex.min.css?ac2365",
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
- "styles/sidebar.css": "styles/sidebar.css?e6af07",
14
- "styles/sidebar.css.map": "styles/sidebar.css.map?7004fc",
15
- "styles/ui-playground.css": "styles/ui-playground.css?fd3796",
16
- "styles/ui-playground.css.map": "styles/ui-playground.css.map?7433c6",
12
+ "styles/sidebar.css": "styles/sidebar.css?ecf77f",
13
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?2cbb43",
14
+ "styles/sidebar.css.map": "styles/sidebar.css.map?3c6946",
15
+ "styles/ui-playground.css.map": "styles/ui-playground.css.map?09d0c6",
16
+ "styles/ui-playground.css": "styles/ui-playground.css?ee7ed0",
17
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?398c10",
17
18
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?77a187",
18
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?d86fca",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?92855b"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?d79fa5"
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){xe(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{const e=Co(t);if(!e)return;const n=be(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&Se(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=ge.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&&xe(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:"+Pt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),xo(),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);Se(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=Ee(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=_e(e),o=we(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=wo(),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 Eo(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function To(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.1011.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 Eo(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function To(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.1012.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 Ao({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Eo(t.notebookAppUrl,{...To(t.notebookAppUrl,t),group:e})})}function ko({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(Ao,{config:e,groupId:s},n)]})})}class Ro{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=ce(this._outerContainer),M(mt(ko,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var Po={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(){
@@ -159,13 +159,13 @@ t.setSelectionRange(0,t.value.length),document.execCommand("copy")}finally{t.rem
159
159
  var Ma=ci((function({annotation:e,toastMessenger:t,group:n,shareUri:r}){const o=Ca(e.permissions),i=wa(e.uri),a=so(null),s=so(null),[l,c]=ro(!1),u=so(l);if(Ho(a,l,(()=>c(!1))),io((()=>{var e,t;u.current!==l&&(u.current=l,l&&!Na()&&(null===(e=s.current)||void 0===e||e.focus(),null===(t=s.current)||void 0===t||t.select()))}),[l]),!n)return null;const h=i,d="private"===n.type?_o("span",{children:["Only members of the group ",_o("em",{children:n.name})," may view this annotation."]}):_o("span",{children:"Anyone using this link may view this annotation."}),p=o?_o("span",{children:"Only you may view this annotation."}):d;return _o("div",{className:"AnnotationShareControl",ref:a,children:[_o(Co,{icon:"share",title:"Share",onClick:()=>c(!l),expanded:l}),l&&_o("div",{className:"annotation-share-panel",children:[_o("div",{className:"annotation-share-panel__header",children:_o("div",{className:"annotation-share-panel__title",children:"Share this annotation"})}),_o("div",{className:"annotation-share-panel__content",
160
160
  children:[_o("div",{className:"hyp-u-layout-row annotation-share-panel__inputs",children:_o(Jo,{children:[_o(Zo,{"aria-label":"Use this URL to share this annotation",type:"text",value:r,readOnly:!0,inputRef:s}),_o(Co,{icon:"copy",title:"Copy share link to clipboard",onClick:()=>{try{Aa(r),t.success("Copied share link to clipboard")}catch(e){t.error("Unable to copy link")}},variant:"dark"})]})}),_o("div",i?{className:"annotation-share-panel__details",children:p}:{className:"annotation-share-panel__details",children:"This annotation cannot be shared in its original context because it was made on a document that is not available on the web. This link shares the annotation by itself."}),h&&_o(Ta,{shareURI:r})]}),_o(Do,{name:"pointer",classes:"annotation-share-panel__arrow"})]})]})}),["toastMessenger"]);var La=ci((function({annotation:e,annotationsService:t,onReply:n,settings:r,toastMessenger:o}){const i=hi(),a=i.profile(),s=i.getGroup(e.group),l=i.isLoggedIn(),c=t=>function(e,t,n){return-1!==e[t].indexOf(n||"")
161
161
  }(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=R(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=R(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return wa(e.uri)?null!==(t=null!==(n=null===(r=e.links)||void 0===r?void 0:r.incontext)&&void 0!==n?n:null===(o=e.links)||void 0===o?void 0:o.html)&&void 0!==t?t:null:null!==(i=null===(a=e.links)||void 0===a?void 0:a.html)&&void 0!==i?i:null}(e);return _o("div",{className:"AnnotationActionBar hyp-u-layout-row text-xl font-medium",children:[h&&_o(Co,{icon:"edit",title:"Edit",onClick:()=>{i.createDraft(e,{tags:e.tags,text:e.text,isPrivate:Ca(e.permissions)})}}),u&&_o(Co,{icon:"trash",title:"Delete",onClick:async()=>{if(await ni({title:"Delete annotation?",message:"Are you sure you want to delete this annotation?",confirmAction:"Delete"}))try{await t.delete(e)}catch(e){o.error(e.message)}}}),_o(Co,{icon:"reply",title:"Reply",onClick:()=>{
162
- l?n():i.openSidebarPanel("loginPrompt")}}),p&&_o(Ma,{annotation:e,group:s,shareUri:p}),d&&!e.flagged&&_o(Co,{icon:"flag",title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&_o(Co,{pressed:!0,icon:"flag--active",title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function za({isCollapsed:e,setCollapsed:t,linkStyle:n={}}){return _o("div",{className:"Excerpt__inline-controls",children:_o("div",{className:"Excerpt__toggle-container",children:_o(Eo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:()=>t(!e),expanded:!e,title:"Toggle visibility of full excerpt text",style:n,variant:"dark",children:e?"More":"Less"})})})}const Oa=()=>{};var Ia=ci((function({children:e,collapse:t=!1,collapsedHeight:n,inlineControls:r=!0,onCollapsibleChanged:o=Oa,onToggleCollapsed:i=Oa,overflowThreshold:a=0,settings:s={}}){const[l,c]=ro(!0),u=so(),[h,d]=ro(0),p=co((()=>{
163
- const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);ao((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new ya;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return _o("div",{className:"Excerpt",style:g,children:[_o("div",{className:"Excerpt__content",ref:u,children:e}),_o("div",{role:"presentation",onClick:()=>v(!1),className:Yr({Excerpt__shadow:!0,"Excerpt__shadow--transparent":r,"is-hidden":!f}),title:"Show the full excerpt"}),m&&r&&_o(za,{isCollapsed:l,setCollapsed:v,
164
- linkStyle:si(["selectionFontFamily"],s)})]})}),["settings"]);function Pa(e,t=16/9){const n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";const n=document.createElement("div");return n.style.paddingBottom=1/t*100+"%",n.style.position="relative",n.appendChild(e),n}(n,t)}function Ra(e){const t=/(\d+)([hms]?)/g,n={h:3600,m:60,s:1};let r,o=0;for(;null!==(r=t.exec(e));)if(r[2]){const e=r[2];o+=Number(r[1])*n[e]}else o+=+r[1];return o.toString()}function Da(e,t){const n=function(e){const t=["end","start","t"],n=new URLSearchParams(e.search),r=new URLSearchParams;for(let[e,o]of n)t.includes(e)&&("t"===e?r.append("start",Ra(o)):r.append(e,o));r.sort();let o=r.toString();return o&&(o=`?${o}`),o}(t);return Pa(`https://www.youtube.com/embed/${e}${n}`)}function Ba(e,t,n,{aspectRatio:r}={}){return o=>{if(o.hostname!==e)return null
165
- ;const i=t.exec(o.pathname);if(!i)return null;const a=i[1];return Pa(n(a),r)}}const Fa=[function(e){if("www.youtube.com"!==e.hostname)return null;if(!/\/watch\/?/.test(e.pathname))return null;const t=/[&?]v=([^&#]+)/.exec(e.search);return t?Da(t[1],e):null},function(e){if("youtu.be"!==e.hostname)return null;const t=/^\/([^/]+)\/?$/.exec(e.pathname);return t?Da(t[1],e):null},Ba("vimeo.com",/^\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Ba("vimeo.com",/^\/channels\/[^/]+\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Ba("flipgrid.com",/^\/s\/([^/]+)$/,(e=>`https://flipgrid.com/s/${e}?embed=true`)),function(e){if("archive.org"!==e.hostname)return null;const t=/^\/(embed|details)\/(.+)/.exec(e.pathname);if(!t)return null;let n=t[2];const r=new URLSearchParams(e.search);let o=r.get("start"),i=r.get("end");if(!o){const e=n.match(/\/start\/([^/]+)/);e&&(o=e[1],n=n.replace(e[0],""))}if(!i){const e=n.match(/\/end\/([^/]+)/);e&&(i=e[1],n=n.replace(e[0],""))}
166
- const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),Pa(a.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?function(e){const t=document.createElement("audio");return t.controls=!0,t.src=e,t}(e.href):null}];function ja(e){if(e.href!==e.textContent&&decodeURI(e.href)!==e.textContent)return null;const t=function(e){let t,n;for(n=0;n<Fa.length;n++)if(t=Fa[n](e),t)return t;return null}(e);return t&&e.parentElement.replaceChild(t,e),t}var Ha=Object.hasOwnProperty,qa=Object.setPrototypeOf,Ua=Object.isFrozen,$a=Object.getPrototypeOf,Ga=Object.getOwnPropertyDescriptor,Va=Object.freeze,Wa=Object.seal,Ya=Object.create,Ka="undefined"!=typeof Reflect&&Reflect,Xa=Ka.apply,Za=Ka.construct;Xa||(Xa=function(e,t,n){return e.apply(t,n)}),Va||(Va=function(e){return e}),Wa||(Wa=function(e){return e}),Za||(Za=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){
167
- if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Ja,Qa=cs(Array.prototype.forEach),es=cs(Array.prototype.pop),ts=cs(Array.prototype.push),ns=cs(String.prototype.toLowerCase),rs=cs(String.prototype.match),os=cs(String.prototype.replace),is=cs(String.prototype.indexOf),as=cs(String.prototype.trim),ss=cs(RegExp.prototype.test),ls=(Ja=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Za(Ja,t)});function cs(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Xa(e,t,r)}}function us(e,t){qa&&qa(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=ns(r);o!==r&&(Ua(t)||(t[n]=o),r=o)}e[r]=!0}return e}function hs(e){var t=Ya(null),n=void 0;for(n in e)Xa(Ha,e,[n])&&(t[n]=e[n]);return t}function ds(e,t){for(;null!==e;){var n=Ga(e,t);if(n){if(n.get)return cs(n.get);if("function"==typeof n.value)return cs(n.value)}e=$a(e)}
168
- return function(e){return console.warn("fallback value for",e),null}}
162
+ l?n():i.openSidebarPanel("loginPrompt")}}),p&&_o(Ma,{annotation:e,group:s,shareUri:p}),d&&!e.flagged&&_o(Co,{icon:"flag",title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&_o(Co,{pressed:!0,icon:"flag--active",title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function za({isCollapsed:e,setCollapsed:t,linkStyle:n={}}){return _o("div",{className:Yr("absolute block right-0 bottom-0","w-20 bg-gradient-to-l from-white"),children:_o("div",{className:"flex justify-end",children:_o(Eo,{classes:"inline underline",onClick:()=>t(!e),expanded:!e,title:"Toggle visibility of full excerpt text",style:n,variant:"dark",children:e?"More":"Less"})})})}const Oa=()=>{};var Ia=ci((function({children:e,collapse:t=!1,collapsedHeight:n,inlineControls:r=!0,onCollapsibleChanged:o=Oa,onToggleCollapsed:i=Oa,overflowThreshold:a=0,settings:s={}}){
163
+ const[l,c]=ro(!0),u=so(),[h,d]=ro(0),p=co((()=>{const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);ao((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new ya;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return _o("div",{"data-testid":"excerpt-container",className:Yr("relative overflow-hidden","transition-[max-height] ease-in duration-150"),style:g,children:[_o("div",{className:Yr("inline-block w-full"),"data-testid":"excerpt-content",ref:u,children:e}),_o("div",{"data-testid":"excerpt-expand",
164
+ role:"presentation",onClick:()=>v(!1),className:Yr("transition-[opacity] duration-150 ease-linear","absolute w-full bottom-0 h-touch-minimum",{"bg-gradient-to-b from-excerptStop1 via-excerptStop2 to-excerptStop3":!r&&f,"bg-none":r,"opacity-0 pointer-events-none":!f}),title:"Show the full excerpt"}),m&&r&&_o(za,{isCollapsed:l,setCollapsed:v,linkStyle:si(["selectionFontFamily"],s)})]})}),["settings"]);function Pa(e,t=16/9){const n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";const n=document.createElement("div");return n.style.paddingBottom=1/t*100+"%",n.style.position="relative",n.appendChild(e),n}(n,t)}function Ra(e){const t=/(\d+)([hms]?)/g,n={h:3600,m:60,s:1};let r,o=0;for(;null!==(r=t.exec(e));)if(r[2]){const e=r[2];o+=Number(r[1])*n[e]}else o+=+r[1];return o.toString()}function Da(e,t){const n=function(e){
165
+ const t=["end","start","t"],n=new URLSearchParams(e.search),r=new URLSearchParams;for(let[e,o]of n)t.includes(e)&&("t"===e?r.append("start",Ra(o)):r.append(e,o));r.sort();let o=r.toString();return o&&(o=`?${o}`),o}(t);return Pa(`https://www.youtube.com/embed/${e}${n}`)}function Ba(e,t,n,{aspectRatio:r}={}){return o=>{if(o.hostname!==e)return null;const i=t.exec(o.pathname);if(!i)return null;const a=i[1];return Pa(n(a),r)}}const Fa=[function(e){if("www.youtube.com"!==e.hostname)return null;if(!/\/watch\/?/.test(e.pathname))return null;const t=/[&?]v=([^&#]+)/.exec(e.search);return t?Da(t[1],e):null},function(e){if("youtu.be"!==e.hostname)return null;const t=/^\/([^/]+)\/?$/.exec(e.pathname);return t?Da(t[1],e):null},Ba("vimeo.com",/^\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Ba("vimeo.com",/^\/channels\/[^/]+\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Ba("flipgrid.com",/^\/s\/([^/]+)$/,(e=>`https://flipgrid.com/s/${e}?embed=true`)),function(e){
166
+ if("archive.org"!==e.hostname)return null;const t=/^\/(embed|details)\/(.+)/.exec(e.pathname);if(!t)return null;let n=t[2];const r=new URLSearchParams(e.search);let o=r.get("start"),i=r.get("end");if(!o){const e=n.match(/\/start\/([^/]+)/);e&&(o=e[1],n=n.replace(e[0],""))}if(!i){const e=n.match(/\/end\/([^/]+)/);e&&(i=e[1],n=n.replace(e[0],""))}const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),Pa(a.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?function(e){const t=document.createElement("audio");return t.controls=!0,t.src=e,t}(e.href):null}];function ja(e){if(e.href!==e.textContent&&decodeURI(e.href)!==e.textContent)return null;const t=function(e){let t,n;for(n=0;n<Fa.length;n++)if(t=Fa[n](e),t)return t;return null}(e);return t&&e.parentElement.replaceChild(t,e),t}
167
+ var Ha=Object.hasOwnProperty,qa=Object.setPrototypeOf,Ua=Object.isFrozen,$a=Object.getPrototypeOf,Ga=Object.getOwnPropertyDescriptor,Va=Object.freeze,Wa=Object.seal,Ya=Object.create,Ka="undefined"!=typeof Reflect&&Reflect,Xa=Ka.apply,Za=Ka.construct;Xa||(Xa=function(e,t,n){return e.apply(t,n)}),Va||(Va=function(e){return e}),Wa||(Wa=function(e){return e}),Za||(Za=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Ja,Qa=cs(Array.prototype.forEach),es=cs(Array.prototype.pop),ts=cs(Array.prototype.push),ns=cs(String.prototype.toLowerCase),rs=cs(String.prototype.match),os=cs(String.prototype.replace),is=cs(String.prototype.indexOf),as=cs(String.prototype.trim),ss=cs(RegExp.prototype.test),ls=(Ja=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Za(Ja,t)});function cs(e){return function(t){
168
+ for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Xa(e,t,r)}}function us(e,t){qa&&qa(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=ns(r);o!==r&&(Ua(t)||(t[n]=o),r=o)}e[r]=!0}return e}function hs(e){var t=Ya(null),n=void 0;for(n in e)Xa(Ha,e,[n])&&(t[n]=e[n]);return t}function ds(e,t){for(;null!==e;){var n=Ga(e,t);if(n){if(n.get)return cs(n.get);if("function"==typeof n.value)return cs(n.value)}e=$a(e)}return function(e){return console.warn("fallback value for",e),null}}
169
169
  var ps=Va(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ms=Va(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fs=Va(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),gs=Va(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),vs=Va(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),ys=Va(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_s=Va(["#text"]),bs=Va(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),ws=Va(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xs=Va(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ks=Va(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ss=Wa(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Cs=Wa(/<%[\s\S]*|[\s\S]*%>/gm),As=Wa(/^data-[\-\w.\u00B7-\uFFFF]/),Es=Wa(/^aria-[\-\w]+$/),Ts=Wa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ns=Wa(/^(?:\w+script|data):/i),Ms=Wa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ls=Wa(/^html$/i),zs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){
170
170
  return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Os(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var Is=function(){return"undefined"==typeof window?null:window},Ps=function(e,t){if("object"!==(void 0===e?"undefined":zs(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};var Rs=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Is(),n=function(t){return e(t)};if(n.version="2.3.6",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n
171
171
  ;var r=t.document,o=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,g=ds(f,"cloneNode"),v=ds(f,"nextSibling"),y=ds(f,"childNodes"),_=ds(f,"parentNode");if("function"==typeof a){var b=o.createElement("template");b.content&&b.content.ownerDocument&&(o=b.content.ownerDocument)}var w=Ps(m,r),x=w?w.createHTML(""):"",k=o,S=k.implementation,C=k.createNodeIterator,A=k.createDocumentFragment,E=k.getElementsByTagName,T=r.importNode,N={};try{N=hs(o).documentMode?o.documentMode:{}}catch(e){}var M={};n.isSupported="function"==typeof _&&S&&void 0!==S.createHTMLDocument&&9!==N;var L=Ss,z=Cs,O=As,I=Es,P=Ns,R=Ms,D=Ts,B=null,F=us({},[].concat(Os(ps),Os(ms),Os(fs),Os(vs),Os(_s))),j=null,H=us({},[].concat(Os(bs),Os(ws),Os(xs),Os(ks))),q=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{
@@ -558,7 +558,7 @@ t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Bp(t),i
558
558
  },s=t>0?`${o} (${t} available)`:o;return _o(Ao,{classes:Yr("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:_o(m,{children:[e,t>0&&!n&&_o("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var Wp=ci((function({annotationsService:e,isLoading:t,settings:n}){const r=hi(),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 _o("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[_o("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[_o(Vp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),_o(Vp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
559
559
  children:"Page Notes"}),s>0&&_o(Vp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&_o("div",{className:"hyp-u-layout-row--justify-right",children:_o(Ao,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:si(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&_o(No,{classes:"text-center",children:_o("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&_o(No,{classes:"text-center",children:_o("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",_o("br",{}),"Create one by selecting some text and clicking the"," ",_o(Do,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var Yp=ci((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
560
560
  const i=na(),a=hi(),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?Wi(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=so(s);io((()=>{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]),io((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return io((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),_o("div",{children:[_o("h2",{className:"sr-only",children:"Annotations"}),w&&_o(Pp,{}),_o(Gp,{onLogin:t,onSignUp:n}),y&&_o(Np,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&_o(Np,{
561
- errorType:"group",onLoginRequest:t}),x&&_o(Wp,{isLoading:c}),_o(Tp,{threads:i.children}),k&&_o(Rp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Kp=ci((function({api:e,toastMessenger:t}){const n=hi(),r=n.routeParams().q,o=co((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...Si(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return io((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),_o(Tp,{threads:na().children})}),["api","toastMessenger"]);class Xp{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.1011.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
561
+ errorType:"group",onLoginRequest:t}),x&&_o(Wp,{isLoading:c}),_o(Tp,{threads:i.children}),k&&_o(Rp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Kp=ci((function({api:e,toastMessenger:t}){const n=hi(),r=n.routeParams().q,o=co((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...Si(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return io((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),_o(Tp,{threads:na().children})}),["api","toastMessenger"]);class Xp{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.1012.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
562
562
  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 Zp(e){const t=R(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function Jp({commandName:e,iconName:t}){return _o("span",{className:"whitespace-nowrap",children:[_o(Do,{name:t,classes:Yr("mx-1 -mt-1","text-color-text-light inline")}),_o("em",{children:e})]})}var Qp=ci((function({settings:e}){const t=!Zp(e);return _o("ol",{className:"list-decimal pl-10 space-y-2",children:[_o("li",{children:["To create an annotation, select text and then select the"," ",_o(Jp,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),_o("li",{
563
563
  children:["To create a highlight (",_o(Bo,{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"," ",_o(Jp,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&_o("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"," ",_o(Bo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),_o("li",{children:["To reply to an annotation, select the"," ",_o(Jp,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var em=ci((function({toastMessenger:e,versionData:t}){return _o("div",{className:"hyp-u-vertical-spacing",children:[_o("dl",{className:"VersionInfo",children:[_o("dt",{className:"VersionInfo__key",children:"Version"}),_o("dd",{
564
564
  className:"VersionInfo__value",children:t.version}),_o("dt",{className:"VersionInfo__key",children:"User Agent"}),_o("dd",{className:"VersionInfo__value",children:t.userAgent}),_o("dt",{className:"VersionInfo__key",children:"URL"}),_o("dd",{className:"VersionInfo__value",children:t.urls}),_o("dt",{className:"VersionInfo__key",children:"Fingerprint"}),_o("dd",{className:"VersionInfo__value",children:t.fingerprint}),_o("dt",{className:"VersionInfo__key",children:"Account"}),_o("dd",{className:"VersionInfo__value",children:t.account}),_o("dt",{className:"VersionInfo__key",children:"Date"}),_o("dd",{className:"VersionInfo__value",children:t.timestamp})]}),_o("div",{className:"hyp-u-layout-row--justify-center",children:_o(Ao,{onClick:()=>{try{Aa(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 tm({children:e,onClick:t}){return _o(Eo,{
@@ -586,7 +586,7 @@ className:Yr("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"Hypo
586
586
  ;function zm({error:e}){return _o("div",{className:"LaunchErrorPanel",children:_o(Wo,{title:"Unable to start Hypothesis",children:e.message})})}class Om{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?xa(e.user):ka(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+H(8),l=Object.assign({created:t.toISOString(),group:r,permissions:Sa(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Ri(l)&&(l.permissions=xa(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Ri(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!zi(n)}),
587
587
  Bi(n)?this._store.selectTab("note"):Fi(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._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:zi(e)?ka(t,e.group):xa(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Mi(e)?this._api.annotation.update({id:e.id},n):this._api.annotation.create({},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
588
588
  this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Om.$inject=["api","store"];class Im extends Error{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 Pm(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Im(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Im(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Im(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Rm(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 Dm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Bm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
589
- return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1011.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Rm(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 Pm(m.toString(),{body:s?JSON.stringify(Dm(s)):null,headers:u,method:c.method})}finally{i()}}}(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={member:{delete:i("group.member.delete")},read:i("group.read")},
589
+ return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1012.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Rm(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 Pm(m.toString(),{body:s?JSON.stringify(Dm(s)):null,headers:u,method:c.method})}finally{i()}}}(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={member:{delete:i("group.member.delete")},read:i("group.read")},
590
590
  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}}Bm.$inject=["apiRoutes","auth","store"];var Fm={};function jm(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 Hm=jm;jm.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},jm.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},jm.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
591
591
  ;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},jm.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)},jm.prototype.try=function(e){
592
592
  console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},jm.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},jm.prototype.start=jm.prototype.try,jm.prototype.errors=function(){return this._errors},jm.prototype.attempts=function(){return this._attempts},jm.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=Hm;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");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
@@ -650,7 +650,7 @@ type:sv.SELECT_TAB,tab:e}},setExpanded:function(e,t){return{type:sv.SET_EXPANDED
650
650
  type:yv.OPEN_SIDEBAR_PANEL,panelName:e}},closeSidebarPanel:function(e){return{type:yv.CLOSE_SIDEBAR_PANEL,panelName:e}},toggleSidebarPanel:function(e,t){return{type:yv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),bv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},wv=sf(bv);const xv=Hf({messages:[]},{namespace:"toastMessages",reducers:bv,actionCreators:{addToastMessage:function(e){return{type:wv.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:wv.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:wv.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},
651
651
  hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),kv={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},Sv=sf(kv);const Cv=Hf({sidebarHasOpened:!1},{namespace:"viewer",reducers:kv,actionCreators:{setSidebarOpened:function(e){return{type:Sv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function Av(e){return jf([Gf,cg,dg,fg,kg,Lg,Rg,Jg,Kg,nv,ng,gv,jg,_v,xv,Cv],[e],[qf])}Av.$inject=["settings"];class Ev{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){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{
652
652
  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,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const Tv=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={}}
653
- e(n,i)}return n}(document),Nv=function(e){const{version:t,origin:n}=P(e.location.href);return"1.1011.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1011.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 Mv(e,t){e.setClientId(t.clientId)}function Lv(e,t,n){e.load(),t.load(),n.sync()}function zv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Ov(e,t){"sidebar"===t.route()&&e.connect()}Tv.sentry&&Nv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Er({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1011.0",beforeSend:(e,t)=>{
653
+ e(n,i)}return n}(document),Nv=function(e){const{version:t,origin:n}=P(e.location.href);return"1.1012.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1012.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 Mv(e,t){e.setClientId(t.clientId)}function Lv(e,t,n){e.load(),t.load(),n.sync()}function zv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Ov(e,t){"sidebar"===t.route()&&e.connect()}Tv.sentry&&Nv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Er({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1012.0",beforeSend:(e,t)=>{
654
654
  if(Mr>=5)return V("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Mr;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{Yt("host_config",P(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Nr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(Tv.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{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)}}}(),Mv.$inject=["api","streamer"],Lv.$inject=["groups","session","router"],zv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],
655
655
  Ov.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&bo.clear();for(let[t,n]of Object.entries(e))bo.set(t,n)}(ti);const Iv=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",J)}(),async function(e,t=window){const n=function(e){const t=P(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)}}},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=n.requestConfigFromFrame;if(!r)return U(e,n);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){
656
656
  if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await $(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(Tv).then((e=>{!function(e,t){const n=new Ev;n.register("annotationsService",Om).register("api",Bm).register("apiRoutes",Gm).register("auth",Ym).register("autosaveService",Km).register("features",Jm).register("frameSync",af).register("groups",uf).register("loadAnnotationsService",hf).register("localStorage",pf).register("persistedDefaults",ff).register("router",gf).register("serviceURL",vf).register("session",yf).register("streamer",wf).register("streamFilter",_f).register("tags",xf).register("threadsService",kf).register("toastMessenger",Sf).register("store",{factory:Av}),n.register("$window",{value:window