hypothesis 1.1405.0 → 1.1406.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?d9c675","styles/annotator.css":"styles/annotator.css?01cc13","styles/annotator.css.map":"styles/annotator.css.map?dcd4af","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","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?b808be","styles/sidebar.css.map":"styles/sidebar.css.map?ddd0f6","styles/ui-playground.css":"styles/ui-playground.css?2051aa","styles/ui-playground.css.map":"styles/ui-playground.css.map?96dc88","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?ae6e24","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?b9ba37","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?d9dce3","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a02e5a","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?0e3da9"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=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),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1405.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"https://hypothes.is/notebook"),h=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)e(s,i(t,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl: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";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?bfe316","styles/annotator.css":"styles/annotator.css?01cc13","styles/annotator.css.map":"styles/annotator.css.map?dcd4af","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","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?b808be","styles/sidebar.css.map":"styles/sidebar.css.map?ddd0f6","styles/ui-playground.css":"styles/ui-playground.css?2051aa","styles/ui-playground.css.map":"styles/ui-playground.css.map?96dc88","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?485742","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?b9ba37","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?d9dce3","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a02e5a","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?7cebf0"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=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),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1406.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"https://hypothes.is/notebook"),h=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)e(s,i(t,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl: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,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?d9c675",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?bfe316",
3
3
  "styles/annotator.css": "styles/annotator.css?01cc13",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?dcd4af",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
@@ -12,9 +12,9 @@
12
12
  "styles/sidebar.css.map": "styles/sidebar.css.map?ddd0f6",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?2051aa",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?96dc88",
15
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?ae6e24",
15
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?485742",
16
16
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?b9ba37",
17
17
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?d9dce3",
18
18
  "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?a02e5a",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?0e3da9"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?7cebf0"
20
20
  }
