hypothesis 1.1728.0 → 1.1729.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-template.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?1b8bda","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?728e30","styles/annotator.css.map":"styles/annotator.css.map?11ce1b","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?e31f39","styles/katex.min.css.map":"styles/katex.min.css.map?0511b4","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?ce361f","styles/sidebar.css.map":"styles/sidebar.css.map?99d088","styles/ui-playground.css":"styles/ui-playground.css?67f38a","styles/ui-playground.css.map":"styles/ui-playground.css.map?cb998a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?3938d3","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?ea08c1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?e8845c"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"__ASSET_ROOT__");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"__NOTEBOOK_APP_URL__"),h=a(d.profileAppUrl||"__PROFILE_APP_URL__"),y=a(d.sidebarAppUrl||"__SIDEBAR_APP_URL__");!function(s,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)t(s,i(e,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?1b8bda","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?728e30","styles/annotator.css.map":"styles/annotator.css.map?11ce1b","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?e31f39","styles/katex.min.css.map":"styles/katex.min.css.map?0511b4","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?ce361f","styles/sidebar.css.map":"styles/sidebar.css.map?99d088","styles/ui-playground.css":"styles/ui-playground.css?67f38a","styles/ui-playground.css.map":"styles/ui-playground.css.map?cb998a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?3938d3","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?ea08c1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?e8845c"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1729.0/");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"https://hypothes.is/notebook"),h=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)t(s,i(e,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
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?1b8bda",
|
|
3
3
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?a8ba5d",
|
|
4
4
|
"styles/annotator.css": "styles/annotator.css?728e30",
|
|
5
5
|
"styles/annotator.css.map": "styles/annotator.css.map?11ce1b",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"styles/sidebar.css.map": "styles/sidebar.css.map?99d088",
|
|
14
14
|
"styles/ui-playground.css": "styles/ui-playground.css?67f38a",
|
|
15
15
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?cb998a",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?3938d3",
|
|
16
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?ea08c1",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?86bce5",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?a9e548",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?e8845c"
|
|
20
20
|
}
|
|
@@ -149,7 +149,7 @@ this._contentReady&&(await this._contentReady,this._contentReady=void 0);const t
|
|
|
149
149
|
this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",e),n}detach(e,t=!0){this._annotations.delete(e);const n=[];for(const t of this.anchors)t.annotation.$tag!==e?n.push(t):t.highlights&&this._highlighter.removeHighlights(t.highlights);this._updateAnchors(n,t)}_updateAnchors(e,t){this.anchors=e,this._clusterToolbar?.scheduleClusterUpdates(),t&&this._bucketBarClient.update(this.anchors)}async createAnnotation(e){if("selection"===e)return this.createAnnotationFromSelection();if(!["rect","point"].includes(e))throw new Error("Unsupported annotation tool");{let t=!1;try{this._hostRPC.call("activeToolChanged",e);const t=await this._drawTool.draw(e),n=await this.getDocumentInfo(),o=[{source:n.uri,selector:await this._integration.describe(this.element,t)}],i={uri:n.uri,document:n.metadata,target:o,$tag:"a:"+Ct(8)};return this._sidebarRPC.call("createAnnotation",i),this.anchor(i),i}catch(e){if(e instanceof oo&&["canceled","restarted"].includes(e.kind))return t="restarted"===e.kind,
|
|
150
150
|
null;throw e}finally{t||this._hostRPC.call("activeToolChanged",null)}}}async createAnnotationFromSelection({highlight:e=!1}={}){const t=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(t.map((e=>this._integration.describe(o,e))))).map((e=>({source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+Ct(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),ir(),r}_hoverAnnotations(e){this._hoveredAnnotations.clear(),e.forEach((e=>this._hoveredAnnotations.add(e)));for(const t of this.anchors)if(t.highlights){const n=e.includes(t.annotation.$tag);this._highlighter.setHighlightsFocused(t.highlights,n)}this._sidebarRPC.call("hoverAnnotations",e)}_onSelection(e){const t=this._integration.getAnnotatableRange(e);if(!t)return void this._onClearSelection();const n=document.getSelection(),o=Hn(n),i=Un(n);i?(this.selectedRanges=[t],
|
|
151
151
|
this._hostRPC.call("textSelected"),this._commentsMode||(this._adder.annotationsForSelection=tr(),this._isAdderVisible=!0,this._adder.show(i,o))):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(e,{toggle:t=!1,focusInSidebar:n=!1}={}){t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){this._highlighter.setHighlightsVisible(e),this._highlightsVisible=e,t&&this._hostRPC.call("highlightsVisibleChanged",e)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(e){this._sidebarLayout=e,this._integration.fitSideBySide(e)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(e){dn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible&&!this._commentsMode)}
|
|
152
|
-
_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Ji(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function lr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.
|
|
152
|
+
_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Ji(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function lr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1729.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const e=n.services[0];e.onLoginRequest&&(e.onLoginRequestProvided=!0),e.onLogoutRequest&&(e.onLogoutRequestProvided=!0),e.onSignupRequest&&(e.onSignupRequestProvided=!0),e.onProfileRequest&&(e.onProfileRequestProvided=!0),e.onHelpRequest&&(e.onHelpRequestProvided=!0)}return n}function cr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=ie(null);return ne((()=>{
|
|
153
153
|
e?r.current?.close():r.current?.showModal()}),[e]),ne((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Se("dialog",{ref:r,className:"relative m-5 w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function hr({closed:e,children:t,...n}){return Se("div",{...n,className:Ne("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Se("div",{className:"relative w-full h-full",children:t})})}function dr({document_:e=document,...t}){return Se(re((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?cr:hr),[e]),{...t})}function ur({config:e,groupId:t}){return Se("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:ar(e.notebookAppUrl,{...lr(e.notebookAppUrl,e),group:t})})}function fr({eventBus:e,config:t}){const[n,o]=te(0),[i,r]=te(!0),[s,a]=te(null),l=ie(""),c=ie(null)
|
|
154
154
|
;ne((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ne((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),ne((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const h=se((()=>{r(!0),c.current?.publish("closeNotebook")}),[]);return null===s?null:Se(dr,{closed:i,onClose:h,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Se("div",{className:"absolute right-0 m-3",children:Se(ot,{title:"Close notebook",onClick:h,variant:"dark",classes:Ne("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Se(Le,{className:"w-4 h-4"})})}),Se(ur,{config:t,groupId:s},n)]})}class pr{constructor(e,t,n){this._container=new vn("notebook",(()=>Se(fr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function gr({eventBus:e,config:t}){const[n,o]=te(!0),i=ie(null);ne((()=>{
|
|
155
155
|
const t=e.createEmitter();return t.subscribe("openProfile",(()=>{o(!1)})),i.current=t,()=>{t.destroy()}}),[e]);const r=()=>{o(!0),i.current?.publish("closeProfile")};return n?null:Se(dr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Se("div",{className:"absolute right-0 m-3",children:Se(ot,{title:"Close profile dialog",onClick:r,variant:"dark",classes:Ne("!bg-transparent enabled:hover:!bg-grey-3"),children:Se(Le,{className:"w-4 h-4"})})}),Se("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class _r{constructor(e,t,n){this._container=new vn("profile",(()=>Se(gr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function mr({above:e,below:t,buckets:n,onFocusAnnotations:o,onScrollToAnnotation:i,onSelectAnnotations:r}){const s=e.anchors.length>0,a=t.anchors.length>0,l=e=>e.anchors.map((e=>e.tag));return Se("ul",{className:"relative",
|
|
@@ -131,10 +131,10 @@ const n=t.annotations.filter((e=>!Pr(e))),r=Jr(t.annotations,Br)===n.length;retu
|
|
|
131
131
|
expanded:xi(e),forcedVisible:ki(e),selected:Ai(e),sortKey:Ci(e),selectedTab:Ti(e)})));function Ci(e){return e.sortKey}const Mi=Mr((e=>e.selectedTab),(e=>e.commentsMode),((e,t)=>{const n=["newest","oldest"];return"note"===e||t||n.push("location"),n})),Ni=fr((function(e){return{selected:bi(e),expanded:bi(e),forcedVisible:{},selectedTab:e.commentsMode?"note":"annotation",sortKey:vi("annotation",e.commentsMode),focusRequest:null,commentsMode:e.commentsMode}}),{namespace:"selection",reducers:_i,actionCreators:{clearAnnotationFocusRequest:function(){return mr(0,"CLEAR_ANNOTATION_FOCUS_REQUEST",void 0)},clearSelection:wi,selectAnnotations:function(e){return t=>{t(wi()),t(mr(0,"SELECT_ANNOTATIONS",{selection:eo(e)}))}},selectTab:function(e){return mr(0,"SELECT_TAB",{tab:e})},setAnnotationFocusRequest:function(e){return mr(0,"SET_ANNOTATION_FOCUS_REQUEST",{id:e})},setExpanded:function(e,t){return mr(0,"SET_EXPANDED",{id:e,expanded:t})},setForcedVisible:function(e,t){return mr(0,"SET_FORCED_VISIBLE",{id:e,visible:t})},
|
|
132
132
|
setSortKey:function(e){return mr(0,"SET_SORT_KEY",{key:e})},toggleSelectedAnnotations:function(e){return mr(0,"TOGGLE_SELECTED_ANNOTATIONS",{toggleIds:e})}},selectors:{expandedMap:xi,annotationFocusRequest:function(e){return e.focusRequest},forcedVisibleThreads:ki,hasSelectedAnnotations:Si,selectedAnnotations:Ai,selectedTab:Ti,selectionState:Ei,sortKey:Ci,sortKeys:Mi}}),Ii={OPEN_SIDEBAR_PANEL:(e,t)=>({activePanelName:t.panelName}),CLOSE_SIDEBAR_PANEL(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL(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}}};const Oi=fr({activePanelName:null},{namespace:"sidebarPanels",reducers:Ii,actionCreators:{openSidebarPanel:function(e){return mr(0,"OPEN_SIDEBAR_PANEL",{panelName:e})},closeSidebarPanel:function(e){return mr(0,"CLOSE_SIDEBAR_PANEL",{panelName:e})},toggleSidebarPanel:function(e,t){
|
|
133
133
|
return mr(0,"TOGGLE_SIDEBAR_PANEL",{panelName:e,panelState:t})}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),zi={ADD_MESSAGE:(e,t)=>({messages:e.messages.concat({...t.message})}),REMOVE_MESSAGE:(e,t)=>({messages:e.messages.filter((e=>e.id!==t.id))})};const Li=fr({messages:[]},{namespace:"toastMessages",reducers:zi,actionCreators:{addToastMessage:function(e){return mr(0,"ADD_MESSAGE",{message:e})},removeToastMessage:function(e){return mr(0,"REMOVE_MESSAGE",{id: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))}}}),Pi={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}};const Ri=fr({sidebarHasOpened:!1},{namespace:"viewer",reducers:Pi,actionCreators:{setSidebarOpened:function(e){return mr(0,"SET_SIDEBAR_OPENED",{opened:e})}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}})
|
|
134
|
-
;class Di{constructor(e,t,n,r){this.name=e,this.method=t,this.args=n,this.result=r}matches(e,t){return this.name===e&&this.args.every(((e,n)=>t[n]===e))}}function ji(e){return pr([br,Eo,Mo,Io,jo,Uo,ei,di,li,fi,oo,Ni,lo,Oi,Li,Ri],[e],[gr])}function Hi(){return function(e){const[,t]=ae((e=>e+1),0),n=ce([]).current,r=ce(null);if(!r.current){const t=new Map,o=(e,r)=>{const o=e[r];if("function"!=typeof o)return o;let i=t.get(r);return i||(i=(...t)=>{const i=n.find((e=>e.matches(r,t)));if(i)return i.result;const a=e.getState(),s=o.apply(e,t);return a===e.getState()&&n.push(new Di(r,o,t,s)),s},t.set(r,i),i)};r.current=new Proxy(e,{get:o})}return le((()=>e.subscribe((()=>{n.find((t=>t.method.apply(e,t.args)!==t.result))&&(n.splice(0,n.length),t(0))}))),[n,e]),r.current}(er("store"))}
|
|
135
|
-
children:[Ve("p",{children:
|
|
136
|
-
;var e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof We&&We&&We.Object===Object&&We,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&u.call(e)==t}(s))return e;if(m(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=m(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(n,"");var c=o.test(s);return c||i.test(s)?a(s.slice(2),c?2:8):r.test(s)?e:+s}return
|
|
137
|
-
function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return g?h(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(g)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=f(t)||0,m(n)&&(u=!!n.leading,i=(g="maxWait"in n)?d(f(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x}
|
|
134
|
+
;class Di{constructor(e,t,n,r){this.name=e,this.method=t,this.args=n,this.result=r}matches(e,t){return this.name===e&&this.args.every(((e,n)=>t[n]===e))}}function ji(e){return pr([br,Eo,Mo,Io,jo,Uo,ei,di,li,fi,oo,Ni,lo,Oi,Li,Ri],[e],[gr])}function Hi(){return function(e){const[,t]=ae((e=>e+1),0),n=ce([]).current,r=ce(null);if(!r.current){const t=new Map,o=(e,r)=>{const o=e[r];if("function"!=typeof o)return o;let i=t.get(r);return i||(i=(...t)=>{const i=n.find((e=>e.matches(r,t)));if(i)return i.result;const a=e.getState(),s=o.apply(e,t);return a===e.getState()&&n.push(new Di(r,o,t,s)),s},t.set(r,i),i)};r.current=new Proxy(e,{get:o})}return le((()=>e.subscribe((()=>{n.find((t=>t.method.apply(e,t.args)!==t.result))&&(n.splice(0,n.length),t(0))}))),[n,e]),r.current}(er("store"))}ji.$inject=["settings"];var Fi,$i,Bi=Jn((function({errorType:e,onLoginRequest:t,showClearSelection:n=!1,settings:{commentsMode:r}}){const o=Hi(),i=o.isLoggedIn();return Ve("div",{className:"mb-4",children:Ve(bn,{icon:on,
|
|
135
|
+
title:"group"===e?"Group unavailable":r?"Comment unavailable":"Annotation unavailable",children:[Ve("p",{children:i?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":`The current URL links to ${r?"a comment":"an annotation"},\n but that ${r?"comment":"annotation"} cannot be found, or you\n do not have permission to view it.`:`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),Ve("div",{className:"flex justify-end space-x-2",children:[n&&Ve(dn,{variant:i?"primary":void 0,onClick:()=>o.clearSelection(),children:["Show all ",r?"comments":"annotations"]}),!i&&Ve(dn,{variant:"primary",onClick:t,children:"Log in"})]})]})})}),["settings"]);var qi=function(){if($i)return Fi;$i=1
|
|
136
|
+
;var e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof We&&We&&We.Object===Object&&We,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&u.call(e)==t}(s))return e;if(m(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=m(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(n,"");var c=o.test(s);return c||i.test(s)?a(s.slice(2),c?2:8):r.test(s)?e:+s}return Fi=function(e,t,n){var r,o,i,a,s,l,c=0,u=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}function y(e){var n=e-l;return void 0===l||n>=t||n<0||g&&e-c>=i}
|
|
137
|
+
function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return g?h(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(g)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=f(t)||0,m(n)&&(u=!!n.leading,i=(g="maxWait"in n)?d(f(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x},Fi}(),Ui=Ke(qi);const Gi={defaultHeight:200,marginAbove:800,marginBelow:800};function Vi(e){const t=window.getComputedStyle(e);return e.getBoundingClientRect().height+(parseFloat(t.marginTop)+parseFloat(t.marginBottom))}function Wi(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+Wi(n,t)),n?1:0)}function Ki(e){return Wi(e,!1)}function Yi(e){return Wi(e,!0)}function Xi(e){
|
|
138
138
|
const t=e.filter((e=>!!e.annotation)).map((e=>e.annotation));if(t.length)return t;const n=[];if(e.forEach((e=>{e.children&&n.push(...e.children)})),n.length)return Xi(n);throw new Error("Thread contains no annotations")}function Zi(e,t,n){const r=Lr(e.user,t);return(n||r)&&e.user_info?.display_name?e.user_info.display_name:zr(e.user)}function Qi(e){var t,n=e.uri;try{t=new URL(n).hostname}catch(e){t=""}"localhost"===t&&(t="");var r=t;return e.document&&e.document.title&&(r=e.document.title[0]),{uri:n,domain:t,title:r}}function Ji(e){var t=e.uri;return t&&0!==t.indexOf("http://")&&0!==t.indexOf("https://")&&(t=null),e.links&&e.links.incontext&&(t=e.links.incontext),t}function ea(e){var t=Qi(e),n="";if(t.uri&&0===t.uri.indexOf("file://")&&t.title){var r=t.uri.split("/"),o=r[r.length-1];o&&(n=o)}else t.domain&&t.domain!==t.title&&(n=t.domain);return n}function ta(e){var t=Qi(e).title;return t.length>30&&(t=t.slice(0,30)+"…"),t}function na(e){var t,n=e.annotation,r=function(e){return{domain:ea(e),titleText:ta(e),
|
|
139
139
|
titleLink:Ji(e)}}(n),o=r.domain,i=r.titleText,a=r.titleLink,s=((null===(t=n.links)||void 0===t?void 0:t.html)||"")&&a?a:"";return Ve("div",{className:"flex gap-x-1",children:[Ve("div",{className:"text-color-text-light",children:['on "',s?Ve($n,{href:s,target:"_blank",underline:"none",children:i}):Ve("span",{children:i}),'"']}),o&&Ve("span",{className:"text-color-text-light",children:["(",o,")"]})]})}function ra(e){var t=e.group,n=null==t?void 0:t.links.html;return Ve(y,{children:t&&n&&Ve($n,{classes:Je("text-color-text-light hover:text-color-text-light"),href:t.links.html,target:"_blank",underline:"hover",variant:"custom",children:Ve("div",{className:"flex items-baseline gap-x-1",children:["open"===t.type?Ve(zt,{className:"w-2.5 h-2.5"}):Ve(Pt,{className:"w-2.5 h-2.5"}),Ve("span",{children:t.name})]})})})}function oa(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:setTimeout,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:clearTimeout,n=ce(null),r=de((function(){n.current&&t(n.current)
|
|
140
140
|
}),[t]);return se((function(){return r}),[r]),de((function(t,o){r(),n.current=e((function(){t(),n.current=null}),o)}),[r,e])}var ia=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ontouchend"in document;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e.platform)||e.userAgent.includes("Mac")&&t};function aa(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return sa(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,s=0,l=e,h.n=n,a}};function p(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],p=h.p,m=i[2];n>3?(o=m===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(s=0,h.v=r,h.n=i[1]):p<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,h.n=m,
|
|
@@ -581,11 +581,11 @@ matches:(e,t)=>e.includes(t),normalize:of}}const cf={quote:lf((e=>[Kr(e)??Yr(e)?
|
|
|
581
581
|
const n=e.slice(0,e.indexOf(":"));if(!n)return[null,e];if(t.includes(n)){return[n,e.slice(n.length+1)]}return[null,e]}function mf(e){const t=e.slice(0,1),n=e.slice(-1);return'"'!==t&&"'"!==t||t!==n||(e=e.slice(1,e.length-1)),e}function ff(e,t){const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(mf).filter((e=>e.length>0)).map((e=>{const[n,r]=pf(e,t);return n?n+":"+mf(r):e})):[]}function gf(e){const t={},n=e=>"tag"===e?"tags":e,r=ff(e,hf);for(const e of r){let[r,o]=pf(e,hf);r||(r="any",o=e);const i=n(r);t[i]?t[i].push(o):t[i]=[o]}return t}function vf(e){return $r(e)?"orphan":Br(e)?"note":"annotation"}function bf(e){return Xi([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function yf(e){return Xi([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}function _f(e,t){const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function wf(e,t){return e===t?0:e<t?-1:1}function xf(e,t,n){switch(n.sortBy){case"newest":{const n=bf(e);return wf(bf(t),n)}
|
|
582
582
|
case"oldest":return wf(yf(e),yf(t));case"location":return function(e,t){if(!e.annotation||!t.annotation)return function(e,t){return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Gr(e.annotation),r=Gr(t.annotation);if(n.cfi||r.cfi){const e="/0",t=Qm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=_f(n.pageIndex,r.pageIndex);if(0!==o)return o;const i=_f(n.top,r.top);if(0!==i)return i;const a=_f(n.charOffset,r.charOffset);if(0!==a)return a;return wf(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const kf=function(e){if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,sortCompareFn:(e,n)=>xf(e,n,{sortBy:t.sortKey})};if(!!t.filterQuery||Object.keys(t.filters).length>0){const e=function(e,t={}){const n=e=>{const n=t[e];return"string"==typeof n?[n]:[]
|
|
583
583
|
},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=ff(e,df);for(const e of h){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and",filterReplies:!0},cfi:{terms:r,operator:"or",filterReplies:!1},quote:{terms:i,operator:"and",filterReplies:!1},page:{terms:o,operator:"or",filterReplies:!1},since:{terms:d,operator:"and",filterReplies:!0},tag:{terms:a,operator:"and",filterReplies:!0},text:{terms:s,operator:"and",filterReplies:!0},uri:{terms:l,operator:"or",filterReplies:!1},user:{terms:c,
|
|
584
|
-
operator:"or",filterReplies:!0}}}(t.filterQuery||"",t.filters),r={},o={};for(const[t,n]of Object.entries(e))n.filterReplies?r[t]=n:o[t]=n;n.filterFn=e=>uf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&uf([e.annotation],o).length>0)}const r=Ym(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
584
|
+
operator:"or",filterReplies:!0}}}(t.filterQuery||"",t.filters),r={},o={};for(const[t,n]of Object.entries(e))n.filterReplies?r[t]=n:o[t]=n;n.filterFn=e=>uf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&uf([e.annotation],o).length>0)}const r=Ym(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(e.annotation&&Hr(e.annotation))return!1;const n=e.annotation?vf(e.annotation):"orphan";return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Sf(){const e=Hi(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=ue((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[o,n,i,t,a]);return kf(s)}var Af,Tf,Ef=Jn((function({loadAnnotationsService:e,onLogin:t}){const n=Hi(),r=n.routeParams().id??"",{rootThread:o}=Sf(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),
|
|
585
|
+
e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(Bi,{errorType:"annotation",onLoginRequest:t}),Ve(Hm,{threads:o.children})]})}),["loadAnnotationsService"]);class Cf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.1729.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||r,this.fingerprint=t[0]?.metadata?.documentFingerprint??r,this.account=o,this.timestamp=(new Date).toString();const i=t[0]?.segment;if(i){const e=[];if(i.cfi&&e.push(["CFI",i.cfi]),i.pages){const t=`${i.pages.start}-${i.pages.end}`;e.push(["Pages",t])}i.url&&e.push(["URL",i.url]),this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}asFormattedString(){
|
|
586
|
+
return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}var Mf=function(){if(Tf)return Af;Tf=1;var e="complete",t="canceled";function n(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function r(t){var o=t._scrollSettings;if(o){var i=o.maxSynchronousAlignments,a=function(e,t){var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect()
|
|
587
|
+
;var v=u.left-(n.left-t.scrollLeft),b=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=b+l*g-t.clientHeight*g,r-=p,o-=m,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(o,t),s=Date.now()-o.startTime,l=Math.min(1/o.time*s,1);if(o.endIterations>=i)return n(t,a.x,a.y),t._scrollSettings=null,o.end(e);var c=1-o.ease(l);if(n(t,a.x-a.differenceX*c,a.y-a.differenceY*c),s>=o.time)return o.endIterations++,o.scrollAncestor&&r(o.scrollAncestor),void r(t);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(r.bind(null,t))}}function o(e){return e.self===e}function i(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function a(){return!0}function s(e){
|
|
588
|
+
if(e.assignedSlot)return s(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}return Af=function(n,l,c){if(n){"function"==typeof l&&(c=l,l=null),l||(l={}),l.time=isNaN(l.time)?1e3:l.time,l.ease=l.ease||function(e){return 1-Math.pow(1-e,e/2)},l.align=l.align||{};var u=s(n),d=1,h=l.validTarget||a,p=l.isScrollable;l.debug&&(console.log("About to scroll to",n),u||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var m=[];u;)if(l.debug&&console.log("Scrolling parent node",u),h(u,d)&&(p?p(u,i):i(u))&&(d++,m.push(u)),!(u=s(u))){f(e);break}return m.reduce(((e,i,a)=>function(e,n,i,a,s){var l,c=!n._scrollSettings,u=n._scrollSettings,d=Date.now(),h={passive:!0};function p(e){n._scrollSettings=null,
|
|
589
589
|
n.parentElement&&n.parentElement._scrollSettings&&n.parentElement._scrollSettings.end(e),i.debug&&console.log("Scrolling ended with type",e,"for",n),s(e),l&&(n.removeEventListener("touchstart",l,h),n.removeEventListener("wheel",l,h))}u&&u.end(t);var m=i.maxSynchronousAlignments;return null==m&&(m=3),n._scrollSettings={startTime:d,endIterations:0,target:e,time:i.time,ease:i.ease,align:i.align,isWindow:i.isWindow||o,maxSynchronousAlignments:m,end:p,scrollAncestor:a},"cancellable"in i&&!i.cancellable||(l=p.bind(null,t),n.addEventListener("touchstart",l,h),n.addEventListener("wheel",l,h)),c&&r(n),l}(n,i,l,m[a+1],f)),null)}function f(e){--d||c&&c(e)}},Af}(),Nf=Ke(Mf);function If({children:e,panelName:t,label:n,onActiveChanged:r,initialFocus:o}){const i=Hi(),a=i.isSidebarPanelOpen(t),[s,l]=ie(!1),c=a||s,u=ce(null),d=ce(a),h=ce(null),p=ce(null);se((()=>{d.current!==a&&(d.current=a,a&&u.current&&Nf(u.current),r?.(a))}),[a,r]);const m=de((e=>{if(l("in"===e),"out"===e)return void p.current?.focus()
|
|
590
590
|
;const t=o?.current,n=t&&!t.disabled?t:h.current;p.current=document.activeElement,n?.focus()}),[o]),f=de((()=>i.toggleSidebarPanel(t,!1)),[i,t]);return Ve(nt.Provider,{value:{onClose:f},children:Ve(Wn,{direction:a?"in":"out",onTransitionEnd:m,elementRef:u,children:c&&Ve("section",{"aria-label":n,className:"mb-4 focus-visible-ring rounded-lg",ref:h,tabIndex:-1,children:e})})})}function Of({commandName:e,icon:t}){return Ve("span",{className:"whitespace-nowrap","data-testid":"instruction",children:[Ve(t,{className:Je("w-em h-em","mx-1 -mt-1","text-color-text-light inline"),"aria-hidden":!0}),Ve("em",{"data-testid":"command-name",children:e})]})}var zf=Jn((function({settings:e}){const t=!Yn(e);return Ve("ol",{className:"list-decimal pl-10 space-y-2",children:[Ve("li",{children:["To create an annotation, select text and then select the"," ",Ve(Of,{icon:lt,commandName:"Annotate"})," button."]}),Ve("li",{children:["To create a highlight (",Ve($n,{
|
|
591
591
|
href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",underline:"always",children:"visible only to you"}),"), select text and then select the"," ",Ve(Of,{icon:jt,commandName:"Highlight"})," button."]}),t&&Ve("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"," ",Ve($n,{href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",underline:"always",children:"join link"}),"."]}),Ve("li",{children:["To reply to an annotation, select the"," ",Ve(Of,{icon:rn,commandName:"Reply"})," button."]})]})}),["settings"]);async function Lf(e,t=navigator){await t.clipboard.writeText(e)}function Pf({label:e,children:t,classes:n}){return Ve(y,{children:[Ve("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Ve("dd",{className:Je("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})}var Rf=Jn((function({toastMessenger:e,versionData:t}){
|
|
@@ -621,7 +621,7 @@ name:"annotation",onSelect:()=>d("annotation"),children:"Annotations"}),Ve(xg,{c
|
|
|
621
621
|
"data-testid":"annotations-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center !space-y-1",children:[Ve("p",{children:"There are no annotations in this group."}),Ve("p",{children:["Create one by selecting some text and clicking the"," ",Ve(lt,{className:"w-em h-em inline m-0.5 -mt-0.5",title:"Annotate"})," ","button."]})]})}),Ve(Hm,{threads:r.children})]})]})]})}),["annotationsService","settings"]);function Sg({label:e,icon:t,description:n,active:r,disabled:o=!1,setActive:i,testId:a}){return Ve(dn,{"data-testid":a,classes:Je({"font-medium rounded-lg py-1":!0,"text-grey-7 bg-grey-2":!r,"text-grey-1 bg-grey-7":r,"opacity-50":o}),disabled:o,onClick:()=>i(!r),pressed:r,variant:"custom",title:n,children:[t&&Ve(t,{className:"w-em h-em"}),Ve("span",{className:"max-w-36 truncate",children:e}),Ve("div",{className:Je({"h-[2em] w-[1.5px] -mt-1 -mb-1":!0,"bg-grey-3":!r,"bg-grey-5":r})}),Ve(r?Xt:Zt,{className:"w-em h-em"})]})}function Ag({children:e}){return Ve("div",{className:"mb-3",children:Ve(it,{
|
|
622
622
|
children:Ve(st,{children:e})})})}function Tg({withCardContainer:e=!1}){const t=Hi(),n=t.selectedAnnotations().length,r=n>0,o=t.getFocusActive(),i=t.getFocusFilters(),a=Object.keys(i).length>0;if(!(r||a))return null;return Ve(e?Ag:y,{children:Ve("div",{className:"flex flex-row flex-wrap gap-2 items-center","data-testid":"filter-controls",children:[Ve("b",{children:"Filters"}),r&&Ve(Sg,{label:`${n} selected`,description:`Show ${n} selected annotations`,active:!0,setActive:()=>t.clearSelection(),testId:"selection-toggle"}),i.user&&Ve(Sg,{icon:en,label:`By ${i.user.display}`,description:`Show annotations by ${i.user.display}`,active:o.has("user"),disabled:r,setActive:()=>t.toggleFocusMode({key:"user"}),testId:"user-focus-toggle"}),i.page&&Ve(Sg,{icon:Mt,label:`Pages ${i.page.display}`,description:`Show annotations on pages ${i.page.display}`,active:o.has("page"),disabled:r,setActive:()=>t.toggleFocusMode({key:"page"}),testId:"page-focus-toggle"}),i.cfi&&Ve(Sg,{icon:Mt,label:"Selected chapter",
|
|
623
623
|
description:"Show annotations on selected book chapter(s)",active:o.has("cfi"),disabled:r,setActive:()=>t.toggleFocusMode({key:"cfi"}),testId:"cfi-focus-toggle"})]})})}var Eg=Jn((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){const i=Hi(),a=i.focusedGroupId(),s=i.isLoading(),l=i.isLoggedIn(),c=i.directLinkedAnnotationId(),u=c?i.findAnnotationByID(c):void 0,d=u?vf(u):"annotation",h=i.searchUris(),p=i.hasSidebarOpened(),m=i.profile().userid,f=!(s||!c)&&!u,g=i.directLinkedGroupFetchFailed(),v=f||g,b=i.isSidebarPanelOpen("searchAnnotations"),y=!v&&!b,_=c&&!l&&!f&&!s,w=ce(a);se((()=>{if(!w.current||w.current!==a){if(w.current){const e=i.focusState().active;i.clearSelection(),e&&i.toggleFocusMode({active:!0})}w.current=a}a&&h.length&&r.load({groupId:a,uris:h})}),[i,r,a,m,h]),se((()=>{u&&!1===u.$orphan?(e.hoverAnnotation(u),e.scrollToAnnotation(u),i.selectTab(d)):u&&i.selectTab(d)}),[d,e,u,i]);const x=i.hasFetchedProfile();return se((()=>{x&&(p||l)&&o.connect({
|
|
624
|
-
applyUpdatesImmediately:!1})}),[x,l,p,o]),Ve("div",{className:"relative",children:[Ve("h2",{className:"sr-only",children:"Annotations"}),Ve("div",{className:Je("fixed z-10","right-[9px] top-12"),children:Ve(tg,{})}),y&&Ve(Tg,{withCardContainer:!0}),Ve(yg,{onLogin:t,onSignUp:n}),f&&Ve(
|
|
624
|
+
applyUpdatesImmediately:!1})}),[x,l,p,o]),Ve("div",{className:"relative",children:[Ve("h2",{className:"sr-only",children:"Annotations"}),Ve("div",{className:Je("fixed z-10","right-[9px] top-12"),children:Ve(tg,{})}),y&&Ve(Tg,{withCardContainer:!0}),Ve(yg,{onLogin:t,onSignUp:n}),f&&Ve(Bi,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),g&&Ve(Bi,{errorType:"group",onLoginRequest:t}),!v&&Ve(kg,{isLoading:s}),_&&Ve(bg,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Cg=Jn((function({api:e,toastMessenger:t}){const n=Hi(),r=n.routeParams().q,o=de((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...gf(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);se((()=>{n.setSortKey("newest"),n.clearAnnotations(),o(r??"").catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]);const{rootThread:i}=Sf();return Ve(Hm,{threads:i.children})
|
|
625
625
|
}),["api","toastMessenger"]);var Mg=Jn((function({toastMessenger:e}){const t=Hi().getToastMessages();return Ve("div",{className:Je("z-10","absolute left-0 w-full"),children:Ve(Fn,{messages:t,onMessageDismiss:t=>e.dismiss(t),transitionClasses:{transitionIn:"motion-safe:animate-slide-in-from-right lg:animate-fade-in motion-reduce:animate-fade-in"}})})}),["toastMessenger"]);function Ng(e){return e.organization.name}const Ig="__default__";function Og(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n=(r=e.organization).id===Ig?Ig:`${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 zg(e){const t=Og(e),n=[],r=[];return Object.keys(t).sort().forEach((e=>{e===Ig?n.push(...t[e].groups):r.push(...t[e].groups)})),n.length&&r.push(...n),r}function Lg({heading:e,children:t}){return Ve(y,{
|
|
626
626
|
children:[e&&Ve("h2",{className:"text-color-text-light p-3 leading-none uppercase",children:e}),Ve("ul",{className:"border-b",children:E(t).map((e=>Ve("li",{children:e},e.key)))})]})}function Pg({type:e}){return Ve("div",{className:"text-color-text-light",title:"open"===e?"Public group":"restricted"===e?"Restricted group":"Private group","data-testid":"group-icon",children:["open"===e&&Ve(zt,{}),"restricted"===e&&Ve(Lt,{}),"private"===e&&Ve(Gt,{})]})}var Rg=Jn((function({isExpanded:e,group:t,groups:n,onExpand:r,showIcon:o=!0,toastMessenger:i}){const a=t.links.html,s=a||t.canLeave,l=t.scopes&&!t.scopes.enforced||t.isScopedToUri,c=Hi(),u=c.focusedGroupId(),d=t.id===u,h=t=>{t.stopPropagation(),t.preventDefault(),r(!e)},p="private"===t.type?"Copy invite link":"Copy activity link",m=t.logo?Ve("img",{className:"w-4 h-4",alt:Ng(t),src:t.logo}):Ve("span",{className:"sr-only",children:Ng(t)});return Ve(bm,{isDisabled:!l,isExpanded:!!s&&e,isSelected:d,isSubmenuVisible:s?e:void 0,label:Ve("div",{
|
|
627
627
|
className:"grow flex items-center justify-between gap-x-2",children:[t.name,o&&Ve(Pg,{type:t.type})]}),leftChannelContent:m,onClick:l?()=>{c.clearDirectLinkedGroupFetchFailed(),c.clearDirectLinkedIds(),n.focus(t.id)}:h,onToggleSubmenu:h,submenuToggleTitle:`Show actions for ${t.name}`,submenu:Ve(y,{children:[Ve("ul",{children:[a&&Ve("li",{children:Ve(bm,{href:a,icon:Ct,isSubmenuItem:!0,label:"View group activity"})}),a&&Ve("li",{children:Ve(bm,{onClick:()=>(async e=>{try{await Lf(e),i.success(`Copied link for "${t.name}"`)}catch{i.error("Unable to copy link")}})(a),icon:_t,isSubmenuItem:!0,label:p})}),t.canLeave&&Ve("li",{children:Ve(bm,{icon:$t,isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await wn({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!l&&Ve("p",{className:Je("p-2 pl-9 bg-grey-1 hyphens-none"),"data-testid":"unselectable-group-note",children:"This group is restricted to specific URLs."})]})})
|
|
@@ -670,7 +670,7 @@ client_version:r.version,annotations:e.map(Eb)}}buildTextExportContent(e,{groupN
|
|
|
670
670
|
${u.join("\n\n")}`}buildCSVExportContent(e,{groupName:t="",defaultAuthority:n="",displayNamesEnabled:r=!1,separator:o=","}={}){const{uri:i,extractUsername:a}=this._exportCommon(e,{displayNamesEnabled:r,defaultAuthority:n}),s=e=>[Cb(new Date(e.created)),a(e),Qr(e)??"",i,t,Ur(e,this._settings),Kr(e)??Yr(e)??"",e.text,e.tags.join(",")].map((e=>function(e,t){return new RegExp(`["\n\r${t}]`).test(e)?`"${e.replace(/"/g,'""')}"`:e}(e,o))).join(o);return`${["Created at","Author","Page","URL","Group","Type","Quote/description","Comment","Tags"].join(o)}\n${e.map((e=>s(e))).join("\n")}`}buildHTMLExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const{uri:i,title:a,uniqueUsers:s,replies:l,extractUsername:c}=this._exportCommon(e,{displayNamesEnabled:n,defaultAuthority:r});return function(e,t,n){var r=Object.assign({},Sb,n||{});return r.jsx||(r.attributeHook=null),Zv(e,t,r)}(Ve("html",{lang:"en",children:[Ve("head",{children:[Ve("title",{
|
|
671
671
|
children:`Annotations on "${a}"`}),Ve("meta",{charSet:"UTF-8"})]}),Ve("body",{children:[Ve("section",{children:[Ve("h1",{children:"Summary"}),Ve("p",{children:Ve("time",{dateTime:o.toISOString(),children:Cb(o)})}),Ve("p",{children:Ve("strong",{children:a})}),Ve("p",{children:Ve("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Group:"}),Ve("td",{children:t})]}),Ve("tr",{children:[Ve("td",{children:"Total users:"}),Ve("td",{children:s.length})]}),Ve("tr",{children:[Ve("td",{children:"Users:"}),Ve("td",{children:s.join(", ")})]}),Ve("tr",{children:[Ve("td",{children:"Total annotations:"}),Ve("td",{children:e.length})]}),Ve("tr",{children:[Ve("td",{children:"Total replies:"}),Ve("td",{children:l.length})]})]})})]}),Ve("hr",{}),Ve("section",{children:[Ve("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Qr(e),r=Kr(e),o=Yr(e),i=ep(e.text),a=i===`<p>${e.text}</p>`?e.text:i
|
|
672
672
|
;return Ve("article",{children:[Ve("h2",{children:["Annotation ",t+1,":"]}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Created at:"}),Ve("td",{children:Ve("time",{dateTime:e.created,children:Cb(new Date(e.created))})})]}),Ve("tr",{children:[Ve("td",{children:"Author:"}),Ve("td",{children:c(e)})]}),n&&Ve("tr",{children:[Ve("td",{children:"Page:"}),Ve("td",{children:n})]}),Ve("tr",{children:[Ve("td",{children:"Type:"}),Ve("td",{children:Ur(e,this._settings)})]}),r&&Ve("tr",{children:[Ve("td",{children:"Quote:"}),Ve("td",{children:Ve("blockquote",{style:{margin:0},children:r})})]}),o&&Ve("tr",{children:[Ve("td",{children:"Description:"}),Ve("td",{children:o})]}),Ve("tr",{children:[Ve("td",{children:"Comment:"}),Ve("td",{dangerouslySetInnerHTML:{__html:a}})]}),e.tags.length>0&&Ve("tr",{children:[Ve("td",{children:"Tags:"}),Ve("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
|
|
673
|
-
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Zi(e,n,t),{uri:i,title:a}=Qi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Mb.$inject=["settings"];class Nb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
673
|
+
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Zi(e,n,t),{uri:i,title:a}=Qi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Mb.$inject=["settings"];class Nb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1729.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=ci(c.url,a),m=new URL(h);for(const[e,t]of Object.entries(p)){
|
|
674
674
|
const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await yp(m.toString(),{body:s?JSON.stringify(Eb(s)):null,headers:u,method:c.method,signal:l})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={read:i("annotation.read"),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"),moderate:i("annotation.moderate")},this.group={member:{delete:i("group.member.delete")},members:{read:i("group.members.read")},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")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}
|
|
675
675
|
Nb.$inject=["apiRoutes","auth","store"];var Ib,Ob,zb,Lb,Pb,Rb={};function Db(){return zb||(zb=1,e=Rb,t=function(){if(Ob)return Ib;function e(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))}return Ob=1,Ib=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),
|
|
676
676
|
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},e.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)},e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){
|
|
@@ -788,8 +788,8 @@ const e=Object.values(this._store.pendingUpdates());e.length&&(this._store.addAn
|
|
|
788
788
|
const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),r.on("error",(t=>this._handleSocketError(e,t))),r.on("message",(e=>this._handleSocketMessage(e))),this._socket=r,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,ry(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}BS.$inject=["store","apiRoutes","auth","groups","session","$window"];const qS="hypothesis.user.tags.list",US="hypothesis.user.tags.map";class GS{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(qS)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${hv(e)}`,"i")
|
|
789
789
|
;return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(US)||{};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(US,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(qS,n)}}GS.$inject=["localStorage"];class VS{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}VS.$inject=["store"];class WS{#t=new Map;#n=30;#r;constructor(e){this.#r=e}get cacheSize(){return this.#n}set cacheSize(e){this.#n=e,this.#o()}#o(){for(const e of this.#t.keys()){const t=this.#t.get(e);if(t&&URL.revokeObjectURL(t.url),this.#t.delete(e),this.#t.size<=this.cacheSize)break}}async fetch(e,t={}){const n=this.get(e);if(n)return n;const r=await this.#r.requestThumbnail(e,t),o=await async function(e){const t=new OffscreenCanvas(e.width,e.height)
|
|
790
790
|
;t.getContext("2d").drawImage(e,0,0,e.width,e.height);const n=await t.convertToBlob();return URL.createObjectURL(n)}(r),i={url:o,width:r.width,height:r.height};return this.#t.set(e,i),this.#t.size>this.cacheSize&&this.#o(),i}get(e){const t=this.#t.get(e);return t?(this.#t.delete(e),this.#t.set(e,t),t):null}cachedThumbnailTags(){return[...this.#t.keys()]}}WS.$inject=["frameSync"];class KS extends $f{constructor(e,t){super(),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,
|
|
791
|
-
messageText:t,options:o})}const i={type:e,id:tv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}KS.$inject=["store","$window"];const YS=function(e){for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),XS=function(e){const{version:t,origin:n}=rv(e.location.href);return"1.
|
|
792
|
-
!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 ZS(e,t){e.setClientId(t.clientId)}function QS(e){e.sync()}function JS(e,t){e.load(),t.load()}function eA(e,t,n){e.init(),t.init(),n.init()}function tA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}YS.sentry&&XS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ES({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
791
|
+
messageText:t,options:o})}const i={type:e,id:tv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}KS.$inject=["store","$window"];const YS=function(e){for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),XS=function(e){const{version:t,origin:n}=rv(e.location.href);return"1.1729.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1729.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."),
|
|
792
|
+
!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 ZS(e,t){e.setClientId(t.clientId)}function QS(e){e.sync()}function JS(e,t){e.load(),t.load()}function eA(e,t,n){e.init(),t.init(),n.init()}function tA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}YS.sentry&&XS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ES({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1729.0",beforeSend:(e,t)=>{if(CS>=5)return cv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++CS;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch{}
|
|
793
793
|
return e}});try{ux("host_config",rv(window.location.href))}catch{}ux("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Xb(((e,t)=>{MS(e,t)}))}(YS.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),ZS.$inject=["api","streamer"],QS.$inject=["router"],JS.$inject=["groups","session"],eA.$inject=["autosaveService","persistedDefaults","serviceURL"],tA.$inject=["frameSync","store","toastMessenger"];const nA=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",yv)}(),async function(e,t=window){const n=function(e){const t=rv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl","commentsMode","groupsAllowlist"],r={openSidebar:ov,requestConfigFromFrame:e=>{
|
|
794
794
|
if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:av(t.origin),ancestorLevel:iv(t.ancestorLevel)}}},o={};for(const[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:sv(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await nv(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=nv(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),
|
|
795
795
|
i.apiUrl=function(e){const t=Kn(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(YS).then((e=>{!function(e,t){const n=new U;n.register("analytics",_v).register("annotationsExporter",Mb).register("annotationsService",xv).register("annotationActivity",wv).register("api",Nb).register("apiRoutes",$b).register("auth",Ub).register("autosaveService",Gb).register("dashboard",Vb).register("frameSync",ay).register("groups",cy).register("importAnnotationsService",IS).register("loadAnnotationsService",OS).register("localStorage",LS).register("persistedDefaults",RS).register("router",DS).register("serviceURL",jS).register("session",HS).register("streamer",BS).register("streamFilter",FS).register("tags",GS).register("threadsService",VS).register("thumbnailService",WS).register("toastMessenger",KS).register("store",{factory:ji}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(QS),n.run(eA),n.run(ZS),n.run(JS),n.run(bv),n.run(tA),
|