hypothesis 1.1707.0 → 1.1708.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.
@@ -1 +1 @@
1
- !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?ed3f68","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?876ce4","styles/highlights.css":"styles/highlights.css?ef86d1","styles/annotator.css.map":"styles/annotator.css.map?78e935","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?7fbc4d","styles/katex.min.css.map":"styles/katex.min.css.map?6974c9","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?1e1216","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?4259e8","styles/sidebar.css.map":"styles/sidebar.css.map?53d628","styles/ui-playground.css":"styles/ui-playground.css?c16d69","styles/ui-playground.css.map":"styles/ui-playground.css.map?6c3cba","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?86a19a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?b3e705","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?b2b7bf"};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/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?812361","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?876ce4","styles/annotator.css.map":"styles/annotator.css.map?78e935","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?7fbc4d","styles/katex.min.css.map":"styles/katex.min.css.map?6974c9","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?1e1216","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?4259e8","styles/sidebar.css.map":"styles/sidebar.css.map?53d628","styles/ui-playground.css":"styles/ui-playground.css?c16d69","styles/ui-playground.css.map":"styles/ui-playground.css.map?6c3cba","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?86a19a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?37780a","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?e936e4"};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?ed3f68","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?876ce4","styles/highlights.css":"styles/highlights.css?ef86d1","styles/annotator.css.map":"styles/annotator.css.map?78e935","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?7fbc4d","styles/katex.min.css.map":"styles/katex.min.css.map?6974c9","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?1e1216","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?4259e8","styles/sidebar.css.map":"styles/sidebar.css.map?53d628","styles/ui-playground.css":"styles/ui-playground.css?c16d69","styles/ui-playground.css.map":"styles/ui-playground.css.map?6c3cba","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?86a19a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?b3e705","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?b2b7bf"};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.1707.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/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?812361","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?876ce4","styles/annotator.css.map":"styles/annotator.css.map?78e935","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?7fbc4d","styles/katex.min.css.map":"styles/katex.min.css.map?6974c9","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?1e1216","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?4259e8","styles/sidebar.css.map":"styles/sidebar.css.map?53d628","styles/ui-playground.css":"styles/ui-playground.css?c16d69","styles/ui-playground.css.map":"styles/ui-playground.css.map?6c3cba","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?86a19a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?37780a","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?e936e4"};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.1708.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/.")}();
@@ -1,9 +1,9 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?ed3f68",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?812361",
3
3
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?a8ba5d",
4
4
  "styles/annotator.css": "styles/annotator.css?876ce4",
5
- "styles/highlights.css": "styles/highlights.css?ef86d1",
6
5
  "styles/annotator.css.map": "styles/annotator.css.map?78e935",
6
+ "styles/highlights.css": "styles/highlights.css?ef86d1",
7
7
  "styles/highlights.css.map": "styles/highlights.css.map?6ce8dd",
8
8
  "styles/katex.min.css": "styles/katex.min.css?7fbc4d",
9
9
  "styles/katex.min.css.map": "styles/katex.min.css.map?6974c9",
@@ -14,7 +14,7 @@
14
14
  "styles/ui-playground.css": "styles/ui-playground.css?c16d69",