@@ -138,7 +138,7 @@ const e=this.anchors.find((e=>e.annotation.$tag===t));null!=e&&e.highlights&&awa
138
138
  this._sendDocumentInfo()}destroy(){var t;this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),function(t){Gn(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){this._contentReady&&(await this._contentReady,this._contentReady=void 0);const e=t=>{var e;const n=cr(t);if(!n)return;const i=Xn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&Kn(i,!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{
139
139
  const i=await this._integration.anchor(this.element,e.selector),o=Bn.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&&Gn(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];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,
140
140
  $highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+s(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),hr(),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);Kn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Un(n),o=zn(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=ar(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){
141
- 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){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){oe(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function fr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function pr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1405.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),
141
+ 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){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){oe(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function fr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function pr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1406.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),
142
142
  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}function mr({config:t,groupId:e}){return _e("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:fr(t.notebookAppUrl,{...pr(t.notebookAppUrl,t),group:e})})}function gr({eventBus:t,config:e}){const[n,i]=Wt(0),[o,r]=Wt(!0),[s,a]=Wt(null),l=jt(""),c=jt(null);zt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),zt((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),zt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:_e("div",{
143
143
  className:me("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:_e("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[_e("div",{className:"absolute right-0 m-3",children:_e(nn,{title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:me("!bg-transparent enabled:hover:!bg-grey-3"),children:_e(Ne,{className:"w-4 h-4"})})}),_e(mr,{config:e,groupId:s},n)]})})}class _r{constructor(t,e,n){i(this,"_outerContainer",void 0),i(this,"_shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this._shadowRoot=Sn(this._outerContainer),Tt(_e(gr,{eventBus:e,config:n}),this._shadowRoot)}destroy(){Tt(null,this._shadowRoot),this._outerContainer.remove()}}function vr({eventBus:t,config:e}){const[n,i]=Wt(!0),o=jt(null);zt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{
144
144
  i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:_e("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:_e("div",{className:"relative w-full h-full","data-testid":"profile-inner",children:[_e("div",{className:"absolute right-0 m-3",children:_e(nn,{title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:me("!bg-transparent enabled:hover:!bg-grey-3"),children:_e(Ne,{className:"w-4 h-4"})})}),_e("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class br{constructor(t,e,n){i(this,"_outerContainer",void 0),i(this,"shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-profile"),t.appendChild(this._outerContainer),this.shadowRoot=Sn(this._outerContainer),Tt(_e(vr,{eventBus:e,config:n}),this.shadowRoot)}destroy(){Tt(null,this.shadowRoot),this._outerContainer.remove()}}var yr={exports:{}}
@@ -551,7 +551,7 @@ const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(of).filter((e=>
551
551
  const a=null!==(n=o.position)&&void 0!==n?n:Number.MAX_SAFE_INTEGER,s=null!==(r=i.position)&&void 0!==r?r:Number.MAX_SAFE_INTEGER;return Math.sign(a-s)}};const hf=function(e){if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,sortCompareFn:df[t.sortKey]},r=!!t.filterQuery||Object.keys(t.filters).length>0;if(r){const e=function(e,t={}){const n=e=>{const n=t[e];return"string"==typeof n?[n]:[]},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=af(e,tf);for(const e of h){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t
552
552
  },r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and"},cfi:{terms:r,operator:"or"},quote:{terms:i,operator:"and"},page:{terms:o,operator:"or"},since:{terms:d,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=(e,t)=>new Zp(t,ef[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new Jp("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new Jp(t.operator,r)})),o=new Jp("and",r);return e.filter((e=>e.id&&o.matches(e))).map((e=>e.id))}([t],e).length>0}return!r&&"sidebar"===e.route&&(n.threadFilterFn=e=>{
553
553
  return!!e.annotation&&(n=e.annotation,r=t.selectedTab,!Ro(n)&&lf(n)===r);var n,r}),Vp(e.annotations,n)}));function mf(){const e=Sa(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a=de((()=>({annotations:t,route:r,selection:{...o,filterQuery:n,filters:i}})),[t,n,r,o,i]);return hf(a)}var pf=Wr((function({loadAnnotationsService:e,onLogin:t}){var n;const r=Sa(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",i=mf(),a=r.profile().userid,[s,l]=ae(!1);return le((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),Re(v,{children:[s&&Re(Aa,{errorType:"annotation",onLoginRequest:t}),Re(Pp,{threads:i.children})]})}),["loadAnnotationsService"]);class ff{constructor(e,t,n=window){var r,o,i;H(this,"version",void 0),H(this,"userAgent",void 0),H(this,"urls",void 0),
554
- H(this,"fingerprint",void 0),H(this,"account",void 0),H(this,"timestamp",void 0),H(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1405.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(o=o.metadata)||void 0===o?void 0:o.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString();const l=null===(i=t[0])||void 0===i?void 0:i.segment;if(l){const e=[];l.cfi&&e.push(["CFI",l.cfi]),l.url&&e.push(["URL",l.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())}}var gf="complete",vf="canceled";function bf(e,t,n){
554
+ H(this,"fingerprint",void 0),H(this,"account",void 0),H(this,"timestamp",void 0),H(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1406.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(o=o.metadata)||void 0===o?void 0:o.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString();const l=null===(i=t[0])||void 0===i?void 0:i.segment;if(l){const e=[];l.cfi&&e.push(["CFI",l.cfi]),l.url&&e.push(["URL",l.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())}}var gf="complete",vf="canceled";function bf(e,t,n){
555
555
  e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function _f(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,m=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=m,o-=p,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect();var v=u.left-(n.left-t.scrollLeft),b=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=b+l*g-t.clientHeight*g,r-=m,o-=p,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,
556
556
  y:o,differenceX:i,differenceY:a}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return bf(e,r.x,r.y),e._scrollSettings=null,t.end(gf);var a=1-t.ease(i);if(bf(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&_f(t.scrollAncestor),void _f(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(_f.bind(null,e))}}function yf(e){return e.self===e}function wf(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function xf(){return!0}function kf(e){if(e.assignedSlot)return kf(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var Nf=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),
557
557
  t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{};var r=kf(e),o=1,i=t.validTarget||xf,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var s=[];r;)if(t.debug&&console.log("Scrolling parent node",r),i(r,o)&&(a?a(r,wf):wf(r))&&(o++,s.push(r)),!(r=kf(r))){l(gf);break}return s.reduce(((n,r,o)=>function(e,t,n,r,o){var i,a=!t._scrollSettings,s=t._scrollSettings,l=Date.now(),c={passive:!0};function u(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),n.debug&&console.log("Scrolling ended with type",e,"for",t),o(e),i&&(t.removeEventListener("touchstart",i,c),t.removeEventListener("wheel",i,c))}s&&s.end(vf);var d=n.maxSynchronousAlignments;return null==d&&(d=3),t._scrollSettings={startTime:l,endIterations:0,target:e,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||yf,maxSynchronousAlignments:d,
@@ -572,10 +572,10 @@ e instanceof Ff&&v(!0)},_=r.hasFetchedProfile();le((()=>{_&&t.connect({applyUpda
572
572
  title:"Too many results to show",children:[Re("p",{children:["This preview of the Notebook can show"," ",Re("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."]}),Re("p",{children:[Re(Ir,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})]})}),Re(Vf,{currentPage:p,isLoading:l,onChangePage:y,threads:u.children})]})]})}),["loadAnnotationsService","streamer"]);function Jf({classes:e,children:t,onClose:n=(()=>{}),...r}){return Re("div",{className:X("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[Re(ht,{className:"text-green-success w-em h-em p-[0.125em]"}),Re("div",{className:"text-sm",children:t})]})}function Qf(){
573
573
  const e=Sa(),[t,n]=ae(!1),[r,o]=ae(0);if(le((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),!e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return Re($e,{"data-testid":"profile-container",classes:"overflow-hidden",children:[Re("div",{className:X("h-12","px-3 border-b flex items-center"),children:[Re("div",{className:"grow",children:Re("h1",{className:"text-xl text-slate-7 font-normal",children:"Notifications"})}),Re("ul",{className:"sr-only","aria-live":"polite",children:i&&Re("li",{children:"Notification preferences saved"},r)}),r>0&&Re(Jf,{onClose:()=>o(0),children:"Saved"},r)]}),Re(He,{children:Re(Ve,{size:"lg",children:Re(yr,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?Un:void 0,icon:t?Un:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function eg(e,t,n,r){const o=new Blob([e],{type:t}),i=URL.createObjectURL(o),a=r.createElement("a");a.setAttribute("href",i),a.setAttribute("download",n),
574
574
  a.style.visibility="hidden",r.body.appendChild(a),a.click(),r.body.removeChild(a),URL.revokeObjectURL(i)}function tg({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&Co(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()];return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function ng(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function rg({documentMetadata:e,groupName:t,date:n=new Date}){const r=[ng(n)];return null!=e&&e.title?r.push(function(e,t){const n=Array.from(e);return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}function og(){return Re("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",children:Re(hr,{size:"md"})})}function ig({userAnnotations:e}){return Re("div",{
575
- className:"flex gap-x-2",children:[e.displayName,Re("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const ag=[{value:"json",name:"JSON"},{value:"txt",name:"Text"}];var sg=Wr((function({annotationsExporter:e,toastMessenger:t}){var n;const r=Sa(),o=r.focusedGroup(),i=o&&!r.isLoading(),a=r.defaultContentFrame(),s=r.savedAnnotations(),l=r.defaultAuthority(),c=r.isFeatureEnabled("client_display_names"),u=he((e=>ts(e,l,c)),[l,c]),d=de((()=>tg({annotations:s,getDisplayName:u})),[s,u]),h=r.profile().userid,m=de((()=>({annotations:s,displayName:"All annotations"})),[s]),[p,f]=ae(null!==(n=d.find((e=>e.userid===h)))&&void 0!==n?n:m),g=r.isFeatureEnabled("export_formats"),[b,_]=ae(ag[0]),y=pe(),w=pe(),x=r.countDrafts(),k=de((()=>rg({documentMetadata:null==a?void 0:a.metadata,groupName:null==o?void 0:o.name})),[a,o]),[N,S]=ae();return i?Re("form",{className:"space-y-3",onSubmit:n=>{n.preventDefault();try{var r
576
- ;const t=b.value,n=null!==(r=null==p?void 0:p.annotations)&&void 0!==r?r:s,i=`${null!=N?N:k}.${t}`;switch(t){case"json":!function(e,t,n=document){const r=JSON.stringify(e,null,2);eg(r,"application/json",t,n)}(e.buildJSONExportContent(n),i);break;case"txt":!function(e,t,n=document){eg(e,"text/plain",t,n)}(e.buildTextExportContent(n,{groupName:null==o?void 0:o.name,defaultAuthority:l,displayNamesEnabled:c}),i);break}}catch(n){t.error("Exporting annotations failed")}},"data-testid":"export-form",children:[s.length>0?Re(v,{children:[Re("p",{className:"text-color-text-light mb-3",children:[Re(Ir,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Re("label",{"data-testid":"export-count",htmlFor:y,className:"font-medium",children:"Name of export file:"}),Re("div",{className:"flex",children:[Re(kr,{classes:"grow",
577
- "data-testid":"export-filename",id:y,defaultValue:k,value:N,onChange:e=>S(e.target.value),required:!0,maxLength:250}),g&&Re("div",{className:"grow-0 ml-2 min-w-[5rem]",children:Re(Cr,{value:b,onChange:_,buttonContent:b.name,"data-testid":"export-format-select",right:!0,children:ag.map((e=>Re(Cr.Option,{value:e,children:e.name},e.value)))})})]}),Re("label",{htmlFor:w,className:"block font-medium",children:["Select which user","'","s annotations to export:"]}),Re(Cr,{value:p,onChange:f,buttonId:w,buttonContent:Re(ig,{userAnnotations:p}),"data-testid":"user-select",children:[Re(Cr.Option,{value:m,children:Re(ig,{userAnnotations:m})}),d.map((e=>Re(Cr.Option,{value:e,children:Re(ig,{userAnnotations:e})},e.userid)))]})]}):Re("p",{"data-testid":"no-annotations-message",children:"There are no annotations available for export."}),x>0&&Re("p",{"data-testid":"drafts-message",children:["You have ",x," unsaved"," ",(A=x,E="draft",T="drafts",1===A?E:T),s.length>0&&Re(v,{children:" that will not be included"}),"."]
578
- }),Re(qe,{children:Re(Wn,{"data-testid":"export-button",variant:"primary",disabled:0===s.length,type:"submit",children:"Export"})})]}):Re(og,{});var A,E,T}),["annotationsExporter","toastMessenger"]);function lg(e,t=new FileReader){const{promise:n,resolve:r,reject:o}=function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}();return t.addEventListener("loadend",(e=>{try{var t,n;const o=null!==(t=null===(n=e.target)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.toString())&&void 0!==t?t:"",i=JSON.parse(o);r(i)}catch(e){o(e)}})),t.readAsText(e),n}function cg({size:e,value:t}){const n=e-4,r=Math.PI*n;return Re("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Re("svg",{viewBox:`0 0 ${e} ${e}`,children:Re("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",
575
+ className:"flex gap-x-2",children:[e.displayName,Re("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const ag=[{value:"json",name:"JSON"},{value:"txt",name:"Text"}];var sg=Wr((function({annotationsExporter:e,toastMessenger:t}){var n;const r=Sa(),o=r.focusedGroup(),i=o&&!r.isLoading(),a=r.defaultContentFrame(),s=r.savedAnnotations(),l=r.defaultAuthority(),c=r.isFeatureEnabled("client_display_names"),u=he((e=>ts(e,l,c)),[l,c]),d=de((()=>tg({annotations:s,getDisplayName:u})),[s,u]),h=r.profile(),m=h.userid,p=de((()=>({annotations:s,displayName:"All annotations"})),[s]),[f,g]=ae(null!==(n=d.find((e=>e.userid===m)))&&void 0!==n?n:p),b=r.isFeatureEnabled("export_formats"),[_,y]=ae(ag[0]),w=pe(),x=pe(),k=r.countDrafts(),N=de((()=>rg({documentMetadata:null==a?void 0:a.metadata,groupName:null==o?void 0:o.name})),[a,o]),[S,A]=ae();return i?Re("form",{className:"space-y-3",onSubmit:n=>{n.preventDefault();try{var r
576
+ ;const t=_.value,n=null!==(r=null==f?void 0:f.annotations)&&void 0!==r?r:s,i=`${null!=S?S:N}.${t}`;switch(t){case"json":!function(e,t,n=document){const r=JSON.stringify(e,null,2);eg(r,"application/json",t,n)}(e.buildJSONExportContent(n,{profile:h}),i);break;case"txt":!function(e,t,n=document){eg(e,"text/plain",t,n)}(e.buildTextExportContent(n,{groupName:null==o?void 0:o.name,defaultAuthority:l,displayNamesEnabled:c}),i);break}}catch(n){t.error("Exporting annotations failed")}},"data-testid":"export-form",children:[s.length>0?Re(v,{children:[Re("p",{className:"text-color-text-light mb-3",children:[Re(Ir,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Re("label",{"data-testid":"export-count",htmlFor:w,className:"font-medium",children:"Name of export file:"}),Re("div",{className:"flex",children:[Re(kr,{classes:"grow",
577
+ "data-testid":"export-filename",id:w,defaultValue:N,value:S,onChange:e=>A(e.target.value),required:!0,maxLength:250}),b&&Re("div",{className:"grow-0 ml-2 min-w-[5rem]",children:Re(Cr,{value:_,onChange:y,buttonContent:_.name,"data-testid":"export-format-select",right:!0,children:ag.map((e=>Re(Cr.Option,{value:e,children:e.name},e.value)))})})]}),Re("label",{htmlFor:x,className:"block font-medium",children:["Select which user","'","s annotations to export:"]}),Re(Cr,{value:f,onChange:g,buttonId:x,buttonContent:Re(ig,{userAnnotations:f}),"data-testid":"user-select",children:[Re(Cr.Option,{value:p,children:Re(ig,{userAnnotations:p})}),d.map((e=>Re(Cr.Option,{value:e,children:Re(ig,{userAnnotations:e})},e.userid)))]})]}):Re("p",{"data-testid":"no-annotations-message",children:"There are no annotations available for export."}),k>0&&Re("p",{"data-testid":"drafts-message",children:["You have ",k," unsaved"," ",(E=k,T="draft",C="drafts",1===E?T:C),s.length>0&&Re(v,{children:" that will not be included"}),"."]
578
+ }),Re(qe,{children:Re(Wn,{"data-testid":"export-button",variant:"primary",disabled:0===s.length,type:"submit",children:"Export"})})]}):Re(og,{});var E,T,C}),["annotationsExporter","toastMessenger"]);function lg(e,t=new FileReader){const{promise:n,resolve:r,reject:o}=function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}();return t.addEventListener("loadend",(e=>{try{var t,n;const o=null!==(t=null===(n=e.target)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.toString())&&void 0!==t?t:"",i=JSON.parse(o);r(i)}catch(e){o(e)}})),t.readAsText(e),n}function cg({size:e,value:t}){const n=e-4,r=Math.PI*n;return Re("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Re("svg",{viewBox:`0 0 ${e} ${e}`,children:Re("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",
579
579
  transitionProperty:"stroke-dashoffset"}})})})}function ug({onFileSelected:e,disabled:t,id:n}){const r=ue(null),[o,i]=ae(null);return Re(Wn,{variant:"custom",classes:X("w-full relative overflow-hidden border rounded","bg-grey-0 hover:bg-grey-0"),title:o?`${o}, Select a file`:"Select a file",onClick:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.click()},disabled:t,"data-testid":"file-input-proxy-button",children:[Re("input",{ref:r,accept:".json",id:n,type:"file",disabled:t,className:"invisible absolute w-0 h-0","aria-hidden":!0,"data-testid":"file-input",onChange:t=>{var n,r;const o=t.target.files;i(null!==(n=null==o||null===(r=o[0])||void 0===r?void 0:r.name)&&void 0!==n?n:null),null!==o&&o.length>0&&e(o[0])}}),Re("div",{className:"max-w-full pr-10 truncate","data-testid":"filename-container",children:null!=o?o:"Select a file"}),Re("div",{className:"absolute right-0 h-full p-2 border-l bg-grey-2",children:Re(Ft,{})})]})}var dg=Wr((function({importAnnotationsService:e}){
580
580
  const[t,n]=ae(null),[r,o]=ae(null),[i,a]=ae(null),s=Sa(),l=s.profile().userid,c=s.defaultAuthority(),u=s.isFeatureEnabled("client_display_names"),d=he((e=>ts(e,c,u)),[c,u]),h=de((()=>r?tg({annotations:r,getDisplayName:d,excludeReplies:!0}):null),[r,d]),[m,p]=ae(null),f=de((()=>{var e;return null!==(e=null==h?void 0:h.find((e=>e.userid===m)))&&void 0!==e?e:null}),[m,h]);let g;le((()=>{l&&t&&(o(null),a(null),p(null),async function(e){let t;try{t=await lg(e)}catch(e){throw new Error("Not a valid JSON file")}if(null===(n=t)||"object"!=typeof n||!Array.isArray(t.annotations))throw new Error("Not a valid Hypothesis JSON file");var n;return t.annotations}(t).then((e=>{o(e);const t=e.some((e=>e.user===l));p(t?l:null)})).catch((e=>{a(e.message)})))}),[l,t]),f&&(g=async()=>{e.import(f.annotations)});const b=pe(),_=pe();if(!l)return Re("p",{"data-testid":"log-in-message",children:"You must log in to import annotations."})
581
581
  ;const y=Boolean(s.focusedGroup()&&s.defaultContentFrame()&&s.hasFetchedAnnotations()&&!s.isFetchingAnnotations()&&g),w=t&&!r&&!i,x=s.importsPending(),k=s.importsTotal(),N=k-x,S=w||x>0,A=x>0?Math.round(N/k*100):null;return Re(v,{children:[Re("p",{className:"text-color-text-light mb-3",children:[Re(Ir,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about importing annotations."]}),Re("label",{htmlFor:b,className:"font-medium",children:"Select Hypothesis export file:"}),Re(ug,{onFileSelected:n,disabled:S,id:b}),h&&Re(v,{children:[Re("label",{htmlFor:_,className:"block font-medium",children:"Select which user's annotations to import:"}),Re(Cr,{value:f,onChange:e=>{var t;return p(null!==(t=null==e?void 0:e.userid)&&void 0!==t?t:null)},buttonId:_,buttonContent:f?Re(ig,{userAnnotations:f}):Re("span",{className:"text-grey-6",children:"Select a user..."}),
@@ -602,18 +602,17 @@ null!==(t=o.current)&&void 0!==t&&t.value||i)&&n(null!==(r=null===(a=o.current)|
602
602
  !n.metaKey&&!n.ctrlKey&&n.target instanceof HTMLElement&&["INPUT","TEXTAREA"].includes(n.target.tagName)||(t.current=document.activeElement,e.isSidebarPanelOpen("searchAnnotations")||(e.openSidebarPanel("searchAnnotations"),n.preventDefault(),n.stopPropagation()))}),[e]),r=ls()?"meta":"ctrl";Kf("/",n),Kf(`${r}+k`,n)}(e),Re(v,{children:[t&&Re(hr,{}),!t&&Re(Lg,{icon:Ln,expanded:n,pressed:n,onClick:r,title:"Search annotations",size:"custom",classes:"touch:min-w-touch-minimum p-1"})]})}function Fg({query:e,onSearch:t,inputRef:n,classes:r,onKeyDown:o}){const i=Sa().isLoading(),a=Ie(n),[s,l]=ae(e),[c,u]=ae(e);Kf("/",(e=>{var t;document.activeElement!==a.current&&(e.preventDefault(),null===(t=a.current)||void 0===t||t.focus())}));return e!==s&&(u(e),l(e)),Re("form",{name:"searchForm",onSubmit:e=>{var n,r,o;(e.preventDefault(),null!==(n=a.current)&&void 0!==n&&n.value||s)&&t(null!==(r=null===(o=a.current)||void 0===o?void 0:o.value)&&void 0!==r?r:"")},className:X("space-y-3",r),children:Re(Xn,{children:[Re(kr,{
603
603
  "aria-label":"Search annotations",classes:X("text-base p-1.5","transition-[max-width] duration-300 ease-out"),"data-testid":"search-input",dir:"auto",name:"query",placeholder:i?"Loading…":"Search annotations…",disabled:i,elementRef:a,value:c||"",onInput:e=>u(e.target.value),onKeyDown:o}),Re(Jn,{icon:Ln,title:"Search",type:"submit",variant:"dark"})]})})}var Bg=Wr((function({router:e}){const t=Sa(),n=t.isFeatureEnabled("search_panel"),{q:r}=t.routeParams(),o=t=>{e.navigate("stream",{q:t})};return n?Re(Fg,{query:null!=r?r:"",onSearch:o}):Re(Pg,{query:null!=r?r:"",onSearch:o,alwaysExpanded:!0})}),["router"]);var Hg=Wr((function({isSidebar:e,onLogin:t,onLogout:n,onSignUp:r,frameSync:o,settings:i}){const a=Gr(["accentColor"],i),s=Sa(),l=s.filterQuery(),c=s.isLoggedIn(),u=s.hasFetchedProfile(),d=s.isFeatureEnabled("search_panel"),h=s.isSidebarPanelOpen("help"),m=s.isSidebarPanelOpen("shareGroupAnnotations");return Re("div",{
604
604
  className:X("absolute h-10 left-0 top-0 right-0 z-4","text-grey-7 border-b theme-clean:border-b-0 bg-white"),"data-testid":"top-bar",children:Re("div",{className:X("container flex items-center h-full","text-[16px]"),"data-testid":"top-bar-content",children:[Re(e?zg:Bg,{}),Re("div",{className:"grow flex items-center justify-end",children:[e&&Re(v,{children:[Re(Xf,{}),!d&&Re(Pg,{query:l||null,onSearch:s.setFilterQuery}),d&&Re(Dg,{}),Re(Rg,{}),Re(Lg,{icon:On,expanded:m,pressed:m,onClick:()=>{s.toggleSidebarPanel("shareGroupAnnotations")},size:"xs",title:"Share annotations on this page","data-testid":"share-icon-button"})]}),Re(Lg,{icon:Yt,expanded:h,pressed:h,onClick:()=>{const e=$r(i);e&&e.onHelpRequestProvided?o.notifyHost("helpRequested"):s.toggleSidebarPanel("help")},size:"xs",title:"Help","data-testid":"help-icon-button"}),c?Re(Og,{onLogout:n}):Re("div",{className:"flex items-center text-md font-medium space-x-1 pl-1","data-testid":"login-links",children:[!c&&!u&&Re("span",{children:"⋯"}),!c&&u&&Re(v,{
605
- children:[Re(Lr,{classes:"inline",onClick:r,style:a,underline:"none",children:"Sign up"}),Re("div",{children:"/"}),Re(Lr,{classes:"inline",onClick:t,style:a,underline:"none",children:"Log in"})]})]})]})]})})}),["frameSync","settings"]);function jg(){const e=Sa(),t=mf(),n=e.filterQuery(),r=e.forcedVisibleThreads().length,o=de((()=>Xa(t)-r),[t,r]),i="Clear search";return Re("div",{className:X("mb-3 flex items-center justify-center space-x-1",{"sr-only":!n}),"data-testid":"search-status-container",children:[Re("div",{className:X("grow min-w-[0]"),role:"status",children:n&&Re(v,{children:[o>0&&Re("span",{children:"Showing "}),Re("span",{className:"whitespace-nowrap font-bold",children:[o>0?o:"No"," ",1===o?"result":"results"]}),Re("span",{children:[" ","for ",Re("span",{className:"break-words",children:`'${n}'`})]})]})}),n&&Re(Wn,{onClick:()=>e.clearSelection(),size:"sm",title:i,variant:"primary","data-testid":"clear-button",children:[n&&Re(et,{}),i]})]})}function $g(){const e=Sa(),t=e.filterQuery(),n=ue(null)
606
- ;return Re(Af,{panelName:"searchAnnotations",variant:"custom",title:"Search annotations",initialFocus:n,onActiveChanged:t=>{t||e.clearSelection()},children:Re($e,{children:Re(Ve,{children:[Re("div",{className:"flex gap-x-3",children:[Re(Fg,{inputRef:n,classes:"grow",query:t||null,onSearch:e.setFilterQuery,onKeyDown:t=>{"Escape"===t.key&&e.closeSidebarPanel("searchAnnotations")}}),Re(er,{classes:"text-[16px] text-grey-6 hover:text-grey-7 hover:bg-grey-3/50",title:"Close",variant:"custom",size:"sm"})]}),t&&Re(jg,{})]})})})}var Ug=Wr((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=Sa(),a=i.profile(),s=i.route(),l="notebook"===s||"profile"===s,c=de((()=>Gr(["appBackgroundColor"],n)),[n]),u="clean"===n.theme,d="sidebar"===s;le((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=$r(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,a,n)&&i.openSidebarPanel("help")}),[d,a,n,i])
607
- ;const h=Ur(n),m=i.isFeatureEnabled("search_panel"),p=async()=>{if($r(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},f=()=>{$r(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return Re("div",{className:X("h-full min-h-full overflow-auto","lg:pb-16 bg-grey-2","js-thread-list-scroll-root",{"theme-clean":u,"pt-[49px]":!l,"p-4 lg:p-12":l}),"data-testid":"hypothesis-app",style:c,children:[!l&&Re(Hg,{onLogin:p,onSignUp:f,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),jr({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),$r(n)?t.notifyHost("logoutRequested"):r.logout())},
608
- isSidebar:d}),Re("div",{className:"container",children:[Re(Ng,{}),Re(Rf,{}),m&&Re($g,{}),Re(mg,{shareTab:!h}),s&&Re("main",{children:["annotation"===s&&Re(pf,{onLogin:p}),"notebook"===s&&Re(Zf,{}),"profile"===s&&Re(Qf,{}),"stream"===s&&Re(kg,{}),"sidebar"===s&&Re(xg,{onLogin:p,onSignUp:f})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"]);function qg({error:e}){return Re("div",{className:X("m-2 mt-12"),children:Re(ar,{title:"Unable to start Hypothesis",children:e.message})})}function Gg(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function Vg(e){const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t).map(Gg).join("")}function Wg(e,t,n,r=[],o=2e3,i=window){const a=Vg(10),s={jsonrpc:"2.0",method:n,params:r,id:a};try{e.postMessage(s,t)}catch(e){return Promise.reject(e)}let l;const c=new Promise(((e,n)=>{l=r=>{if(r.origin!==t)return;if(!(r.data instanceof Object)||"2.0"!==r.data.jsonrpc||r.data.id!==a)return;const{error:o,result:i}=r.data
609
- ;void 0!==o?n(o):void 0!==i?e(i):n(new Error("RPC reply had no result or error"))},i.addEventListener("message",l)})),u=[c];var d,h;return o&&u.push((d=o,h=`Request to ${t} timed out`,new Promise(((e,t)=>{setTimeout((()=>t(new Error(h))),d)})))),Promise.race(u).then((e=>(i.removeEventListener("message",l),e))).catch((e=>{throw i.removeEventListener("message",l),e}))}function Yg(e){const t=new URL(e).hash.slice(1),n=new URLSearchParams(t).get("config");return JSON.parse(n||"{}")}function Kg(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function Xg(e){return parseInt(e)}function Zg(e){return e&&"function"==typeof e.toString?e.toString():""}function Jg(e,t=window){let n=t;for(let t=0;t<e;t++){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}const Qg=new Set;function ev(...e){
610
- const t=e.join();Qg.has(t)||(console.warn(...e),Qg.add(t))}ev.reset=()=>{Qg.clear()};var tv=t((e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}));function nv(e,t,n,r){const o=t.find((e=>"__world__"===e.id));o&&e.unshift(o);const i=e.map((e=>e.id));t=t.filter((e=>!i.includes(e.id))),t.forEach((e=>e.isMember=!1)),e.forEach((e=>e.isMember=!0));const a=e.concat(t);return a.forEach((e=>{e.canLeave=!!function(e){const t=$r(e);return!t||!!t.allowLeavingGroups}(r)&&"private"===e.type})),a.forEach((e=>e.isScopedToUri=function(e,t){if(e.scopes&&e.scopes.uri_patterns.length>0&&t)return function(e,t){return t.some((t=>e.match(t.split("*").map(tv).join(".*"))))}(t,e.scopes.uri_patterns);return!0}(e,n))),a}let rv=[];const ov=e=>({changeFocusModeUser:t=>{var n;e.changeFocusModeUser(t);const r=null!==(n=null==t?void 0:t.groups)&&void 0!==n?n:[],o=function(e,t){return function(e,t){
611
- return t.filter((t=>e.includes(t.id)||t.groupid&&e.includes(t.groupid)))}(e,t).map((e=>e.id))}(r,e.allGroups());r.length&&!o.length&&console.error("No matching groups found in list of filtered group IDs"),e.filterGroups(o)},showContentInfo:t=>{e.setContentInfo(t)}});function iv(e,t,n){const r=ov(e);function o(e){const n=t.rpcAllowedOrigins||[];if(null==(o=e.data)||"object"!=typeof o||"2.0"!==o.jsonrpc)return;var o;if(!n.includes(e.origin))return void ev(`Ignoring JSON-RPC request from non-whitelisted origin ${e.origin}`);const i=e.data;e.source.postMessage(function(e){const t=r[e.method];if(void 0===t)return{jsonrpc:"2.0",id:e.id,error:{code:-32601,message:"Method not found"}};e.params?t(...e.params):t();return{jsonrpc:"2.0",result:"ok",id:e.id}}(i),e.origin)}rv.forEach((e=>{o(e)})),rv=[],window.removeEventListener("message",av),n.addEventListener("message",o)}function av(e){rv.push(e)}iv.$inject=["store","settings","$window"];class sv{constructor(e){H(this,"_rpc",void 0),H(this,"_reportConfig",void 0),
612
- 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:as(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])}}sv.$inject=["settings"];class lv{constructor(e,t,n,r){H(this,"_activity",void 0),H(this,"_api",void 0),H(this,"_settings",void 0),H(this,"_store",void 0),this._activity=e,this._api=t,this._settings=n,this._store=r}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?rs(e.user):os(e.user,e.group)),{...e,...t}}annotationFromData(e,t=new Date){
613
- 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 a=o.user_info,s=`s:${Vg(8)}`,l=Object.assign({created:t.toISOString(),group:r,permissions:is(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Po(l)&&(l.permissions=rs(i)),this._settings.annotationMetadata&&(l.metadata={...this._settings.annotationMetadata}),l}create(e,t=new Date){const n=this.annotationFromData(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Po(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!zo(n)}),Fo(n)?this._store.selectTab("note"):Bo(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame()
614
- ;if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[{source:e.uri}],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:zo(e)?os(t,e.group):rs(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;Mo(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(const[t,n]of Object.entries(e))if(t.startsWith("$")){o[t]=n}return this._store.removeDraft(e),
615
- this._store.addAnnotations([o]),o}}function cv(e,t){const n=new RegExp(`^ {${t}}`,"gm");return e.replace(n,"")}function uv(e,...t){return n=function(e,...t){const n=e.join("").match(/^[ \t]*(?=\S)/gm),r=n?Math.min(...n.map((e=>e.length))):0;let o="";for(const[n,i]of t.entries())o+=cv(e[n],r),o+=i;return o+cv(e[e.length-1],r)}([...e],...t),n.replace(/^\s*\n|\n\s*$/g,"");var n}function dv(e){const t={};for(const[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}lv.$inject=["annotationActivity","api","settings","store"];let hv,mv,pv=e=>e;class fv{constructor(e){H(this,"_store",void 0),this._store=e}buildJSONExportContent(e,t=new Date){var n;const r=this._store.profile(),o=new ff(r,[]);return{export_date:t.toISOString(),export_userid:null!==(n=r.userid)&&void 0!==n?n:"",client_version:o.version,annotations:e.map(dv)}}buildTextExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const[i]=e;if(!i)throw new Error("No annotations to export")
616
- ;const a=e=>ts(e,r,n),{uri:s,title:l}=So(i),c=[...new Set(e.map((e=>a(e))).filter(Boolean))],u=e.map(((e,t)=>{const n=qo(e),r=[e.created,e.text,a(e),`"${$o(e)}"`,e.tags.length>0?`Tags: ${e.tags.join(", ")}`:void 0,n?`Page: ${n}`:void 0].filter(Boolean);return uv(hv||(hv=pv`
605
+ children:[Re(Lr,{classes:"inline",onClick:r,style:a,underline:"none",children:"Sign up"}),Re("div",{children:"/"}),Re(Lr,{classes:"inline",onClick:t,style:a,underline:"none",children:"Log in"})]})]})]})]})})}),["frameSync","settings"]);function jg(){const e=Sa(),t=mf(),n=e.filterQuery(),r=e.forcedVisibleThreads().length,o=de((()=>Xa(t)-r),[t,r]);return Re("div",{className:X("mb-1 flex items-center justify-center space-x-1",{"sr-only":!n}),"data-testid":"search-status-container",children:Re("div",{className:X("grow min-w-[0]"),role:"status",children:n&&Re(v,{children:[o>0&&Re("span",{children:"Showing "}),Re("span",{className:"whitespace-nowrap font-bold",children:[o>0?o:"No"," ",1===o?"result":"results"]}),Re("span",{children:[" ","for ",Re("span",{className:"break-words",children:`'${n}'`})]})]})})})}function $g(){const e=Sa(),t=e.filterQuery(),n=ue(null);return Re(Af,{panelName:"searchAnnotations",variant:"custom",title:"Search annotations",initialFocus:n,onActiveChanged:t=>{t||e.clearSelection()},
606
+ children:Re($e,{children:Re(Ve,{children:[Re("div",{className:"flex gap-x-3",children:[Re(Fg,{inputRef:n,classes:"grow",query:t||null,onSearch:e.setFilterQuery,onKeyDown:t=>{"Escape"===t.key&&e.closeSidebarPanel("searchAnnotations")}}),Re(er,{classes:"text-[16px] text-grey-6 hover:text-grey-7 hover:bg-grey-3/50",title:"Close",variant:"custom",size:"sm"})]}),t&&Re(jg,{})]})})})}var Ug=Wr((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=Sa(),a=i.profile(),s=i.route(),l="notebook"===s||"profile"===s,c=de((()=>Gr(["appBackgroundColor"],n)),[n]),u="clean"===n.theme,d="sidebar"===s;le((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=$r(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,a,n)&&i.openSidebarPanel("help")}),[d,a,n,i]);const h=Ur(n),m=i.isFeatureEnabled("search_panel"),p=async()=>{if($r(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),
607
+ r.reload()}catch(e){o.error(e.message)}},f=()=>{$r(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return Re("div",{className:X("h-full min-h-full overflow-auto","lg:pb-16 bg-grey-2","js-thread-list-scroll-root",{"theme-clean":u,"pt-[49px]":!l,"p-4 lg:p-12":l}),"data-testid":"hypothesis-app",style:c,children:[!l&&Re(Hg,{onLogin:p,onSignUp:f,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),jr({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),$r(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),Re("div",{className:"container",children:[Re(Ng,{}),Re(Rf,{}),m&&Re($g,{}),Re(mg,{shareTab:!h}),s&&Re("main",{children:["annotation"===s&&Re(pf,{onLogin:p
608
+ }),"notebook"===s&&Re(Zf,{}),"profile"===s&&Re(Qf,{}),"stream"===s&&Re(kg,{}),"sidebar"===s&&Re(xg,{onLogin:p,onSignUp:f})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"]);function qg({error:e}){return Re("div",{className:X("m-2 mt-12"),children:Re(ar,{title:"Unable to start Hypothesis",children:e.message})})}function Gg(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function Vg(e){const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t).map(Gg).join("")}function Wg(e,t,n,r=[],o=2e3,i=window){const a=Vg(10),s={jsonrpc:"2.0",method:n,params:r,id:a};try{e.postMessage(s,t)}catch(e){return Promise.reject(e)}let l;const c=new Promise(((e,n)=>{l=r=>{if(r.origin!==t)return;if(!(r.data instanceof Object)||"2.0"!==r.data.jsonrpc||r.data.id!==a)return;const{error:o,result:i}=r.data;void 0!==o?n(o):void 0!==i?e(i):n(new Error("RPC reply had no result or error"))},i.addEventListener("message",l)})),u=[c];var d,h;return o&&u.push((d=o,h=`Request to ${t} timed out`,
609
+ new Promise(((e,t)=>{setTimeout((()=>t(new Error(h))),d)})))),Promise.race(u).then((e=>(i.removeEventListener("message",l),e))).catch((e=>{throw i.removeEventListener("message",l),e}))}function Yg(e){const t=new URL(e).hash.slice(1),n=new URLSearchParams(t).get("config");return JSON.parse(n||"{}")}function Kg(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function Xg(e){return parseInt(e)}function Zg(e){return e&&"function"==typeof e.toString?e.toString():""}function Jg(e,t=window){let n=t;for(let t=0;t<e;t++){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}const Qg=new Set;function ev(...e){const t=e.join();Qg.has(t)||(console.warn(...e),Qg.add(t))}ev.reset=()=>{Qg.clear()};var tv=t((e=>{if("string"!=typeof e)throw new TypeError("Expected a string")
610
+ ;return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}));function nv(e,t,n,r){const o=t.find((e=>"__world__"===e.id));o&&e.unshift(o);const i=e.map((e=>e.id));t=t.filter((e=>!i.includes(e.id))),t.forEach((e=>e.isMember=!1)),e.forEach((e=>e.isMember=!0));const a=e.concat(t);return a.forEach((e=>{e.canLeave=!!function(e){const t=$r(e);return!t||!!t.allowLeavingGroups}(r)&&"private"===e.type})),a.forEach((e=>e.isScopedToUri=function(e,t){if(e.scopes&&e.scopes.uri_patterns.length>0&&t)return function(e,t){return t.some((t=>e.match(t.split("*").map(tv).join(".*"))))}(t,e.scopes.uri_patterns);return!0}(e,n))),a}let rv=[];const ov=e=>({changeFocusModeUser:t=>{var n;e.changeFocusModeUser(t);const r=null!==(n=null==t?void 0:t.groups)&&void 0!==n?n:[],o=function(e,t){return function(e,t){return t.filter((t=>e.includes(t.id)||t.groupid&&e.includes(t.groupid)))}(e,t).map((e=>e.id))}(r,e.allGroups());r.length&&!o.length&&console.error("No matching groups found in list of filtered group IDs"),
611
+ e.filterGroups(o)},showContentInfo:t=>{e.setContentInfo(t)}});function iv(e,t,n){const r=ov(e);function o(e){const n=t.rpcAllowedOrigins||[];if(null==(o=e.data)||"object"!=typeof o||"2.0"!==o.jsonrpc)return;var o;if(!n.includes(e.origin))return void ev(`Ignoring JSON-RPC request from non-whitelisted origin ${e.origin}`);const i=e.data;e.source.postMessage(function(e){const t=r[e.method];if(void 0===t)return{jsonrpc:"2.0",id:e.id,error:{code:-32601,message:"Method not found"}};e.params?t(...e.params):t();return{jsonrpc:"2.0",result:"ok",id:e.id}}(i),e.origin)}rv.forEach((e=>{o(e)})),rv=[],window.removeEventListener("message",av),n.addEventListener("message",o)}function av(e){rv.push(e)}iv.$inject=["store","settings","$window"];class sv{constructor(e){H(this,"_rpc",void 0),H(this,"_reportConfig",void 0),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":
612
+ n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id,isShared:as(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])}}sv.$inject=["settings"];class lv{constructor(e,t,n,r){H(this,"_activity",void 0),H(this,"_api",void 0),H(this,"_settings",void 0),H(this,"_store",void 0),this._activity=e,this._api=t,this._settings=n,this._store=r}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?rs(e.user):os(e.user,e.group)),{...e,...t}}annotationFromData(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")
613
+ ;const a=o.user_info,s=`s:${Vg(8)}`,l=Object.assign({created:t.toISOString(),group:r,permissions:is(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Po(l)&&(l.permissions=rs(i)),this._settings.annotationMetadata&&(l.metadata={...this._settings.annotationMetadata}),l}create(e,t=new Date){const n=this.annotationFromData(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Po(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!zo(n)}),Fo(n)?this._store.selectTab("note"):Bo(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:[{source:e.uri}],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._activity.reportActivity("delete",e),
614
+ 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:zo(e)?os(t,e.group):rs(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;Mo(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(const[t,n]of Object.entries(e))if(t.startsWith("$")){o[t]=n}return this._store.removeDraft(e),this._store.addAnnotations([o]),o}}function cv(e,t){const n=new RegExp(`^ {${t}}`,"gm");return e.replace(n,"")}function uv(e,...t){return n=function(e,...t){const n=e.join("").match(/^[ \t]*(?=\S)/gm),r=n?Math.min(...n.map((e=>e.length))):0;let o=""
615
+ ;for(const[n,i]of t.entries())o+=cv(e[n],r),o+=i;return o+cv(e[e.length-1],r)}([...e],...t),n.replace(/^\s*\n|\n\s*$/g,"");var n}function dv(e){const t={};for(const[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}lv.$inject=["annotationActivity","api","settings","store"];let hv,mv,pv=e=>e;class fv{buildJSONExportContent(e,{profile:t,now:n=new Date}){var r;const o=new ff(t,[]);return{export_date:n.toISOString(),export_userid:null!==(r=t.userid)&&void 0!==r?r:"",client_version:o.version,annotations:e.map(dv)}}buildTextExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const[i]=e;if(!i)throw new Error("No annotations to export");const a=e=>ts(e,r,n),{uri:s,title:l}=So(i),c=[...new Set(e.map((e=>a(e))).filter(Boolean))],u=e.map(((e,t)=>{const n=qo(e),r=[e.created,e.text,a(e),`"${$o(e)}"`,e.tags.length>0?`Tags: ${e.tags.join(", ")}`:void 0,n?`Page: ${n}`:void 0].filter(Boolean);return uv(hv||(hv=pv`
617
616
  Annotation ${0}:
618
617
  ${0}`),t+1,r.join("\n"))})).join("\n\n");return uv(mv||(mv=pv`
619
618
  ${0}
@@ -625,8 +624,8 @@ this._store.addAnnotations([o]),o}}function cv(e,t){const n=new RegExp(`^ {${t}}
625
624
  Total annotations: ${0}
626
625
  Total replies: ${0}
627
626
 
628
- ${0}`),o.toISOString(),l,s,t,c.length,c.join(", "),e.length,e.filter(Co).length,u)}}fv.$inject=["store"];class gv extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),H(this,"url",void 0),H(this,"response",void 0),H(this,"reason",void 0),this.url=e,this.response=t,this.reason=n}}async function vv(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new gv(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new gv(e,n,"Failed to parse response")}var o;if(!n.ok)throw new gv(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}class bv{constructor(e,t,n){H(this,"_clientId",void 0),H(this,"search",void 0),H(this,"annotation",void 0),H(this,"group",void 0),H(this,"groups",void 0),H(this,"profile",void 0),this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{
629
- const[o,i]=await Promise.all([e,n()]),l=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1405.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=Zi(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await vv(m.toString(),{body:s?JSON.stringify(dv(s)):null,headers:c,method:l.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"),
627
+ ${0}`),o.toISOString(),l,s,t,c.length,c.join(", "),e.length,e.filter(Co).length,u)}}fv.$inject=[];class gv extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),H(this,"url",void 0),H(this,"response",void 0),H(this,"reason",void 0),this.url=e,this.response=t,this.reason=n}}async function vv(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new gv(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new gv(e,n,"Failed to parse response")}var o;if(!n.ok)throw new gv(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}class bv{constructor(e,t,n){H(this,"_clientId",void 0),H(this,"search",void 0),H(this,"annotation",void 0),H(this,"group",void 0),H(this,"groups",void 0),H(this,"profile",void 0),this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{
628
+ const[o,i]=await Promise.all([e,n()]),l=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1406.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=Zi(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await vv(m.toString(),{body:s?JSON.stringify(dv(s)):null,headers:c,method:l.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"),
630
629
  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}}bv.$inject=["apiRoutes","auth","store"];var _v={};function yv(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 wv=yv;yv.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},yv.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],
631
630
  this._cachedTimeouts=null},yv.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++,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},yv.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)),
632
631
  this._operationStart=(new Date).getTime(),this._fn(this._attempts)},yv.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},yv.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},yv.prototype.start=yv.prototype.try,yv.prototype.errors=function(){return this._errors},yv.prototype.attempts=function(){return this._attempts},yv.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=wv;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]
@@ -736,8 +735,8 @@ ev("Error connecting to H push notification service:",t);const n=new URL(e).host
736
735
  }))}setConfig(e,t){var n;this._configMessages[e]=t,null!==(n=this._socket)&&void 0!==n&&n.isConnected()&&this._socket.send(t)}async _reconnect(){var e;const t=await this._websocketURL;if(!t)return;let n,r;null===(e=this._socket)||void 0===e||e.close();try{n=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(n){const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new _x(r);o.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(o)})),o.on("disconnect",(()=>{if(++this._reconnectionAttempts,this._reconnectionAttempts<10){const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),
737
736
  this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,Bv(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}yx.$inject=["store","apiRoutes","auth","groups","session"];const wx="hypothesis.user.tags.list",xx="hypothesis.user.tags.map";class kx{constructor(e){H(this,"_storage",void 0),this._storage=e}filter(e,t=null){const n=this._storage.getObject(wx)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${tv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(xx)||{};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(xx,t)
738
737
  ;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(wx,n)}}kx.$inject=["localStorage"];class Nx{constructor(e){H(this,"_store",void 0),this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}Nx.$inject=["store"];class Sx extends Df{constructor(e,t){super(),H(this,"_store",void 0),H(this,"_window",void 0),H(this,"_delayedMessageQueue",void 0),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,
739
- visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:Vg(10),message:t,visuallyHidden:r};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}Sx.$inject=["store","$window"];const Ax=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),Ex=function(e){const{version:t,origin:n}=Yg(e.location.href);return"1.1405.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1405.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."),
740
- !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 Tx(e,t){e.setClientId(t.clientId)}function Cx(e,t,n){e.load(),t.load(),n.sync()}function Mx(e,t,n){e.init(),t.init(),n.init()}function Ix(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}Ax.sentry&&Ex&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ox({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1405.0",beforeSend:(e,t)=>{if(ax>=5)return ev("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++ax;try{const n=t&&t.originalException;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{
738
+ visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:Vg(10),message:t,visuallyHidden:r};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}Sx.$inject=["store","$window"];const Ax=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),Ex=function(e){const{version:t,origin:n}=Yg(e.location.href);return"1.1406.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1406.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."),
739
+ !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 Tx(e,t){e.setClientId(t.clientId)}function Cx(e,t,n){e.load(),t.load(),n.sync()}function Mx(e,t,n){e.init(),t.init(),n.init()}function Ix(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}Ax.sentry&&Ex&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ox({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1406.0",beforeSend:(e,t)=>{if(ax>=5)return ev("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++ax;try{const n=t&&t.originalException;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{
741
740
  zy("host_config",Yg(window.location.href))}catch(e){}zy("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Lv(((e,t)=>{sx(e,t)}))}(Ax.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")}))}(document.body),Tx.$inject=["api","streamer"],Cx.$inject=["groups","session","router"],Mx.$inject=["autosaveService","persistedDefaults","serviceURL"],Ix.$inject=["frameSync","store","toastMessenger"];const zx=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",av)}(),async function(e,t=window){const n=function(e){const t=Yg(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:Kg,requestConfigFromFrame:e=>{if("string"==typeof e)return e
742
741
  ;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Zg(t.origin),ancestorLevel:Xg(t.ancestorLevel)}}},o={};for(const[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:Jg(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await Wg(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=Wg(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,r)}else o=n;const i={...e,...o};return r&&(i.rpc=r),i.apiUrl=function(e){const t=$r(e)
743
742
  ;if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(Ax).then((e=>{!function(e,t){const n=new q;n.register("annotationsExporter",fv).register("annotationsService",lv).register("annotationActivity",sv).register("api",bv).register("apiRoutes",Sv).register("auth",Tv).register("autosaveService",Cv).register("frameSync",$v).register("groups",Gv).register("importAnnotationsService",cx).register("loadAnnotationsService",ux).register("localStorage",hx).register("persistedDefaults",px).register("router",fx).register("serviceURL",gx).register("session",vx).register("streamer",yx).register("streamFilter",bx).register("tags",kx).register("threadsService",Nx).register("toastMessenger",Sx).register("store",{factory:Na}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Mx),n.run(Tx),n.run(Cx),n.run(iv),n.run(Ix),D(Re(Vr.Provider,{value:n,children:Re(Ug,{})}),t)}(e,zx)})).catch((e=>function(e,t){