hypothesis 1.1158.0 → 1.1159.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 s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?e66b3e","styles/annotator.css":"styles/annotator.css?c10c10","styles/highlights.css":"styles/highlights.css?bb6e29","styles/annotator.css.map":"styles/annotator.css.map?02fa76","styles/highlights.css.map":"styles/highlights.css.map?51e295","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/katex.min.css":"styles/katex.min.css?776307","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css.map":"styles/sidebar.css.map?f950c5","styles/sidebar.css":"styles/sidebar.css?b1db12","styles/ui-playground.css":"styles/ui-playground.css?bcd7be","styles/ui-playground.css.map":"styles/ui-playground.css.map?7e7078","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?eac162","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?7c2adf","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?8b6a33","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?e0e9f5","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?3c1e44"};if(function(){var s=[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 s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=l(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1158.0/");if(document.querySelector("hypothesis-app")){!function(s,n){r(s,"fetch",n.apiUrl),r(s,"fetch",n.apiUrl+"links");for(var a=0,i=["scripts/sidebar.bundle.js"];a<i.length;a++)e(s,o(n,i[a]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,o(n,c[l]))}(document,{assetRoot:u,manifest:c,apiUrl:p.apiUrl})}else{var d=p,h=l(d.notebookAppUrl||"https://hypothes.is/notebook"),y=l(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,a){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",a.sidebarAppUrl),n(s,"notebook","html",a.notebookAppUrl),r(s,"style",o(a,"styles/annotator.css")),n(s,"hypothesis-client","javascript",a.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)e(s,o(a,l[i]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)t(s,o(a,u[p]))}}(document,{assetRoot:u,manifest:c,notebookAppUrl:h,sidebarAppUrl:y})}}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 s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?bbfb14","styles/annotator.css":"styles/annotator.css?c10c10","styles/annotator.css.map":"styles/annotator.css.map?02fa76","styles/highlights.css":"styles/highlights.css?bb6e29","styles/highlights.css.map":"styles/highlights.css.map?51e295","styles/katex.min.css":"styles/katex.min.css?776307","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?b1db12","styles/sidebar.css.map":"styles/sidebar.css.map?f950c5","styles/ui-playground.css":"styles/ui-playground.css?bcd7be","styles/ui-playground.css.map":"styles/ui-playground.css.map?7e7078","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?7c2adf","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?7117bf","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?8b6a33","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?e0e9f5","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?657cbe"};if(function(){var s=[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 s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=l(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1159.0/");if(document.querySelector("hypothesis-app")){!function(s,n){r(s,"fetch",n.apiUrl),r(s,"fetch",n.apiUrl+"links");for(var a=0,i=["scripts/sidebar.bundle.js"];a<i.length;a++)e(s,o(n,i[a]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,o(n,c[l]))}(document,{assetRoot:u,manifest:c,apiUrl:p.apiUrl})}else{var d=p,h=l(d.notebookAppUrl||"https://hypothes.is/notebook"),y=l(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,a){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",a.sidebarAppUrl),n(s,"notebook","html",a.notebookAppUrl),r(s,"style",o(a,"styles/annotator.css")),n(s,"hypothesis-client","javascript",a.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)e(s,o(a,l[i]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)t(s,o(a,u[p]))}}(document,{assetRoot:u,manifest:c,notebookAppUrl:h,sidebarAppUrl:y})}}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?e66b3e",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?bbfb14",
3
3
  "styles/annotator.css": "styles/annotator.css?c10c10",
4
- "styles/highlights.css": "styles/highlights.css?bb6e29",
5
4
  "styles/annotator.css.map": "styles/annotator.css.map?02fa76",
5
+ "styles/highlights.css": "styles/highlights.css?bb6e29",
6
6
  "styles/highlights.css.map": "styles/highlights.css.map?51e295",
7
+ "styles/katex.min.css": "styles/katex.min.css?776307",
7
8
  "styles/katex.min.css.map": "styles/katex.min.css.map?42d80c",
8
9
  "styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
9
- "styles/katex.min.css": "styles/katex.min.css?776307",
10
10
  "styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
11
- "styles/sidebar.css.map": "styles/sidebar.css.map?f950c5",
12
11
  "styles/sidebar.css": "styles/sidebar.css?b1db12",
12
+ "styles/sidebar.css.map": "styles/sidebar.css.map?f950c5",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?bcd7be",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?7e7078",
15
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?eac162",
16
15
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?7c2adf",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?7117bf",
17
17
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?8b6a33",
18
18
  "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?e0e9f5",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?3c1e44"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?657cbe"
20
20
  }
@@ -121,7 +121,7 @@ var e,n;return null===(e=(n=this._integration).showContentInfo)||void 0===e?void
121
121
  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 i=await this._integration.anchor(this.element,e.selector),o=Ie.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&We(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges
122
122
  ;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+St(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),po(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);Xe(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=Ye(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}
123
123
  _onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=He(e),i=qe(e);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=ho(),this._isAdderVisible=!0,this._adder.show(i,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){
124
- this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Kt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function mo(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function _o(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1158.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}
124
+ this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Kt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function mo(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function _o(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1159.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}
125
125
  function vo({config:t,groupId:e}){return ct("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:mo(t.notebookAppUrl,{..._o(t.notebookAppUrl,t),group:e})})}function yo({eventBus:t,config:e}){const[n,i]=G(0),[o,r]=G(!0),[s,a]=G(null),l=J(""),h=J(null);K((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),K((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),K((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),h.current=e,()=>{e.destroy()}}),[t]);return null===s?null:ct("div",{className:c("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:ct("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[ct("div",{className:"absolute right-0 text-xl m-3",children:ct(gt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),
126
126
  null===(t=h.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),ct(vo,{config:e,groupId:s},n)]})})}class bo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=Ae(this._outerContainer),I(ct(yo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){I(null,this.shadowRoot),this._outerContainer.remove()}}var wo={exports:{}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){
127
127
  var n=new Error("get-stack-trace"),i=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,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[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 i,o=e.prototype;(i=t.prototype=Object.create(o)).constructor=t,i._super=o,n&&r(i,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){
@@ -615,9 +615,9 @@ function sv({onLogin:e,onSignUp:t}){return ss().isLoggedIn()?null:Kr(av,{icon:"r
615
615
  r.selectTab(e)},u="annotation"===o&&0===a&&!l,d="note"===o&&0===i;return Kr("div",{className:Gn("space-y-3 pb-[9px]"),children:[Kr("div",{className:"flex gap-x-6 theme-clean:ml-[15px]",role:"tablist",children:[Kr(lv,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),Kr(lv,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),children:"Page Notes"}),s>0&&Kr(lv,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&Kr("div",{className:"flex justify-end",children:Kr(no,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:Oo(["ctaBackgroundColor"],n),children:"New note"})}),!t&&d&&Kr(io,{classes:"text-center",children:Kr("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&Kr(io,{
616
616
  classes:"text-center",children:Kr("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",Kr("br",{}),"Create one by selecting some text and clicking the"," ",Kr(fo,{classes:"inline m-0.5 -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var uv=Po((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){const i=Fs(),a=ss(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),d=a.directLinkedAnnotationId(),h=d?a.findAnnotationByID(d):void 0,p=h?As(h):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=!(c||!d)&&!h,b=a.directLinkedGroupFetchFailed(),_=v||b,y=!_,w=!_&&!l,x=d&&!u&&!v&&!c,k=Pr(s);Or((()=>{if(!k.current||k.current!==s){if(k.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}k.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Or((()=>{
617
617
  h&&!1===h.$orphan?(e.hoverAnnotation(h),e.scrollToAnnotation(h),a.selectTab(p)):h&&a.selectTab(p)}),[p,e,h,a]);const S=a.hasFetchedProfile();return Or((()=>{S&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[S,u,f,o]),Kr("div",{children:[Kr("h2",{className:"sr-only",children:"Annotations"}),y&&Kr(Zg,{}),Kr(sv,{onLogin:t,onSignUp:n}),v&&Kr(Wg,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),b&&Kr(Wg,{errorType:"group",onLoginRequest:t}),w&&Kr(cv,{isLoading:c}),Kr(Yg,{threads:i.children}),x&&Kr(Jg,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var dv=Po((function({api:e,toastMessenger:t}){const n=ss(),r=n.routeParams().q,o=Fr((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...ws(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Or((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))
618
- }),[r,o,n,t]),Kr(Yg,{threads:Fs().children})}),["api","toastMessenger"]);class hv{constructor(e,t,n=window){var r,o,i,a;const s="N/A";let l=s;e.userid&&(l=e.userid,e.displayName&&(l=`${e.displayName} (${l})`)),this.version="1.1158.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||s,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:s,this.account=l,this.timestamp=(new Date).toString();const c=null===(a=t[0])||void 0===a?void 0:a.segment;if(c){const e=[];c.cfi&&e.push(["CFI",c.cfi]),c.url&&e.push(["URL",c.url]),this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}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 pv(e){const n=t(e)
618
+ }),[r,o,n,t]),Kr(Yg,{threads:Fs().children})}),["api","toastMessenger"]);class hv{constructor(e,t,n=window){var r,o,i,a;const s="N/A";let l=s;e.userid&&(l=e.userid,e.displayName&&(l=`${e.displayName} (${l})`)),this.version="1.1159.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||s,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:s,this.account=l,this.timestamp=(new Date).toString();const c=null===(a=t[0])||void 0===a?void 0:a.segment;if(c){const e=[];c.cfi&&e.push(["CFI",c.cfi]),c.url&&e.push(["URL",c.url]),this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}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 pv(e){const n=t(e)
619
619
  ;return!(null==n||!n.authority)&&n.authority!==e.authDomain}function mv({commandName:e,icon:t}){return Kr("span",{className:"whitespace-nowrap","data-testid":"instruction",children:[Kr(t,{className:Gn("w-em h-em","mx-1 -mt-1","text-color-text-light inline")}),Kr("em",{"data-testid":"command-name",children:e})]})}var fv=Po((function({settings:e}){const t=!pv(e);return Kr("ol",{className:"list-decimal pl-10 space-y-2",children:[Kr("li",{children:["To create an annotation, select text and then select the"," ",Kr(mv,{icon:al,commandName:"Annotate"})," button."]}),Kr("li",{children:["To create a highlight (",Kr(mc,{href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",underline:"always",children:"visible only to you"}),"), select text and then select the"," ",Kr(mv,{icon:Il,commandName:"Highlight"})," button."]}),t&&Kr("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"," ",Kr(mc,{
620
- href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",underline:"always",children:"join link"}),")."]}),Kr("li",{children:["To reply to an annotation, select the"," ",Kr(mv,{icon:Vl,commandName:"Reply"})," button."]})]})}),["settings"]);function gv({label:e,children:t,classes:n}){return Kr(Jn,{children:[Kr("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Kr("dd",{className:Gn("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})}var vv=Po((function({toastMessenger:e,versionData:t}){return Kr("div",{className:"space-y-4",children:[Kr("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Kr(gv,{label:"Version",children:t.version}),Kr(gv,{label:"User Agent",children:t.userAgent}),Kr(gv,{classes:Gn("break-all"),label:"URL",children:t.urls}),Kr(gv,{label:"Fingerprint",children:t.fingerprint}),t.segment&&Kr(gv,{label:"Segment",children:t.segment}),Kr(gv,{label:"Account",children:t.account}),Kr(gv,{label:"Date",
620
+ href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",underline:"always",children:"join link"}),"."]}),Kr("li",{children:["To reply to an annotation, select the"," ",Kr(mv,{icon:Vl,commandName:"Reply"})," button."]})]})}),["settings"]);function gv({label:e,children:t,classes:n}){return Kr(Jn,{children:[Kr("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Kr("dd",{className:Gn("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})}var vv=Po((function({toastMessenger:e,versionData:t}){return Kr("div",{className:"space-y-4",children:[Kr("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Kr(gv,{label:"Version",children:t.version}),Kr(gv,{label:"User Agent",children:t.userAgent}),Kr(gv,{classes:Gn("break-all"),label:"URL",children:t.urls}),Kr(gv,{label:"Fingerprint",children:t.fingerprint}),t.segment&&Kr(gv,{label:"Segment",children:t.segment}),Kr(gv,{label:"Account",children:t.account}),Kr(gv,{label:"Date",
621
621
  children:t.timestamp})]}),Kr("div",{className:"flex items-center justify-center",children:Kr(ac,{onClick:()=>{try{Cc(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:yl,children:"Copy version details"})})]})}),["toastMessenger"]);function bv({children:e,onClick:t}){return Kr(fc,{color:"brand",onClick:t,underline:"hover",children:Kr("div",{className:"flex items-center gap-x-1",children:[e,Kr(ul,{className:"w-em h-em"})]})})}function _v({linkText:e,url:t}){return Kr("div",{className:"flex-1 flex items-center justify-center border-r last-of-type:border-r-0 text-lg font-medium",children:Kr(mc,{color:"text-light",href:t,target:"_blank",children:Kr("div",{className:"flex items-center gap-x-2",children:[Kr("span",{children:e})," ",Kr(Al,{className:"w-3 h-3"})]})})})}var yv=Po((function({session:e}){var t,n
622
622
  ;const r=ss(),o=r.frames(),i=r.mainFrame(),a=r.profile(),s=null!==(t=null===(n=a.user_info)||void 0===n?void 0:n.display_name)&&void 0!==t?t:vc(a.userid),l=!!r.profile().preferences.show_sidebar_tutorial,[c,u]=Rr("tutorial"),d=Br((()=>{const e=[...o].sort(((e,t)=>e===i?-1:t===i?1:0));return new hv({userid:a.userid,displayName:s},e)}),[a,s,o,i]),h=`https://web.hypothes.is/get-help/?sys_info=${d.asEncodedURLString()}`,p=(e,t)=>{e.preventDefault(),u(t)};return Kr(av,{title:"Help",panelName:"help",onActiveChanged:Fr((t=>{!t&&l&&e.dismissSidebarTutorial()}),[e,l]),children:Kr("div",{className:"space-y-4",children:[Kr("div",{className:"flex items-center",children:[Kr("h3",{className:"grow text-lg font-medium","data-testid":"subpanel-title",children:{tutorial:"Getting started",versionInfo:"About this version"}[c]}),"versionInfo"===c&&Kr(bv,{onClick:e=>p(e,"tutorial"),children:"Getting started"}),"tutorial"===c&&Kr(bv,{onClick:e=>p(e,"versionInfo"),children:"About this version"})]}),Kr("div",{
623
623
  className:"border-y py-4",children:["tutorial"===c&&Kr(fv,{}),"versionInfo"===c&&Kr(vv,{versionData:d})]}),Kr("div",{className:"flex items-center",children:[Kr(_v,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),Kr(_v,{linkText:"New support ticket",url:h})]})]})})}),["session"]),wv={exports:{}};function xv(){}xv.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,a=r.length;i<a;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},wv.exports=xv;var kv=wv.exports.TinyEmitter=xv;class Sv extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function Nv(e){
@@ -645,7 +645,7 @@ await(async()=>{const e=a.countDrafts();if(0===e)return!0;let t="";return 1===e?
645
645
  const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?wc(e.user):xc(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;if(!i)throw new Error("Cannot create annotation when logged out");const s=o.user_info,l="s:"+a(8),c=Object.assign({created:t.toISOString(),group:r,permissions:kc(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:s,$tag:l,hidden:!1,links:{},document:{title:""}},e);return Ni(c)&&(c.permissions=wc(i)),c}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Ni(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!wi(n)}),Ei(n)?this._store.selectTab("note"):Ai(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}
646
646
  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:wi(e)?xc(t,e.group):wc(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t,n;const r=this._applyDraftChanges(e);let o;_i(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}
647
647
  return this._store.removeDraft(e),this._store.addAnnotations([o]),o}}eb.$inject=["annotationActivity","api","store"];class tb{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,isShared:Sc(t.permissions)}};this._reportConfig.events.includes(e)&&function(e,t,n,r=[]){const o={jsonrpc:"2.0",method:n,params:r};e.postMessage(o,t)}(this._rpc.targetFrame,this._rpc.origin,this._reportConfig.method,[e,r])}}tb.$inject=["settings"];class nb 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 rb(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new nb(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){
648
- throw new nb(e,n,"Failed to parse response")}var o;if(!n.ok)throw new nb(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function ob(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function ib(e){return"url"in e}function ab(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||ib(o)){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.1158.0"};l&&(u.Authorization="Bearer "+l);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=Ra(c.url,a),m=new URL(h);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 rb(m.toString(),{body:s?JSON.stringify(ob(s)):null,headers:u,
648
+ throw new nb(e,n,"Failed to parse response")}var o;if(!n.ok)throw new nb(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function ob(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function ib(e){return"url"in e}function ab(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||ib(o)){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.1159.0"};l&&(u.Authorization="Bearer "+l);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=Ra(c.url,a),m=new URL(h);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 rb(m.toString(),{body:s?JSON.stringify(ob(s)):null,headers:u,
649
649
  method:c.method})}finally{i()}}}class sb{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>ab(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")},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}}sb.$inject=["apiRoutes","auth","store"];var lb={exports:{}},cb={};function ub(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,
650
650
  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 db=ub;ub.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},ub.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},ub.prototype.retry=function(e){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++,
651
651
  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},ub.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)},ub.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},ub.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},ub.prototype.start=ub.prototype.try,ub.prototype.errors=function(){return this._errors},ub.prototype.attempts=function(){return this._attempts},ub.prototype.mainError=function(){if(0===this._errors.length)return null
@@ -681,7 +681,7 @@ this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":th
681
681
  }filter(e,t=null){const n=this._storage.getObject("hypothesis.user.tags.list")||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${p(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject("hypothesis.user.tags.map")||{};e.forEach((e=>{t[e]?(t[e].count+=1,t[e].updated=Date.now()):t[e]={text:e,count:1,updated:Date.now()}})),this._storage.setObject("hypothesis.user.tags.map",t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject("hypothesis.user.tags.list",n)}}$b.$inject=["localStorage"];class Gb{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}Gb.$inject=["store"];class Vb{constructor(e){this._store=e}dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{
682
682
  this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r="",visuallyHidden:o=!1}={}){if(this._store.hasToastMessage(e,t))return;const i=a(10),s={type:e,id:i,message:t,moreInfoURL:r,visuallyHidden:o};this._store.addToastMessage({isDismissed:!1,...s}),n&&setTimeout((()=>{this.dismiss(i)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}Vb.$inject=["store"];class Yb{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{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{
683
683
  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 Wb=function(e){for(var t={},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(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),Kb=function(t){const{version:n,origin:r}=e(t.location.href)
684
- ;return"1.1158.0"!==n?(console.warn(`The Hypothesis sidebar is using a different version (1.1158.0) than the host page (${n}). It may not work.`),!1):"null"===t.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):t.origin===r||(console.warn(`The Hypothesis sidebar is running in a different origin (${t.origin}) than expected (${r}). It may not work.`),!1)}(window);function Xb(e,t){e.setClientId(t.clientId)}function Zb(e,t,n){e.load(),t.load(),n.sync()}function Jb(e,t,n){e.init(),t.init(),n.init()}function Qb(e,t){"sidebar"===t.route()&&e.connect()}Wb.sentry&&Kb&&function(t){const n=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),r=n?[n]:void 0;Rn({dsn:t.dsn,environment:t.environment,allowUrls:r,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1158.0",beforeSend:(e,t)=>{if(Dn>=5)return u("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Dn;try{const n=t&&t.originalException
684
+ ;return"1.1159.0"!==n?(console.warn(`The Hypothesis sidebar is using a different version (1.1159.0) than the host page (${n}). It may not work.`),!1):"null"===t.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):t.origin===r||(console.warn(`The Hypothesis sidebar is running in a different origin (${t.origin}) than expected (${r}). It may not work.`),!1)}(window);function Xb(e,t){e.setClientId(t.clientId)}function Zb(e,t,n){e.load(),t.load(),n.sync()}function Jb(e,t,n){e.init(),t.init(),n.init()}function Qb(e,t){"sidebar"===t.route()&&e.connect()}Wb.sentry&&Kb&&function(t){const n=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),r=n?[n]:void 0;Rn({dsn:t.dsn,environment:t.environment,allowUrls:r,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1159.0",beforeSend:(e,t)=>{if(Dn>=5)return u("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Dn;try{const n=t&&t.originalException
685
685
  ;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch(e){}return e}});try{bt("host_config",e(window.location.href))}catch(e){}bt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),On(((e,t)=>{vt(e,{tags:{context:t}})}))}(Wb.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),Xb.$inject=["api","streamer"],Zb.$inject=["groups","session","router"],Jb.$inject=["autosaveService","persistedDefaults","serviceURL"],Qb.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&Xr.clear();for(let[t,n]of Object.entries(e))Xr.set(t,n)}(zo);const e_=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",v)}(),async function(i,a=window){const c=function(t){
686
686
  const i=e(t.location.href),a=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],s={openSidebar:n,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:o(t.origin),ancestorLevel:r(t.ancestorLevel)}}},l={};for(let[e,t]of Object.entries(i))a.includes(e)&&null!==t&&(s[e]?l[e]=s[e](t):l[e]=t);return l}(window),u=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:l(n.ancestorLevel,t),origin:n.origin}}(c,a);let d;if(u){const e=await async function(e,t){return{...await s(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(c,u);d=function(e,t){const n=e.services
687
687
  ;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=s(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,u)}else d=c;const h={...i,...d};return u&&(h.rpc=u),h.apiUrl=function(e){const n=t(e);if(n){if(n.apiUrl)return n.apiUrl;throw new Error("Service should contain an apiUrl value.")}return e.apiUrl}(h),h}(Wb).then((e=>{!function(e,t){const n=new Yb;n.register("annotationsService",eb).register("annotationActivity",tb).register("api",sb).register("apiRoutes",fb).register("auth",bb).register("autosaveService",_b).register("frameSync",Tb).register("groups",zb).register("loadAnnotationsService",Rb).register("localStorage",Ob).register("persistedDefaults",Pb).register("router",Bb).register("serviceURL",Fb).register("session",Hb).register("streamer",qb).register("streamFilter",jb).register("tags",$b).register("threadsService",Gb).register("toastMessenger",Vb).register("store",{factory:as}),n.register("$window",{