hypothesis 1.985.0 → 1.986.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 +1 -1
- package/build/manifest.json +8 -8
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/sidebar.bundle.js +22 -22
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function h(t){return function(t){return t.filter((function(t){var e=s[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function f(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?f(e.src):null}function m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function t(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function h(t){return function(t){return t.filter((function(t){var e=s[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function f(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?f(e.src):null}function m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?cd6227","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?68ba85","styles/annotator.css":"styles/annotator.css?76bbb5","styles/highlights.css":"styles/highlights.css?c308d0","styles/annotator.css.map":"styles/annotator.css.map?72e007","styles/highlights.css.map":"styles/highlights.css.map?5be890","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?dd8179","styles/katex.min.css":"styles/katex.min.css?28919c","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?bf5f6c","styles/sidebar.css.map":"styles/sidebar.css.map?30b65e","styles/sidebar.css":"styles/sidebar.css?b80114","styles/ui-playground.css.map":"styles/ui-playground.css.map?dbfa5a","styles/ui-playground.css":"styles/ui-playground.css?415380","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?46ed01","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?65cc2c","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?7c5f7a","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?321837"};if(function(){var t=[function(){return Promise.resolve()},function(){return new Map},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return t.every((function(t){return t()}))}catch(t){return!1}}()){var v=function(e){for(var s={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(s,o)}return s}(document),g=m(v.assetRoot||"https://cdn.hypothes.is/hypothesis/1.986.0/");if(document.querySelector("hypothesis-app"))!function(t,e){u(t,"fetch",e.apiUrl),u(t,"fetch",e.apiUrl+"links");var s=h(o);d(t,e,[].concat(n(s),["scripts/sidebar.bundle.js","styles/katex.min.css","styles/sidebar.css"]))}(document,{assetRoot:g,manifest:b,apiUrl:v.apiUrl});else{var j=m(v.notebookAppUrl||"https://hypothes.is/notebook"),w=m(v.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){l(t,"sidebar","html",e.sidebarAppUrl),l(t,"notebook","html",e.notebookAppUrl),u(t,"style",p(e,"styles/annotator.css")),l(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var s=h(o);d(t,e,[].concat(n(s),["scripts/annotator.bundle.js","styles/highlights.css","styles/pdfjs-overrides.css"]),{forceModuleReload:!0})}}(document,{assetRoot:g,manifest:b,notebookAppUrl:j,sidebarAppUrl:w})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?cd6227",
|
|
3
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?68ba85",
|
|
3
4
|
"styles/annotator.css": "styles/annotator.css?76bbb5",
|
|
4
|
-
"styles/annotator.css.map": "styles/annotator.css.map?b32246",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?c308d0",
|
|
6
|
+
"styles/annotator.css.map": "styles/annotator.css.map?72e007",
|
|
6
7
|
"styles/highlights.css.map": "styles/highlights.css.map?5be890",
|
|
7
|
-
"styles/katex.min.css": "styles/katex.min.css?28919c",
|
|
8
8
|
"styles/katex.min.css.map": "styles/katex.min.css.map?4daef7",
|
|
9
9
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?dd8179",
|
|
10
|
+
"styles/katex.min.css": "styles/katex.min.css?28919c",
|
|
10
11
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?bf5f6c",
|
|
11
|
-
"
|
|
12
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?30b65e",
|
|
12
13
|
"styles/sidebar.css": "styles/sidebar.css?b80114",
|
|
13
|
-
"styles/
|
|
14
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?dbfa5a",
|
|
14
15
|
"styles/ui-playground.css": "styles/ui-playground.css?415380",
|
|
15
|
-
"styles/ui-playground.css.map": "styles/ui-playground.css.map?63048b",
|
|
16
16
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?46ed01",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?c99629",
|
|
18
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?65cc2c",
|
|
19
|
-
"scripts/sidebar.bundle.js
|
|
18
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?7c5f7a",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?321837"
|
|
20
20
|
}
|
|
@@ -95,7 +95,7 @@ this._sidebarRPC.on("deleteAnnotation",(t=>this.detach(t))),this._sidebarRPC.on(
|
|
|
95
95
|
target:e};let n;try{const o=await this._integration.anchor(this.element,e.selector),i=fe.fromRange(o);n={annotation:t,target:e,range:i}}catch(o){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(let t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(let e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&be(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Rt(8)}
|
|
96
96
|
;return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),oo(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);Ce(e.highlights,n)}this._sidebarRPC.call("focusAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,o=0;for(let r of t){var i;if(null===(i=r.highlights)||void 0===i||!i.length)continue;const t=Ee(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>o||"down"===e&&t<o)&&(n=r,o=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=ge(e),o=ve(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=to(),this._isAdderVisible=!0,
|
|
97
97
|
this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function ro(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function so(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n)
|
|
98
|
-
;o.origin=new URL(t).origin,o.version="1.
|
|
98
|
+
;o.origin=new URL(t).origin,o.version="1.986.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),(null===(n=o.services)||void 0===n?void 0:n.length)>0){const t=o.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 o}function ao({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"NotebookIframe",allowFullScreen:!0,src:ro(t.notebookAppUrl,{...so(t.notebookAppUrl,t),group:e})})}function lo({eventBus:t,config:e}){const[n,o]=rt(0),[i,r]=rt(!0),[s,a]=rt(null),l=lt(""),c=lt(null);st((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),st((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),
|
|
99
99
|
c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:mt("div",{className:G("NotebookModal__outer",{"is-hidden":i}),children:mt("div",{className:"NotebookModal__inner",children:[mt("div",{className:"NotebookModal__close-button-container",children:mt(Ct,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),mt(ao,{config:e,groupId:s},n)]})})}class co{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=se(this._outerContainer),L(mt(lo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){L(null,this.shadowRoot),this._outerContainer.remove()}}var ho={exports:{}};!function(t){!function(e,n,o,i){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 o
|
|
100
100
|
;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(o=0;o<t.length;)e.call(n,t[o],o,t),o++;else for(o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function p(t,n,o){var i="DEPRECATED METHOD: "+n+"\n"+o+" AT \n";return function(){var n=new Error("get-stack-trace"),o=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,i,o),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===i||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(o!==i&&null!==o)for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var o=Object.keys(e),r=0;r<o.length;)(!n||n&&t[o[r]]===i)&&(t[o[r]]=e[o[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)
|
|
101
101
|
}),"merge","Use `assign`.");function _(t,e,n){var o,i=e.prototype;(o=t.prototype=Object.create(i)).constructor=t,o._super=i,n&&r(o,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||i,e):t}function w(t,e){return t===i?e:t}function b(t,e,n){f(S(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(S(e),(function(e){t.removeEventListener(e,n,!1)}))}function E(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function x(t,e){return t.indexOf(e)>-1}function S(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var o=0;o<t.length;){if(n&&t[o][n]==e||!n&&t[o]===e)return o;o++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function k(t,e,n){for(var o=[],i=[],r=0;r<t.length;){var s=e?t[r][e]:t[r];T(i,s)<0&&o.push(t[r]),i[r]=s,r++}return n&&(o=e?o.sort((function(t,n){return t[e]>n[e]})):o.sort()),o}function R(t,e){
|
|
@@ -557,7 +557,7 @@ t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Mp(t),i
|
|
|
557
557
|
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:qr("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var jp=ri((function({annotationsService:e,isLoading:t,settings:n}){const r=ii(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return po("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[po(Fp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),po(Fp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
|
|
558
558
|
children:"Page Notes"}),s>0&&po(Fp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",po("br",{}),"Create one by selecting some text and clicking the"," ",po(Mo,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var Hp=ri((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
559
559
|
const i=Xi(),a=ii(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?Hi(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=to(s);Qr((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Qr((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return Qr((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),po("div",{children:[po("h2",{className:"sr-only",children:"Annotations"}),w&&po(Tp,{}),po(Bp,{onLogin:t,onSignUp:n}),y&&po(xp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&po(xp,{
|
|
560
|
-
errorType:"group",onLoginRequest:t}),x&&po(jp,{isLoading:c}),po(wp,{threads:i.children}),k&&po(Np,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var qp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(wp,{threads:Xi().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.
|
|
560
|
+
errorType:"group",onLoginRequest:t}),x&&po(jp,{isLoading:c}),po(wp,{threads:i.children}),k&&po(Np,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var qp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(wp,{threads:Xi().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.986.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
561
561
|
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function $p(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function Gp({commandName:e,iconName:t}){return po("span",{className:"whitespace-nowrap",children:[po(Mo,{name:t,classes:qr("mx-1 -mt-1","text-color-text-light inline")}),po("em",{children:e})]})}var Vp=ri((function({settings:e}){const t=!$p(e);return po("ol",{className:"list-decimal pl-10 space-y-2",children:[po("li",{children:["To create an annotation, select text and then select the"," ",po(Gp,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),po("li",{
|
|
562
562
|
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po(Gp,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&po("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"," ",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),po("li",{children:["To reply to an annotation, select the"," ",po(Gp,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var Wp=ri((function({toastMessenger:e,versionData:t}){return po("div",{className:"hyp-u-vertical-spacing",children:[po("dl",{className:"VersionInfo",children:[po("dt",{className:"VersionInfo__key",children:"Version"}),po("dd",{
|
|
563
563
|
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{wa(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Yp({children:e,onClick:t}){return po(wo,{
|
|
@@ -585,7 +585,7 @@ className:qr("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"Hypo
|
|
|
585
585
|
;function Cm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Am{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?ga(e.user):va(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+U(8),l=Object.assign({created:t.toISOString(),group:r,permissions:ya(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Li(l)&&(l.permissions=ga(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Li(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Ai(n)}),
|
|
586
586
|
zi(n)?this._store.selectTab("note"):Oi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ai(e)?va(t,e.group):ga(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Si(e)?this._api.annotation.update({id:e.id},n):this._api.annotation.create({},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
|
|
587
587
|
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Am.$inject=["api","store"];class Em 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 Tm(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Em(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Em(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Em(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Nm(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function Lm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Mm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
|
|
588
|
-
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
588
|
+
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.986.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Nm(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await Tm(m.toString(),{body:s?JSON.stringify(Lm(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={
|
|
589
589
|
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}}Mm.$inject=["apiRoutes","auth","store"];var zm={};function Om(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 Im=Om;Om.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Om.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Om.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
|
|
590
590
|
;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},Om.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)},Om.prototype.try=function(e){
|
|
591
591
|
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Om.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Om.prototype.start=Om.prototype.try,Om.prototype.errors=function(){return this._errors},Om.prototype.attempts=function(){return this._attempts},Om.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=Im;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
|
|
@@ -598,24 +598,24 @@ Hm.$inject=["$window","apiRoutes","localStorage","settings","toastMessenger"];cl
|
|
|
598
598
|
const r=Array.isArray(t),o=()=>r?t.map((e=>e())):t();let i=o();return e((()=>{const e=o();if(r?Um(e,i):e===i)return;const t=i;i=e,n(e,t)}))}class Gm{constructor(e,t){this._frameSync=e,this._store=t}init(){const e=()=>this._store.profile().features;$m(this._store.subscribe,[e,()=>this._store.frames()],(()=>{this._frameSync.notifyHost("featureFlagsUpdated",e()||{})}))}}function Vm(e,t){return!!function(e){if(null===e||"object"!=typeof e)return!1;for(let t of["frame1","frame2","type","requestId"])if("string"!=typeof e[t])return!1;return!0}(e)&&JSON.stringify(e,Object.keys(t).sort())===JSON.stringify(t,Object.keys(t).sort())}Gm.$inject=["frameSync","store"];class Wm{constructor({hostFrame:e,source:t}){this._hostFrame=e,this._source=t,this._listeners=new da}destroy(){this._listeners.removeAll()}async discover(e){let t=!1;if(("guest"===this._source&&"host"===e||"guest"===this._source&&"sidebar"===e||"sidebar"===this._source&&"host"===e||"notebook"===this._source&&"sidebar"===e)&&(t=!0),
|
|
599
599
|
!t)throw new Error("Invalid request of channel/port");const n=U(6);return new Promise(((t,r)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:e,type:"request",requestId:n},"*")},i=setInterval(o,250),a=setTimeout((()=>{clearInterval(i),r(new Error(`Unable to establish ${this._source}-${e} communication channel`))}),2e4),s=this._listeners.add(window,"message",(r=>{const{data:o,ports:l}=r;Vm(o,{frame1:this._source,frame2:e,type:"offer",requestId:n})&&(clearInterval(i),clearTimeout(a),this._listeners.remove(s),t(l[0]))}));o()}))}}function Ym(e,t,n=[],r=-1){e.postMessage({protocol:"frame-rpc",version:"1.0.0",arguments:n,method:t,sequence:r})}class Km{constructor({userAgent:e=navigator.userAgent,currentWindow:t=window}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new da,this._listeners.add(t,"unload",(()=>{this._port&&(Ym(this._port,"close"),t!==t.parent&&function(e){const t=e.match(/\bAppleWebKit\/([0-9]+)\b/)
|
|
600
600
|
;return!!t&&!(parseInt(t[1])<=537)}(e)&&t.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],this._receivedCloseEvent=!1}on(e,t){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(e,t)}connect(e){this._port=e,this._listeners.add(e,"message",(e=>this._handle(e))),e.start(),Ym(e,"connect");for(let[e,t]of this._pendingCalls)this.call(e,...t);this._pendingCalls=[]}destroy(){this._port&&(Ym(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(e,...t){if(this._port||this._pendingCalls.push([e,t]),!this._port||this._destroyed)return;const n=this._sequence++,r=t[t.length-1];"function"==typeof r&&(this._callbacks.set(n,r),t=t.slice(0,-1)),Ym(this._port,e,t,n)}_parseMessage({data:e}){return e&&"object"==typeof e?"frame-rpc"!==e.protocol||"1.0.0"!==e.version?null:Array.isArray(e.arguments)?e:null:null}_handle(e){const t=this._parseMessage(e),n=this._port;if(t&&n)if("method"in t){
|
|
601
|
-
if("close"===t.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const e=this._methods.get(t.method);if(!e)return;const r=(...e)=>{const r={arguments:e,protocol:"frame-rpc",response:t.sequence,version:"1.0.0"};n.postMessage(r)};e(...t.arguments,r)}else if("response"in t){const e=this._callbacks.get(t.response);this._callbacks.delete(t.response),e&&e(...t.arguments)}}}function Xm({$tag:e,target:t,uri:n}){return{$tag:e,target:t,uri:n}}function Zm(e,t){const n=e.find((e=>e.uri===t.uri));return n
|
|
602
|
-
let o=0;const i=new Set,a=[];t.forEach((e=>{ki(e)||(Ai(e)&&++o,i.add(e.$tag),this._inFrame.has(e.$tag)||a.push(e))}));const s=r.filter((e=>!i.has(e.$tag)));if(a.length>0){const e=new Map;for(let t of a){var l;const r=Zm(n,t);if(!r)continue;const o=null!==(l=e.get(r.id))&&void 0!==l?l:[];o.push(t),e.set(r.id,o)}for(let[t,n]of e){const e=this._guestRPC.get(t);e&&e.call("loadAnnotations",n.map(Xm))}a.forEach((e=>{this._inFrame.add(e.$tag)}))}s.forEach((e=>{this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag))),this._inFrame.delete(e.$tag)})),n.length>0&&n.every((e=>e.isAnnotationFetchComplete))&&(0!==o&&o===e||(this._hostRPC.call("publicAnnotationCountChanged",o),e=o))}))}_connectGuest(e){const t=new Km;++this._nextGuestId;let n=`temp-${this._nextGuestId}`;this._guestRPC.set(n,t),t.on("documentInfoChanged",(e=>{this._guestRPC.delete(n),n=e.frameIdentifier,this._guestRPC.set(n,t),this._store.connectFrame({
|
|
603
|
-
const e=this._store.frames().find((e=>e.id===n));e&&this._store.destroyFrame(e),t.destroy(),this._guestRPC.delete(n)})),t.on("createAnnotation",(e=>{if(!this._store.isLoggedIn())return this._hostRPC.call("openSidebar"),this._store.openSidebarPanel("loginPrompt"),void this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag)));this._inFrame.add(e.$tag),e.$highlight||this._hostRPC.call("openSidebar"),this._hostRPC.call("showHighlights"),this._annotationsService.create(e)}));let r={};const o=ha((()=>{this._store.updateAnchorStatus(r),r={}}),10);t.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),r[e]=t?"orphan":"anchored",o()})),t.on("showAnnotations",(e=>{this._store.selectAnnotations(this._store.findIDsForTags(e)),this._store.selectTab("annotation")})),t.on("focusAnnotations",(e=>{this._store.focusAnnotations(e||[])})),t.on("toggleAnnotationSelection",(e=>{
|
|
604
|
-
})),t.on("closeSidebar",(()=>{this._hostRPC.call("closeSidebar")})),t.connect(e),t.call("setHighlightsVisible",this._highlightsVisible)}_setupHostEvents(){this._hostRPC.on("sidebarOpened",(()=>{this._store.setSidebarOpened(!0)})),this._hostRPC.on("setHighlightsVisible",(e=>{this._highlightsVisible=e,this._guestRPC.forEach((t=>t.call("setHighlightsVisible",e)))}))}async connect(){const e=await this._portFinder.discover("host");this._hostRPC.connect(e),this._listeners.add(e,"message",(e=>{const{data:t,ports:n}=e;Vm(t,{frame1:"guest",frame2:"sidebar",type:"offer"})&&this._connectGuest(n[0])}))}notifyHost(e,...t){this._hostRPC.call(e,...t)}focusAnnotations(e){this._store.focusAnnotations(e),this._guestRPC.forEach((t=>t.call("focusAnnotations",e)))}scrollToAnnotation(e){this._guestRPC.forEach((t=>t.call("scrollToAnnotation",e)))}destroy(){this._portFinder.destroy(),
|
|
605
|
-
;const ef={id:"__default__",name:"__DEFAULT__",logo:"data:image/svg+xml;utf8,"+encodeURIComponent(Yo)};const tf=["organization","scopes"];class nf{constructor(e,t,n,r,o,i){this._store=e,this._api=t,this._auth=n,this._settings=o,this._toastMessenger=i,this._serviceConfig=P(o),this._reloadSetUp=!1}_mainURI(){var e,t;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e:null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,$m(this._store.subscribe,(()=>this._mainURI()),(()=>{
|
|
606
|
-
_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=ef)}))}(e);const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:tf})}async _loadGroupsForUserAndDocument(){var e;const t=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let n=null;"sidebar"===this._store.route()&&(n=await t()),this._setupAutoReload();const r=this._store.directLinkedAnnotationId();let o=null;r&&(o=this._api.annotation.get({id:r}).catch((()=>null)));const i=this._store.directLinkedGroupId();let a=null
|
|
607
|
-
null))));const s={expand:tf},l=null===(e=this._serviceConfig)||void 0===e?void 0:e.authority;l&&(s.authority=l),n&&(s.document_uri=n);const[c,u,h,d,p]=await Promise.all([this._api.profile.groups.read({expand:tf}),this._api.groups.list(s),this._auth.getAccessToken(),o,a]);p&&!u.some((e=>e.id===p.id))&&u.push(p);let m=null;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:tf});let n;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}
|
|
608
|
-
n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){var e;if(null!==(e=this._serviceConfig)&&void 0!==e&&e.groups){let e=[];try{e=await this._serviceConfig.groups}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}}nf.$inject=["store","api","auth","session","settings","toastMessenger"];class rf{
|
|
609
|
-
load({groupId:e,uris:t,onError:n,maxResults:r,sortBy:o,sortOrder:i,streamFilterBy:a="uri"}){if(this._store.removeAnnotations(this._store.savedAnnotations()),this._searchClient&&this._searchClient.cancel(),"group"===a)this._streamFilter.resetFilter().addClause("/group","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()});else t&&t.length>0&&(this._streamFilter.resetFilter().addClause("/uri","one_of",t),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}));const s={incremental:!0,separateReplies:!1,maxResults:r,sortBy:o,sortOrder:i};this._searchClient=new nm(this._api.search,s),this._searchClient.on("resultCount",(e=>{this._store.setAnnotationResultCount(e)})),this._searchClient.on("results",(e=>{e.length&&this._store.addAnnotations(e)})),this._searchClient.on("error",(e=>{"function"==typeof n?n(e):console.error(e)})),
|
|
610
|
-
t.indexOf(e.uri)>=0&&this._store.updateFrameAnnotationFetchStatus(e.uri,!0)})),this._store.annotationFetchFinished()})),this._store.annotationFetchStarted(),this._searchClient.get({group:e,uri:t})}async loadThread(e){let t,n;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),ki(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}const r=[t,...n.rows];if(this._store.addAnnotations(r),!ki(t)){const e=t.id;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}rf.$inject=["api","store","streamer","streamFilter"];class of{constructor(){this._store={}}getItem(e){return e in this._store?this._store[e]:null}
|
|
611
|
-
let t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch(e){this._storage=new of}}getItem(e){return this._storage.getItem(e)}getObject(e){const t=this._storage.getItem(e);return t?JSON.parse(t):null}setItem(e,t){this._storage.setItem(e,t)}setObject(e,t){const n=JSON.stringify(t);this._storage.setItem(e,n)}removeItem(e){this._storage.removeItem(e)}}af.$inject=["$window"];const sf={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class lf{constructor(e,t){this._storage=e,this._store=t}init(){Object.keys(sf).forEach((e=>{const t=this._storage.getItem(sf[e]);this._store.setDefault(e,t)})),$m(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(let n in e)t[n]!==e[n]&&n in sf&&this._storage.setItem(sf[n],e[n])}))}}lf.$inject=["localStorage","store"];class cf{constructor(e,t){this._window=e,
|
|
612
|
-
const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(let[e,r]of t)n[e]=r;"client"===e[0]&&e.shift();let r;switch(e[0].replace(/\.html$/,"")){case"a":r="annotation",n.id=e[1]||"";break;case"notebook":r="notebook";break;case"stream":r="stream";break;default:r="sidebar"}return{route:r,params:n}}routeUrl(e,t={}){let n;const r={...t};switch(e){case"annotation":{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){
|
|
613
|
-
cf.$inject=["$window","store"];class uf{constructor(e,t){this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links();this._store.updateLinks(e)}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}uf.$inject=["apiRoutes","store"];class hf{constructor(e,t,n,r,o){var i,a;this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=P(r))||void 0===a?void 0:a.authority)&&void 0!==i?i:null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=Pm((()=>{const e=this._authority?{authority:this._authority}:{};return this._api.profile.read(e)})).then((e=>(this.update(e),this._lastLoadTime=Date.now(),e))).catch((e=>{throw this._lastLoadTime=null,e}))),this._lastLoad}async dismissSidebarTutorial(){
|
|
614
|
-
show_sidebar_tutorial:!1}});this.update(e)}update(e){const t=this._store.profile(),n=e.userid!==t.userid;return this._store.updateProfile(e),this._lastLoad=Promise.resolve(e),this._lastLoadTime=Date.now(),n&&(e.userid?Cr({id:e.userid}):Cr(null)),e}async logout(){try{return await this._auth.logout(),this.reload()}catch(e){throw this._toastMessenger.error("Log out failed"),new Error(e)}}reload(){return this._lastLoad=null,this._lastLoadTime=null,this.load()}}hf.$inject=["store","api","auth","settings","toastMessenger"];class df{constructor(){this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}}}addClause(e,t,n,r=!1){return this._filter.clauses.push({field:e,operator:t,value:n,case_sensitive:r}),this}getFilter(){return this._filter}resetFilter(){return this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}},this}}class pf extends Qp{constructor(e){super();const t=[];let n
|
|
615
|
-
;n.send(e)}};this.close=()=>{n.close(1e3)},this.send=e=>{t.push(e),this.isConnected()&&r()},this.isConnected=()=>n.readyState===WebSocket.OPEN,(()=>{n=new WebSocket(e),n.onopen=e=>{r(),this.emit("open",e)},n.onclose=e=>{if(1e3===e.code||1001===e.code)return void this.emit("close",e);const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class mf{constructor(e,t,n,r,o){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=U(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&this._store.addAnnotations(e);const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})))
|
|
616
|
-
_handleSocketError(e,t){K("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&K("Check that your H service is configured to allow WebSocket connections from "+window.location.origin)}_handleSocketMessage(e){const t=JSON.parse(e.data);if(t)if("annotation-notification"===t.type){const e=t.payload;switch(t.options.action){case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else K("Received unsupported notification",t.type)}_sendClientConfig(e){
|
|
617
|
-
this._configMessages[t]&&e.send(this._configMessages[t])}))}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 pf(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))),
|
|
618
|
-
messageType:"client_id",value:this.clientId}),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,$m(this._store.subscribe,(()=>this._store.profile().userid),(()=>{this._reconnect()}))),this._socket||await this._reconnect()}}mf.$inject=["store","apiRoutes","auth","groups","session"];class ff{constructor(e){this._storage=e}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(`^${Z(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)
|
|
601
|
+
if("close"===t.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const e=this._methods.get(t.method);if(!e)return;const r=(...e)=>{const r={arguments:e,protocol:"frame-rpc",response:t.sequence,version:"1.0.0"};n.postMessage(r)};e(...t.arguments,r)}else if("response"in t){const e=this._callbacks.get(t.response);this._callbacks.delete(t.response),e&&e(...t.arguments)}}}function Xm({$tag:e,target:t,uri:n}){return{$tag:e,target:t,uri:n}}function Zm(e,t){const n=e.find((e=>e.uri===t.uri));if(n)return n;const r=e.find((e=>null===e.id));return r||e[0]}class Jm{constructor(e,t,n){this._window=e,this._annotationsService=t,this._store=n,this._portFinder=new Wm({hostFrame:this._window.parent,source:"sidebar"}),this._listeners=new da,this._hostRPC=new Km,this._guestRPC=new Map,this._nextGuestId=0,this._inFrame=new Set,this._highlightsVisible=!1,this._setupSyncToGuests(),this._setupHostEvents()}_setupSyncToGuests(){let e=0
|
|
602
|
+
;$m(this._store.subscribe,[()=>this._store.allAnnotations(),()=>this._store.frames()],(([t,n],[r])=>{let o=0;const i=new Set,a=[];t.forEach((e=>{ki(e)||(Ai(e)&&++o,i.add(e.$tag),this._inFrame.has(e.$tag)||a.push(e))}));const s=r.filter((e=>!i.has(e.$tag)));if(a.length>0){const e=new Map;for(let t of a){var l;const r=Zm(n,t);if(!r)continue;const o=null!==(l=e.get(r.id))&&void 0!==l?l:[];o.push(t),e.set(r.id,o)}for(let[t,n]of e){const e=this._guestRPC.get(t);e&&e.call("loadAnnotations",n.map(Xm))}a.forEach((e=>{this._inFrame.add(e.$tag)}))}s.forEach((e=>{this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag))),this._inFrame.delete(e.$tag)})),n.length>0&&n.every((e=>e.isAnnotationFetchComplete))&&(0!==o&&o===e||(this._hostRPC.call("publicAnnotationCountChanged",o),e=o))}))}_connectGuest(e){const t=new Km;++this._nextGuestId;let n=`temp-${this._nextGuestId}`;this._guestRPC.set(n,t),t.on("documentInfoChanged",(e=>{this._guestRPC.delete(n),n=e.frameIdentifier,this._guestRPC.set(n,t),this._store.connectFrame({
|
|
603
|
+
id:e.frameIdentifier,metadata:e.metadata,uri:e.uri})})),t.on("close",(()=>{const e=this._store.frames().find((e=>e.id===n));e&&this._store.destroyFrame(e),t.destroy(),this._guestRPC.delete(n)})),t.on("createAnnotation",(e=>{if(!this._store.isLoggedIn())return this._hostRPC.call("openSidebar"),this._store.openSidebarPanel("loginPrompt"),void this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag)));this._inFrame.add(e.$tag),e.$highlight||this._hostRPC.call("openSidebar"),this._hostRPC.call("showHighlights"),this._annotationsService.create(e)}));let r={};const o=ha((()=>{this._store.updateAnchorStatus(r),r={}}),10);t.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),r[e]=t?"orphan":"anchored",o()})),t.on("showAnnotations",(e=>{this._store.selectAnnotations(this._store.findIDsForTags(e)),this._store.selectTab("annotation")})),t.on("focusAnnotations",(e=>{this._store.focusAnnotations(e||[])})),t.on("toggleAnnotationSelection",(e=>{
|
|
604
|
+
this._store.toggleSelectedAnnotations(this._store.findIDsForTags(e))})),t.on("openSidebar",(()=>{this._hostRPC.call("openSidebar")})),t.on("closeSidebar",(()=>{this._hostRPC.call("closeSidebar")})),t.connect(e),t.call("setHighlightsVisible",this._highlightsVisible)}_setupHostEvents(){this._hostRPC.on("sidebarOpened",(()=>{this._store.setSidebarOpened(!0)})),this._hostRPC.on("setHighlightsVisible",(e=>{this._highlightsVisible=e,this._guestRPC.forEach((t=>t.call("setHighlightsVisible",e)))}))}async connect(){const e=await this._portFinder.discover("host");this._hostRPC.connect(e),this._listeners.add(e,"message",(e=>{const{data:t,ports:n}=e;Vm(t,{frame1:"guest",frame2:"sidebar",type:"offer"})&&this._connectGuest(n[0])}))}notifyHost(e,...t){this._hostRPC.call(e,...t)}focusAnnotations(e){this._store.focusAnnotations(e),this._guestRPC.forEach((t=>t.call("focusAnnotations",e)))}scrollToAnnotation(e){this._guestRPC.forEach((t=>t.call("scrollToAnnotation",e)))}destroy(){this._portFinder.destroy(),
|
|
605
|
+
this._listeners.removeAll()}}function Qm(e){return Object.keys(e).reduce(((e,t)=>(e[t]=t,e)),{})}Jm.$inject=["$window","annotationsService","store"];const ef={id:"__default__",name:"__DEFAULT__",logo:"data:image/svg+xml;utf8,"+encodeURIComponent(Yo)};const tf=["organization","scopes"];class nf{constructor(e,t,n,r,o,i){this._store=e,this._api=t,this._auth=n,this._settings=o,this._toastMessenger=i,this._serviceConfig=P(o),this._reloadSetUp=!1}_mainURI(){var e,t;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e:null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,$m(this._store.subscribe,(()=>this._mainURI()),(()=>{
|
|
606
|
+
this.load()})),$m(this._store.subscribe,[()=>this._store.hasFetchedProfile(),()=>this._store.profile().userid],((e,[t])=>{t&&this.load()})))}_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=ef)}))}(e);const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:tf})}async _loadGroupsForUserAndDocument(){var e;const t=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let n=null;"sidebar"===this._store.route()&&(n=await t()),this._setupAutoReload();const r=this._store.directLinkedAnnotationId();let o=null;r&&(o=this._api.annotation.get({id:r}).catch((()=>null)));const i=this._store.directLinkedGroupId();let a=null
|
|
607
|
+
;i&&(a=this._fetchGroup(i).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),null))));const s={expand:tf},l=null===(e=this._serviceConfig)||void 0===e?void 0:e.authority;l&&(s.authority=l),n&&(s.document_uri=n);const[c,u,h,d,p]=await Promise.all([this._api.profile.groups.read({expand:tf}),this._api.groups.list(s),this._auth.getAccessToken(),o,a]);p&&!u.some((e=>e.id===p.id))&&u.push(p);let m=null;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:tf});let n;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}
|
|
608
|
+
},o=await Promise.all(e.map((e=>t.find((t=>t.id===e||t.groupid===e))||r(e)))),i=o.filter((e=>null!==e)),a=this._store.directLinkedGroupId();return this._addGroupsToStore(i,a),n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){var e;if(null!==(e=this._serviceConfig)&&void 0!==e&&e.groups){let e=[];try{e=await this._serviceConfig.groups}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}}nf.$inject=["store","api","auth","session","settings","toastMessenger"];class rf{
|
|
609
|
+
constructor(e,t,n,r){this._api=e,this._store=t,this._streamer=n,this._streamFilter=r,this._searchClient=null}load({groupId:e,uris:t,onError:n,maxResults:r,sortBy:o,sortOrder:i,streamFilterBy:a="uri"}){if(this._store.removeAnnotations(this._store.savedAnnotations()),this._searchClient&&this._searchClient.cancel(),"group"===a)this._streamFilter.resetFilter().addClause("/group","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()});else t&&t.length>0&&(this._streamFilter.resetFilter().addClause("/uri","one_of",t),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}));const s={incremental:!0,separateReplies:!1,maxResults:r,sortBy:o,sortOrder:i};this._searchClient=new nm(this._api.search,s),this._searchClient.on("resultCount",(e=>{this._store.setAnnotationResultCount(e)})),this._searchClient.on("results",(e=>{e.length&&this._store.addAnnotations(e)})),this._searchClient.on("error",(e=>{"function"==typeof n?n(e):console.error(e)})),
|
|
610
|
+
this._searchClient.on("end",(()=>{this._searchClient=null,t&&t.length>0&&this._store.frames().forEach((e=>{t.indexOf(e.uri)>=0&&this._store.updateFrameAnnotationFetchStatus(e.uri,!0)})),this._store.annotationFetchFinished()})),this._store.annotationFetchStarted(),this._searchClient.get({group:e,uri:t})}async loadThread(e){let t,n;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),ki(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}const r=[t,...n.rows];if(this._store.addAnnotations(r),!ki(t)){const e=t.id;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}rf.$inject=["api","store","streamer","streamFilter"];class of{constructor(){this._store={}}getItem(e){return e in this._store?this._store[e]:null}
|
|
611
|
+
setItem(e,t){this._store[e]=t}removeItem(e){delete this._store[e]}}class af{constructor(e){let t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch(e){this._storage=new of}}getItem(e){return this._storage.getItem(e)}getObject(e){const t=this._storage.getItem(e);return t?JSON.parse(t):null}setItem(e,t){this._storage.setItem(e,t)}setObject(e,t){const n=JSON.stringify(t);this._storage.setItem(e,n)}removeItem(e){this._storage.removeItem(e)}}af.$inject=["$window"];const sf={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class lf{constructor(e,t){this._storage=e,this._store=t}init(){Object.keys(sf).forEach((e=>{const t=this._storage.getItem(sf[e]);this._store.setDefault(e,t)})),$m(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(let n in e)t[n]!==e[n]&&n in sf&&this._storage.setItem(sf[n],e[n])}))}}lf.$inject=["localStorage","store"];class cf{constructor(e,t){this._window=e,
|
|
612
|
+
this._store=t,this._didRegisterPopstateListener=!1}currentRoute(){const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(let[e,r]of t)n[e]=r;"client"===e[0]&&e.shift();let r;switch(e[0].replace(/\.html$/,"")){case"a":r="annotation",n.id=e[1]||"";break;case"notebook":r="notebook";break;case"stream":r="stream";break;default:r="sidebar"}return{route:r,params:n}}routeUrl(e,t={}){let n;const r={...t};switch(e){case"annotation":{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){
|
|
613
|
+
this._window.history.pushState({},"",this.routeUrl(e,t)),this.sync()}}cf.$inject=["$window","store"];class uf{constructor(e,t){this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links();this._store.updateLinks(e)}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}uf.$inject=["apiRoutes","store"];class hf{constructor(e,t,n,r,o){var i,a;this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=P(r))||void 0===a?void 0:a.authority)&&void 0!==i?i:null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=Pm((()=>{const e=this._authority?{authority:this._authority}:{};return this._api.profile.read(e)})).then((e=>(this.update(e),this._lastLoadTime=Date.now(),e))).catch((e=>{throw this._lastLoadTime=null,e}))),this._lastLoad}async dismissSidebarTutorial(){
|
|
614
|
+
const e=await this._api.profile.update({},{preferences:{show_sidebar_tutorial:!1}});this.update(e)}update(e){const t=this._store.profile(),n=e.userid!==t.userid;return this._store.updateProfile(e),this._lastLoad=Promise.resolve(e),this._lastLoadTime=Date.now(),n&&(e.userid?Cr({id:e.userid}):Cr(null)),e}async logout(){try{return await this._auth.logout(),this.reload()}catch(e){throw this._toastMessenger.error("Log out failed"),new Error(e)}}reload(){return this._lastLoad=null,this._lastLoadTime=null,this.load()}}hf.$inject=["store","api","auth","settings","toastMessenger"];class df{constructor(){this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}}}addClause(e,t,n,r=!1){return this._filter.clauses.push({field:e,operator:t,value:n,case_sensitive:r}),this}getFilter(){return this._filter}resetFilter(){return this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}},this}}class pf extends Qp{constructor(e){super();const t=[];let n
|
|
615
|
+
;const r=()=>{for(;t.length>0;){const e=JSON.stringify(t.shift());n.send(e)}};this.close=()=>{n.close(1e3)},this.send=e=>{t.push(e),this.isConnected()&&r()},this.isConnected=()=>n.readyState===WebSocket.OPEN,(()=>{n=new WebSocket(e),n.onopen=e=>{r(),this.emit("open",e)},n.onclose=e=>{if(1e3===e.code||1001===e.code)return void this.emit("close",e);const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class mf{constructor(e,t,n,r,o){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=U(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&this._store.addAnnotations(e);const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})))
|
|
616
|
+
;t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){K("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&K("Check that your H service is configured to allow WebSocket connections from "+window.location.origin)}_handleSocketMessage(e){const t=JSON.parse(e.data);if(t)if("annotation-notification"===t.type){const e=t.payload;switch(t.options.action){case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else K("Received unsupported notification",t.type)}_sendClientConfig(e){
|
|
617
|
+
Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}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 pf(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))),
|
|
618
|
+
this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),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,$m(this._store.subscribe,(()=>this._store.profile().userid),(()=>{this._reconnect()}))),this._socket||await this._reconnect()}}mf.$inject=["store","apiRoutes","auth","groups","session"];class ff{constructor(e){this._storage=e}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(`^${Z(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)
|
|
619
619
|
;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)}}ff.$inject=["localStorage"];class gf{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}gf.$inject=["store"];class vf{constructor(e){this._store=e}dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r=""}={}){if(this._store.hasToastMessage(e,t))return;const o=U(10),i={type:e,id:o,message:t,moreInfoURL:r};this._store.addToastMessage({isDismissed:!1,...i}),n&&setTimeout((()=>{this.dismiss(o)}),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)}}function yf(e,t,n){return t in e?Object.defineProperty(e,t,{
|
|
620
620
|
value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_f(Object(n),!0).forEach((function(t){yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wf(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}vf.$inject=["store"];var xf="function"==typeof Symbol&&Symbol.observable||"@@observable",kf=function(){return Math.random().toString(36).substring(7).split("").join(".")},Sf={INIT:"@@redux/INIT"+kf(),
|
|
621
621
|
REPLACE:"@@redux/REPLACE"+kf(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+kf()}};function Cf(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Af(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wf(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wf(1));return n(Af)(e,t)}if("function"!=typeof e)throw new Error(wf(2));var o=e,i=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(wf(3));return i}function h(e){if("function"!=typeof e)throw new Error(wf(4));if(l)throw new Error(wf(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(wf(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),a=null}}}function d(e){if(!Cf(e))throw new Error(wf(7));if(void 0===e.type)throw new Error(wf(8))
|
|
@@ -648,8 +648,8 @@ return e.expanded}const nv=Uf((e=>e.forcedVisible),(e=>Vf(e))),rv=Uf((e=>e.selec
|
|
|
648
648
|
type:ev.SET_SORT_KEY,key:e}},toggleSelectedAnnotations:function(e){return{type:ev.TOGGLE_SELECTED_ANNOTATIONS,toggleIds:e}}},selectors:{expandedMap:tv,forcedVisibleThreads:nv,hasSelectedAnnotations:rv,selectedAnnotations:ov,selectedTab:iv,selectionState:av,sortKey:sv,sortKeys:lv}}),uv={OPEN_SIDEBAR_PANEL:function(e,t){return{activePanelName:t.panelName}},CLOSE_SIDEBAR_PANEL:function(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}},hv=Qm(uv);const dv=If({activePanelName:null},{namespace:"sidebarPanels",reducers:uv,actionCreators:{openSidebarPanel:function(e){return{type:hv.OPEN_SIDEBAR_PANEL,panelName:e}},closeSidebarPanel:function(e){return{type:hv.CLOSE_SIDEBAR_PANEL,panelName:e}},toggleSidebarPanel:function(e,t){return{type:hv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},
|
|
649
649
|
selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),pv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},mv=Qm(pv);const fv=If({messages:[]},{namespace:"toastMessages",reducers:pv,actionCreators:{addToastMessage:function(e){return{type:mv.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:mv.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:mv.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),gv={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},vv=Qm(gv);const yv=If({sidebarHasOpened:!1},{namespace:"viewer",reducers:gv,
|
|
650
650
|
actionCreators:{setSidebarOpened:function(e){return{type:vv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function _v(e){return Of([Bf,ng,ig,lg,gg,Sg,Ng,Gg,qg,Kg,Kf,cv,Og,dv,fv,yv],[e],[Rf])}_v.$inject=["settings"];class bv{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{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)}
|
|
651
|
-
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 wv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),xv=function(e){const{version:t,origin:n}=R(e.location.href);return"1.
|
|
652
|
-
!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function kv(e,t){e.setClientId(t.clientId)}function Sv(e,t,n){e.load(),t.load(),n.sync()}function Cv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Av(e,t){"sidebar"===t.route()&&e.connect()}wv.sentry&&xv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
651
|
+
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 wv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),xv=function(e){const{version:t,origin:n}=R(e.location.href);return"1.986.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.986.0) than the host page (${t}). It may not work.`),
|
|
652
|
+
!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function kv(e,t){e.setClientId(t.clientId)}function Sv(e,t,n){e.load(),t.load(),n.sync()}function Cv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Av(e,t){"sidebar"===t.route()&&e.connect()}wv.sentry&&xv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.986.0",beforeSend:(e,t)=>{if(Sr>=5)return K("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Sr;try{const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{
|
|
653
653
|
Yt("host_config",R(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),kr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(wv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),kv.$inject=["api","streamer"],Sv.$inject=["groups","session","router"],Cv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],Av.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&mo.clear();for(let[t,n]of Object.entries(e))mo.set(t,n)}(Ko);const Ev=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",te)}(),async function(e,t=window){
|
|
654
654
|
const n=H(window),r=n.requestConfigFromFrame;if(!r)return V(e,n);if("string"==typeof r)return await G(e,t);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(wv).then((e=>{!function(e,t){const n=new bv
|
|
655
655
|
;n.register("annotationsService",Am).register("api",Mm).register("apiRoutes",Bm).register("auth",Hm).register("autosaveService",qm).register("features",Gm).register("frameSync",Jm).register("groups",nf).register("loadAnnotationsService",rf).register("localStorage",af).register("persistedDefaults",lf).register("router",cf).register("serviceURL",uf).register("session",hf).register("streamer",mf).register("streamFilter",df).register("tags",ff).register("threadsService",gf).register("toastMessenger",vf).register("store",{factory:_v}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Cv),n.run(kv),n.run(Sv),n.run(ee),n.run(Av),I(po(ni.Provider,{value:n,children:po(Sm,{})}),t)}(e,Ev)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(po(Cm,{error:e}),t)}(e,Ev)));
|