hypothesis 1.1059.0 → 1.1060.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?y(e.src):null}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var n=m(e);if(!n)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",n.hostname)).replace("{current_scheme}",n.protocol)}var v={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?y(e.src):null}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var n=m(e);if(!n)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",n.hostname)).replace("{current_scheme}",n.protocol)}var v={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?bbce6d","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?71599b","styles/annotator.css":"styles/annotator.css?310566","styles/annotator.css.map":"styles/annotator.css.map?dc6ede","styles/highlights.css":"styles/highlights.css?5dd56a","styles/highlights.css.map":"styles/highlights.css.map?f1e719","styles/katex.min.css":"styles/katex.min.css?ac2365","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?961d51","styles/sidebar.css":"styles/sidebar.css?29212e","styles/sidebar.css.map":"styles/sidebar.css.map?5a48a8","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?8891ac","styles/ui-playground.css.map":"styles/ui-playground.css.map?0761cc","styles/ui-playground.css":"styles/ui-playground.css?e3fc2a","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?c6b8d0","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?c930ed","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?25e7b5"};if(function(){var t=[function(){return Promise.resolve()},function(){return new Map},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return t.every((function(t){return t()}))}catch(t){return!1}}()){var g=function(e){for(var n={},r=e.querySelectorAll("script.js-hypothesis-config"),s=0;s<r.length;s++){var o=void 0;try{o=JSON.parse(r[s].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(n,o)}return n}(document),j=b(g.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1060.0/");if(document.querySelector("hypothesis-app")){!function(t,e){d(t,"fetch",e.apiUrl),d(t,"fetch",e.apiUrl+"links");var n,o=h(i),a=r([].concat(s(o),["scripts/sidebar.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!0})}catch(t){a.e(t)}finally{a.f()}for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)c(t,f(e,p[l]))}(document,{assetRoot:j,manifest:v,apiUrl:g.apiUrl})}else{var w=g,A=b(w.notebookAppUrl||"https://hypothes.is/notebook"),k=b(w.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){p(t,"sidebar","html",e.sidebarAppUrl),p(t,"notebook","html",e.notebookAppUrl),d(t,"style",f(e,"styles/annotator.css")),p(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var n,o=h(i),a=r([].concat(s(o),["scripts/annotator.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!1})}catch(t){a.e(t)}finally{a.f()}var l=[];void 0!==window.PDFViewerApplication&&l.push("styles/pdfjs-overrides.css"),l.push("styles/highlights.css");for(var y=0,m=l;y<m.length;y++)c(t,f(e,m[y]))}}(document,{assetRoot:j,manifest:v,notebookAppUrl:A,sidebarAppUrl:k})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?bbce6d",
|
|
3
3
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?71599b",
|
|
4
4
|
"styles/annotator.css": "styles/annotator.css?310566",
|
|
5
5
|
"styles/annotator.css.map": "styles/annotator.css.map?dc6ede",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?8891ac",
|
|
15
15
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?0761cc",
|
|
16
16
|
"styles/ui-playground.css": "styles/ui-playground.css?e3fc2a",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?06da9c",
|
|
18
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?c6b8d0",
|
|
19
|
-
"scripts/sidebar.bundle.js
|
|
18
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?c930ed",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?25e7b5"
|
|
20
20
|
}
|
|
@@ -105,7 +105,7 @@ this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",[])})),this._l
|
|
|
105
105
|
this.getDocumentInfo().then((t=>this._sidebarRPC.call("documentInfoChanged",t)))}destroy(){this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),function(t){Ae(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{const e=Do(t);if(!e)return;const n=Ee(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&ke(n,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const o=await this._integration.anchor(this.element,e.selector),i=_e.fromRange(o);n={annotation:t,target:e,range:i}}catch(o){n={annotation:t,target:e}}return n})))
|
|
106
106
|
;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&&Ae(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Lt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Bo(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){
|
|
107
107
|
const n=t.includes(e.annotation.$tag);ke(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=Re(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>o||"down"===e&&t<o)&&(n=r,o=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=we(e),o=xe(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Oo(),this._isAdderVisible=!0,this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}
|
|
108
|
-
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 Ho(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Vo(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.
|
|
108
|
+
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 Ho(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Vo(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.1060.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),Array.isArray(o.services)&&(null===(n=o.services)||void 0===n?void 0:n.length)>0){const t=o.services[0]
|
|
109
109
|
;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 qo({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Ho(t.notebookAppUrl,{...Vo(t.notebookAppUrl,t),group:e})})}function Uo({eventBus:t,config:e}){const[n,o]=rt(0),[i,r]=rt(!0),[s,a]=rt(null),c=ct(""),l=ct(null);st((()=>(c.current=document.body.style.overflow,()=>{document.body.style.overflow=c.current})),[]),st((()=>{document.body.style.overflow=i?c.current:"hidden"}),[i]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),l.current=e,()=>{e.destroy()}}),[t]);return null===s?null:mt("div",{className:Z("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:i}),"data-testid":"notebook-outer",
|
|
110
110
|
children:mt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[mt("div",{className:"absolute right-0 text-xl m-3",children:mt(Ct,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=l.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),mt(qo,{config:e,groupId:s},n)]})})}class Wo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=he(this._outerContainer),M(mt(Uo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var zo={exports:{}};!function(t){!function(e,n,o,i){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),c=Math.round,l=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var o;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(o=0;o<t.length;)e.call(n,t[o],o,t),
|
|
111
111
|
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)}),"merge","Use `assign`.");function _(t,e,n){var o,i=e.prototype;(o=t.prototype=Object.create(i)).constructor=t,
|
|
@@ -595,7 +595,7 @@ if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTi
|
|
|
595
595
|
"font-bold":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:Ro(m,{children:[e,t>0&&!n&&Ro("span",{className:"relative bottom-[3px] left-[2px] text-tiny",children:t})]})})}var Ng=Ai((function({annotationsService:e,isLoading:t,settings:n}){const r=Ys(),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,d="note"===o&&0===i;return Ro("div",{className:uo("space-y-3 pb-[9px]"),children:[Ro("div",{className:"flex gap-x-6 theme-clean:ml-[15px]",role:"tablist",children:[Ro(Eg,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),Ro(Eg,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),children:"Page Notes"}),s>0&&Ro(Eg,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]
|
|
596
596
|
}),"note"===o&&n.enableExperimentalNewNoteButton&&Ro("div",{className:"flex justify-end",children:Ro(qo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:Si(["ctaBackgroundColor"],n),children:"New note"})}),!t&&d&&Ro(Go,{classes:"text-center",children:Ro("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&Ro(Go,{classes:"text-center",children:Ro("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",Ro("br",{}),"Create one by selecting some text and clicking the"," ",Ro(ei,{classes:"inline m-0.5 -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var Mg=Ai((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
597
597
|
const i=kl(),a=Ys(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),d=a.directLinkedAnnotationId(),h=d?a.findAnnotationByID(d):void 0,p=h?ml(h):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=h&&!1===h.$orphan?h.$tag:null,y=!(c||!d)&&!h,b=a.directLinkedGroupFetchFailed(),_=y||b,w=!_,x=!_&&!l,k=d&&!u&&!y&&!c,S=So(s);xo((()=>{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]),xo((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):h&&a.selectTab(p)}),[p,e,h,v,a]);const C=a.hasFetchedProfile();return xo((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),Ro("div",{children:[Ro("h2",{className:"sr-only",children:"Annotations"}),w&&Ro(vg,{}),Ro(Tg,{onLogin:t,onSignUp:n}),y&&Ro(dg,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),b&&Ro(dg,{
|
|
598
|
-
errorType:"group",onLoginRequest:t}),x&&Ro(Ng,{isLoading:c}),Ro(ug,{threads:i.children}),k&&Ro(yg,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Lg=Ai((function({api:e,toastMessenger:t}){const n=Ys(),r=n.routeParams().q,o=Ao((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...sl(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return xo((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),Ro(ug,{threads:kl().children})}),["api","toastMessenger"]);class zg{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.
|
|
598
|
+
errorType:"group",onLoginRequest:t}),x&&Ro(Ng,{isLoading:c}),Ro(ug,{threads:i.children}),k&&Ro(yg,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Lg=Ai((function({api:e,toastMessenger:t}){const n=Ys(),r=n.routeParams().q,o=Ao((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...sl(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return xo((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),Ro(ug,{threads:kl().children})}),["api","toastMessenger"]);class zg{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.1060.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
599
599
|
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 Og(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function Ig({commandName:e,iconName:t}){return Ro("span",{className:"whitespace-nowrap",children:[Ro(ei,{name:t,classes:uo("mx-1 -mt-1","text-color-text-light inline")}),Ro("em",{children:e})]})}var Rg=Ai((function({settings:e}){const t=!Og(e);return Ro("ol",{className:"list-decimal pl-10 space-y-2",children:[Ro("li",{children:["To create an annotation, select text and then select the"," ",Ro(Ig,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),Ro("li",{
|
|
600
600
|
children:["To create a highlight (",Ro(ti,{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"," ",Ro(Ig,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&Ro("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"," ",Ro(ti,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),Ro("li",{children:["To reply to an annotation, select the"," ",Ro(Ig,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);function Pg({label:e,children:t,classes:n}){return Ro(m,{children:[Ro("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Ro("dd",{className:uo("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})}
|
|
601
601
|
var Dg=Ai((function({toastMessenger:e,versionData:t}){return Ro("div",{className:"space-y-4",children:[Ro("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Ro(Pg,{label:"Version",children:t.version}),Ro(Pg,{label:"User Agent",children:t.userAgent}),Ro(Pg,{classes:uo("break-all"),label:"URL",children:t.urls}),Ro(Pg,{label:"Fingerprint",children:t.fingerprint}),Ro(Pg,{label:"Account",children:t.account}),Ro(Pg,{label:"Date",children:t.timestamp})]}),Ro("div",{className:"flex items-center justify-center",children:Ro(qo,{onClick:()=>{try{Xl(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 Bg({children:e,onClick:t}){return Ro(Uo,{classes:"leading-none text-brand",onClick:t,children:[e,Ro(ei,{classes:"ml-1",name:"arrow-right"})]})}function Fg({linkText:e,url:t}){return Ro("div",{className:"flex-1 border-r last-of-type:border-r-0",
|
|
@@ -611,7 +611,7 @@ children:null===t?Ro("div",{"data-testid":"pagination-gap",children:"..."}):Ro(q
|
|
|
611
611
|
currentPage:f,isLoading:l,onChangePage:w,threads:d.children})]})]})}),["loadAnnotationsService","streamer"]);var Qg=Ai((function({toastMessenger:e}){const t=Ys(),n=t.mainFrame(),r=t.focusedGroup(),o=`Share Annotations in ${r&&r.name||"..."}`,i=r&&n,a=i&&(s=n.uri,l=r.id,$l(s)?`https://hyp.is/go?url=${encodeURIComponent(s)}&group=${l}`:null);var s,l;return Ro(Ag,{title:o,panelName:"shareGroupAnnotations",children:[!i&&Ro("div",{className:"flex flex-row items-center justify-center",children:Ro(hi,{})}),i&&Ro("div",{className:"text-color-text-light space-y-3",children:a?Ro(m,{children:[Ro("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?Ro("p",{children:"Use this link to share these annotations with other group members:"}):Ro("p",{children:"Use this link to share these annotations with anyone:"})}),Ro("div",{children:Ro(fi,{children:[Ro(mi,{"aria-label":"Use this URL to share these annotations",type:"text",value:a,readOnly:!0}),Ro(Ho,{icon:"copy",
|
|
612
612
|
onClick:()=>{try{Xl(a),e.success("Copied share link to clipboard")}catch(t){e.error("Unable to copy link")}},title:"Copy share link",variant:"dark"})]})}),Ro("p",{"data-testid":"sharing-details",children:["private"===r.type?Ro("span",{children:["Annotations in the private group"," ",Ro("em",{children:r.name})," are only visible to group members."]}):Ro("span",{children:["Anyone using this link may view the annotations in the group"," ",Ro("em",{children:r.name}),"."]})," ",Ro("span",{children:["Private (",Ro(ei,{name:"lock",classes:"inline -mt-0.5"})," ",Ro("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),Ro("div",{className:"text-[24px]",children:Ro(Ql,{shareURI:a})})]}):Ro("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})})]})}),["toastMessenger"]);const ev=function(e,t){function n({classes:e,elementRef:n,children:r,...o}){return Ro("div",{className:uo(t,e),ref:n,...o,children:r})}
|
|
613
613
|
return n.displayName=e,n}("SidebarContent","mx-auto lg:px-16 lg:max-w-3xl");function tv({message:e,onDismiss:t}){const n="notice"!==e.type?`${e.type.charAt(0).toUpperCase()+e.type.slice(1)}: `:"",r="notice"===e.type?"cancel":e.type;return Ro(Vo,{classes:uo("p-0 flex border",{"sr-only":e.visuallyHidden,"border-red-error":"error"===e.type,"border-yellow-notice":"notice"===e.type,"border-green-success":"success"===e.type}),onClick:()=>t(e.id),children:[Ro("div",{className:uo("flex items-center p-3 text-white",{"bg-red-error":"error"===e.type,"bg-yellow-notice":"notice"===e.type,"bg-green-success":"success"===e.type}),children:Ro(ei,{name:r,classes:uo("mt-[2px]")})}),Ro("div",{className:uo("grow p-3 !mt-0"),"data-testid":"toast-message-text",children:[Ro("strong",{children:n}),e.message,e.moreInfoURL&&Ro("div",{className:"text-right",children:Ro(ti,{href:e.moreInfoURL,onClick:e=>e.stopPropagation(),target:"_new",children:"More info"})})]})]})}var nv=Ai((function({toastMessenger:e}){return Ro("div",{
|
|
614
|
-
children:Ro("ul",{"aria-live":"polite","aria-relevant":"additions",className:"absolute z-2 left-0 w-full
|
|
614
|
+
children:Ro("ul",{"aria-live":"polite","aria-relevant":"additions",className:"absolute z-2 left-0 w-full",children:Ys().getToastMessages().map((t=>Ro("li",{className:uo("relative w-full container hover:cursor-pointer",{"mb-2":!t.visuallyHidden,"motion-safe:animate-slide-in-from-right lg:animate-fade-in":!t.isDismissed,"motion-reduce:animate-fade-in":!t.isDismissed,"animate-fade-out":t.isDismissed}),children:Ro(tv,{message:t,onDismiss:t=>e.dismiss(t)})},t.id)))})})}),["toastMessenger"]);function rv(e){return e.organization&&e.organization.name}function ov(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n="__default__"===(r=e.organization).id?"__default__":`${r.name.toLowerCase()}${r.id}`;var r;void 0===t[n]&&(t[n]={...e.organization,groups:[]}),function(e,t){const n=Object.assign({},e),r=t.groups;!r.length&&e.organization.logo&&(n.logo=e.organization.logo),r.push(n)}(e,t[n])})),t}function iv(e){const t=ov(e),n=[],r=[];return Object.keys(t).sort().forEach((e=>{
|
|
615
615
|
"__default__"===e?n.push(...t[e].groups):r.push(...t[e].groups)})),n.length&&r.push(...n),r}function av({heading:e,children:t}){return Ro(m,{children:[e&&Ro("h2",{className:"text-color-text-light p-3 leading-none uppercase",children:e}),Ro("ul",{className:"border-b",children:x(t).map((e=>Ro("li",{children:e},e.key)))})]})}var sv=Ai((function({isExpanded:e,group:t,groups:n,onExpand:r,toastMessenger:o}){const i=t.links.html,a=i||t.canLeave,s=t.scopes&&!t.scopes.enforced||t.isScopedToUri,l=Ys(),c=l.focusedGroupId(),u=t.id===c,d=t=>{t.stopPropagation(),t.preventDefault(),r(!e)},h="private"===t.type?"Copy invite link":"Copy activity link";return Ro(If,{icon:t.logo||"blank",iconAlt:rv(t),isDisabled:!s,isExpanded:!!a&&e,isSelected:u,isSubmenuVisible:a?e:void 0,label:t.name,onClick:s?()=>{l.clearDirectLinkedGroupFetchFailed(),l.clearDirectLinkedIds(),n.focus(t.id)}:d,onToggleSubmenu:d,submenu:Ro(m,{children:[Ro("ul",{children:[i&&Ro("li",{children:Ro(If,{href:i,icon:"external",isSubmenuItem:!0,
|
|
616
616
|
label:"View group activity"})}),i&&Ro("li",{children:Ro(If,{onClick:()=>(e=>{try{Xl(e),o.success(`Copied link for "${t.name}"`)}catch(e){o.error("Unable to copy link")}})(i),icon:"copy",isSubmenuItem:!0,label:h})}),t.canLeave&&Ro("li",{children:Ro(If,{icon:"leave",isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await bi({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!s&&Ro("p",{className:uo("p-2 pl-9 bg-grey-1 hyphens-none"),"data-testid":"unselectable-group-note",children:"This group is restricted to specific URLs."})]})})}),["groups","toastMessenger"]);function lv({expandedGroup:e,onExpandGroup:t,groups:n,heading:r}){return Ro(av,{heading:r,children:n.map((n=>Ro(sv,{isExpanded:n===e,onExpand:e=>t(e?n:null),group:n},n.id)))})}var cv=Ai((function({settings:e}){
|
|
617
617
|
const t=Ys(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=Co((()=>iv(o)),[o]),l=Co((()=>iv(r)),[r]),c=Co((()=>iv(n)),[n]),u=t.defaultAuthority(),d=a&&!xi(a,u),h=t.getLink("groups.new"),[p,m]=_o(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=rv(i)?rv(i):"";f=Ro("span",{className:uo("shrink-0 flex items-center gap-x-1 text-lg text-color-text font-bold"),children:[t&&Ro("img",{className:uo("relative top-[1px] w-4 h-4"),src:t,alt:n}),i.name]})}else f=Ro("span",{children:"…"});return!!Og(e)&&n.length+r.length+o.length<2?f:Ro(Lf,{align:"left",contentClass:"min-w-[250px]",label:f,onOpenChanged:()=>m(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[c.length>0&&Ro(lv,{expandedGroup:p,onExpandGroup:m,heading:"Currently Viewing",groups:c}),l.length>0&&Ro(lv,{expandedGroup:p,onExpandGroup:m,heading:"Featured Groups",groups:l}),s.length>0&&Ro(lv,{
|
|
@@ -625,7 +625,7 @@ P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return Ro
|
|
|
625
625
|
document:{title:""}},e);return ha(l)&&(l.permissions=Gl(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),ha(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!la(n)}),ma(n)?this._store.selectTab("note"):fa(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._activity.reportActivity("delete",e),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._activity.reportActivity("flag",e),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:la(e)?Vl(t,e.group):Gl(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],
|
|
626
626
|
uri:e.uri};this.create(n)}async save(e){let t,n;const r=this._applyDraftChanges(e);let o;aa(e)?(t=this._api.annotation.update({id:e.id},r),n="update"):(t=this._api.annotation.create({},r),n="create"),this._store.annotationSaveStarted(e);try{o=await t,this._activity.reportActivity(n,o)}finally{this._store.annotationSaveFinished(e)}for(let[t,n]of Object.entries(e))if(t.startsWith("$")){o[t]=n}return this._store.removeDraft(e),this._store.addAnnotations([o]),o}}vv.$inject=["annotationActivity","api","store"];class yv{constructor(e){this._rpc=e.rpc,this._reportConfig=e.reportActivity}reportActivity(e,t){if(!this._rpc||!this._reportConfig)return;let n;switch(e){case"create":n=new Date(t.created).toISOString();break;case"update":n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id,isShared:Yl(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)
|
|
627
627
|
}(this._rpc.targetFrame,this._rpc.origin,this._reportConfig.method,[e,r])}}yv.$inject=["settings"];class bv 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 _v(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new bv(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new bv(e,n,"Failed to parse response")}var o;if(!n.ok)throw new bv(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function wv(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function xv(e){return"url"in e}function kv(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const o=n[t];if(!o||xv(o)){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t)
|
|
628
|
-
;if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
628
|
+
;if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1060.0"};l&&(u.Authorization="Bearer "+l);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=_s(c.url,a),m=new URL(h);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await _v(m.toString(),{body:s?JSON.stringify(wv(s)):null,headers:u,method:c.method})}finally{i()}}}class Sv{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>kv(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")},
|
|
629
629
|
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}}Sv.$inject=["apiRoutes","auth","store"];var Cv={exports:{}},Av={};function Tv(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 Ev=Tv;Tv.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Tv.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Tv.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),
|
|
630
630
|
!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},Tv.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)},Tv.prototype.try=function(e){
|
|
631
631
|
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Tv.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Tv.prototype.start=Tv.prototype.try,Tv.prototype.errors=function(){return this._errors},Tv.prototype.attempts=function(){return this._attempts},Tv.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=Ev;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))
|
|
@@ -658,8 +658,8 @@ null!==(n=this._socket)&&void 0!==n&&n.isConnected()&&this._socket.send(t)}async
|
|
|
658
658
|
var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,Hv(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}oy.$inject=["store","apiRoutes","auth","groups","session"];class iy{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(`^${Y(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject("hypothesis.user.tags.map")||{};e.forEach((e=>{t[e]?(t[e].count+=1,t[e].updated=Date.now()):t[e]={text:e,count:1,updated:Date.now()}})),this._storage.setObject("hypothesis.user.tags.map",t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject("hypothesis.user.tags.list",n)}}iy.$inject=["localStorage"]
|
|
659
659
|
;class ay{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}ay.$inject=["store"];class sy{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="",visuallyHidden:o=!1}={}){if(this._store.hasToastMessage(e,t))return;const i=H(10),a={type:e,id:i,message:t,moreInfoURL:r,visuallyHidden:o};this._store.addToastMessage({isDismissed:!1,...a}),n&&setTimeout((()=>{this.dismiss(i)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}sy.$inject=["store"];class ly{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)
|
|
660
660
|
;if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)
|
|
661
|
-
}}}const cy=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),uy=function(e){const{version:t,origin:n}=R(e.location.href);return"1.
|
|
662
|
-
;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Hr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
661
|
+
}}}const cy=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),uy=function(e){const{version:t,origin:n}=R(e.location.href);return"1.1060.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1060.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function dy(e,t){e.setClientId(t.clientId)}function hy(e,t,n){e.load(),t.load(),n.sync()}function py(e,t,n){e.init(),t.init(),n.init()}function my(e,t){"sidebar"===t.route()&&e.connect()}cy.sentry&&uy&&function(e){const t=function(){let e=import.meta.url
|
|
662
|
+
;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Hr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1060.0",beforeSend:(e,t)=>{if(Vr>=5)return G("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Vr;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{Qt("host_config",R(window.location.href))}catch(e){}Qt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Gr(((e,t)=>{Jt(e,{tags:{context:t}})}))}(cy.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{if("string"==typeof e.type){
|
|
663
663
|
const t=e.props;"dir"in t&&"auto"===t.dir&&(t.dir="")}t&&t(e)}}}(),dy.$inject=["api","streamer"],hy.$inject=["groups","session","router"],py.$inject=["autosaveService","persistedDefaults","serviceURL"],my.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&Po.clear();for(let[t,n]of Object.entries(e))Po.set(t,n)}(yi);const fy=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",J)}(),async function(e,t=window){const n=function(e){const t=R(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:D,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:F(t.origin),ancestorLevel:B(t.ancestorLevel)}}},o={};for(let[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){
|
|
664
664
|
const n=e.requestConfigFromFrame;if(!n)return null;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:U(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await q(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=q(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,r)}else o=n;const i={...e,...o};return r&&(i.rpc=r),i.apiUrl=function(e){const t=P(e);if(t){if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}return e.apiUrl}(i),i}(cy).then((e=>{!function(e,t){const n=new ly
|
|
665
665
|
;n.register("annotationsService",vv).register("annotationActivity",yv).register("api",Sv).register("apiRoutes",zv).register("auth",Rv).register("autosaveService",Pv).register("frameSync",$v).register("groups",Wv).register("loadAnnotationsService",Yv).register("localStorage",Xv).register("persistedDefaults",Jv).register("router",Qv).register("serviceURL",ey).register("session",ty).register("streamer",oy).register("streamFilter",ny).register("tags",iy).register("threadsService",ay).register("toastMessenger",sy).register("store",{factory:Ws}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(py),n.run(dy),n.run(hy),n.run(Z),n.run(my),I(Ro(Ci.Provider,{value:n,children:Ro(fv,{})}),t)}(e,fy)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(Ro(gv,{error:e}),t)}(e,fy)));
|