hypothesis 1.1264.0 → 1.1266.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?7e9249","styles/annotator.css":"styles/annotator.css?540e64","styles/annotator.css.map":"styles/annotator.css.map?347677","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e64527","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?781567","styles/sidebar.css.map":"styles/sidebar.css.map?2bb612","styles/ui-playground.css":"styles/ui-playground.css?dfd411","styles/ui-playground.css.map":"styles/ui-playground.css.map?12072a","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?2bf84c","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?87da05","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?5a8f1f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?4e76f2","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?f6fe86"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function l(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function p(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=l(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var c=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=p(c.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1264.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)e(s,i(t,p[l]))}(document,{assetRoot:u,manifest:s,apiUrl:c.apiUrl})}else{var d=function(){var s,t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return null===(s=e.chrome)||void 0===s||null===(t=s.runtime)||void 0===t?void 0:t.id}();if(d&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(d))throw new Error("Could not start Hypothesis extension as configuration is missing");var h=c,y=p(h.notebookAppUrl||"https://hypothes.is/notebook"),f=p(h.profileAppUrl||"https://hypothes.is/user-profile"),m=p(h.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var p=[];void 0!==window.PDFViewerApplication&&p.push("styles/pdfjs-overrides.css"),p.push("styles/highlights.css");for(var c=0,u=p;c<u.length;c++)e(s,i(t,u[c]))}}(document,{assetRoot:u,manifest:s,notebookAppUrl:y,profileAppUrl:f,sidebarAppUrl:m})}}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?2f0669","styles/annotator.css":"styles/annotator.css?c72b20","styles/annotator.css.map":"styles/annotator.css.map?01cafc","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e64527","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?9c4329","styles/sidebar.css.map":"styles/sidebar.css.map?a5910a","styles/ui-playground.css":"styles/ui-playground.css?92405e","styles/ui-playground.css.map":"styles/ui-playground.css.map?a10f32","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?bdc23f","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?a4af2f","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?1598f1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?1e1f39","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?10e6b0"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function l(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function c(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=l(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=c(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1266.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:u,manifest:s,apiUrl:p.apiUrl})}else{var d=function(){var s,t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return null===(s=e.chrome)||void 0===s||null===(t=s.runtime)||void 0===t?void 0:t.id}();if(d&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(d))throw new Error("Could not start Hypothesis extension as configuration is missing");var h=p,y=c(h.notebookAppUrl||"https://hypothes.is/notebook"),f=c(h.profileAppUrl||"https://hypothes.is/user-profile"),m=c(h.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)e(s,i(t,u[p]))}}(document,{assetRoot:u,manifest:s,notebookAppUrl:y,profileAppUrl:f,sidebarAppUrl:m})}}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,20 +1,20 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?7e9249",
3
- "styles/annotator.css": "styles/annotator.css?540e64",
4
- "styles/annotator.css.map": "styles/annotator.css.map?347677",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?2f0669",
3
+ "styles/annotator.css": "styles/annotator.css?c72b20",
4
+ "styles/annotator.css.map": "styles/annotator.css.map?01cafc",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
6
6
  "styles/highlights.css.map": "styles/highlights.css.map?241350",
7
7
  "styles/katex.min.css": "styles/katex.min.css?e64527",
8
8
  "styles/katex.min.css.map": "styles/katex.min.css.map?42d80c",
9
9
  "styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
10
10
  "styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
11
- "styles/sidebar.css": "styles/sidebar.css?781567",
12
- "styles/sidebar.css.map": "styles/sidebar.css.map?2bb612",
13
- "styles/ui-playground.css": "styles/ui-playground.css?dfd411",
14
- "styles/ui-playground.css.map": "styles/ui-playground.css.map?12072a",
15
- "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?2bf84c",
16
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?87da05",
17
- "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?5a8f1f",
18
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?4e76f2",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?f6fe86"
11
+ "styles/sidebar.css": "styles/sidebar.css?9c4329",
12
+ "styles/sidebar.css.map": "styles/sidebar.css.map?a5910a",
13
+ "styles/ui-playground.css": "styles/ui-playground.css?92405e",
14
+ "styles/ui-playground.css.map": "styles/ui-playground.css.map?a10f32",
15
+ "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?bdc23f",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a4af2f",
17
+ "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?1598f1",
18
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?1e1f39",
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?10e6b0"
20
20
  }