15
15
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?6c3cba",
16
16
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?86a19a",
17
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?b3e705",
17
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?37780a",
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?b2b7bf"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?e936e4"
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._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)}_setOutsideAssignmentNoticeVisible(e){
152
- 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.1707.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((()=>{e?r.current?.close():r.current?.showModal()}),[e]),ne((()=>{const e=r.current
152
+ 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.1708.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((()=>{e?r.current?.close():r.current?.showModal()}),[e]),ne((()=>{const e=r.current
153
153
  ;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);ne((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ne((()=>{
154
154
  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((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{o(!1)})),i.current=t,()=>{t.destroy()}
155
155
  }),[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",children:[s&&Se("li",{className:"absolute right-0 pointer-events-auto mt-[-11px]",style:{top:e.position},children:Se(vt,{
@@ -569,53 +569,53 @@ const a=ji(),s=Kr(e),l=Yr(e),c=a.getDraft(e),u=a.profile().userid,d=a.isAnnotati
569
569
  threadIsCollapsed:o})]}),h&&Ve(Tm,{}),f&&Ve(at,{classes:"grow",children:Ve(Ep,{annotation:e,onReply:()=>{Rr(e)&&u&&i.reply(e,u)}})})]})]})}),["annotationsService"]);function Cm({isReply:e,replyCount:t,threadIsCollapsed:n,onToggleReplies:r}){return Ve("article",{className:"space-y-4","aria-label":(e?"Reply":"Annotation")+" with unavailable content",children:[Ve("div",{children:Ve("em",{children:"Message not available."})}),r&&Ve("footer",{className:"flex items-center",children:Ve(Sm,{onToggleReplies:r,replyCount:t,threadIsCollapsed:n})})]})}function Mm({annotation:e}){const t=Wr(e);return!!t?Ve("div",{className:Je("flex gap-x-3 bg-grey-1 text-color-text font-semibold","rounded-t-lg overflow-hidden","mb-2 ",{"-mt-3 -ml-3 -mr-3":!Pr(e),"-mr-3":Pr(e)}),children:[Ve("div",{className:Je("p-3 text-white",{"bg-red-error":!e.hidden,"bg-grey-6":e.hidden}),children:e.hidden?Ve(Dt,{className:"w-em h-em"}):Ve(It,{className:"w-em h-em"})}),Ve("div",{className:"self-center grow",children:[!e.hidden&&Ve("span",{
570
570
  children:["Flagged for review by ",t," ",1===t?"user":"users"]}),e.hidden&&Ve("span",{children:"Hidden from users"})]})]}):null}function Nm({threadIsCollapsed:e,onToggleReplies:t}){const n=e?ht:Yt,r=e?"Expand replies":"Collapse replies";return Ve("div",{className:Je("cursor-auto",{"bg-thread-line":!e}),"data-testid":"thread-collapse-channel",children:Ve("div",{className:Je("bg-white"),children:Ve(dn,{classes:Je("-mt-1 touch:min-w-[auto] touch:min-h-[auto] p-[6.5px]","text-grey-6 hover:text-grey-8"),"data-testid":"toggle-button",expanded:!e,title:r,onClick:t,size:"custom",variant:"custom",children:Ve(n,{className:"w-em h-em"})})})})}var Im=Jn((function e({thread:t,threadsService:n}){const r=!!t.parent,o=t.children.filter((e=>Ki(e)>0)),i=ji(),a=i.hasAppliedFilter(),s=t.annotation&&i.isSavingAnnotation(t.annotation),l=t.annotation&&!!i.getDraft(t.annotation)&&!s,c=de((()=>i.setExpanded(t.id,!!t.collapsed)),[i,t.id,t.collapsed]),u=!r&&!l&&!a&&t.replyCount>0,d=ue((()=>t.visible&&Ve(y,{children:t.annotation?Ve(y,{
571
571
  children:[Ve(Mm,{annotation:t.annotation}),Ve(Em,{annotation:t.annotation,isReply:r,onToggleReplies:u?c:void 0,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})]}):Ve(Cm,{isReply:r,onToggleReplies:u?c:void 0,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})})),[r,c,u,t.annotation,t.replyCount,t.collapsed,t.visible]);return Ve("section",{className:"flex","data-testid":"thread-container",children:[r&&Ve(Nm,{threadIsCollapsed:t.collapsed,onToggleReplies:c}),Ve("div",{className:Je("grow max-w-full min-w-0"),"data-testid":"thread-content",children:[d,Wi(t)>0&&Ve("div",{className:"space-y-2",children:[!t.parent&&t.annotation&&Ve(wm,{annotation:t.annotation,isEditing:l,replyCount:t.replyCount,threadIsCollapsed:t.collapsed}),Ve("div",{children:Ve(dn,{"data-testid":"show-hidden-button",onClick:()=>n.forceVisible(t),children:["Show ",Wi(t)," more in conversation"]})})]}),!t.collapsed&&Ve("ul",{className:Je("-ml-3"),"data-testid":"thread-children",children:o.map((t=>Ve("li",{
572
- className:Je("mt-2","[text-align:start]"),children:Ve(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var Om=Jn((function({frameSync:e,thread:t}){const n=ji(),r=t.annotation?.$tag??null,o=!(!r||!n.isAnnotationHovered(r)),i=ue((()=>qi((t=>e.hoverAnnotation(t)),10)),[e]),a=n.isAnnotationHighlighted(t.annotation),s=de((t=>{e.scrollToAnnotation(t)}),[e]),l=n.profile().userid,c="DENIED"===t.annotation?.moderation_status&&t.annotation.user===l,u=ue((()=>Ve(Im,{thread:t})),[t]),d=n.annotationFocusRequest(),h=ce(null);return se((()=>{d===t.id&&h.current&&(h.current.focus(),n.clearAnnotationFocusRequest())}),[d,n,t.id]),Ve(it,{active:o,classes:Je("cursor-pointer focus-visible-ring theme-clean:border-none",{"border-brand":a,"border-red":!a&&c}),"data-testid":"thread-card",elementRef:h,tabIndex:-1,onClick:e=>{var n;(n=e.target).closest("button")||n.closest("a")||!t.annotation||s(t.annotation)},onMouseEnter:()=>i(t.annotation??null),onMouseLeave:()=>i(null),children:Ve(st,{children:u})},t.id)
573
- }),["frameSync"]);const zm=50;function Lm(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function Pm(e){return Math.max(e-e%zm,0)}function Rm(e){const t=e.target[0];if(t)return t.selector?.find((e=>"EPUBContentSelector"===e.type))}function Dm(e){if(!e.annotation)return null;const t=Rm(e.annotation);return t?.cfi??null}function jm({threads:e}){const[t,n]=ie(0),[r,o]=ie(0);le((()=>{const e=new xe,t=Lm();n(t.clientHeight),o(Pm(t.scrollTop));const r=qi((()=>{n(t.clientHeight),o(Pm(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}}),[]);const[i,a]=ie((()=>new Map)),[s,l]=ie(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:d,visibleThreads:h,offscreenThreadsAbove:p}=ue((()=>function(e,t,n,r,o=Ui){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,d=0,h=0;return e.forEach((e=>{const o=t.get(e.id)||i;c+o<n-a?(u+=o,h+=1):c<n+r+s?l.push(e):d+=o,c+=o
574
- })),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:d,offscreenThreadsAbove:h}}(c,i,r,t)),[c,i,r,t]),m=ue((()=>{let t=null,n=null;const r=function(e){const t=new Map;for(const n of e){if(!n.annotation)continue;const e=Rm(n.annotation);e?.title&&t.set(e.cfi,e.title)}return t}(e),o=new Map;for(const i of e){const e=Dm(i);if(!e||t===e)continue;t=e;const a=r.get(e)??"Untitled chapter";n!==a&&(n=a,o.set(i,a))}return o}),[e]),f=ji(),g=f.profile().userid,v=f.countDrafts()>0,b=f.highlightedAnnotations(),y=f.allAnnotations(),_=(()=>{const e=f.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();se((()=>{_&&(f.setForcedVisible(_,!0),l(_))}),[f,_]);const w=ue((()=>function(e,{highlightedAnnotations:t,currentUserId:n}){if(0===t.length)return null;const r=e.filter((e=>e.id&&t.includes(e.id))).sort(((e,t)=>t.updated===e.updated?0:t.updated>e.updated?1:-1));return(n?r.find((e=>e.mentions&&e.mentions.some((({userid:e})=>e===n)))):null)??r[0]??null}(y,{highlightedAnnotations:b,currentUserId:g
575
- })?.id),[y,g,b]);return se((()=>{!v&&w&&l(w)}),[v,w]),se((()=>{if(!s)return;const e=c.findIndex((e=>e.id===s));if(-1===e)return;l(null);const t=c.slice(0,e).reduce(((e,t)=>e+(e=>i.get(e.id)||Ui.defaultHeight)(t)),0);Lm().scrollTop=t}),[s,c,i]),se((()=>{a((e=>{const t=new Map;for(const{id:n}of h){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=Gi(r);o!==e.get(n)&&t.set(n,o)}return 0===t.size?e:new Map([...e,...t])}))}),[h]),Ve("div",{role:"list",children:[Ve("div",{style:{height:d}}),h.map(((t,n)=>Ve("div",{role:"listitem","aria-setsize":e.length,"aria-posinset":p+n+1,className:Je("mb-3"),"data-testid":"thread-card-container",id:t.id,children:[m.get(t)&&Ve("h3",{className:"text-md text-grey-7 font-bold pt-3 pb-2",children:m.get(t)}),Ve(Om,{thread:t})]},t.id))),Ve("div",{style:{height:u}})]})}const Hm={collapsed:!1,depth:0,visible:!0,replyCount:0};function Fm(e){return e.id||e.$tag}function $m(e,t,n){const r=e[n]
576
- ;return!(!r||r.parent===t)&&(!r.parent||$m(e,t,r.parent))}function Bm(e,t,n){if(e[t].parent||!n.length)return;const r=n[n.length-1];e[r]||(e[r]={...Hm,children:[],id:r},Bm(e,r,n.slice(0,-1))),$m(e,t,r)&&(e[t].parent=r,e[r].children.push(e[t]))}function qm(e,t){return Object.assign({},t(e),{children:e.children.map((e=>qm(e,t)))})}function Um(e,t,n){const r=e.children.map((e=>Um(e,n,n))).slice().sort(t);return{...e,children:r}}function Gm(e,t){const n=e.children.map((e=>Gm(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);return{...e,children:n,depth:t,replyCount:r}}function Vm(e){return e.children.some((e=>e.visible||Vm(e)))}const Wm=(e,t)=>e.annotation&&t.annotation?e.annotation.created<t.annotation.created?-1:e.annotation.created>t.annotation.created?1:0:0;function Km(e,t){const n=t.selected.length>0,r=t.forcedVisible.length>0;let o=function(e){const t={};e.forEach((e=>{const n=Fm(e);t[n]={...Hm,children:[],annotation:e,id:n}})),e.forEach((e=>{const n=(e.references||[]).filter((t=>t!==e.id))
577
- ;return Bm(t,Fm(e),n)}));const n=[];for(const e in t)t[e].parent||(t[e].collapsed=!0,n.push(t[e]));return{...Hm,id:"root",children:n}}(e);if(n)o.children=o.children.filter((e=>{const n=t.selected.includes(e.id),o=r&&t.forcedVisible.includes(e.id);return n||o}));else if(t.threadFilterFn){const e=t.threadFilterFn;o.children=o.children.filter((n=>!(!r||!t.forcedVisible.includes(n.id))||e(n)))}return o.visible=!1,o=qm(o,(e=>{if(n)return{...e,visible:!0};let o=e.visible;return t.filterFn&&(o=!(!r||!t.forcedVisible.includes(e.id))||!!e.annotation&&!!t.filterFn(e.annotation)),{...e,visible:o}})),o.children=o.children.filter((e=>e.visible||Vm(e))),o=qm(o,(e=>{const n={collapsed:e.collapsed};if(Ir(t.expanded,e.id))n.collapsed=!t.expanded[e.id];else{const r=t.filterFn&&Vm(e);n.collapsed=e.collapsed&&!r}return{...e,...n}})),o=Um(o,t.sortCompareFn,Wm),o=Gm(o,-1),o}function Ym(e){const t=Xm(e),[n,r]=t.split("-",2);return[n,r??n]}function Xm(e){if(!e.includes("["))return e;let t="",n=!1,r=!1
578
- ;for(const o of e)n||"^"!==o?(n||"["!==o?!n&&r&&"]"===o?r=!1:r||(t+=o):r=!0,n=!1):n=!0;return t}function Zm(e,t){const n=e=>function(e){const t=Xm(e),n=t.indexOf("!");return-1===n?t:t.slice(0,n)}(e).split("/").map((e=>{const t=parseInt(e,10);return Number.isNaN(t)?e:t}));return function(e,t){for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n]){if(typeof e[n]!=typeof t[n])return"number"==typeof e[n]?-1:1;if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length}(n(e),n(t))}function Qm(e,t,n){return Zm(e,t)>=0&&Zm(e,n)<0}function Jm(e){if(!e)return null;const[t,n]=e.includes("-")?e.split("-"):[e,e];let r=null;if(t&&(r=parseInt(t),!Number.isInteger(r)))return null;let o=null;return n&&(o=parseInt(n),!Number.isInteger(o))?null:null===r||null===o?[r,o]:[Math.min(r,o),Math.max(r,o)]}let ef=function(e){return e[e.Overlap=0]="Overlap",e[e.NoOverlap=1]="NoOverlap",e[e.Unknown=2]="Unknown",e}({});function tf(e,t,n){return[e[0]??t,e[1]??n]}function nf(e,t){const n=Jm(e),r=Jm(t)
579
- ;if(!n||!r)return e&&t&&e===t?ef.Overlap:ef.Unknown;const o=2**31,[i,a]=tf(n,1,o),[s,l]=tf(r,1,o);return i<=s?s<=a?ef.Overlap:ef.NoOverlap:i<=l?ef.Overlap:ef.NoOverlap}function rf(e){return function(e){return e.replace(/\p{M}/gu,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class of{constructor(e,t){this.term=t.normalize(e),this.matcher=t}matches(e){const t=this.matcher;return t.fieldValues(e).some((e=>t.matches(t.normalize(e),this.term)))}}class af{constructor(e,t){this.operator=e,this.filters=t}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}function sf(e){return{fieldValues:e,matches:(e,t)=>e.includes(t),normalize:rf}}const lf={quote:sf((e=>[Kr(e)??Yr(e)??""])),cfi:{fieldValues:e=>[Zr(e)?.trim()??""],matches:(e,t)=>{const[n,r]=Ym(t);return Qm(e,n,r)},normalize:e=>Xm(e.trim())},page:{fieldValues:e=>[Qr(e)?.trim()??""],matches:(e,t)=>nf(e,t)===ef.Overlap,normalize:e=>e.trim()},since:{fieldValues:e=>[new Date(e.updated).valueOf()],
580
- matches:(e,t)=>(Date.now()-e)/1e3<=t,normalize:e=>e},tag:sf((e=>e.tags)),text:sf((e=>[e.text])),uri:sf((e=>[e.uri])),user:sf((e=>[e.user,e.user_info?.display_name??""]))};function cf(e,t){const n=(e,t)=>new of(t,lf[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new af("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new af(t.operator,r)})),o=new af("and",r);return e.filter((e=>o.matches(e)))}const uf=["cfi","quote","page","since","tag","text","uri","user"],df=["group","quote","tag","text","uri","user"];function hf(e,t){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 pf(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 mf(e,t){const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(pf).filter((e=>e.length>0)).map((e=>{const[n,r]=hf(e,t)
581
- ;return n?n+":"+pf(r):e})):[]}function ff(e){const t={},n=e=>"tag"===e?"tags":e,r=mf(e,df);for(const e of r){let[r,o]=hf(e,df);r||(r="any",o=e);const i=n(r);t[i]?t[i].push(o):t[i]=[o]}return t}function gf(e){return $r(e)?"orphan":Br(e)?"note":"annotation"}function vf(e){return Yi([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function bf(e){return Yi([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}function yf(e,t){const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function _f(e,t){return e===t?0:e<t?-1:1}function wf(e,t,n){switch(n.sortBy){case"newest":{const n=vf(e);return _f(vf(t),n)}case"oldest":return _f(bf(e),bf(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=Zm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=yf(n.pageIndex,r.pageIndex);if(0!==o)return o
582
- ;const i=yf(n.top,r.top);if(0!==i)return i;const a=yf(n.charOffset,r.charOffset);if(0!==a)return a;return _f(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const xf=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)=>wf(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]:[]},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=mf(e,uf);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
583
- },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,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=>cf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&cf([e.annotation],o).length>0)}const r=Km(e.annotations,n),o={annotation:0,note:0,orphan:0}
584
- ;return e.showTabs&&(r.children=r.children.filter((e=>{if(!e.annotation)return!1;if(Hr(e.annotation))return!1;const n=gf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function kf(){const e=ji(),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}}),[t,n,o,i,a]);return xf(s)}var Sf,Af,Tf=Jn((function({loadAnnotationsService:e,onLogin:t}){const n=ji(),r=n.routeParams().id??"",{rootThread:o}=kf(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),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(Hi,{errorType:"annotation",onLoginRequest:t}),Ve(jm,{threads:o.children})]})}),["loadAnnotationsService"]);class Ef{
585
- 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.1707.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(){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 Cf=function(){if(Af)return Sf;Af=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){
586
- 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();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)
587
- ;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){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 Sf=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)},
588
- 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,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),
589
- 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)}},Sf}(),Mf=Ke(Cf);function Nf({children:e,panelName:t,label:n,onActiveChanged:r,initialFocus:o}){const i=ji(),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&&Mf(u.current),r?.(a))}),[a,r]);const m=de((e=>{if(l("in"===e),"out"===e)return void p.current?.focus();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 If({commandName:e,icon:t}){return Ve("span",{className:"whitespace-nowrap","data-testid":"instruction",children:[Ve(t,{
590
- 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 Of=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(If,{icon:lt,commandName:"Annotate"})," button."]}),Ve("li",{children:["To create a highlight (",Ve($n,{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(If,{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",{
591
- children:["To reply to an annotation, select the"," ",Ve(If,{icon:rn,commandName:"Reply"})," button."]})]})}),["settings"]);async function zf(e,t=navigator){await t.clipboard.writeText(e)}function Lf({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 Pf=Jn((function({toastMessenger:e,versionData:t}){return Ve("div",{className:"space-y-4",children:[Ve("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Ve(Lf,{label:"Version",children:t.version}),Ve(Lf,{label:"User Agent",children:t.userAgent}),Ve(Lf,{classes:Je("break-all"),label:"URL",children:t.urls}),Ve(Lf,{label:"Fingerprint",children:t.fingerprint}),t.segment&&Ve(Lf,{label:"Segment",children:t.segment}),Ve(Lf,{label:"Account",children:t.account}),Ve(Lf,{label:"Date",children:t.timestamp})]}),Ve("div",{className:"flex items-center justify-center",
592
- children:Ve(dn,{onClick:async()=>{try{await zf(t.asFormattedString()),e.success("Copied version info to clipboard")}catch{e.error("Unable to copy version info")}},icon:_t,children:"Copy version details"})})]})}),["toastMessenger"]);function Rf({children:e,closeTitle:t}){return Ve("div",{"data-testid":"tab-header",className:"flex items-center",children:[Ve(fn,{classes:Je("order-last","text-[16px]","text-grey-6 hover:text-grey-7 hover:bg-grey-3/50","touch:!min-h-0"),title:t,variant:"custom",size:"sm"}),Ve(Vn,{classes:"grow gap-x-1 -mb-[1px] z-2",children:e})]})}function Df({children:e,active:t,title:n,...r}){return Ve("div",{role:"tabpanel",...r,className:Je("p-3 focus-visible-ring ring-inset",{hidden:!t}),hidden:!t,children:[n&&Ve(gn,{children:n}),Ve("div",{className:"space-y-3 pt-2",children:e})]})}function jf({linkText:e,url:t}){return Ve("div",{className:"flex-1 flex items-center justify-center border-r last-of-type:border-r-0 text-md font-medium",children:Ve($n,{variant:"text-light",href:t,target:"_blank",
593
- underline:"none",children:Ve("div",{className:"flex items-center gap-x-2",children:[Ve("span",{children:e})," ",Ve(Ct,{className:"w-3 h-3"})]})})})}var Hf=Jn((function({session:e}){const t=ji(),n=t.frames(),r=t.mainFrame(),o=t.profile(),i=o.user_info?.display_name??zr(o.userid),a=pe(),s=pe(),l=pe(),c=pe(),u=!!t.profile().preferences.show_sidebar_tutorial,[d,h]=ie("tutorial"),p=ue((()=>{const e=[...n].sort(((e,t)=>e===r?-1:t===r?1:0));return new Ef({userid:o.userid,displayName:i},e)}),[o,i,n,r]),m=`https://web.hypothes.is/get-help/?sys_info=${p.asEncodedURLString()}`;return Ve(Nf,{label:"Help panel",panelName:"help",onActiveChanged:de((t=>{!t&&u&&e.dismissSidebarTutorial()}),[e,u]),children:[Ve(Rf,{closeTitle:"Close help panel",children:[Ve(Gn,{id:a,"aria-controls":s,variant:"tab",textContent:"Help",selected:"tutorial"===d,onClick:()=>h("tutorial"),"data-testid":"tutorial-tab",children:"Help"}),Ve(Gn,{id:l,"aria-controls":c,variant:"tab",textContent:"Version",selected:"versionInfo"===d,
594
- onClick:()=>h("versionInfo"),"data-testid":"version-info-tab",children:"Version"})]}),Ve(it,{classes:Je({"rounded-tl-none":"tutorial"===d}),children:[Ve("div",{className:"border-b",children:[Ve(Df,{id:s,"aria-labelledby":a,active:"tutorial"===d,title:"Getting started",children:Ve(Of,{})}),Ve(Df,{id:c,"aria-labelledby":l,active:"versionInfo"===d,title:"Version details",children:Ve(Pf,{versionData:p})})]}),Ve("div",{className:"flex items-center p-3",children:[Ve(jf,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),Ve(jf,{linkText:"New support ticket",url:m})]})]})]})}),["session"]);class Ff{#e=[];destroy(){this.#e=[]}on(e,t){this.#e.push({name:e,callback:t})}off(e,t){this.#e=this.#e.filter((n=>!(n.name===e&&n.callback===t)))}emit(e,...t){for(const n of this.#e){if(n.name!==e)continue;(0,n.callback)(...t)}}}class $f extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function Bf(e){return 0===e?50:200}class qf extends Ff{
595
- constructor(e,{getPageSize:t=Bf,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._expectedCount=null,this._fetchedCount=0,this._results=[]}async _getPage(e,t,n=0){const r={limit:this._getPageSize(n),sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(r.search_after=t);try{const t=await this._searchFn(r);if(this._canceled)return;if(null===this._expectedCount&&(this._expectedCount=t.total,this.emit("resultCount",this._expectedCount)),this._maxResults&&t.total>this._maxResults)return this.emit("error",new $f(this._maxResults)),void this.emit("end");const o=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",o):this._results=this._results.concat(o),this._fetchedCount+=o.length;const i=this._fetchedCount<this._expectedCount||this._expectedCount>1e3
596
- ;let a=null;o.length>0&&i&&(a=o[o.length-1][this._sortBy]),a?this._getPage(e,a,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._expectedCount=null,this._fetchedCount=0,this._results=[],this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function Uf({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=o??e,l=Ve("span",{className:Je("shrink-0 flex items-center gap-x-2","text-color-text font-bold text-md"),children:[t&&Ve(t,{className:"w-4 h-4"}),s.display]});return Ve(fm,{label:l,title:i,contentClass:Je("max-h-[min(60vh,504px)] overflow-y-auto"),children:a.map((e=>Ve(vm,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function Gf(){const e=ji(),t=e.getFilter("user"),n=function(){
597
- const e=ji(),t=e.allAnnotations(),n=e.getFocusFilters(),r=zr(e.profile().userid),o=e.defaultAuthority(),i=e.isFeatureEnabled("client_display_names");return ue((()=>{const e={};if(t.forEach((t=>{const n=zr(t.user);e[n]=Xi(t,o,i)})),n.user){const t=zr(n.user.value)||n.user.value;e[t]=n.user.display}const a=Object.keys(e).map((t=>({display:t===r?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>r===e.value?-1:r===t.value?1:e.display.localeCompare(t.display))),a}),[t,r,o,i,n.user])}();return Ve(Uf,{defaultOption:{value:"",display:"Everybody"},icon:en,onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function Vf({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const{rootThread:o}=kf(),i=n?r:Ki(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return Ve("div",{className:"flex gap-x-1 leading-none",children:[n&&Ve(Rn,{size:"sm"}),!n&&Ve("h2",{className:"font-bold",children:[!a&&Ve("span",{children:"No results"}),a&&t&&Ve("span",{
598
- children:[l," ",1===l?"result":"results"]}),a&&!t&&Ve("span",{children:[c," ",1===c?"thread":"threads"]})]}),s&&Ve("h3",{className:"italic font-normal",children:["(and ",e," more)"]}),!t&&a&&Ve("h3",{className:"italic font-normal",children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function Wf({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=ue((()=>{const t=r.filter((e=>Ki(e)>0)),n=(e-1)*o,i=n+o,a=Math.ceil(t.length/o);return{paginatedThreads:t.slice(n,i),totalPages:a}}),[r,e,o]);return Ve(y,{children:[Ve(jm,{threads:i}),!t&&Ve(Un,{currentPage:e,onChangePage:n,totalPages:a})]})}function Kf(e,t,n){return 1===e?t:n}const Yf={alt:1,ctrl:2,meta:4,shift:8};function Xf(e,t,{rootElement:n=document.documentElement??void 0}={}){const r=n=>{(function(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let r=0,o=null;for(const e of n){const t=Yf[e];if(t)r|=t;else{
599
- if(null!==o)throw new Error("Multiple non-modifier keys specified");o=e}}if(!o)throw new Error(`Invalid shortcut: ${t}`);return((e.ctrlKey?Yf.ctrl:0)|(e.metaKey?Yf.meta:0)|(e.altKey?Yf.alt:0)|(e.shiftKey?Yf.shift:0))===r&&e.key.toLowerCase()===o})(n,e)&&t(n)};return n?(n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r)):()=>{}}function Zf(e,t,{rootElement:n}={}){se((()=>{if(e)return Xf(e,t,{rootElement:n})}),[e,t,n])}function Qf({hidden:e,children:t}){return Ve("span",{className:Je("group-hover:inline group-focus:inline",{hidden:e}),children:t})}function Jf({type:e,collapsed:t,count:n}){const r="updates"===e?"update":"mention",o="updates"===e?"updates":"mentions",i="updates"===e?wt:Wt;return Ve("div",{className:Je("flex gap-1.5 items-center px-2 py-1","border-l first:border-l-0 border-white/60"),children:[Ve(i,{className:"w-em h-em"}),Ve("div",{className:"flex gap-1",children:[Ve("span",{className:"font-bold",children:n}),Ve(Qf,{hidden:t,children:Kf(n,r,o)})]})]})}
600
- var eg=Jn((function({streamer:e,analytics:t,setTimeout_:n=setTimeout,clearTimeout_:r=clearTimeout}){const o=ji(),i=o.pendingUpdateCount(),a=o.pendingMentionCount(),s=o.isFeatureEnabled("at_mentions"),l=o.hasPendingUpdatesOrDeletions(),c=de((()=>{e.applyPendingUpdates(),t.trackEvent("client.realtime.apply_updates")}),[t,e]),[u,d]=ie(!1),h=ce(null);return Zf("l",(()=>l&&c())),se((()=>(l?h.current=n((()=>{d(!0),h.current=null}),5e3):d(!1),()=>h.current&&r(h.current))),[r,l,n]),l?Ve("div",{role:"status",className:"absolute right-0 animate-updates-notification-slide-in",children:Ve(dn,{onClick:c,unstyled:!0,classes:Je("flex items-center","rounded shadow-lg bg-gray-900 text-white","group focus-visible-ring"),"data-testid":"notification","data-collapsed":u,children:[Ve(Jf,{type:"updates",collapsed:u,count:i}),s&&a>0&&Ve(Jf,{type:"mentions",collapsed:u,count:a}),Ve("span",{className:"sr-only",children:"load them by pressing l"})]})}):null}),["streamer","analytics"])
601
- ;var tg=Jn((function({loadAnnotationsService:e,streamer:t}){const n=ji(),r=n.getFilterValues(),o=n.focusedGroup(),i=n.forcedVisibleThreads().length,a=n.hasAppliedFilter(),s=n.isLoading(),l=n.annotationResultCount(),{rootThread:c}=kf(),u=o?.name??"…",d=o?.id||n.directLinkedGroupId(),h=ce(1),[p,m]=ie(1),[f,g]=ie(!1),v=e=>{e instanceof $f&&g(!0)},b=n.hasFetchedProfile();se((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),se((()=>{n.setSortKey("newest"),d&&e.load({groupId:d,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:v,streamFilterBy:"group"})}),[e,d,n]);const y=e=>{m(e)};se((()=>{y(1)}),[r,o]);const _=ce(null);return le((()=>{p!==h.current&&(_.current&&Mf(_.current),h.current=p)}),[p]),Ve("div",{className:"grid gap-2 lg:grid-cols-2","data-testid":"notebook-container",children:[Ve("header",{className:"leading-none lg:col-span-2",ref:_,children:Ve("h1",{className:"text-xl font-bold","data-testid":"notebook-group-name",children:u})}),Ve("div",{
602
- className:"absolute w-full z-5 left-0 lg:top-8 top-5",children:Ve("div",{className:Je("container flex flex-row-reverse relative","right-[4rem]"),children:Ve(eg,{})})}),Ve("div",{className:"justify-self-start",children:Ve(Gf,{})}),Ve("div",{className:"flex items-center lg:justify-self-end text-md font-medium",children:Ve(Vf,{forcedVisibleCount:i,isFiltered:a,isLoading:s,resultCount:l??0})}),Ve("div",{className:"lg:col-span-2",children:[f&&Ve("div",{className:"py-4","data-testid":"notebook-messages",children:Ve(bn,{title:"Too many results to show",children:[Ve("p",{children:["This preview of the Notebook can show"," ",Ve("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",l," to show here)."]}),Ve("p",{children:[Ve($n,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"
603
- })," ","if you would like to be notified when support for more annotations is available."]})]})}),Ve(Wf,{currentPage:p,isLoading:s,onChangePage:y,threads:c.children})]})]})}),["loadAnnotationsService","streamer"]);function ng({classes:e,children:t,onClose:n=(()=>{}),...r}){return Ve("div",{className:Je("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[Ve(gt,{className:"text-green-success w-em h-em p-[0.125em]"}),Ve("div",{className:"text-sm",children:t})]})}function rg(){const e=ji(),[t,n]=ie(!1),[r,o]=ie(0);if(se((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),!e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return Ve(it,{"data-testid":"profile-container",classes:"overflow-hidden",children:[Ve("div",{className:Je("h-12","px-3 border-b flex items-center"),children:[Ve("div",{className:"grow",children:Ve("h1",{className:"text-xl text-slate-7 font-normal",
604
- children:"Notifications"})}),Ve("ul",{className:"sr-only","aria-live":"polite",children:i&&Ve("li",{children:"Notification preferences saved"},r)}),r>0&&Ve(ng,{onClose:()=>o(0),children:"Saved"},r)]}),Ve(ot,{children:Ve(st,{size:"lg",children:Ve(kn,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?cn:void 0,icon:t?cn:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function og({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&Pr(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()];return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function ig(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function ag({documentMetadata:e,groupName:t,date:n=new Date}){const r=[ig(n)];return e?.title?r.push(function(e,t){const n=Array.from(e)
605
- ;return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}function sg(){return Ve("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",children:Ve(Rn,{size:"md"})})}function lg({userAnnotations:e}){return Ve("div",{className:"flex gap-x-2",children:[e.displayName,Ve("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const cg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"html",title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"}];var ug=Jn((function({annotationsExporter:e,toastMessenger:t}){
606
- const n=ji(),r=n.focusedGroup(),o=r&&!n.isLoading(),i=n.defaultContentFrame(),a=n.savedAnnotations(),s=n.defaultAuthority(),l=n.isFeatureEnabled("client_display_names"),c=de((e=>Xi(e,s,l)),[s,l]),u=ue((()=>og({annotations:a,getDisplayName:c})),[a,c]),d=n.profile(),h=d.userid,p=ue((()=>({annotations:a,displayName:"All annotations"})),[a]),[m,f]=ie(h),g=ue((()=>u.find((e=>e.userid===m))??p),[p,m,u]),[v,b]=ie(cg[0]),_=pe(),w=pe(),x=n.countDrafts(),k=ue((()=>ag({documentMetadata:i?.metadata,groupName:r?.name})),[i,r]),[S,A]=ie(),T=de(((t,n)=>{const o=g?.annotations??a;switch(t){case"json":{const t=e.buildJSONExportContent(o,{profile:d});return JSON.stringify(t,null,2)}case"txt":return e.buildTextExportContent(o,{groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});case"csv":return e.buildCSVExportContent(o,{separator:"file"===n?",":"\t",groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});case"html":return e.buildHTMLExportContent(o,{groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l})
607
- ;default:throw new Error(`Invalid format: ${t}`)}}),[e,s,l,a,r?.name,d,g?.annotations]),E=de((e=>{e.preventDefault();try{const e=v.value,t=`${S??k}.${e}`,n=T(e,"file"),r=function(e){return{json:"application/json",txt:"text/plain",csv:"text/csv",html:"text/html"}[e]}(e);!function(e,t,n,r=document){const o=new Blob([e],{type:t}),i=URL.createObjectURL(o),a=r.createElement("a");a.setAttribute("href",i),a.setAttribute("download",n),a.style.visibility="hidden",r.body.appendChild(a),a.click(),r.body.removeChild(a),URL.revokeObjectURL(i)}(n,r,t)}catch(e){t.error(`Exporting annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,S,k,v.value,t]),C=de((async()=>{const e=v.value,n=T(e,"clipboard");try{"html"===e?await async function(e,t=navigator,n=document){const r=["text/html","text/plain"];if(t.clipboard.write){const n=r.reduce(((t,n)=>(t[n]=new Blob([e],{type:n}),t)),{});await t.clipboard.write([new ClipboardItem(n)])}else{const t=t=>{r.forEach((n=>t.clipboardData?.setData(n,e))),t.preventDefault()}
608
- ;n.addEventListener("copy",t);try{n.execCommand("copy")}finally{n.removeEventListener("copy",t)}}}(n):await zf(n),t.success("Annotations copied")}catch(e){t.error(`Copying annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,v.value,t]);return o?Ve("form",{className:"space-y-3",onSubmit:E,"data-testid":"export-form",children:[a.length>0?Ve(y,{children:[Ve("p",{className:"text-color-text-light",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Ve("div",{className:"flex flex-col gap-y-3",children:[Ve("label",{htmlFor:w,className:"font-medium",children:["Select which user","'","s annotations to export:"]}),Ve(Pn,{value:m,onChange:f,buttonId:w,buttonContent:Ve(lg,{userAnnotations:g}),"data-testid":"user-select",children:[Ve(Pn.Option,{value:void 0,children:Ve(lg,{userAnnotations:p})}),u.map((e=>Ve(Pn.Option,{
609
- value:e.userid,children:Ve(lg,{userAnnotations:e})},e.userid)))]}),Ve("label",{"data-testid":"export-count",htmlFor:_,className:"font-medium",children:"Name of export file:"}),Ve("div",{className:"flex",children:[Ve(An,{classes:"grow","data-testid":"export-filename",id:_,defaultValue:k,value:S,onChange:e=>A(e.target.value),required:!0,maxLength:250}),Ve("div",{className:"grow-0 ml-2 min-w-[5rem]",children:Ve(Pn,{"aria-label":"Export format",value:v,onChange:b,buttonContent:v.shortTitle??v.title,"data-testid":"export-format-select",alignListbox:"right",listboxOverflow:"wrap",children:cg.map((e=>Ve(Pn.Option,{value:e,children:Ve("div",{className:"flex-col gap-y-2",children:[Ve("div",{className:"font-bold","data-testid":"format-name",children:e.title}),Ve("div",{"data-testid":"format-description",children:e.description})]})},e.value)))})})]})]})]}):Ve("p",{"data-testid":"no-annotations-message",children:"There are no annotations available for export."}),x>0&&Ve("p",{"data-testid":"drafts-message",
610
- children:["You have ",x," unsaved"," ",Kf(x,"draft","drafts"),a.length>0&&Ve(y,{children:" that will not be included"}),"."]}),Ve(at,{children:[Ve(dn,{"data-testid":"copy-button",icon:_t,onClick:C,disabled:0===a.length,children:"Copy to clipboard"}),Ve(dn,{"data-testid":"export-button",variant:"primary",disabled:0===a.length,type:"submit",children:"Export"})]})]}):Ve(sg,{})}),["annotationsExporter","toastMessenger"]);function dg(e,t=new FileReader){const{promise:n,resolve:r,reject:o}=function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}();return t.addEventListener("loadend",(e=>{try{const t=e.target?.result?.toString()??"",n=JSON.parse(t);r(n)}catch(e){o(e)}})),t.readAsText(e),n}function hg({size:e,value:t}){const n=e-4,r=Math.PI*n;return Ve("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Ve("svg",{viewBox:`0 0 ${e} ${e}`,children:Ve("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",
611
- stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",transitionProperty:"stroke-dashoffset"}})})})}function pg({onFileSelected:e,disabled:t,id:n}){const r=ce(null),[o,i]=ie(null);return Ve(dn,{variant:"custom",classes:Je("w-full relative overflow-hidden border rounded","bg-grey-0 hover:bg-grey-0"),title:o?`${o}, Select a file`:"Select a file",onClick:()=>r.current?.click(),disabled:t,"data-testid":"file-input-proxy-button",children:[Ve("input",{ref:r,accept:".json",id:n,type:"file",disabled:t,className:"invisible absolute w-0 h-0","aria-hidden":!0,"data-testid":"file-input",onChange:t=>{const n=t.target.files;i(n?.[0]?.name??null),null!==n&&n.length>0&&e(n[0])}}),Ve("div",{className:"max-w-full pr-10 truncate","data-testid":"filename-container",children:o??"Select a file"}),Ve("div",{className:"absolute right-0 h-full p-2 border-l bg-grey-2",children:Ve(Mt,{})})]})}var mg=Jn((function({importAnnotationsService:e}){
612
- const[t,n]=ie(null),[r,o]=ie(null),[i,a]=ie(null),s=ji(),l=s.profile().userid,c=s.defaultAuthority(),u=s.isFeatureEnabled("client_display_names"),d=de((e=>Xi(e,c,u)),[c,u]),h=ue((()=>r?og({annotations:r,getDisplayName:d,excludeReplies:!0}):null),[r,d]),[p,m]=ie(null),f=ue((()=>h?.find((e=>e.userid===p))??null),[p,h]);let g;se((()=>{l&&t&&(o(null),a(null),m(null),async function(e){let t;try{t=await dg(e)}catch{throw new Error("Not a valid JSON file")}if(null===(n=t)||"object"!=typeof n||!Array.isArray(t.annotations))throw new Error("Not a valid Hypothesis JSON file");var n;return t.annotations}(t).then((e=>{o(e);const t=e.some((e=>e.user===l));m(t?l:null)})).catch((e=>{a(e.message)})))}),[l,t]),f&&(g=async()=>{e.import(f.annotations)});const v=pe(),b=pe();if(!l)return Ve("p",{"data-testid":"log-in-message",children:"You must log in to import annotations."})
613
- ;const _=Boolean(s.focusedGroup()&&s.defaultContentFrame()&&s.hasFetchedAnnotations()&&!s.isFetchingAnnotations()&&g),w=t&&!r&&!i,x=s.importsPending(),k=s.importsTotal(),S=k-x,A=w||x>0,T=x>0?Math.round(S/k*100):null;return Ve(y,{children:[Ve("p",{className:"text-color-text-light mb-3",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations/",target:"_blank",children:"Learn more"})," ","about importing annotations."]}),Ve("label",{htmlFor:v,className:"font-medium",children:"Select Hypothesis export file:"}),Ve(pg,{onFileSelected:n,disabled:A,id:v}),h&&Ve(y,{children:[Ve("label",{htmlFor:b,className:"block font-medium",children:"Select which user's annotations to import:"}),Ve(Pn,{value:f,onChange:e=>m(e?.userid??null),buttonId:b,buttonContent:f?Ve(lg,{userAnnotations:f}):Ve("span",{className:"text-grey-6",children:"Select a user..."}),children:h.map((e=>Ve(Pn.Option,{value:e,children:Ve(lg,{userAnnotations:e})},e.userid)))})]}),i&&Ve("p",{
614
- "data-testid":"error-info",children:[Ve("b",{children:"Unable to find annotations to import:"})," ",i]}),Ve(at,{children:[null!==T&&Ve("span",{"data-testid":"progress-text",className:"text-grey-6",children:[T,"% complete"]}),Ve(dn,{"data-testid":"import-button",disabled:!_||A,onClick:g,variant:"primary",children:[null!==T&&Ve(hg,{size:22,value:T}),"Import"]})]})]})}),["importAnnotationsService"]);var fg=Jn((function({toastMessenger:e}){const t=ji(),n=t.mainFrame(),r=t.focusedGroup(),o=r&&n,i=o&&(a=n.uri,s=r.id,/^http(s?):/i.test(a)?`https://hyp.is/go?url=${encodeURIComponent(a)}&group=${s}`:null);var a,s;const l=de((async()=>{try{i&&(await zf(i),e.success("Copied share link to clipboard"))}catch{e.error("Unable to copy link")}}),[i,e]);return o?Ve("div",{className:"text-color-text-light space-y-3",children:i?Ve(y,{children:[Ve("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?Ve("p",{
615
- children:"Use this link to share these annotations with other group members:"}):Ve("p",{children:"Use this link to share these annotations with anyone:"})}),Ve("div",{children:Ve(pn,{children:[Ve(An,{"aria-label":"Use this URL to share these annotations",type:"text",value:i,readOnly:!0}),Ve(mn,{icon:_t,onClick:l,title:"Copy share link",variant:"dark"})]})}),Ve("p",{"data-testid":"sharing-details",children:["private"===r.type?Ve("span",{children:["Annotations in the private group ",Ve("em",{children:r.name})," ","are only visible to group members."]}):Ve("span",{children:["Anyone using this link may view the annotations in the group"," ",Ve("em",{children:r.name}),"."]})," ",Ve("span",{children:["Private (",Ve(Gt,{className:"inline w-[14px] h-[14px] -mt-0.5"})," ",Ve("em",{children:"Only Me"}),") annotations are only visible to you."]})]})]}):Ve("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})}):Ve(sg,{})}),["toastMessenger"])
616
- ;function gg({shareTab:e}){const t=ji().focusedGroup(),n=t&&t.name||"...",r=`Share Annotations in ${n}`,o=e?"share":"export",[i,a]=ie(o),s=i===o;return Ve(Nf,{label:"Share panel",panelName:"shareGroupAnnotations",children:[Ve(Rf,{closeTitle:"Close share panel",children:[e&&Ve(Gn,{id:"share-panel-tab","aria-controls":"share-panel",variant:"tab",selected:"share"===i,onClick:()=>a("share"),textContent:"Share",children:"Share"}),Ve(Gn,{id:"export-panel-tab","aria-controls":"export-panel",variant:"tab",selected:"export"===i,onClick:()=>a("export"),textContent:"Export",children:"Export"}),Ve(Gn,{id:"import-panel-tab","aria-controls":"import-panel",variant:"tab",selected:"import"===i,onClick:()=>a("import"),textContent:"Import",children:"Import"})]}),Ve(it,{classes:Je({"rounded-tl-none":s}),children:[Ve(Df,{id:"share-panel","data-testid":"share-panel",active:"share"===i,"aria-labelledby":"share-panel-tab",title:r,children:Ve(fg,{})}),Ve(Df,{id:"export-panel",active:"export"===i,"aria-labelledby":"export-panel-tab",
617
- title:`Export from ${n}`,children:Ve(ug,{})}),Ve(Df,{id:"import-panel",active:"import"===i,"aria-labelledby":"import-panel-tab",title:`Import into ${n}`,children:Ve(mg,{})})]})]})}function vg({onLogin:e}){const t=ji();return Ve("div",{className:"flex flex-col items-center m-6 space-y-6",children:[Ve("span",{className:"text-center",children:["This is a public annotation created with Hypothesis. ",Ve("br",{}),"To reply or make your own annotations on this document,"," ",Ve($n,{variant:"text",href:t.getLink("signup"),target:"_blank",underline:"always",children:"create a free account"})," ","or"," ",Ve(Bn,{inline:!0,variant:"text",onClick:e,underline:"always",children:"log in"}),"."]}),Ve("div",{children:Ve($n,{href:"https://hypothes.is","aria-label":"Hypothesis homepage",target:"_blank",title:"Hypothesis homepage",underline:"none",variant:"custom",children:Ve(Vt,{className:"w-16 h-16 text-grey-7"})})})]})}function bg({onLogin:e,onSignUp:t}){return ji().isLoggedIn()?null:Ve(Nf,{label:"Login panel",
618
- panelName:"loginPrompt",children:Ve(it,{children:[Ve(vn,{children:[Ve(on,{className:"w-em h-em"}),Ve(gn,{children:"Login needed"})]}),Ve(st,{children:[Ve("p",{children:"Please log in to create annotations or highlights."}),Ve(at,{children:[Ve(dn,{title:"Sign up",onClick:t,children:"Sign up"}),Ve(dn,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})]})})}const yg=e=>`${e}-tab`,_g=e=>`${e}-panel`;function wg({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i,name:a}){const s=()=>{r||i()},l=t>0?`${o} (${t} available)`:o;return Ve(Bn,{classes:Je("bg-transparent min-w-[5.25rem]",{"font-bold":r}),variant:"text",onClick:s,onMouseDown:s,pressed:!!r,role:"tab",id:yg(a),"aria-controls":_g(a),tabIndex:0,title:l,underline:"none",children:Ve(y,{children:[e,t>0&&!n&&Ve("span",{className:"relative bottom-[3px] left-[2px] text-[10px]",children:t})]})})}var xg=Jn((function({annotationsService:e,isLoading:t,settings:n}){
572
+ className:Je("mt-2","[text-align:start]"),children:Ve(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var Om=Jn((function({frameSync:e,thread:t}){const n=ji(),r=t.annotation?.$tag??null,o=!(!r||!n.isAnnotationHovered(r)),i=ue((()=>qi((t=>e.hoverAnnotation(t)),10)),[e]),a=n.isAnnotationHighlighted(t.annotation),s=de((t=>{e.scrollToAnnotation(t)}),[e]),l=n.profile().userid,c="DENIED"===t.annotation?.moderation_status&&t.annotation.user===l,u=ue((()=>Ve(Im,{thread:t})),[t]),d=n.annotationFocusRequest(),h=ce(null);return se((()=>{d===t.id&&h.current&&(h.current.focus(),n.clearAnnotationFocusRequest())}),[d,n,t.id]),Ve(it,{active:o,classes:Je("cursor-pointer focus-visible-ring theme-clean:border-none",{"border-brand":a,"border-red":!a&&c}),"data-testid":"thread-card",elementRef:h,tabIndex:0,role:"article","aria-label":"Press Enter to scroll annotation into view",onClick:e=>{var n;(n=e.target).closest("button")||n.closest("a")||!t.annotation||s(t.annotation)},
573
+ onMouseEnter:()=>i(t.annotation??null),onMouseLeave:()=>i(null),onKeyDown:e=>{e.target===h.current&&["Enter"," "].includes(e.key)&&t.annotation&&s(t.annotation)},children:Ve(st,{children:u})},t.id)}),["frameSync"]);const zm=50;function Lm(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function Pm(e){return Math.max(e-e%zm,0)}function Rm(e){const t=e.target[0];if(t)return t.selector?.find((e=>"EPUBContentSelector"===e.type))}function Dm(e){if(!e.annotation)return null;const t=Rm(e.annotation);return t?.cfi??null}function jm({threads:e}){const[t,n]=ie(0),[r,o]=ie(0);le((()=>{const e=new xe,t=Lm();n(t.clientHeight),o(Pm(t.scrollTop));const r=qi((()=>{n(t.clientHeight),o(Pm(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}}),[])
574
+ ;const[i,a]=ie((()=>new Map)),[s,l]=ie(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:d,visibleThreads:h,offscreenThreadsAbove:p}=ue((()=>function(e,t,n,r,o=Ui){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,d=0,h=0;return e.forEach((e=>{const o=t.get(e.id)||i;c+o<n-a?(u+=o,h+=1):c<n+r+s?l.push(e):d+=o,c+=o})),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:d,offscreenThreadsAbove:h}}(c,i,r,t)),[c,i,r,t]),m=ue((()=>{let t=null,n=null;const r=function(e){const t=new Map;for(const n of e){if(!n.annotation)continue;const e=Rm(n.annotation);e?.title&&t.set(e.cfi,e.title)}return t}(e),o=new Map;for(const i of e){const e=Dm(i);if(!e||t===e)continue;t=e;const a=r.get(e)??"Untitled chapter";n!==a&&(n=a,o.set(i,a))}return o}),[e]),f=ji(),g=f.profile().userid,v=f.countDrafts()>0,b=f.highlightedAnnotations(),y=f.allAnnotations(),_=(()=>{const e=f.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();se((()=>{_&&(f.setForcedVisible(_,!0),l(_))}),[f,_])
575
+ ;const w=ue((()=>function(e,{highlightedAnnotations:t,currentUserId:n}){if(0===t.length)return null;const r=e.filter((e=>e.id&&t.includes(e.id))).sort(((e,t)=>t.updated===e.updated?0:t.updated>e.updated?1:-1));return(n?r.find((e=>e.mentions&&e.mentions.some((({userid:e})=>e===n)))):null)??r[0]??null}(y,{highlightedAnnotations:b,currentUserId:g})?.id),[y,g,b]);return se((()=>{!v&&w&&l(w)}),[v,w]),se((()=>{if(!s)return;const e=c.findIndex((e=>e.id===s));if(-1===e)return;l(null);const t=c.slice(0,e).reduce(((e,t)=>e+(e=>i.get(e.id)||Ui.defaultHeight)(t)),0);Lm().scrollTop=t}),[s,c,i]),se((()=>{a((e=>{const t=new Map;for(const{id:n}of h){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=Gi(r);o!==e.get(n)&&t.set(n,o)}return 0===t.size?e:new Map([...e,...t])}))}),[h]),Ve("div",{role:"list",children:[Ve("div",{style:{height:d}}),h.map(((t,n)=>Ve("div",{role:"listitem","aria-setsize":e.length,"aria-posinset":p+n+1,className:Je("mb-3"),
576
+ "data-testid":"thread-card-container",id:t.id,children:[m.get(t)&&Ve("h3",{className:"text-md text-grey-7 font-bold pt-3 pb-2",children:m.get(t)}),Ve(Om,{thread:t})]},t.id))),Ve("div",{style:{height:u}})]})}const Hm={collapsed:!1,depth:0,visible:!0,replyCount:0};function Fm(e){return e.id||e.$tag}function $m(e,t,n){const r=e[n];return!(!r||r.parent===t)&&(!r.parent||$m(e,t,r.parent))}function Bm(e,t,n){if(e[t].parent||!n.length)return;const r=n[n.length-1];e[r]||(e[r]={...Hm,children:[],id:r},Bm(e,r,n.slice(0,-1))),$m(e,t,r)&&(e[t].parent=r,e[r].children.push(e[t]))}function qm(e,t){return Object.assign({},t(e),{children:e.children.map((e=>qm(e,t)))})}function Um(e,t,n){const r=e.children.map((e=>Um(e,n,n))).slice().sort(t);return{...e,children:r}}function Gm(e,t){const n=e.children.map((e=>Gm(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);return{...e,children:n,depth:t,replyCount:r}}function Vm(e){return e.children.some((e=>e.visible||Vm(e)))}
577
+ const Wm=(e,t)=>e.annotation&&t.annotation?e.annotation.created<t.annotation.created?-1:e.annotation.created>t.annotation.created?1:0:0;function Km(e,t){const n=t.selected.length>0,r=t.forcedVisible.length>0;let o=function(e){const t={};e.forEach((e=>{const n=Fm(e);t[n]={...Hm,children:[],annotation:e,id:n}})),e.forEach((e=>{const n=(e.references||[]).filter((t=>t!==e.id));return Bm(t,Fm(e),n)}));const n=[];for(const e in t)t[e].parent||(t[e].collapsed=!0,n.push(t[e]));return{...Hm,id:"root",children:n}}(e);if(n)o.children=o.children.filter((e=>{const n=t.selected.includes(e.id),o=r&&t.forcedVisible.includes(e.id);return n||o}));else if(t.threadFilterFn){const e=t.threadFilterFn;o.children=o.children.filter((n=>!(!r||!t.forcedVisible.includes(n.id))||e(n)))}return o.visible=!1,o=qm(o,(e=>{if(n)return{...e,visible:!0};let o=e.visible;return t.filterFn&&(o=!(!r||!t.forcedVisible.includes(e.id))||!!e.annotation&&!!t.filterFn(e.annotation)),{...e,visible:o}})),o.children=o.children.filter((e=>e.visible||Vm(e))),
578
+ o=qm(o,(e=>{const n={collapsed:e.collapsed};if(Ir(t.expanded,e.id))n.collapsed=!t.expanded[e.id];else{const r=t.filterFn&&Vm(e);n.collapsed=e.collapsed&&!r}return{...e,...n}})),o=Um(o,t.sortCompareFn,Wm),o=Gm(o,-1),o}function Ym(e){const t=Xm(e),[n,r]=t.split("-",2);return[n,r??n]}function Xm(e){if(!e.includes("["))return e;let t="",n=!1,r=!1;for(const o of e)n||"^"!==o?(n||"["!==o?!n&&r&&"]"===o?r=!1:r||(t+=o):r=!0,n=!1):n=!0;return t}function Zm(e,t){const n=e=>function(e){const t=Xm(e),n=t.indexOf("!");return-1===n?t:t.slice(0,n)}(e).split("/").map((e=>{const t=parseInt(e,10);return Number.isNaN(t)?e:t}));return function(e,t){for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n]){if(typeof e[n]!=typeof t[n])return"number"==typeof e[n]?-1:1;if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length}(n(e),n(t))}function Qm(e,t,n){return Zm(e,t)>=0&&Zm(e,n)<0}function Jm(e){if(!e)return null;const[t,n]=e.includes("-")?e.split("-"):[e,e];let r=null;if(t&&(r=parseInt(t),
579
+ !Number.isInteger(r)))return null;let o=null;return n&&(o=parseInt(n),!Number.isInteger(o))?null:null===r||null===o?[r,o]:[Math.min(r,o),Math.max(r,o)]}let ef=function(e){return e[e.Overlap=0]="Overlap",e[e.NoOverlap=1]="NoOverlap",e[e.Unknown=2]="Unknown",e}({});function tf(e,t,n){return[e[0]??t,e[1]??n]}function nf(e,t){const n=Jm(e),r=Jm(t);if(!n||!r)return e&&t&&e===t?ef.Overlap:ef.Unknown;const o=2**31,[i,a]=tf(n,1,o),[s,l]=tf(r,1,o);return i<=s?s<=a?ef.Overlap:ef.NoOverlap:i<=l?ef.Overlap:ef.NoOverlap}function rf(e){return function(e){return e.replace(/\p{M}/gu,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class of{constructor(e,t){this.term=t.normalize(e),this.matcher=t}matches(e){const t=this.matcher;return t.fieldValues(e).some((e=>t.matches(t.normalize(e),this.term)))}}class af{constructor(e,t){this.operator=e,this.filters=t}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}function sf(e){return{fieldValues:e,
580
+ matches:(e,t)=>e.includes(t),normalize:rf}}const lf={quote:sf((e=>[Kr(e)??Yr(e)??""])),cfi:{fieldValues:e=>[Zr(e)?.trim()??""],matches:(e,t)=>{const[n,r]=Ym(t);return Qm(e,n,r)},normalize:e=>Xm(e.trim())},page:{fieldValues:e=>[Qr(e)?.trim()??""],matches:(e,t)=>nf(e,t)===ef.Overlap,normalize:e=>e.trim()},since:{fieldValues:e=>[new Date(e.updated).valueOf()],matches:(e,t)=>(Date.now()-e)/1e3<=t,normalize:e=>e},tag:sf((e=>e.tags)),text:sf((e=>[e.text])),uri:sf((e=>[e.uri])),user:sf((e=>[e.user,e.user_info?.display_name??""]))};function cf(e,t){const n=(e,t)=>new of(t,lf[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new af("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new af(t.operator,r)})),o=new af("and",r);return e.filter((e=>o.matches(e)))}const uf=["cfi","quote","page","since","tag","text","uri","user"],df=["group","quote","tag","text","uri","user"];function hf(e,t){
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 pf(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 mf(e,t){const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(pf).filter((e=>e.length>0)).map((e=>{const[n,r]=hf(e,t);return n?n+":"+pf(r):e})):[]}function ff(e){const t={},n=e=>"tag"===e?"tags":e,r=mf(e,df);for(const e of r){let[r,o]=hf(e,df);r||(r="any",o=e);const i=n(r);t[i]?t[i].push(o):t[i]=[o]}return t}function gf(e){return $r(e)?"orphan":Br(e)?"note":"annotation"}function vf(e){return Yi([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function bf(e){return Yi([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}function yf(e,t){const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function _f(e,t){return e===t?0:e<t?-1:1}function wf(e,t,n){switch(n.sortBy){case"newest":{const n=vf(e);return _f(vf(t),n)}
582
+ case"oldest":return _f(bf(e),bf(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=Zm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=yf(n.pageIndex,r.pageIndex);if(0!==o)return o;const i=yf(n.top,r.top);if(0!==i)return i;const a=yf(n.charOffset,r.charOffset);if(0!==a)return a;return _f(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const xf=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)=>wf(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
+ },r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=mf(e,uf);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=>cf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&cf([e.annotation],o).length>0)}const r=Km(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(!e.annotation)return!1;if(Hr(e.annotation))return!1;const n=gf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function kf(){const e=ji(),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}}),[t,n,o,i,a]);return xf(s)}var Sf,Af,Tf=Jn((function({loadAnnotationsService:e,onLogin:t}){const n=ji(),r=n.routeParams().id??"",{rootThread:o}=kf(),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(Hi,{errorType:"annotation",onLoginRequest:t}),Ve(jm,{threads:o.children})]})}),["loadAnnotationsService"]);class Ef{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.1708.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 Cf=function(){if(Af)return Sf;Af=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 Sf=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
+ 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)}},Sf}(),Mf=Ke(Cf);function Nf({children:e,panelName:t,label:n,onActiveChanged:r,initialFocus:o}){const i=ji(),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&&Mf(u.current),r?.(a))}),[a,r]);const m=de((e=>{if(l("in"===e),"out"===e)return void p.current?.focus()
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 If({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 Of=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(If,{icon:lt,commandName:"Annotate"})," button."]}),Ve("li",{children:["To create a highlight (",Ve($n,{
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(If,{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(If,{icon:rn,commandName:"Reply"})," button."]})]})}),["settings"]);async function zf(e,t=navigator){await t.clipboard.writeText(e)}function Lf({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 Pf=Jn((function({toastMessenger:e,versionData:t}){
592
+ return Ve("div",{className:"space-y-4",children:[Ve("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Ve(Lf,{label:"Version",children:t.version}),Ve(Lf,{label:"User Agent",children:t.userAgent}),Ve(Lf,{classes:Je("break-all"),label:"URL",children:t.urls}),Ve(Lf,{label:"Fingerprint",children:t.fingerprint}),t.segment&&Ve(Lf,{label:"Segment",children:t.segment}),Ve(Lf,{label:"Account",children:t.account}),Ve(Lf,{label:"Date",children:t.timestamp})]}),Ve("div",{className:"flex items-center justify-center",children:Ve(dn,{onClick:async()=>{try{await zf(t.asFormattedString()),e.success("Copied version info to clipboard")}catch{e.error("Unable to copy version info")}},icon:_t,children:"Copy version details"})})]})}),["toastMessenger"]);function Rf({children:e,closeTitle:t}){return Ve("div",{"data-testid":"tab-header",className:"flex items-center",children:[Ve(fn,{classes:Je("order-last","text-[16px]","text-grey-6 hover:text-grey-7 hover:bg-grey-3/50","touch:!min-h-0"),title:t,variant:"custom",
593
+ size:"sm"}),Ve(Vn,{classes:"grow gap-x-1 -mb-[1px] z-2",children:e})]})}function Df({children:e,active:t,title:n,...r}){return Ve("div",{role:"tabpanel",...r,className:Je("p-3 focus-visible-ring ring-inset",{hidden:!t}),hidden:!t,children:[n&&Ve(gn,{children:n}),Ve("div",{className:"space-y-3 pt-2",children:e})]})}function jf({linkText:e,url:t}){return Ve("div",{className:"flex-1 flex items-center justify-center border-r last-of-type:border-r-0 text-md font-medium",children:Ve($n,{variant:"text-light",href:t,target:"_blank",underline:"none",children:Ve("div",{className:"flex items-center gap-x-2",children:[Ve("span",{children:e})," ",Ve(Ct,{className:"w-3 h-3"})]})})})}var Hf=Jn((function({session:e}){const t=ji(),n=t.frames(),r=t.mainFrame(),o=t.profile(),i=o.user_info?.display_name??zr(o.userid),a=pe(),s=pe(),l=pe(),c=pe(),u=!!t.profile().preferences.show_sidebar_tutorial,[d,h]=ie("tutorial"),p=ue((()=>{const e=[...n].sort(((e,t)=>e===r?-1:t===r?1:0));return new Ef({userid:o.userid,displayName:i},e)
594
+ }),[o,i,n,r]),m=`https://web.hypothes.is/get-help/?sys_info=${p.asEncodedURLString()}`;return Ve(Nf,{label:"Help panel",panelName:"help",onActiveChanged:de((t=>{!t&&u&&e.dismissSidebarTutorial()}),[e,u]),children:[Ve(Rf,{closeTitle:"Close help panel",children:[Ve(Gn,{id:a,"aria-controls":s,variant:"tab",textContent:"Help",selected:"tutorial"===d,onClick:()=>h("tutorial"),"data-testid":"tutorial-tab",children:"Help"}),Ve(Gn,{id:l,"aria-controls":c,variant:"tab",textContent:"Version",selected:"versionInfo"===d,onClick:()=>h("versionInfo"),"data-testid":"version-info-tab",children:"Version"})]}),Ve(it,{classes:Je({"rounded-tl-none":"tutorial"===d}),children:[Ve("div",{className:"border-b",children:[Ve(Df,{id:s,"aria-labelledby":a,active:"tutorial"===d,title:"Getting started",children:Ve(Of,{})}),Ve(Df,{id:c,"aria-labelledby":l,active:"versionInfo"===d,title:"Version details",children:Ve(Pf,{versionData:p})})]}),Ve("div",{className:"flex items-center p-3",children:[Ve(jf,{linkText:"Help topics",
595
+ url:"https://web.hypothes.is/help/"}),Ve(jf,{linkText:"New support ticket",url:m})]})]})]})}),["session"]);class Ff{#e=[];destroy(){this.#e=[]}on(e,t){this.#e.push({name:e,callback:t})}off(e,t){this.#e=this.#e.filter((n=>!(n.name===e&&n.callback===t)))}emit(e,...t){for(const n of this.#e){if(n.name!==e)continue;(0,n.callback)(...t)}}}class $f extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function Bf(e){return 0===e?50:200}class qf extends Ff{constructor(e,{getPageSize:t=Bf,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._expectedCount=null,this._fetchedCount=0,this._results=[]}async _getPage(e,t,n=0){const r={limit:this._getPageSize(n),sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(r.search_after=t);try{const t=await this._searchFn(r)
596
+ ;if(this._canceled)return;if(null===this._expectedCount&&(this._expectedCount=t.total,this.emit("resultCount",this._expectedCount)),this._maxResults&&t.total>this._maxResults)return this.emit("error",new $f(this._maxResults)),void this.emit("end");const o=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",o):this._results=this._results.concat(o),this._fetchedCount+=o.length;const i=this._fetchedCount<this._expectedCount||this._expectedCount>1e3;let a=null;o.length>0&&i&&(a=o[o.length-1][this._sortBy]),a?this._getPage(e,a,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._expectedCount=null,this._fetchedCount=0,this._results=[],this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function Uf({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=o??e,l=Ve("span",{
597
+ className:Je("shrink-0 flex items-center gap-x-2","text-color-text font-bold text-md"),children:[t&&Ve(t,{className:"w-4 h-4"}),s.display]});return Ve(fm,{label:l,title:i,contentClass:Je("max-h-[min(60vh,504px)] overflow-y-auto"),children:a.map((e=>Ve(vm,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function Gf(){const e=ji(),t=e.getFilter("user"),n=function(){const e=ji(),t=e.allAnnotations(),n=e.getFocusFilters(),r=zr(e.profile().userid),o=e.defaultAuthority(),i=e.isFeatureEnabled("client_display_names");return ue((()=>{const e={};if(t.forEach((t=>{const n=zr(t.user);e[n]=Xi(t,o,i)})),n.user){const t=zr(n.user.value)||n.user.value;e[t]=n.user.display}const a=Object.keys(e).map((t=>({display:t===r?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>r===e.value?-1:r===t.value?1:e.display.localeCompare(t.display))),a}),[t,r,o,i,n.user])}();return Ve(Uf,{defaultOption:{value:"",display:"Everybody"},icon:en,onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,
598
+ title:"Filter by user"})}function Vf({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const{rootThread:o}=kf(),i=n?r:Ki(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return Ve("div",{className:"flex gap-x-1 leading-none",children:[n&&Ve(Rn,{size:"sm"}),!n&&Ve("h2",{className:"font-bold",children:[!a&&Ve("span",{children:"No results"}),a&&t&&Ve("span",{children:[l," ",1===l?"result":"results"]}),a&&!t&&Ve("span",{children:[c," ",1===c?"thread":"threads"]})]}),s&&Ve("h3",{className:"italic font-normal",children:["(and ",e," more)"]}),!t&&a&&Ve("h3",{className:"italic font-normal",children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function Wf({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=ue((()=>{const t=r.filter((e=>Ki(e)>0)),n=(e-1)*o,i=n+o,a=Math.ceil(t.length/o);return{paginatedThreads:t.slice(n,i),totalPages:a}}),[r,e,o]);return Ve(y,{children:[Ve(jm,{threads:i}),!t&&Ve(Un,{currentPage:e,onChangePage:n,
599
+ totalPages:a})]})}function Kf(e,t,n){return 1===e?t:n}const Yf={alt:1,ctrl:2,meta:4,shift:8};function Xf(e,t,{rootElement:n=document.documentElement??void 0}={}){const r=n=>{(function(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let r=0,o=null;for(const e of n){const t=Yf[e];if(t)r|=t;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=e}}if(!o)throw new Error(`Invalid shortcut: ${t}`);return((e.ctrlKey?Yf.ctrl:0)|(e.metaKey?Yf.meta:0)|(e.altKey?Yf.alt:0)|(e.shiftKey?Yf.shift:0))===r&&e.key.toLowerCase()===o})(n,e)&&t(n)};return n?(n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r)):()=>{}}function Zf(e,t,{rootElement:n}={}){se((()=>{if(e)return Xf(e,t,{rootElement:n})}),[e,t,n])}function Qf({hidden:e,children:t}){return Ve("span",{className:Je("group-hover:inline group-focus:inline",{hidden:e}),children:t})}function Jf({type:e,collapsed:t,count:n}){
600
+ const r="updates"===e?"update":"mention",o="updates"===e?"updates":"mentions",i="updates"===e?wt:Wt;return Ve("div",{className:Je("flex gap-1.5 items-center px-2 py-1","border-l first:border-l-0 border-white/60"),children:[Ve(i,{className:"w-em h-em"}),Ve("div",{className:"flex gap-1",children:[Ve("span",{className:"font-bold",children:n}),Ve(Qf,{hidden:t,children:Kf(n,r,o)})]})]})}var eg=Jn((function({streamer:e,analytics:t,setTimeout_:n=setTimeout,clearTimeout_:r=clearTimeout}){const o=ji(),i=o.pendingUpdateCount(),a=o.pendingMentionCount(),s=o.isFeatureEnabled("at_mentions"),l=o.hasPendingUpdatesOrDeletions(),c=de((()=>{e.applyPendingUpdates(),t.trackEvent("client.realtime.apply_updates")}),[t,e]),[u,d]=ie(!1),h=ce(null);return Zf("l",(()=>l&&c())),se((()=>(l?h.current=n((()=>{d(!0),h.current=null}),5e3):d(!1),()=>h.current&&r(h.current))),[r,l,n]),l?Ve("div",{role:"status",className:"absolute right-0 animate-updates-notification-slide-in",children:Ve(dn,{onClick:c,unstyled:!0,
601
+ classes:Je("flex items-center","rounded shadow-lg bg-gray-900 text-white","group focus-visible-ring"),"data-testid":"notification","data-collapsed":u,children:[Ve(Jf,{type:"updates",collapsed:u,count:i}),s&&a>0&&Ve(Jf,{type:"mentions",collapsed:u,count:a}),Ve("span",{className:"sr-only",children:"load them by pressing l"})]})}):null}),["streamer","analytics"]);var tg=Jn((function({loadAnnotationsService:e,streamer:t}){const n=ji(),r=n.getFilterValues(),o=n.focusedGroup(),i=n.forcedVisibleThreads().length,a=n.hasAppliedFilter(),s=n.isLoading(),l=n.annotationResultCount(),{rootThread:c}=kf(),u=o?.name??"…",d=o?.id||n.directLinkedGroupId(),h=ce(1),[p,m]=ie(1),[f,g]=ie(!1),v=e=>{e instanceof $f&&g(!0)},b=n.hasFetchedProfile();se((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),se((()=>{n.setSortKey("newest"),d&&e.load({groupId:d,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:v,streamFilterBy:"group"})}),[e,d,n]);const y=e=>{m(e)};se((()=>{y(1)}),[r,o]);const _=ce(null);return le((()=>{
602
+ p!==h.current&&(_.current&&Mf(_.current),h.current=p)}),[p]),Ve("div",{className:"grid gap-2 lg:grid-cols-2","data-testid":"notebook-container",children:[Ve("header",{className:"leading-none lg:col-span-2",ref:_,children:Ve("h1",{className:"text-xl font-bold","data-testid":"notebook-group-name",children:u})}),Ve("div",{className:"absolute w-full z-5 left-0 lg:top-8 top-5",children:Ve("div",{className:Je("container flex flex-row-reverse relative","right-[4rem]"),children:Ve(eg,{})})}),Ve("div",{className:"justify-self-start",children:Ve(Gf,{})}),Ve("div",{className:"flex items-center lg:justify-self-end text-md font-medium",children:Ve(Vf,{forcedVisibleCount:i,isFiltered:a,isLoading:s,resultCount:l??0})}),Ve("div",{className:"lg:col-span-2",children:[f&&Ve("div",{className:"py-4","data-testid":"notebook-messages",children:Ve(bn,{title:"Too many results to show",children:[Ve("p",{children:["This preview of the Notebook can show"," ",Ve("strong",{children:["up to ",5e3," results"]
603
+ })," at a time (there are"," ",l," to show here)."]}),Ve("p",{children:[Ve($n,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})]})}),Ve(Wf,{currentPage:p,isLoading:s,onChangePage:y,threads:c.children})]})]})}),["loadAnnotationsService","streamer"]);function ng({classes:e,children:t,onClose:n=(()=>{}),...r}){return Ve("div",{className:Je("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[Ve(gt,{className:"text-green-success w-em h-em p-[0.125em]"}),Ve("div",{className:"text-sm",children:t})]})}function rg(){const e=ji(),[t,n]=ie(!1),[r,o]=ie(0);if(se((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),
604
+ !e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return Ve(it,{"data-testid":"profile-container",classes:"overflow-hidden",children:[Ve("div",{className:Je("h-12","px-3 border-b flex items-center"),children:[Ve("div",{className:"grow",children:Ve("h1",{className:"text-xl text-slate-7 font-normal",children:"Notifications"})}),Ve("ul",{className:"sr-only","aria-live":"polite",children:i&&Ve("li",{children:"Notification preferences saved"},r)}),r>0&&Ve(ng,{onClose:()=>o(0),children:"Saved"},r)]}),Ve(ot,{children:Ve(st,{size:"lg",children:Ve(kn,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?cn:void 0,icon:t?cn:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function og({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&Pr(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()]
605
+ ;return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function ig(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function ag({documentMetadata:e,groupName:t,date:n=new Date}){const r=[ig(n)];return e?.title?r.push(function(e,t){const n=Array.from(e);return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}function sg(){return Ve("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",children:Ve(Rn,{size:"md"})})}function lg({userAnnotations:e}){return Ve("div",{className:"flex gap-x-2",children:[e.displayName,Ve("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const cg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"html",
606
+ title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"}];var ug=Jn((function({annotationsExporter:e,toastMessenger:t}){const n=ji(),r=n.focusedGroup(),o=r&&!n.isLoading(),i=n.defaultContentFrame(),a=n.savedAnnotations(),s=n.defaultAuthority(),l=n.isFeatureEnabled("client_display_names"),c=de((e=>Xi(e,s,l)),[s,l]),u=ue((()=>og({annotations:a,getDisplayName:c})),[a,c]),d=n.profile(),h=d.userid,p=ue((()=>({annotations:a,displayName:"All annotations"})),[a]),[m,f]=ie(h),g=ue((()=>u.find((e=>e.userid===m))??p),[p,m,u]),[v,b]=ie(cg[0]),_=pe(),w=pe(),x=n.countDrafts(),k=ue((()=>ag({documentMetadata:i?.metadata,groupName:r?.name})),[i,r]),[S,A]=ie(),T=de(((t,n)=>{const o=g?.annotations??a;switch(t){case"json":{const t=e.buildJSONExportContent(o,{profile:d});return JSON.stringify(t,null,2)}case"txt":return e.buildTextExportContent(o,{groupName:r?.name,defaultAuthority:s,
607
+ displayNamesEnabled:l});case"csv":return e.buildCSVExportContent(o,{separator:"file"===n?",":"\t",groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});case"html":return e.buildHTMLExportContent(o,{groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});default:throw new Error(`Invalid format: ${t}`)}}),[e,s,l,a,r?.name,d,g?.annotations]),E=de((e=>{e.preventDefault();try{const e=v.value,t=`${S??k}.${e}`,n=T(e,"file"),r=function(e){return{json:"application/json",txt:"text/plain",csv:"text/csv",html:"text/html"}[e]}(e);!function(e,t,n,r=document){const o=new Blob([e],{type:t}),i=URL.createObjectURL(o),a=r.createElement("a");a.setAttribute("href",i),a.setAttribute("download",n),a.style.visibility="hidden",r.body.appendChild(a),a.click(),r.body.removeChild(a),URL.revokeObjectURL(i)}(n,r,t)}catch(e){t.error(`Exporting annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,S,k,v.value,t]),C=de((async()=>{const e=v.value,n=T(e,"clipboard");try{"html"===e?await async function(e,t=navigator,n=document){
608
+ const r=["text/html","text/plain"];if(t.clipboard.write){const n=r.reduce(((t,n)=>(t[n]=new Blob([e],{type:n}),t)),{});await t.clipboard.write([new ClipboardItem(n)])}else{const t=t=>{r.forEach((n=>t.clipboardData?.setData(n,e))),t.preventDefault()};n.addEventListener("copy",t);try{n.execCommand("copy")}finally{n.removeEventListener("copy",t)}}}(n):await zf(n),t.success("Annotations copied")}catch(e){t.error(`Copying annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,v.value,t]);return o?Ve("form",{className:"space-y-3",onSubmit:E,"data-testid":"export-form",children:[a.length>0?Ve(y,{children:[Ve("p",{className:"text-color-text-light",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Ve("div",{className:"flex flex-col gap-y-3",children:[Ve("label",{htmlFor:w,className:"font-medium",
609
+ children:["Select which user","'","s annotations to export:"]}),Ve(Pn,{value:m,onChange:f,buttonId:w,buttonContent:Ve(lg,{userAnnotations:g}),"data-testid":"user-select",children:[Ve(Pn.Option,{value:void 0,children:Ve(lg,{userAnnotations:p})}),u.map((e=>Ve(Pn.Option,{value:e.userid,children:Ve(lg,{userAnnotations:e})},e.userid)))]}),Ve("label",{"data-testid":"export-count",htmlFor:_,className:"font-medium",children:"Name of export file:"}),Ve("div",{className:"flex",children:[Ve(An,{classes:"grow","data-testid":"export-filename",id:_,defaultValue:k,value:S,onChange:e=>A(e.target.value),required:!0,maxLength:250}),Ve("div",{className:"grow-0 ml-2 min-w-[5rem]",children:Ve(Pn,{"aria-label":"Export format",value:v,onChange:b,buttonContent:v.shortTitle??v.title,"data-testid":"export-format-select",alignListbox:"right",listboxOverflow:"wrap",children:cg.map((e=>Ve(Pn.Option,{value:e,children:Ve("div",{className:"flex-col gap-y-2",children:[Ve("div",{className:"font-bold","data-testid":"format-name",
610
+ children:e.title}),Ve("div",{"data-testid":"format-description",children:e.description})]})},e.value)))})})]})]})]}):Ve("p",{"data-testid":"no-annotations-message",children:"There are no annotations available for export."}),x>0&&Ve("p",{"data-testid":"drafts-message",children:["You have ",x," unsaved"," ",Kf(x,"draft","drafts"),a.length>0&&Ve(y,{children:" that will not be included"}),"."]}),Ve(at,{children:[Ve(dn,{"data-testid":"copy-button",icon:_t,onClick:C,disabled:0===a.length,children:"Copy to clipboard"}),Ve(dn,{"data-testid":"export-button",variant:"primary",disabled:0===a.length,type:"submit",children:"Export"})]})]}):Ve(sg,{})}),["annotationsExporter","toastMessenger"]);function dg(e,t=new FileReader){const{promise:n,resolve:r,reject:o}=function(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}();return t.addEventListener("loadend",(e=>{try{const t=e.target?.result?.toString()??"",n=JSON.parse(t);r(n)}catch(e){o(e)}})),t.readAsText(e),n}function hg({size:e,value:t}){
611
+ const n=e-4,r=Math.PI*n;return Ve("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Ve("svg",{viewBox:`0 0 ${e} ${e}`,children:Ve("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",transitionProperty:"stroke-dashoffset"}})})})}function pg({onFileSelected:e,disabled:t,id:n}){const r=ce(null),[o,i]=ie(null);return Ve(dn,{variant:"custom",classes:Je("w-full relative overflow-hidden border rounded","bg-grey-0 hover:bg-grey-0"),title:o?`${o}, Select a file`:"Select a file",onClick:()=>r.current?.click(),disabled:t,"data-testid":"file-input-proxy-button",children:[Ve("input",{ref:r,accept:".json",id:n,type:"file",disabled:t,className:"invisible absolute w-0 h-0","aria-hidden":!0,"data-testid":"file-input",onChange:t=>{const n=t.target.files;i(n?.[0]?.name??null),null!==n&&n.length>0&&e(n[0])}}),Ve("div",{
612
+ className:"max-w-full pr-10 truncate","data-testid":"filename-container",children:o??"Select a file"}),Ve("div",{className:"absolute right-0 h-full p-2 border-l bg-grey-2",children:Ve(Mt,{})})]})}var mg=Jn((function({importAnnotationsService:e}){const[t,n]=ie(null),[r,o]=ie(null),[i,a]=ie(null),s=ji(),l=s.profile().userid,c=s.defaultAuthority(),u=s.isFeatureEnabled("client_display_names"),d=de((e=>Xi(e,c,u)),[c,u]),h=ue((()=>r?og({annotations:r,getDisplayName:d,excludeReplies:!0}):null),[r,d]),[p,m]=ie(null),f=ue((()=>h?.find((e=>e.userid===p))??null),[p,h]);let g;se((()=>{l&&t&&(o(null),a(null),m(null),async function(e){let t;try{t=await dg(e)}catch{throw new Error("Not a valid JSON file")}if(null===(n=t)||"object"!=typeof n||!Array.isArray(t.annotations))throw new Error("Not a valid Hypothesis JSON file");var n;return t.annotations}(t).then((e=>{o(e);const t=e.some((e=>e.user===l));m(t?l:null)})).catch((e=>{a(e.message)})))}),[l,t]),f&&(g=async()=>{e.import(f.annotations)});const v=pe(),b=pe()
613
+ ;if(!l)return Ve("p",{"data-testid":"log-in-message",children:"You must log in to import annotations."});const _=Boolean(s.focusedGroup()&&s.defaultContentFrame()&&s.hasFetchedAnnotations()&&!s.isFetchingAnnotations()&&g),w=t&&!r&&!i,x=s.importsPending(),k=s.importsTotal(),S=k-x,A=w||x>0,T=x>0?Math.round(S/k*100):null;return Ve(y,{children:[Ve("p",{className:"text-color-text-light mb-3",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations/",target:"_blank",children:"Learn more"})," ","about importing annotations."]}),Ve("label",{htmlFor:v,className:"font-medium",children:"Select Hypothesis export file:"}),Ve(pg,{onFileSelected:n,disabled:A,id:v}),h&&Ve(y,{children:[Ve("label",{htmlFor:b,className:"block font-medium",children:"Select which user's annotations to import:"}),Ve(Pn,{value:f,onChange:e=>m(e?.userid??null),buttonId:b,buttonContent:f?Ve(lg,{userAnnotations:f}):Ve("span",{className:"text-grey-6",children:"Select a user..."}),
614
+ children:h.map((e=>Ve(Pn.Option,{value:e,children:Ve(lg,{userAnnotations:e})},e.userid)))})]}),i&&Ve("p",{"data-testid":"error-info",children:[Ve("b",{children:"Unable to find annotations to import:"})," ",i]}),Ve(at,{children:[null!==T&&Ve("span",{"data-testid":"progress-text",className:"text-grey-6",children:[T,"% complete"]}),Ve(dn,{"data-testid":"import-button",disabled:!_||A,onClick:g,variant:"primary",children:[null!==T&&Ve(hg,{size:22,value:T}),"Import"]})]})]})}),["importAnnotationsService"]);var fg=Jn((function({toastMessenger:e}){const t=ji(),n=t.mainFrame(),r=t.focusedGroup(),o=r&&n,i=o&&(a=n.uri,s=r.id,/^http(s?):/i.test(a)?`https://hyp.is/go?url=${encodeURIComponent(a)}&group=${s}`:null);var a,s;const l=de((async()=>{try{i&&(await zf(i),e.success("Copied share link to clipboard"))}catch{e.error("Unable to copy link")}}),[i,e]);return o?Ve("div",{className:"text-color-text-light space-y-3",children:i?Ve(y,{children:[Ve("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",
615
+ children:"private"===r.type?Ve("p",{children:"Use this link to share these annotations with other group members:"}):Ve("p",{children:"Use this link to share these annotations with anyone:"})}),Ve("div",{children:Ve(pn,{children:[Ve(An,{"aria-label":"Use this URL to share these annotations",type:"text",value:i,readOnly:!0}),Ve(mn,{icon:_t,onClick:l,title:"Copy share link",variant:"dark"})]})}),Ve("p",{"data-testid":"sharing-details",children:["private"===r.type?Ve("span",{children:["Annotations in the private group ",Ve("em",{children:r.name})," ","are only visible to group members."]}):Ve("span",{children:["Anyone using this link may view the annotations in the group"," ",Ve("em",{children:r.name}),"."]})," ",Ve("span",{children:["Private (",Ve(Gt,{className:"inline w-[14px] h-[14px] -mt-0.5"})," ",Ve("em",{children:"Only Me"}),") annotations are only visible to you."]})]})]}):Ve("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})
616
+ }):Ve(sg,{})}),["toastMessenger"]);function gg({shareTab:e}){const t=ji().focusedGroup(),n=t&&t.name||"...",r=`Share Annotations in ${n}`,o=e?"share":"export",[i,a]=ie(o),s=i===o;return Ve(Nf,{label:"Share panel",panelName:"shareGroupAnnotations",children:[Ve(Rf,{closeTitle:"Close share panel",children:[e&&Ve(Gn,{id:"share-panel-tab","aria-controls":"share-panel",variant:"tab",selected:"share"===i,onClick:()=>a("share"),textContent:"Share",children:"Share"}),Ve(Gn,{id:"export-panel-tab","aria-controls":"export-panel",variant:"tab",selected:"export"===i,onClick:()=>a("export"),textContent:"Export",children:"Export"}),Ve(Gn,{id:"import-panel-tab","aria-controls":"import-panel",variant:"tab",selected:"import"===i,onClick:()=>a("import"),textContent:"Import",children:"Import"})]}),Ve(it,{classes:Je({"rounded-tl-none":s}),children:[Ve(Df,{id:"share-panel","data-testid":"share-panel",active:"share"===i,"aria-labelledby":"share-panel-tab",title:r,children:Ve(fg,{})}),Ve(Df,{id:"export-panel",active:"export"===i,
617
+ "aria-labelledby":"export-panel-tab",title:`Export from ${n}`,children:Ve(ug,{})}),Ve(Df,{id:"import-panel",active:"import"===i,"aria-labelledby":"import-panel-tab",title:`Import into ${n}`,children:Ve(mg,{})})]})]})}function vg({onLogin:e}){const t=ji();return Ve("div",{className:"flex flex-col items-center m-6 space-y-6",children:[Ve("span",{className:"text-center",children:["This is a public annotation created with Hypothesis. ",Ve("br",{}),"To reply or make your own annotations on this document,"," ",Ve($n,{variant:"text",href:t.getLink("signup"),target:"_blank",underline:"always",children:"create a free account"})," ","or"," ",Ve(Bn,{inline:!0,variant:"text",onClick:e,underline:"always",children:"log in"}),"."]}),Ve("div",{children:Ve($n,{href:"https://hypothes.is","aria-label":"Hypothesis homepage",target:"_blank",title:"Hypothesis homepage",underline:"none",variant:"custom",children:Ve(Vt,{className:"w-16 h-16 text-grey-7"})})})]})}function bg({onLogin:e,onSignUp:t}){
618
+ return ji().isLoggedIn()?null:Ve(Nf,{label:"Login panel",panelName:"loginPrompt",children:Ve(it,{children:[Ve(vn,{children:[Ve(on,{className:"w-em h-em"}),Ve(gn,{children:"Login needed"})]}),Ve(st,{children:[Ve("p",{children:"Please log in to create annotations or highlights."}),Ve(at,{children:[Ve(dn,{title:"Sign up",onClick:t,children:"Sign up"}),Ve(dn,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})]})})}const yg=e=>`${e}-tab`,_g=e=>`${e}-panel`;function wg({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i,name:a}){const s=()=>{r||i()},l=t>0?`${o} (${t} available)`:o;return Ve(Bn,{classes:Je("bg-transparent min-w-[5.25rem]",{"font-bold":r}),variant:"text",onClick:s,onMouseDown:s,pressed:!!r,role:"tab",id:yg(a),"aria-controls":_g(a),tabIndex:0,title:l,underline:"none",children:Ve(y,{children:[e,t>0&&!n&&Ve("span",{className:"relative bottom-[3px] left-[2px] text-[10px]",children:t})]})})}var xg=Jn((function({annotationsService:e,isLoading:t,settings:n}){
619
619
  const{rootThread:r,tabCounts:o}=kf(),i=ji(),a=i.selectedTab(),s=o.note,l=o.annotation,c=o.orphan,u=i.isWaitingToAnchorAnnotations(),d=e=>{i.selectTab(e)},h="annotation"===a&&0===l&&!u,p="note"===a&&0===s,m=[];if(l>0){const e=Kf(l,"annotation","annotations");m.push(`${l} ${e}`)}if(s>0){const e=Kf(s,"note","notes");m.push(`${s} ${e}`)}if(c>0){const e=Kf(s,"orphan","orphans");m.push(`${c} ${e}`)}return Ve(y,{children:[Ve("div",{"aria-live":"polite",role:"status",className:"sr-only",children:m.join(", ")}),Ve("div",{className:Je("space-y-3 pb-[9px]"),children:[Ve("div",{className:"flex gap-x-6 theme-clean:ml-[15px] mt-1",role:"tablist",children:[Ve(wg,{count:l,isWaitingToAnchor:u,isSelected:"annotation"===a,label:"Annotations",name:"annotation",onSelect:()=>d("annotation"),children:"Annotations"}),Ve(wg,{count:s,isWaitingToAnchor:u,isSelected:"note"===a,label:"Page notes",name:"note",onSelect:()=>d("note"),children:"Page Notes"}),c>0&&Ve(wg,{count:c,isWaitingToAnchor:u,isSelected:"orphan"===a,label:"Orphans",
620
620
  name:"orphan",onSelect:()=>d("orphan"),children:"Orphans"})]}),Ve("div",{className:"space-y-3",role:"tabpanel",id:_g(a),"aria-labelledby":yg(a),children:["note"===a&&n.enableExperimentalNewNoteButton&&Ve("div",{className:"flex justify-end",children:Ve(dn,{"data-testid":"new-note-button",onClick:()=>e.createPageNote(),variant:"primary",style:Zn(["ctaBackgroundColor"],n),children:[Ve(Zt,{}),"New note"]})}),!t&&p&&Ve(it,{"data-testid":"notes-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center",children:"There are no page notes in this group."})}),!t&&h&&Ve(it,{"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(jm,{threads:r.children})]})]})]})}),["annotationsService","settings"])
621
621
  ;function kg({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 Sg({children:e}){return Ve("div",{className:"mb-3",children:Ve(it,{children:Ve(st,{children:e})})})}function Ag({withCardContainer:e=!1}){const t=ji(),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?Sg: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(kg,{label:`${n} selected`,
@@ -670,7 +670,7 @@ const n=Qr(e),r=Kr(e),o=Yr(e);return kb`
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=>[Ab(new Date(e.created)),a(e),Qr(e)??"",i,t,Ur(e),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({},wb,n||{});return r.jsx||(r.attributeHook=null),Kv(e,t,r)}(Ve("html",{lang:"en",children:[Ve("head",{children:[Ve("title",{children:`Annotations on "${a}"`
671
671
  }),Ve("meta",{charSet:"UTF-8"})]}),Ve("body",{children:[Ve("section",{children:[Ve("h1",{children:"Summary"}),Ve("p",{children:Ve("time",{dateTime:o.toISOString(),children:Ab(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=Jh(e.text),a=i===`<p>${e.text}</p>`?e.text:i;return Ve("article",{children:[Ve("h2",{
672
672
  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:Ab(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)})]}),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," ")}_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e
673
- ;if(!r)throw new Error("No annotations to export");const o=e=>Xi(e,n,t),{uri:i,title:a}=Zi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Tb.$inject=[];class Eb{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.1707.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)){const n=Array.isArray(t)?t:[t]
673
+ ;if(!r)throw new Error("No annotations to export");const o=e=>Xi(e,n,t),{uri:i,title:a}=Zi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Tb.$inject=[];class Eb{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.1708.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)){const n=Array.isArray(t)?t:[t]
674
674
  ;for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await bp(m.toString(),{body:s?JSON.stringify(Sb(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}}Eb.$inject=["apiRoutes","auth","store"]
675
675
  ;var Cb,Mb,Nb,Ib,Ob,zb={};function Lb(){return Nb||(Nb=1,e=zb,t=function(){if(Mb)return Cb;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 Mb=1,Cb=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){
@@ -787,8 +787,8 @@ Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(t
787
787
  value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,ey(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}CS.$inject=["store","apiRoutes","auth","groups","session","$window"];const MS="hypothesis.user.tags.list",NS="hypothesis.user.tags.map";class IS{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(MS)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${dv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(NS)||{};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(NS,t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)))
788
788
  ;this._storage.setObject(MS,n)}}IS.$inject=["localStorage"];class OS{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}OS.$inject=["store"];class zS{#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);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(){
789
789
  return[...this.#t.keys()]}}zS.$inject=["frameSync"];class LS extends Ff{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,messageText:t,options:o})}const i={type:e,id:ev(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)}}LS.$inject=["store","$window"]
790
- ;const PS=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),RS=function(e){const{version:t,origin:n}=nv(e.location.href);return"1.1707.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1707.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 DS(e,t){e.setClientId(t.clientId)}function jS(e){e.sync()}function HS(e,t){e.load(),t.load()}function FS(e,t,n){e.init(),t.init(),n.init()}function $S(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{
791
- n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}PS.sentry&&RS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;!function(e={}){const t=!e.skipBrowserExtensionCheck&&pS(),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||Zk,Array.isArray(r)?Ay(...r):r),integrations:px({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[Vx(),qx(),rS(),tS(),lS(),hS(),tk(),dS(),sS()]:e.defaultIntegrations}),transport:e.transport||qk};var r;Nx(Ck,n)}({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1707.0",beforeSend:(e,t)=>{if(mS>=5)return lv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++mS;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{}return e}});try{
790
+ ;const PS=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),RS=function(e){const{version:t,origin:n}=nv(e.location.href);return"1.1708.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1708.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 DS(e,t){e.setClientId(t.clientId)}function jS(e){e.sync()}function HS(e,t){e.load(),t.load()}function FS(e,t,n){e.init(),t.init(),n.init()}function $S(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{
791
+ n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}PS.sentry&&RS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;!function(e={}){const t=!e.skipBrowserExtensionCheck&&pS(),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||Zk,Array.isArray(r)?Ay(...r):r),integrations:px({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[Vx(),qx(),rS(),tS(),lS(),hS(),tk(),dS(),sS()]:e.defaultIntegrations}),transport:e.transport||qk};var r;Nx(Ck,n)}({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1708.0",beforeSend:(e,t)=>{if(mS>=5)return lv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++mS;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{}return e}});try{
792
792
  ix("host_config",nv(window.location.href))}catch{}ix("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Wb(((e,t)=>{fS(e,t)}))}(PS.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),DS.$inject=["api","streamer"],jS.$inject=["router"],HS.$inject=["groups","session"],FS.$inject=["autosaveService","persistedDefaults","serviceURL"],$S.$inject=["frameSync","store","toastMessenger"];const BS=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",bv)}(),async function(e,t=window){const n=function(e){const t=nv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:rv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){
793
793
  return"object"==typeof e&&null!==e?e:{}}(e);return{origin:iv(t.origin),ancestorLevel:ov(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:av(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await tv(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=tv(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=Kn(e)
794
794
  ;if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(PS).then((e=>{!function(e,t){const n=new U;n.register("analytics",yv).register("annotationsExporter",Tb).register("annotationsService",wv).register("annotationActivity",_v).register("api",Eb).register("apiRoutes",jb).register("auth",$b).register("autosaveService",Bb).register("dashboard",qb).register("frameSync",ry).register("groups",ay).register("importAnnotationsService",vS).register("loadAnnotationsService",bS).register("localStorage",_S).register("persistedDefaults",xS).register("router",kS).register("serviceURL",SS).register("session",AS).register("streamer",CS).register("streamFilter",TS).register("tags",IS).register("threadsService",OS).register("thumbnailService",zS).register("toastMessenger",LS).register("store",{factory:Di}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(jS),n.run(FS),n.run(DS),n.run(HS),n.run(vv),n.run($S),H(Ve(Qn.Provider,{value:n,