@@ -59,7 +59,7 @@ end:Ue(t.endContainer.textContent,t.endOffset,Ve.Backwards)};if(o.start>=0&&(e.s
59
59
  t.top="0",t.width="100%",t.height="100%",t.mixBlendMode="multiply"}const o=n.getBoundingClientRect(),r=t.map((t=>{const n=t.getBoundingClientRect(),i=document.createElementNS(on,"rect");return i.setAttribute("x",(n.left-o.left).toString()),i.setAttribute("y",(n.top-o.top).toString()),i.setAttribute("width",n.width.toString()),i.setAttribute("height",n.height.toString()),i.setAttribute("class",be("hypothesis-svg-highlight",e)),t.classList.add("is-transparent"),t.svgHighlight=i,i}));i.append(...r)}(l,e),l}function an(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function ln(t){cn(t,!1);for(const e of t){if(e.parentNode){an(e,Array.from(e.childNodes))}e.svgHighlight&&e.svgHighlight.remove()}}function cn(t,e){t.forEach((t=>{t.svgHighlight?function(t,e){const n=t.parentNode,i=t.getAttribute("data-focused-id");if(Boolean(i)!==e)if(e){t.setAttribute("data-focused-id",o(8));const e=t.cloneNode();e.setAttribute("data-is-focused","data-is-focused"),n.append(e)}else{
60
60
  const e=n.querySelector(`[data-focused-id="${i}"][data-is-focused]`);null==e||e.remove(),t.removeAttribute("data-focused-id")}}(t.svgHighlight,e):t.classList.toggle("hypothesis-highlight-focused",e)}))}function hn(t){const e=t.map((t=>t.getBoundingClientRect()));return e.reduce(((t,e)=>({top:Math.min(t.top,e.top),left:Math.min(t.left,e.left),bottom:Math.max(t.bottom,e.bottom),right:Math.max(t.right,e.right)})))}function un(t){pn(fn(t)),function(t){for(const[e,n]of function(t){const e=new Map;for(const n of(null!=t?t:document).getElementsByClassName("hypothesis-highlight-layer"))e.set(n,Array.from(n.querySelectorAll(".hypothesis-svg-highlight")));return e}(t)){n.every(((t,e,n)=>0===e||mn(t)>=mn(n[e-1])))||(n.sort(((t,e)=>mn(t)-mn(e))),e.replaceChildren(...n))}}(t)}const dn=t=>"hypothesis-highlight"===t.tagName.toLowerCase();function fn(t){let e;return e=dn(t)?Array.from(t.children).filter(dn):Array.from(t.getElementsByTagName("hypothesis-highlight")).filter((t=>!t.parentElement||!dn(t.parentElement))),e}
61
61
  function pn(t,e="",n=0,i=0){for(const r of t){var o;const t=null!==(o=rn.find((t=>r.classList.contains(t))))&&void 0!==o?o:"other-content",s=e&&t===e?i+1:0;r.setAttribute("data-nesting-level",`${n}`),r.setAttribute("data-cluster-level",`${s}`),r.svgHighlight&&(r.svgHighlight.setAttribute("data-nesting-level",`${n}`),r.svgHighlight.setAttribute("data-cluster-level",`${s}`)),pn(fn(r),t,n+1,s)}}function mn(t){var e;return t.getAttribute("data-is-focused")?Number.MAX_SAFE_INTEGER:parseInt(null!==(e=t.getAttribute("data-nesting-level"))&&void 0!==e?e:"0",10)}class gn{constructor({contentContainer:t,hostRPC:i}){e(this,"_hostRPC",void 0),e(this,"_updatePending",void 0),e(this,"_anchors",void 0),e(this,"_listeners",void 0),this._hostRPC=i,this._updatePending=!1,this._anchors=[],this._listeners=new n,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(t,"scroll",(()=>this.update()))}destroy(){this._listeners.removeAll()}update(t){
62
- t&&(this._anchors=t),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const t=function(t){const e=[];return t.forEach((({annotation:t,highlights:n})=>{if(null==n||!n.length)return;const{top:i,bottom:o}=hn(n);i>=o||e.push({tag:t.$tag,top:i,bottom:o})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}let _n=new Set;function vn(...t){const e=t.join();_n.has(e)||(console.warn(...t),_n.add(e))}vn.reset=()=>{_n.clear()};const bn=["html_side_by_side","styled_highlight_clusters"];class yn extends u{constructor(t=bn){super(),e(this,"_flags",void 0),e(this,"_knownFlags",void 0),this._flags=new Map,this._knownFlags=t}update(t){this._flags.clear();for(const[e,n]of Object.entries(t))this._flags.set(e,n);this.emit("flagsChanged")}flagEnabled(t){var e;return this._knownFlags.includes(t)?null!==(e=this._flags.get(t))&&void 0!==e&&e:(vn("Looked up unknown feature",t),!1)}allFlags(){return Object.fromEntries(this._flags)}}
62
+ t&&(this._anchors=t),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const t=function(t){const e=[];return t.forEach((({annotation:t,highlights:n})=>{if(null==n||!n.length)return;const{top:i,bottom:o}=hn(n);i>=o||e.push({tag:t.$tag,top:i,bottom:o})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}const _n=new Set;function vn(...t){const e=t.join();_n.has(e)||(console.warn(...t),_n.add(e))}vn.reset=()=>{_n.clear()};const bn=["html_side_by_side","styled_highlight_clusters"];class yn extends u{constructor(t=bn){super(),e(this,"_flags",void 0),e(this,"_knownFlags",void 0),this._flags=new Map,this._knownFlags=t}update(t){this._flags.clear();for(const[e,n]of Object.entries(t))this._flags.set(e,n);this.emit("flagsChanged")}flagEnabled(t){var e;return this._knownFlags.includes(t)?null!==(e=this._flags.get(t))&&void 0!==e&&e:(vn("Looked up unknown feature",t),!1)}allFlags(){return Object.fromEntries(this._flags)}}
63
63
  function wn({cluster:t,label:e,onChange:n,currentStyles:i,highlightStyles:o}){const r=i[t],s="transparent"===r;return Wt("div",{className:"space-y-2",children:[Wt("div",{className:"flex items-center gap-x-2 text-annotator-base",children:Wt("div",{className:"grow text-color-text px-2 py-1 rounded",style:{backgroundColor:o[r].color},children:e})}),Wt("div",{className:"flex items-center gap-x-2",children:Object.keys(o).map((e=>Wt("div",{className:"relative",children:[Wt("input",{className:be("absolute w-6 h-6","opacity-[.00001]","cursor-pointer"),name:t,id:`hypothesis-${t}-${e}`,checked:r===e,onChange:n,type:"radio",value:e}),Wt("label",{className:"block",htmlFor:`${t}-${e}`,children:[Wt("div",{style:{backgroundColor:o[e].color},className:be("block w-6 h-6 rounded-full flex items-center justify-center",{"border-2 border-slate-0":r!==e,"border-2 border-slate-3":r===e}),children:"transparent"===e&&Wt(re,{className:be("w-3 h-3",{"text-slate-3":!s,"text-slate-7":s})})}),Wt("span",{className:"sr-only",children:e})]
64
64
  })]},`${t}-${e}`)))})]})}function xn({active:t,availableStyles:e,currentStyles:n,onStyleChange:i}){const o=Tt((t=>{const e=t.target,n=e.name,o=e.value;i(n,o)}),[i]),[r,s]=Nt(!1);return t?Wt(ye,{children:Wt("div",{className:"flex flex-col text-annotator-base text-color-text",children:[Wt(Se,{"data-testid":"control-toggle-button",onClick:()=>s(!r),title:r?"Hide highlight settings":"Show highlight settings",children:Wt($,r?{children:[Wt(Zt,{}),Wt("span",{children:"Highlight Appearance"})]}:{children:[Wt(Jt,{}),Wt(ae,{})]})}),r&&Wt(we,{"data-testid":"cluster-style-controls",size:"sm",children:[Wt(wn,{highlightStyles:e,label:"My annotations",cluster:"user-annotations",onChange:o,currentStyles:n}),Wt(wn,{highlightStyles:e,label:"My highlights",cluster:"user-highlights",onChange:o,currentStyles:n}),Wt(wn,{highlightStyles:e,label:"Everybody's content",cluster:"other-content",onChange:o,currentStyles:n})]})]})}):null}const Cn={transparent:{color:"transparent",secondColor:"transparent",thirdColor:"transparent"},pink:{
65
65
  color:"var(--hypothesis-color-pink)",secondColor:"var(--hypothesis-color-pink-1)",thirdColor:"var(--hypothesis-color-pink-2)"},orange:{color:"var(--hypothesis-color-orange)",secondColor:"var(--hypothesis-color-orange-1)",thirdColor:"var(--hypothesis-color-orange-2)"},yellow:{color:"var(--hypothesis-color-yellow)",secondColor:"var(--hypothesis-color-yellow-1)",thirdColor:"var(--hypothesis-color-yellow-2)"},green:{color:"var(--hypothesis-color-green)",secondColor:"var(--hypothesis-color-green-1)",thirdColor:"var(--hypothesis-color-green-2)"},purple:{color:"var(--hypothesis-color-purple)",secondColor:"var(--hypothesis-color-purple-1)",thirdColor:"var(--hypothesis-color-purple-2)"},grey:{color:"var(--hypothesis-color-grey)",secondColor:"var(--hypothesis-color-grey-1)",thirdColor:"var(--hypothesis-color-grey-2)"}},Sn={"other-content":"yellow","user-annotations":"orange","user-highlights":"purple"};class En{constructor(t,n){e(this,"appliedStyles",void 0),e(this,"_element",void 0),e(this,"_features",void 0),
@@ -120,7 +120,7 @@ this._hostRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._hostRP
120
120
  }(this.element),this._integration.destroy()}async anchor(t){const e=t=>{var e;const n=Ro(t);if(!n)return;const i=sn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&cn(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Ye.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[]
121
121
  ;for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&ln(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,r=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),s={uri:n.uri,document:n.metadata,target:r,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+o(8)};return this._sidebarRPC.call("createAnnotation",s),this.anchor(s),ko(),s}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);cn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){
122
122
  const n=function(t,e){let n=null,i=0;for(const r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=hn(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Je(n),o=nn(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=No(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){
123
- e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Po(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Oo(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1264.0";const o=new URL(window.location.href)
123
+ e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Po(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Oo(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1266.0";const o=new URL(window.location.href)
124
124
  ;if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function Lo({config:t,groupId:e}){return Wt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Po(t.notebookAppUrl,{...Oo(t.notebookAppUrl,t),group:e})})}function Mo({eventBus:t,config:e}){const[n,i]=Nt(0),[o,r]=Nt(!0),[s,a]=Nt(null),l=Rt(""),c=Rt(null);At((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),At((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),At((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t])
125
125
  ;return null===s?null:Wt("div",{className:be("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ae,{title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt(Lo,{config:e,groupId:s},n)]})})}class Io{constructor(t,n,i){e(this,"_outerContainer",void 0),e(this,"_shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this._shadowRoot=Fe(this._outerContainer),ut(Wt(Mo,{eventBus:n,config:i}),this._shadowRoot)}destroy(){ut(null,this._shadowRoot),this._outerContainer.remove()}}function Fo({eventBus:t,config:e}){const[n,i]=Nt(!0),o=Rt(null);At((()=>{const e=t.createEmitter()
126
126
  ;return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:Wt("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"profile-inner",children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ae,{title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class Do{constructor(t,n,i){e(this,"_outerContainer",void 0),e(this,"shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-profile"),t.appendChild(this._outerContainer),this.shadowRoot=Fe(this._outerContainer),ut(Wt(Fo,{eventBus:n,config:i}),this.shadowRoot)}destroy(){ut(null,this.shadowRoot),