hypothesis 1.1525.0 → 1.1526.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?f081ce","styles/annotator.css":"styles/annotator.css?e1c6e7","styles/annotator.css.map":"styles/annotator.css.map?4dcebd","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?58e394","styles/katex.min.css.map":"styles/katex.min.css.map?1785d7","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?f04d36","styles/sidebar.css.map":"styles/sidebar.css.map?7780ad","styles/ui-playground.css":"styles/ui-playground.css?47f01e","styles/ui-playground.css.map":"styles/ui-playground.css.map?647144","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3d3c40","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?1459c9","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?7e39a1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?4b9470","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?4667cc"};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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(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 l=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),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1525.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: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 u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.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:c,manifest:s,notebookAppUrl:d,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?1fa647","styles/annotator.css":"styles/annotator.css?e1c6e7","styles/annotator.css.map":"styles/annotator.css.map?4dcebd","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?58e394","styles/katex.min.css.map":"styles/katex.min.css.map?1785d7","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?f04d36","styles/sidebar.css.map":"styles/sidebar.css.map?7780ad","styles/ui-playground.css":"styles/ui-playground.css?47f01e","styles/ui-playground.css.map":"styles/ui-playground.css.map?647144","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?234e18","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?085a60","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?02aa14","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?86edc8","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?4863fe"};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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(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 l=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),p=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1526.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:p,manifest:s,apiUrl:l.apiUrl})}else{var c=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(c&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(c))throw new Error("Could not start Hypothesis extension as configuration is missing");var u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.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:p,manifest:s,notebookAppUrl:d,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,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?f081ce",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?1fa647",
3
3
  "styles/annotator.css": "styles/annotator.css?e1c6e7",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?4dcebd",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
@@ -12,9 +12,9 @@
12
12
  "styles/sidebar.css.map": "styles/sidebar.css.map?7780ad",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?47f01e",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?647144",
15
- "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?3d3c40",
16
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?1459c9",
17
- "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?7e39a1",
18
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?4b9470",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?4667cc"
15
+ "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?234e18",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?085a60",
17
+ "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?02aa14",
18
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?86edc8",
19
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?4863fe"
20
20
  }
@@ -9,7 +9,7 @@ this._handledRequests=new Set,this._sidebarHostChannel=new MessageChannel,this._
9
9
  return!!s(e)&&JSON.stringify(e,Object.keys(t).sort())===JSON.stringify(t,Object.keys(t).sort())}(n,e)}on(e,t){this._emitter.on(e,t)}destroy(){this._listeners.removeAll()}}const _="1.0.0",b="frame-rpc";function v(e,t=[],n=-1){return{protocol:b,version:_,arguments:t,method:e,sequence:n}}function y(e,t,n=[],i=-1){e.postMessage(v(t,n,i))}function w(e){const t=e.match(/\bAppleWebKit\/([0-9]+)\b/);if(!t)return!1;if(parseInt(t[1])<=537)return!1;const n=e.match(/\bVersion\/([0-9]+)\b/);if(!n)return!1;return!(parseInt(n[1])>=16)}class x{constructor({userAgent:e=navigator.userAgent,currentWindow:t=window,forceUnloadListener:n=!1}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new i,"onclose"in MessagePort.prototype&&!n||this._listeners.add(t,"unload",(()=>{this._port&&(y(this._port,"close"),t!==t.parent&&w(e)&&t.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],this._destroyed=!1,this._receivedCloseEvent=!1}on(e,t){
10
10
  if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(e,t)}connect(e){this._port=e,this._listeners.add(e,"message",(e=>this._handle(e))),this._listeners.add(e,"close",(()=>{e.dispatchEvent(new MessageEvent("message",{data:v("close")}))})),e.start(),y(e,"connect");for(const[e,t]of this._pendingCalls)this.call(e,...t);this._pendingCalls=[]}destroy(){this._port&&(y(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(e,...t){if(this._port||this._pendingCalls.push([e,t]),!this._port||this._destroyed)return;const n=this._sequence++,i=t[t.length-1];"function"==typeof i&&(this._callbacks.set(n,i),t=t.slice(0,-1)),y(this._port,e,t,n)}_parseMessage({data:e}){return e&&"object"==typeof e?e.protocol!==b||e.version!==_?null:Array.isArray(e.arguments)?e:null:null}_handle(e){const t=this._parseMessage(e),n=this._port;if(t&&n)if("method"in t){if("close"===t.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}
11
11
  const e=this._methods.get(t.method);if(!e)return;const i=(...e)=>{const i={arguments:e,protocol:b,response:t.sequence,version:_};n.postMessage(i)};e(...t.arguments,i)}else if("response"in t){const e=this._callbacks.get(t.response);this._callbacks.delete(t.response),e&&e(...t.arguments)}}}function C(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function N(e){for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function E(e){return e.width<=0||e.height<=0}function A(e,t,n,i){return Math.max(e,n)<Math.min(t,i)}function k(e,t){return!E(e)&&!E(t)&&(A(e.left,e.right,t.left,t.right)&&A(e.top,e.bottom,t.top,t.bottom))}function T(e,t){
12
- return A(e.top,e.bottom,t.top,t.bottom)}function R(e,t){return A(e.left,e.right,t.left,t.right)}function P(e,t){if(E(e))return t;if(E(t))return e;const n=Math.min(e.left,t.left),i=Math.min(e.top,t.top),o=Math.max(e.right,t.right),r=Math.max(e.bottom,t.bottom);return new DOMRect(n,i,o-n,r-i)}function O(e){return new DOMPoint((e.left+e.right)/2,(e.top+e.bottom)/2)}function I(e){return e.nodeType===Node.ELEMENT_NODE}function M(e){return e.nodeType===Node.TEXT_NODE}const L=["p",".para"];let B;function D(e,t=0,n=e.data.length){return B||(B=document.createRange()),B.setStart(e,t),B.setEnd(e,n),B.getBoundingClientRect()}function F(e){const t=e.getBoundingClientRect();return t.x-=e.scrollLeft,t.y-=e.scrollTop,t.height=Math.max(t.height,e.scrollHeight),t.width=Math.max(t.width,e.scrollWidth),t}function*H(e,t,n){let i=e.firstChild;for(;i;){if(I(i)){const e=k(F(i),t);n(i)&&e&&(yield*H(i,t,n))}else M(i)&&k(D(i),t)&&(yield i);i=i.nextSibling}}function V(e,t){let n=null;const i=e=>!function(e){
12
+ return A(e.top,e.bottom,t.top,t.bottom)}function R(e,t){return A(e.left,e.right,t.left,t.right)}function P(e,t){if(E(e))return t;if(E(t))return e;const n=Math.min(e.left,t.left),i=Math.min(e.top,t.top),o=Math.max(e.right,t.right),r=Math.max(e.bottom,t.bottom);return new DOMRect(n,i,o-n,r-i)}function I(e){return new DOMPoint((e.left+e.right)/2,(e.top+e.bottom)/2)}function O(e){return e.nodeType===Node.ELEMENT_NODE}function M(e){return e.nodeType===Node.TEXT_NODE}const L=["p",".para"];let B;function D(e,t=0,n=e.data.length){return B||(B=document.createRange()),B.setStart(e,t),B.setEnd(e,n),B.getBoundingClientRect()}function F(e){const t=e.getBoundingClientRect();return t.x-=e.scrollLeft,t.y-=e.scrollTop,t.height=Math.max(t.height,e.scrollHeight),t.width=Math.max(t.width,e.scrollWidth),t}function*H(e,t,n){let i=e.firstChild;for(;i;){if(O(i)){const e=k(F(i),t);n(i)&&e&&(yield*H(i,t,n))}else M(i)&&k(D(i),t)&&(yield i);i=i.nextSibling}}function V(e,t){let n=null;const i=e=>!function(e){
13
13
  switch(getComputedStyle(e).position){case"fixed":case"sticky":return!0;default:return!1}}(e);e:for(const s of H(e,t,i)){let e=0;for(const i of s.data.split(/\b/)){if(/\S/.test(i)){const a=e,l=e+i.length,c=D(s,a,l);if(r=c,!E(o=t)&&!E(r)&&r.left>=o.left&&r.right<=o.right&&r.top>=o.top&&r.bottom<=o.bottom){n=document.createRange(),n.setStart(s,a),n.setEnd(s,l);break e}}e+=i.length}}var o,r;return n}function U(e,t=document.documentElement,n=new DOMRect(0,0,window.innerWidth,window.innerHeight)){const i=V(t,n);if(!i)return e(),0;const o=i.getBoundingClientRect().top;e();const r=i.getBoundingClientRect().top-o;return t.scrollTop+=r,r}function q(e,t,n){const i=e.document.querySelector(`link[type="application/annotator+${n}"][rel="${t}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${t}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${t}") link has no href`);return i.href}function W(e){return"string"==typeof e?e:null}function $(e){const t=function(e){
14
14
  if(!S(e,"hypothesisConfig"))return{};if("function"!=typeof e.hypothesisConfig){const e="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+e),{}}return e.hypothesisConfig()}(e),n=C(t.ignoreOtherConfiguration)?{}:N(e.document);function i(e){return S(t,e)?t[e]:S(n,e)?n[e]:void 0}return{get annotations(){return W(n.annotations)||function(){const t=e.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return t?t[1]:null}()},get clientUrl(){return q(e,"hypothesis-client","javascript")},get group(){return W(n.group)||function(){const t=e.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return t?t[1]:null}()},get notebookAppUrl(){return q(e,"notebook","html")},get profileAppUrl(){return q(e,"profile","html")},get showHighlights(){return function(){const e=i("showHighlights");switch(e){case"always":case"never":case"whenSidebarOpen":return e;case!0:return"always";case!1:return"never";default:
15
15
  return"always"}}()},get sidebarAppUrl(){return q(e,"sidebar","html")},get query(){return W(n.query)||function(){const t=e.location.href.match(/#annotations:(query|q):(.+)$/i);if(t)try{return decodeURIComponent(t[2])}catch(e){}return null}()},get sideBySide(){return function(){const e=i("sideBySide");if(!function(e){return null!==e&&"object"==typeof e}(e))return{mode:"auto"};const t="mode"in e&&function(e){return"string"==typeof e&&["auto","manual"].includes(e)}(e.mode)?e.mode:"auto";return"auto"===t?{mode:t}:{mode:t,isActive:"isActive"in e&&"function"==typeof e.isActive?e.isActive:void 0}}()},hostPageSetting:i}}const z=(e,t)=>e.hostPageSetting(t),j={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:e=>e.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:z},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:z},bucketContainerSelector:{defaultValue:null,allowInBrowserExt:!1,getValue:z},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:e=>e.clientUrl},
@@ -21,24 +21,24 @@ const e=j[r],s=void 0!==e.defaultValue,a=!((o=q(t,"sidebar","html")).startsWith(
21
21
  ;do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function ye(e,t,n,i){var o=e.key,r=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&o==l.key&&r===l.type&&0==(131072&l.__u))return n;if(i>(null!=l&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&o==l.key&&r===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(131072&l.__u)&&o==l.key&&r===l.type)return a;a++}}return-1}function we(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||ae.test(t)?n:n+"px"}function xe(e,t,n,i,o){var r;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||we(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||we(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?i?n.u=i.u:(n.u=te,
22
22
  e.addEventListener(t,r?ie:ne,r)):e.removeEventListener(t,r?ie:ne,r);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Ce(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=te++;else if(t.t<n.u)return;return n(G.event?G.event(t):t)}}}function Ne(e,t,n,i,o,r,s,a,l,c){var u,h,d,f,m,p,g,_,b,v,y,w,x,C,N,S,E=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[a=t.__e=n.__e]),(u=G.__b)&&u(t);e:if("function"==typeof E)try{if(_=t.props,b="prototype"in E&&E.prototype.render,v=(u=E.contextType)&&i[u.__c],y=u?v?v.props.value:u.__:i,n.__c?g=(h=t.__c=n.__c).__=h.__E:(b?t.__c=h=new E(_,y):(t.__c=h=new fe(_,y),
23
23
  h.constructor=E,h.render=Te),v&&v.sub(h),h.props=_,h.state||(h.state={}),h.context=y,h.__n=i,d=h.__d=!0,h.__h=[],h._sb=[]),b&&null==h.__s&&(h.__s=h.state),b&&null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=ce({},h.__s)),ce(h.__s,E.getDerivedStateFromProps(_,h.__s))),f=h.props,m=h.state,h.__v=t,d)b&&null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(b&&null==E.getDerivedStateFromProps&&_!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(_,y),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(_,h.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=_,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some((function(e){e&&(e.__=t)})),w=0;w<h._sb.length;w++)h.__h.push(h._sb[w]);h._sb=[],h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(_,h.__s,y),b&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(f,m,p)}))}
24
- if(h.context=y,h.props=_,h.__P=e,h.__e=!1,x=G.__r,C=0,b){for(h.state=h.__s,h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),N=0;N<h._sb.length;N++)h.__h.push(h._sb[N]);h._sb=[]}else do{h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(i=ce(ce({},i),h.getChildContext())),b&&!d&&null!=h.getSnapshotBeforeUpdate&&(p=h.getSnapshotBeforeUpdate(f,m)),be(e,le(S=null!=u&&u.type===de&&null==u.key?u.props.children:u)?S:[S],t,n,i,o,r,s,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),g&&(h.__E=h.__=null)}catch(e){if(t.__v=null,l||null!=r){for(t.__u|=l?160:32;a&&8===a.nodeType&&a.nextSibling;)a=a.nextSibling;r[r.indexOf(a)]=null,t.__e=a}else t.__e=n.__e,t.__k=n.__k;G.__e(e,t,n)}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ee(n.__e,t,n,i,o,r,s,l,c);(u=G.diffed)&&u(t)}function Se(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Ae(n[i],n[++i],n[++i]);G.__c&&G.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],
24
+ if(h.context=y,h.props=_,h.__P=e,h.__e=!1,x=G.__r,C=0,b){for(h.state=h.__s,h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),N=0;N<h._sb.length;N++)h.__h.push(h._sb[N]);h._sb=[]}else do{h.__d=!1,x&&x(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(i=ce(ce({},i),h.getChildContext())),b&&!d&&null!=h.getSnapshotBeforeUpdate&&(p=h.getSnapshotBeforeUpdate(f,m)),be(e,le(S=null!=u&&u.type===de&&null==u.key?u.props.children:u)?S:[S],t,n,i,o,r,s,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),g&&(h.__E=h.__=null)}catch(e){if(t.__v=null,l||null!=r){for(t.__u|=l?160:128;a&&8===a.nodeType&&a.nextSibling;)a=a.nextSibling;r[r.indexOf(a)]=null,t.__e=a}else t.__e=n.__e,t.__k=n.__k;G.__e(e,t,n)}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ee(n.__e,t,n,i,o,r,s,l,c);(u=G.diffed)&&u(t)}function Se(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Ae(n[i],n[++i],n[++i]);G.__c&&G.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],
25
25
  e.some((function(e){e.call(t)}))}catch(e){G.__e(e,t.__v)}}))}function Ee(e,t,n,i,o,r,s,a,l){var c,u,h,d,f,m,p,g=n.props,_=t.props,b=t.type;if("svg"===b?o="http://www.w3.org/2000/svg":"math"===b?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;c<r.length;c++)if((f=r[c])&&"setAttribute"in f==!!b&&(b?f.localName===b:3===f.nodeType)){e=f,r[c]=null;break}if(null==e){if(null===b)return document.createTextNode(_);e=document.createElementNS(o,b,_.is&&_),a&&(G.__m&&G.__m(t,r),a=!1),r=null}if(null===b)g===_||a&&e.data===_||(e.data=_);else{if(r=r&&Y.call(e.childNodes),g=n.props||re,!a&&null!=r)for(g={},c=0;c<e.attributes.length;c++)g[(f=e.attributes[c]).name]=f.value;for(c in g)if(f=g[c],"children"==c);else if("dangerouslySetInnerHTML"==c)h=f;else if(!(c in _)){if("value"==c&&"defaultValue"in _||"checked"==c&&"defaultChecked"in _)continue;xe(e,c,null,f,o)}for(c in _)f=_[c],
26
26
  "children"==c?d=f:"dangerouslySetInnerHTML"==c?u=f:"value"==c?m=f:"checked"==c?p=f:a&&"function"!=typeof f||g[c]===f||xe(e,c,f,g[c],o);if(u)a||h&&(u.__html===h.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(h&&(e.innerHTML=""),be(e,le(d)?d:[d],t,n,i,"foreignObject"===b?"http://www.w3.org/1999/xhtml":o,r,s,r?r[0]:n.__k&&me(n,0),a,l),null!=r)for(c=r.length;c--;)ue(r[c]);a||(c="value","progress"===b&&null==m?e.removeAttribute("value"):void 0!==m&&(m!==e[c]||"progress"===b&&!m||"option"===b&&m!==g[c])&&xe(e,c,m,g[c],o),c="checked",void 0!==p&&p!==e[c]&&xe(e,c,p,g[c],o))}return e}function Ae(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){G.__e(e,n)}}function ke(e,t,n){var i,o;if(G.unmount&&G.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Ae(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){G.__e(e,t)}i.base=i.__P=null}
27
- if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&ke(i[o],t,n||"function"!=typeof e.type);n||ue(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Te(e,t,n){return this.constructor(e,n)}function Re(e,t,n){var i,o,r,s;G.__&&G.__(e,t),o=(i="function"==typeof n)?null:t.__k,r=[],s=[],Ne(t,e=(!i&&n||t).__k=function(e,t,n){var i,o,r,s={};for(r in t)"key"==r?i=t[r]:"ref"==r?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Y.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===s[r]&&(s[r]=e.defaultProps[r]);return he(e,s,i,o,null)}(de,null,[e]),o||re,re,t.namespaceURI,!i&&n?[n]:o?null:t.firstChild?Y.call(t.childNodes):null,r,!i&&n?n:o?o.__e:t.firstChild,i,s),Se(r,e,s)}function Pe(e,t){var n={__c:t="__cC"+oe++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){
28
- this.props.value!==e.value&&n.some((function(e){e.__e=!0,ge(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}Y=se.slice,G={__e:function(e,t,n,i){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},K=0,fe.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ce({},this.state),"function"==typeof e&&(e=e(ce({},n),this.props)),e&&ce(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),ge(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ge(this))},fe.prototype.render=de,Q=[],J="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ee=function(e,t){
29
- return e.__v.__b-t.__v.__b},_e.__r=0,te=0,ne=Ce(!1),ie=Ce(!0),oe=0;var Oe,Ie,Me,Le,Be=0,De=[],Fe=G,He=Fe.__b,Ve=Fe.__r,Ue=Fe.diffed,qe=Fe.__c,We=Fe.unmount,$e=Fe.__;function ze(e,t){Fe.__h&&Fe.__h(Ie,e,Be||t),Be=0;var n=Ie.__H||(Ie.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function je(e){return Be=1,function(e,t,n){var i=ze(Oe++,2);if(i.t=e,!i.__c&&(i.__=[st(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Ie,!Ie.u)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return!!e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!r||r.call(this,e,t,n))};Ie.u=!0;var r=Ie.shouldComponentUpdate,s=Ie.componentWillUpdate;Ie.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}s&&s.call(this,e,t,n)},
30
- Ie.shouldComponentUpdate=o}return i.__N||i.__}(st,e)}function Xe(e,t){var n=ze(Oe++,3);!Fe.__s&&rt(n.__H,t)&&(n.__=e,n.i=t,Ie.__H.__h.push(n))}function Ye(e,t){var n=ze(Oe++,4);!Fe.__s&&rt(n.__H,t)&&(n.__=e,n.i=t,Ie.__h.push(n))}function Ge(e){return Be=5,Ke((function(){return{current:e}}),[])}function Ke(e,t){var n=ze(Oe++,7);return rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qe(e,t){return Be=8,Ke((function(){return e}),t)}function Ze(e){var t=Ie.context[e.__c],n=ze(Oe++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ie)),t.props.value):e.__}function Je(){var e=ze(Oe++,11);if(!e.__){for(var t=Ie.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function et(){for(var e;e=De.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(it),e.__H.__h.forEach(ot),e.__H.__h=[]}catch(t){e.__H.__h=[],Fe.__e(t,e.__v)}}Fe.__b=function(e){Ie=null,He&&He(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$e&&$e(e,t)},Fe.__r=function(e){Ve&&Ve(e),Oe=0
31
- ;var t=(Ie=e.__c).__H;t&&(Me===Ie?(t.__h=[],Ie.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0}))):(t.__h.forEach(it),t.__h.forEach(ot),t.__h=[],Oe=0)),Me=Ie},Fe.diffed=function(e){Ue&&Ue(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==De.push(t)&&Le===Fe.requestAnimationFrame||((Le=Fe.requestAnimationFrame)||nt)(et)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.i=void 0}))),Me=Ie=null},Fe.__c=function(e,t){t.some((function(e){try{e.__h.forEach(it),e.__h=e.__h.filter((function(e){return!e.__||ot(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Fe.__e(n,e.__v)}})),qe&&qe(e,t)},Fe.unmount=function(e){We&&We(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{it(e)}catch(e){t=e}})),n.__H=void 0,t&&Fe.__e(t,n.__v))};var tt="function"==typeof requestAnimationFrame;function nt(e){var t,n=function(){clearTimeout(i),tt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);tt&&(t=requestAnimationFrame(n))}function it(e){var t=Ie,n=e.__c
32
- ;"function"==typeof n&&(e.__c=void 0,n()),Ie=t}function ot(e){var t=Ie;e.__c=e.__(),Ie=t}function rt(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function st(e,t){return"function"==typeof t?t(e):t}const at={alt:1,ctrl:2,meta:4,shift:8};function lt(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let i=0,o=null;for(const e of n){const t=at[e];if(t)i|=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?at.ctrl:0)|(e.metaKey?at.meta:0)|(e.altKey?at.alt:0)|(e.shiftKey?at.shift:0))===i&&e.key.toLowerCase()===o}function ct(e,t,{rootElement:n}={}){Xe((()=>{if(e)return function(e,t,{rootElement:n=document.documentElement??void 0}={}){const i=n=>{lt(n,e)&&t(n)};return n?(n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)):()=>{}}(e,t,{rootElement:n})}),[e,t,n])}const ut=(e=window)=>e.matchMedia("(pointer: coarse)").matches
27
+ if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&ke(i[o],t,n||"function"!=typeof e.type);n||ue(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function Te(e,t,n){return this.constructor(e,n)}function Re(e,t,n){var i,o,r,s;G.__&&G.__(e,t),o=(i="function"==typeof n)?null:t.__k,r=[],s=[],Ne(t,e=(!i&&n||t).__k=function(e,t,n){var i,o,r,s={};for(r in t)"key"==r?i=t[r]:"ref"==r?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Y.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===s[r]&&(s[r]=e.defaultProps[r]);return he(e,s,i,o,null)}(de,null,[e]),o||re,re,t.namespaceURI,!i&&n?[n]:o?null:t.firstChild?Y.call(t.childNodes):null,r,!i&&n?n:o?o.__e:t.firstChild,i,s),Se(r,e,s)}function Pe(e,t){var n={__c:t="__cC"+oe++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=new Set,(i={})[t]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){
28
+ this.props.value!==e.value&&n.forEach((function(e){e.__e=!0,ge(e)}))},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}Y=se.slice,G={__e:function(e,t,n,i){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,i||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},K=0,fe.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ce({},this.state),"function"==typeof e&&(e=e(ce({},n),this.props)),e&&ce(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),ge(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ge(this))},fe.prototype.render=de,Q=[],J="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ee=function(e,t){
29
+ return e.__v.__b-t.__v.__b},_e.__r=0,te=0,ne=Ce(!1),ie=Ce(!0),oe=0;var Ie,Oe,Me,Le,Be=0,De=[],Fe=G,He=Fe.__b,Ve=Fe.__r,Ue=Fe.diffed,qe=Fe.__c,We=Fe.unmount,$e=Fe.__;function ze(e,t){Fe.__h&&Fe.__h(Oe,e,Be||t),Be=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function je(e){return Be=1,function(e,t,n){var i=ze(Ie++,2);if(i.t=e,!i.__c&&(i.__=[st(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Oe,!Oe.u)){var o=function(e,t,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(e){return!!e.__c}));if(o.every((function(e){return!e.__N})))return!r||r.call(this,e,t,n);var s=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!r||r.call(this,e,t,n))};Oe.u=!0;var r=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(e,t,n){if(this.__e){var i=r;r=void 0,o(e,t,n),r=i}s&&s.call(this,e,t,n)},
30
+ Oe.shouldComponentUpdate=o}return i.__N||i.__}(st,e)}function Xe(e,t){var n=ze(Ie++,3);!Fe.__s&&rt(n.__H,t)&&(n.__=e,n.i=t,Oe.__H.__h.push(n))}function Ye(e,t){var n=ze(Ie++,4);!Fe.__s&&rt(n.__H,t)&&(n.__=e,n.i=t,Oe.__h.push(n))}function Ge(e){return Be=5,Ke((function(){return{current:e}}),[])}function Ke(e,t){var n=ze(Ie++,7);return rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qe(e,t){return Be=8,Ke((function(){return e}),t)}function Ze(e){var t=Oe.context[e.__c],n=ze(Ie++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Oe)),t.props.value):e.__}function Je(){var e=ze(Ie++,11);if(!e.__){for(var t=Oe.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function et(){for(var e;e=De.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(it),e.__H.__h.forEach(ot),e.__H.__h=[]}catch(t){e.__H.__h=[],Fe.__e(t,e.__v)}}Fe.__b=function(e){Oe=null,He&&He(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$e&&$e(e,t)},Fe.__r=function(e){Ve&&Ve(e),Ie=0
31
+ ;var t=(Oe=e.__c).__H;t&&(Me===Oe?(t.__h=[],Oe.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0}))):(t.__h.forEach(it),t.__h.forEach(ot),t.__h=[],Ie=0)),Me=Oe},Fe.diffed=function(e){Ue&&Ue(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==De.push(t)&&Le===Fe.requestAnimationFrame||((Le=Fe.requestAnimationFrame)||nt)(et)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.i=void 0}))),Me=Oe=null},Fe.__c=function(e,t){t.some((function(e){try{e.__h.forEach(it),e.__h=e.__h.filter((function(e){return!e.__||ot(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Fe.__e(n,e.__v)}})),qe&&qe(e,t)},Fe.unmount=function(e){We&&We(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{it(e)}catch(e){t=e}})),n.__H=void 0,t&&Fe.__e(t,n.__v))};var tt="function"==typeof requestAnimationFrame;function nt(e){var t,n=function(){clearTimeout(i),tt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);tt&&(t=requestAnimationFrame(n))}function it(e){var t=Oe,n=e.__c
32
+ ;"function"==typeof n&&(e.__c=void 0,n()),Oe=t}function ot(e){var t=Oe;e.__c=e.__(),Oe=t}function rt(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function st(e,t){return"function"==typeof t?t(e):t}const at={alt:1,ctrl:2,meta:4,shift:8};function lt(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let i=0,o=null;for(const e of n){const t=at[e];if(t)i|=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?at.ctrl:0)|(e.metaKey?at.meta:0)|(e.altKey?at.alt:0)|(e.shiftKey?at.shift:0))===i&&e.key.toLowerCase()===o}function ct(e,t,{rootElement:n}={}){Xe((()=>{if(e)return function(e,t,{rootElement:n=document.documentElement??void 0}={}){const i=n=>{lt(n,e)&&t(n)};return n?(n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)):()=>{}}(e,t,{rootElement:n})}),[e,t,n])}const ut=(e=window)=>e.matchMedia("(pointer: coarse)").matches
33
33
  ;function ht(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class dt{constructor(){ht(this,"_listeners",void 0),this._listeners=new Map}add(e,t,n,i){e.addEventListener(t,n,i);const o=Symbol();return this._listeners.set(o,{eventTarget:e,eventType:t,listener:n,options:i}),o}remove(e){const t=this._listeners.get(e);if(t){const{eventTarget:n,eventType:i,listener:o,options:r}=t;n.removeEventListener(i,o,r),this._listeners.delete(e)}}removeAll(){this._listeners.forEach((({eventTarget:e,eventType:t,listener:n,options:i})=>{e.removeEventListener(t,n,i)})),this._listeners.clear()}}function ft(e){e.focus()}
34
34
  function mt(e,{autofocus:t=!1,loop:n=!0,horizontal:i=!0,vertical:o=!0,selector:r="a,button",containerVisible:s=!0,focusElement:a=ft}={}){const l=Ge(null),c=function(e){const t=Ge({callback:e,call:(...e)=>t.current.callback(...e)});return t.current.callback=e,t.current.call}(a);Xe((()=>{if(!s)return()=>{};if(!e.current)throw new Error("Container ref not set");const a=e.current,u=()=>{const e=Array.from(a.querySelectorAll(r)).filter((e=>null!==e.offsetParent&&!function(e){return"boolean"==typeof e.disabled&&e.disabled}(e)));return document.activeElement===a&&e.unshift(a),e},h=(e=u(),t=-1,n=!1,i)=>{t<0&&(t=e.findIndex((e=>0===e.tabIndex)))<0&&(t=0);for(const[o,r]of e.entries())r.tabIndex=o===t?0:-1,o===t&&n&&(l.current=r,c(r,i))},d=u(),f=l.current?d.indexOf(l.current):0;h(d,f,t);const m=new dt;m.add(a,"focusin",(e=>{if(e.target===a&&l.current)return void c(l.current);const n=u(),i=n.indexOf(e.target);i>=0&&h(n,i,t)})),m.add(a,"keydown",(e=>{const t=u();let r=t.findIndex((e=>0===e.tabIndex)),s=!1
35
35
  ;i&&"ArrowLeft"===e.key||o&&"ArrowUp"===e.key?(0===r?r=n?t.length-1:r:--r,s=!0):i&&"ArrowRight"===e.key||o&&"ArrowDown"===e.key?(r===t.length-1?r=n?0:r:++r,s=!0):"Home"===e.key?(r=0,s=!0):"End"===e.key&&(r=t.length-1,s=!0),s&&(h(t,r,!0,e),e.preventDefault(),e.stopPropagation())}));const p=new MutationObserver((()=>{h()}));return p.observe(a,{subtree:!0,attributes:!0,attributeFilter:["disabled"],childList:!0}),()=>{m.removeAll(),p.disconnect()}}),[t,e,c,i,n,r,o,s])}function pt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class gt{constructor(e){pt(this,"_target",void 0),pt(this,"_value",void 0),this._target=e,this._value=null}
36
36
  get current(){return this._value}set current(e){this._value=e,this._updateTarget()}get target(){return this._target}set target(e){e!==this._target&&(this._target=e,this._updateTarget())}_updateTarget(){const e=this._value;"function"==typeof this._target?this._target(e):this._target&&(this._target.current=e)}}function _t(e){const t=Ge(new gt(e));return t.current.target=e,t.current}var bt,vt={exports:{}};var yt,wt=(bt||(bt=1,yt=vt,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=i(e,n(o)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var o="";for(var r in n)e.call(n,r)&&n[r]&&(o=i(o,r));return o}function i(e,t){return t?e?e+" "+t:e+t:e}yt.exports?(t.default=t,yt.exports=t):window.classNames=t}()),vt.exports),xt=t(wt);var Ct=0
37
37
  ;function Nt(e,t,n,i,o,r){t||(t={});var s,a,l=t;"ref"in t&&(s=t.ref,delete t.ref);var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ct,__i:-1,__u:0,__source:o,__self:r};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return G.vnode&&G.vnode(c),c}Pe({}),Pe({});var St="/home/runner/work/frontend-shared/frontend-shared/src/components/layout/Card.tsx";function Et({children:e,classes:t,elementRef:n,active:i=!1,variant:o="raised",width:r="full",...s}){return Nt("div",{"data-component":"Card",...s,ref:n,className:xt("rounded-lg border bg-white",{"shadow hover:shadow-md":"raised"===o,"shadow-md":i&&"raised"===o},{"w-full":"full"===r,"w-auto":"auto"===r},t),children:e},void 0,0,{fileName:St,lineNumber:40,columnNumber:5},this)}var At="/home/runner/work/frontend-shared/frontend-shared/src/components/layout/CardContent.tsx";function kt({children:e,classes:t,elementRef:n,size:i="md",...o}){return Nt("div",{
38
38
  "data-component":"CardContent",...o,ref:n,className:xt({"p-3 space-y-4":"md"===i,"p-2 space-y-3":"sm"===i,"p-4 space-y-6":"lg"===i},t),children:e},void 0,0,{fileName:At,lineNumber:29,columnNumber:5},this)}var Tt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Annotate.tsx";function Rt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","data-component":"AnnotateIcon",...e,children:Nt("path",{fill:"currentColor",
39
- d:"M15 0q.406 0 .703.297A.96.96 0 0 1 16 1v15l-4-3H1a.97.97 0 0 1-.703-.29A.95.95 0 0 1 0 12V1A.96.96 0 0 1 .29.29.97.97 0 0 1 1 0zM7 3l-.469.063q-.468.062-1.031.437T4.469 4.688Q3.999 5.5 4 7l.002.063.006.062a1 1 0 0 1 .008.11l-.002.074-.006.066a1.45 1.45 0 0 0 .43 1.188Q4.874 9 5.5 9q.624 0 1.063-.438Q7 8.126 7 7.5q0-.624-.438-1.063A1.45 1.45 0 0 0 5.5 6a1.5 1.5 0 0 0-.422.062q.266-1.545 1.094-1.804L7 4zm5 0-.469.063q-.468.062-1.031.437T9.469 4.688Q8.999 5.5 9 7l.002.063.006.062a1 1 0 0 1 .008.11l-.002.074-.006.066a1.45 1.45 0 0 0 .43 1.188Q9.874 9 10.5 9q.624 0 1.063-.438Q12 8.125 12 7.5t-.438-1.063A1.45 1.45 0 0 0 10.5 6a1.5 1.5 0 0 0-.422.062q.266-1.545 1.094-1.804L12 4z"},void 0,0,{fileName:Tt,lineNumber:19,columnNumber:7},this)},void 0,0,{fileName:Tt,lineNumber:11,columnNumber:5},this)}var Pt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Cancel.tsx";function Ot(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",
40
- viewBox:"0 0 16 16","data-component":"CancelIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Pt,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8 3.536-3.536zL4.464 4.464zm0 0-3.536 3.536zl3.536 3.536z"},void 0,0,{fileName:Pt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Pt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Pt,lineNumber:11,columnNumber:5},this)}var It="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretDown.tsx";function Mt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretDownIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:It,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round",
41
- "stroke-linejoin":"round","stroke-width":"2",d:"m12 6-4 4-4-4"},void 0,0,{fileName:It,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:It,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:It,lineNumber:11,columnNumber:5},this)}var Lt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretLeft.tsx";function Bt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretLeftIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Lt,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 12 6 8l4-4"},void 0,0,{fileName:Lt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Lt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Lt,lineNumber:11,columnNumber:5},this)}
39
+ d:"M15 0q.406 0 .703.297A.96.96 0 0 1 16 1v15l-4-3H1a.97.97 0 0 1-.703-.29A.95.95 0 0 1 0 12V1A.96.96 0 0 1 .29.29.97.97 0 0 1 1 0zM7 3l-.469.063q-.468.062-1.031.437T4.469 4.688Q3.999 5.5 4 7l.002.063.006.062a1 1 0 0 1 .008.11l-.002.074-.006.066a1.45 1.45 0 0 0 .43 1.188Q4.874 9 5.5 9q.624 0 1.063-.438Q7 8.126 7 7.5q0-.624-.438-1.063A1.45 1.45 0 0 0 5.5 6a1.5 1.5 0 0 0-.422.062q.266-1.545 1.094-1.804L7 4zm5 0-.469.063q-.468.062-1.031.437T9.469 4.688Q8.999 5.5 9 7l.002.063.006.062a1 1 0 0 1 .008.11l-.002.074-.006.066a1.45 1.45 0 0 0 .43 1.188Q9.874 9 10.5 9q.624 0 1.063-.438Q12 8.125 12 7.5t-.438-1.063A1.45 1.45 0 0 0 10.5 6a1.5 1.5 0 0 0-.422.062q.266-1.545 1.094-1.804L12 4z"},void 0,0,{fileName:Tt,lineNumber:19,columnNumber:7},this)},void 0,0,{fileName:Tt,lineNumber:11,columnNumber:5},this)}var Pt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Cancel.tsx";function It(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",
40
+ viewBox:"0 0 16 16","data-component":"CancelIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Pt,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8 3.536-3.536zL4.464 4.464zm0 0-3.536 3.536zl3.536 3.536z"},void 0,0,{fileName:Pt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Pt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Pt,lineNumber:11,columnNumber:5},this)}var Ot="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretDown.tsx";function Mt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretDownIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Ot,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round",
41
+ "stroke-linejoin":"round","stroke-width":"2",d:"m12 6-4 4-4-4"},void 0,0,{fileName:Ot,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Ot,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Ot,lineNumber:11,columnNumber:5},this)}var Lt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretLeft.tsx";function Bt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretLeftIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Lt,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 12 6 8l4-4"},void 0,0,{fileName:Lt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Lt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Lt,lineNumber:11,columnNumber:5},this)}
42
42
  var Dt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretRight.tsx";function Ft(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretRightIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Dt,lineNumber:21,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 4 4 4-4 4"},void 0,0,{fileName:Dt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Dt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Dt,lineNumber:11,columnNumber:5},this)}var Ht="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Caution.tsx";function Vt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",viewBox:"0 0 24 24",
43
43
  "data-component":"CautionIcon",...e,children:Nt("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0M12 9v4M12 17h.01"},void 0,0,{fileName:Ht,lineNumber:24,columnNumber:7},this)},void 0,0,{fileName:Ht,lineNumber:11,columnNumber:5},this)}var Ut="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Check.tsx";function qt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","data-component":"CheckIcon",...e,children:Nt("g",{fill:"none","fill-rule":"evenodd",children:[Nt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Ut,lineNumber:20,columnNumber:9},this),Nt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3 6 13 3 8"},void 0,0,{fileName:Ut,lineNumber:21,columnNumber:9},this)]},void 0,0,{fileName:Ut,lineNumber:19,columnNumber:7},this)},void 0,0,{fileName:Ut,lineNumber:11,columnNumber:5},this)}
44
44
  var Wt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CheckboxChecked.tsx";function $t(e){return Nt("svg",{width:"16",height:"16","aria-hidden":"true",viewBox:"-4 -4 39 39","data-component":"CheckboxCheckedIcon",...e,children:[Nt("rect",{width:"35",height:"35",x:"-2",y:"-2",fill:"none",stroke:"currentColor","stroke-width":"3",rx:"5",ry:"5"},void 0,0,{fileName:Wt,lineNumber:19,columnNumber:7},this),Nt("path",{fill:"none",stroke:"currentColor","stroke-width":"5",d:"m4 14 8 9L28 5"},void 0,0,{fileName:Wt,lineNumber:30,columnNumber:7},this)]},void 0,0,{fileName:Wt,lineNumber:11,columnNumber:5},this)}var zt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CheckboxCheckedFilled.tsx";function jt(e){return Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16","data-component":"CheckboxCheckedFilledIcon",...e,children:[Nt("rect",{width:"16",height:"16",fill:"currentColor",rx:"4"},void 0,0,{fileName:zt,lineNumber:22,
@@ -56,12 +56,12 @@ var Cn="/home/runner/work/frontend-shared/frontend-shared/src/components/input/C
56
56
  ["Enter"," "].includes(t.key)&&(t.preventDefault(),a(e))},tabIndex:-1,children:[Nt("div",{className:"flex items-center gap-x-1.5",children:[l?Nt(fn,{},void 0,0,{fileName:En,lineNumber:68,columnNumber:23},this):Nt(hn,{},void 0,0,{fileName:En,lineNumber:68,columnNumber:46},this),t]},void 0,0,{fileName:En,lineNumber:67,columnNumber:7},this),n&&Nt("div",{className:xt("pl-4 ml-1.5 mt-1 text-sm",{"text-grey-7":l,"text-grey-6 group-hover:text-grey-7":!l&&!s}),children:n},void 0,0,{fileName:En,lineNumber:72,columnNumber:9},this)]},void 0,0,{fileName:En,lineNumber:40,columnNumber:5},this)}An.displayName="RadioGroup.Radio",Object.assign((function({direction:e="horizontal",children:t,selected:n,onChange:i,disabled:o,"aria-label":r,"aria-labelledby":s,name:a}){const l=Ge(null);return mt(l,{loop:!1,selector:'[role="radio"]:not([aria-disabled="true"])',focusElement:e=>{i(e.dataset.value),e.focus()}}),Nt(Sn.Provider,{value:{selected:n,disabled:o,onChange:i},children:[Nt("div",{"aria-label":r,"aria-labelledby":s,ref:l,
57
57
  role:"radiogroup",className:xt("w-full flex gap-1.5",{"flex-col":"vertical"===e}),children:t},void 0,0,{fileName:En,lineNumber:134,columnNumber:7},this),a&&Nt("input",{type:"hidden","data-testid":"hidden-input",name:a,value:n,disabled:o},void 0,0,{fileName:En,lineNumber:146,columnNumber:9},this)]},void 0,0,{fileName:En,lineNumber:131,columnNumber:5},this)}),{Radio:An,displayName:"RadioGroup"});const kn=Pe(null);var Tn="/home/runner/work/frontend-shared/frontend-shared/src/components/input/Select.tsx";function Rn(e,t){return"function"==typeof e?e(t):e}function Pn({value:e,children:t,disabled:n=!1,classes:i,elementRef:o}){const r=Ge(null),s=Ge(null),a=_t(o),l=e=>e.target===r.current||e.target===s.current,c=Ze(kn);if(!c)throw new Error("Select.Option can only be used as Select or MultiSelect child");const{selectValue:u,value:h,multiple:d}=c,f=Ke((()=>!n&&(d?h.includes(e)||0===h.length&&void 0===e:h===e)),[h,n,d,e]),m=Qe((()=>{const t={closeListbox:!0};u(d?void 0!==e?[e]:[]:e,t)}),[d,u,e]),p=Qe((()=>{if(!d)return
58
58
  ;const t={closeListbox:void 0===e};if(void 0===e)return void u([],t);const n=h.indexOf(e);if(-1===n)u([...h,e],t);else{const e=[...h];e.splice(n,1),u(e,t)}}),[h,d,u,e]);return Nt("li",{className:xt("w-full ring-inset outline-none rounded-none select-none","px-1 mb-1 first:mt-1 whitespace-nowrap group",{"text-grey-4":n,"cursor-pointer":!n},i),onClick:e=>{n||l(e)||m()},onKeyDown:e=>{n||(["Enter"," "].includes(e.key)&&!l(e)?(e.preventDefault(),m()):r.current&&"ArrowRight"===e.key&&(e.preventDefault(),r.current.focus()))},role:"option","aria-disabled":n,"aria-selected":f,tabIndex:-1,ref:a,children:Nt("div",{className:xt("flex justify-between items-stretch","w-full rounded",{"hover:bg-grey-1 group-focus-visible:ring":!n,"bg-grey-1 hover:bg-grey-2":f}),children:[Nt("div",{className:"flex items-center py-2 pl-3",children:Rn(t,{selected:f,disabled:n})},void 0,0,{fileName:Tn,lineNumber:204,columnNumber:9},this),!d&&Nt("div",{className:"flex items-center py-2 px-3",children:Nt(qt,{className:xt("text-grey-6 scale-125",{
59
- "opacity-0":!f})},void 0,0,{fileName:Tn,lineNumber:209,columnNumber:13},this)},void 0,0,{fileName:Tn,lineNumber:208,columnNumber:11},this),d&&Nt(Nn,{containerClasses:xt("flex items-center py-2 px-3","text-lg",{"text-grey-6":f,"text-grey-3 hover:text-grey-6":!f}),checked:f,checkedIcon:jt,elementRef:r,containerRef:s,onChange:p,onKeyDown:e=>{var t;"ArrowLeft"===e.key&&(e.preventDefault(),null===(t=a.current)||void 0===t||t.focus())}},void 0,0,{fileName:Tn,lineNumber:220,columnNumber:11},this)]},void 0,0,{fileName:Tn,lineNumber:191,columnNumber:7},this)},void 0,0,{fileName:Tn,lineNumber:146,columnNumber:5},this)}Pn.displayName="Select.Option";const On=".25rem";function In({buttonContent:e,value:t,onChange:n,children:i,disabled:o,elementRef:r,buttonId:s,buttonClasses:a,listboxClasses:l,containerClasses:c,onListboxScroll:u,right:h=!1,multiple:d,"aria-label":f,"aria-labelledby":m,listboxAsPopover:p=HTMLElement.prototype.hasOwnProperty("popover")}){const g=Ge(null),_=Ge(null),[b,v]=je(!1),y=Qe((e=>{var t;(v(e),
60
- p)&&(null===(t=_.current)||void 0===t||t.togglePopover(e))}),[p]),w=Qe((()=>y(!1)),[y]),x=Je(),C=_t(r),N=Je();!function(e,t,n,i,o){const r=Qe((()=>{const r=t.current,s=e.current;if(!s||!r||!n)return()=>{};const a=e=>{Object.assign(r.style,e);const t=Object.keys(e);return()=>t.map((e=>r.style[e]=""))},l=window.innerHeight,{top:c,bottom:u,left:h,height:d,width:f}=s.getBoundingClientRect(),m=l-u,{height:p,width:g}=r.getBoundingClientRect(),_=m<p&&c>m;if(i){const{top:e}=document.body.getBoundingClientRect(),t=Math.abs(e);return a({minWidth:`${f}px`,top:_?`calc(${t+c-p}px - ${On})`:`calc(${t+c+d}px + ${On})`,left:o&&g>f?h-(g-f)+"px":`${h}px`})}return a(_?{bottom:"100%",marginBottom:On}:{top:"100%",marginTop:On})}),[i,e,n,t,o]);Ye((()=>{const e=r();if(!i)return e;const t=new dt;return t.add(document.body,"scroll",r,{capture:!0}),()=>{e(),t.removeAll()}}),[r,i])}(C,_,b,p,h);const S=Qe(((e,t)=>{n(e),t.closeListbox&&w()}),[n,w]);return function(e,t,{enabled:n=!0}={}){Xe((()=>{if(!n)return()=>{}
59
+ "opacity-0":!f})},void 0,0,{fileName:Tn,lineNumber:209,columnNumber:13},this)},void 0,0,{fileName:Tn,lineNumber:208,columnNumber:11},this),d&&Nt(Nn,{containerClasses:xt("flex items-center py-2 px-3","text-lg",{"text-grey-6":f,"text-grey-3 hover:text-grey-6":!f}),checked:f,checkedIcon:jt,elementRef:r,containerRef:s,onChange:p,onKeyDown:e=>{var t;"ArrowLeft"===e.key&&(e.preventDefault(),null===(t=a.current)||void 0===t||t.focus())}},void 0,0,{fileName:Tn,lineNumber:220,columnNumber:11},this)]},void 0,0,{fileName:Tn,lineNumber:191,columnNumber:7},this)},void 0,0,{fileName:Tn,lineNumber:146,columnNumber:5},this)}Pn.displayName="Select.Option";const In=".25rem";function On({buttonContent:e,value:t,onChange:n,children:i,disabled:o,elementRef:r,buttonId:s,buttonClasses:a,listboxClasses:l,containerClasses:c,onListboxScroll:u,right:h=!1,multiple:d,"aria-label":f,"aria-labelledby":m,listboxAsPopover:p=HTMLElement.prototype.hasOwnProperty("popover")}){const g=Ge(null),_=Ge(null),[b,v]=je(!1),y=Qe((e=>{var t;(v(e),
60
+ p)&&(null===(t=_.current)||void 0===t||t.togglePopover(e))}),[p]),w=Qe((()=>y(!1)),[y]),x=Je(),C=_t(r),N=Je();!function(e,t,n,i,o){const r=Qe((()=>{const r=t.current,s=e.current;if(!s||!r||!n)return()=>{};const a=e=>{Object.assign(r.style,e);const t=Object.keys(e);return()=>t.map((e=>r.style[e]=""))},l=window.innerHeight,{top:c,bottom:u,left:h,height:d,width:f}=s.getBoundingClientRect(),m=l-u,{height:p,width:g}=r.getBoundingClientRect(),_=m<p&&c>m;if(i){const{top:e}=document.body.getBoundingClientRect(),t=Math.abs(e);return a({minWidth:`${f}px`,top:_?`calc(${t+c-p}px - ${In})`:`calc(${t+c+d}px + ${In})`,left:o&&g>f?h-(g-f)+"px":`${h}px`})}return a(_?{bottom:"100%",marginBottom:In}:{top:"100%",marginTop:In})}),[i,e,n,t,o]);Ye((()=>{const e=r();if(!i)return e;const t=new dt;return t.add(document.body,"scroll",r,{capture:!0}),()=>{e(),t.removeAll()}}),[r,i])}(C,_,b,p,h);const S=Qe(((e,t)=>{n(e),t.closeListbox&&w()}),[n,w]);return function(e,t,{enabled:n=!0}={}){Xe((()=>{if(!n)return()=>{}
61
61
  ;const i=document.body,o=new dt,r=n=>{e.current&&!n.composedPath().includes(e.current)&&t(n)};return o.add(i,"mousedown",r),o.add(i,"click",r),()=>{o.removeAll()}}),[e,n,t])}(g,w),function(e,t,{enabled:n=!0}={}){Xe((()=>{if(!n||!e.current)return()=>{};const i=new dt;return i.add(e.current,"focusout",(n=>{const i=n;e.current&&!e.current.contains(i.relatedTarget)&&t(i)})),()=>{i.removeAll()}}),[e,n,t])}(g,w),function(e,t,{enabled:n=!0}={}){Xe((()=>{if(!n)return()=>{};const i=document.body,o=new dt;return o.add(i,"keydown",(n=>{e.includes(n.key)&&t(n)})),()=>{o.removeAll()}}),[n,t,e])}(["Escape"],w),mt(_,{horizontal:!1,loop:!1,autofocus:!0,containerVisible:b,selector:'[role="option"]:not([aria-disabled="true"])'}),Ye((()=>{!b&&_.current.contains(document.activeElement)&&C.current.focus()}),[C,b]),Nt("div",{className:xt("relative w-full border rounded",{"border-grey-5":b},bn,c),ref:g,children:[Nt("button",{id:null!=s?s:N,
62
62
  className:xt("focus-visible-ring transition-colors whitespace-nowrap","w-full flex items-center justify-between gap-x-2 p-2","bg-grey-0 disabled:bg-grey-1 disabled:text-grey-6","rounded-[inherit]",a),type:"button",role:"combobox",disabled:o,"aria-expanded":b,"aria-haspopup":"listbox","aria-controls":x,"aria-label":f,"aria-labelledby":m,ref:C,onClick:()=>y(!b),onKeyDown:e=>{"ArrowDown"!==e.key||b||(e.preventDefault(),y(!0))},"data-testid":"select-toggle-button",children:[Nt("div",{className:"truncate",children:e},void 0,0,{fileName:Tn,lineNumber:541,columnNumber:9},this),Nt("div",{className:"text-grey-6",children:b?Nt(en,{},void 0,0,{fileName:Tn,lineNumber:543,columnNumber:26},this):Nt(nn,{},void 0,0,{fileName:Tn,lineNumber:543,columnNumber:49},this)},void 0,0,{fileName:Tn,lineNumber:542,columnNumber:9},this)]},void 0,0,{fileName:Tn,lineNumber:510,columnNumber:7},this),Nt(kn.Provider,{value:{value:t,selectValue:S,multiple:d},children:Nt("ul",{
63
- className:xt("absolute z-5 max-h-80 overflow-y-auto","rounded border bg-white shadow hover:shadow-md focus-within:shadow-md",!p&&{hidden:!b,"right-0":h,"min-w-full":!0},l),role:"listbox",ref:_,id:x,"aria-multiselectable":d,"aria-labelledby":null!=s?s:N,"aria-orientation":"vertical","data-testid":"select-listbox","data-listbox-open":b,popover:p?"auto":void 0,onScroll:u,children:i},void 0,0,{fileName:Tn,lineNumber:555,columnNumber:9},this)},void 0,0,{fileName:Tn,lineNumber:547,columnNumber:7},this)]},void 0,0,{fileName:Tn,lineNumber:501,columnNumber:5},this)}Object.assign((function(e){return In({...e,multiple:!1})}),{Option:Pn,displayName:"Select"}),Object.assign((function(e){return In({...e,multiple:!0})}),{Option:Pn,displayName:"MultiSelect"}),Pe({}),Pe(null);var Mn="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/Callout.tsx";function Ln({children:e,classes:t,elementRef:n,icon:i,status:o="notice",size:r="md",variant:s="outlined",unstyled:a=!1,...l}){
64
- const c=!a,u=c&&"custom"!==s,h=c&&"custom"!==r;let d=i;if(!d)switch(o){case"success":d=qt;break;case"error":d=Ot;break;default:d=Vt}const f=u&&h;return Nt("div",{"data-component":"Callout",...l,ref:n,className:xt(c&&"flex items-center border",u&&{"rounded border":!0,"shadow hover:shadow-md cursor-pointer":"raised"===s,"border-yellow-notice":"notice"===o,"border-green-success":"success"===o,"border-red-error":"error"===o},u&&{"bg-yellow-notice":"notice"===o&&f,"bg-green-success":"success"===o&&f,"bg-red-error":"error"===o&&f,"bg-white":!f},t),children:[f&&Nt("div",{className:xt({"p-2":"md"===r,"p-1.5":"sm"===r,"p-3":"lg"===r}),children:Nt(d,{"data-testid":"callout-icon",className:xt("text-white",{"w-[1.25em] h-[1.25em]":"md"===r,"w-[0.85em] h-[0.85em]":"sm"===r,"w-[1.5em] h-[1.5em]":"lg"===r})},void 0,0,{fileName:Mn,lineNumber:95,columnNumber:11},this)},void 0,0,{fileName:Mn,lineNumber:88,columnNumber:9},this),Nt("div",{className:xt(h&&{"p-2":"md"===r,"py-1.5 px-2":"sm"===r,"p-3":"lg"===r
63
+ className:xt("absolute z-5 max-h-80 overflow-y-auto","rounded border bg-white shadow hover:shadow-md focus-within:shadow-md",!p&&{hidden:!b,"right-0":h,"min-w-full":!0},l),role:"listbox",ref:_,id:x,"aria-multiselectable":d,"aria-labelledby":null!=s?s:N,"aria-orientation":"vertical","data-testid":"select-listbox","data-listbox-open":b,popover:p?"auto":void 0,onScroll:u,children:i},void 0,0,{fileName:Tn,lineNumber:555,columnNumber:9},this)},void 0,0,{fileName:Tn,lineNumber:547,columnNumber:7},this)]},void 0,0,{fileName:Tn,lineNumber:501,columnNumber:5},this)}Object.assign((function(e){return On({...e,multiple:!1})}),{Option:Pn,displayName:"Select"}),Object.assign((function(e){return On({...e,multiple:!0})}),{Option:Pn,displayName:"MultiSelect"}),Pe({}),Pe(null);var Mn="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/Callout.tsx";function Ln({children:e,classes:t,elementRef:n,icon:i,status:o="notice",size:r="md",variant:s="outlined",unstyled:a=!1,...l}){
64
+ const c=!a,u=c&&"custom"!==s,h=c&&"custom"!==r;let d=i;if(!d)switch(o){case"success":d=qt;break;case"error":d=It;break;default:d=Vt}const f=u&&h;return Nt("div",{"data-component":"Callout",...l,ref:n,className:xt(c&&"flex items-center border",u&&{"rounded border":!0,"shadow hover:shadow-md cursor-pointer":"raised"===s,"border-yellow-notice":"notice"===o,"border-green-success":"success"===o,"border-red-error":"error"===o},u&&{"bg-yellow-notice":"notice"===o&&f,"bg-green-success":"success"===o&&f,"bg-red-error":"error"===o&&f,"bg-white":!f},t),children:[f&&Nt("div",{className:xt({"p-2":"md"===r,"p-1.5":"sm"===r,"p-3":"lg"===r}),children:Nt(d,{"data-testid":"callout-icon",className:xt("text-white",{"w-[1.25em] h-[1.25em]":"md"===r,"w-[0.85em] h-[0.85em]":"sm"===r,"w-[1.5em] h-[1.5em]":"lg"===r})},void 0,0,{fileName:Mn,lineNumber:95,columnNumber:11},this)},void 0,0,{fileName:Mn,lineNumber:88,columnNumber:9},this),Nt("div",{className:xt(h&&{"p-2":"md"===r,"py-1.5 px-2":"sm"===r,"p-3":"lg"===r
65
65
  },c&&"grow",u&&"bg-white rounded-r"),children:e},void 0,0,{fileName:Mn,lineNumber:105,columnNumber:7},this)]},void 0,0,{fileName:Mn,lineNumber:64,columnNumber:5},this)}var Bn="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/ToastMessages.tsx";function Dn({message:e,onDismiss:t}){return Nt(Ln,{classes:xt({"sr-only":e.visuallyHidden}),status:e.type,onClick:()=>t(e.id),variant:"raised",children:e.message},void 0,0,{fileName:Bn,lineNumber:55,columnNumber:5},this)}const Fn=({direction:e,onTransitionEnd:t,children:n,transitionClasses:i={}})=>{const o="out"===e,r=Ge(null),s=Ke((()=>{const{transitionIn:e="animate-fade-in",transitionOut:t="animate-fade-out"}=i;return{[e]:!o,[t]:o}}),[o,i]);return Nt("div",{"data-testid":"animation-container",onAnimationEnd:n=>{n.target===r.current&&(null==t||t(null!=e?e:"in"))},ref:r,className:xt("relative w-full container",s),children:n},void 0,0,{fileName:Bn,lineNumber:103,columnNumber:5},void 0)}
66
66
  ;function Hn({messages:e,onMessageDismiss:t,transitionClasses:n,setTimeout_:i=setTimeout}){const[o,r]=je([]),s=Ge(new Map),a=Qe((e=>r((t=>[...t,e]))),[]),l=Qe((e=>{const t=i((()=>{a(e),s.current.delete(e)}),5e3);s.current.set(e,t)}),[a,i]),c=Qe(((e,n)=>{var i;const o=null===(i=n.autoDismiss)||void 0===i||i;"in"===e&&o&&l(n.id),"out"===e&&(t(n.id),r((e=>e.filter((e=>e!==n.id)))))}),[l,t]);return Ye((()=>{const e=s.current;return()=>{e.forEach((e=>clearTimeout(e)))}}),[]),Nt("ul",{"aria-live":"polite","aria-relevant":"additions",className:"w-full space-y-2","data-component":"ToastMessages",children:e.map((e=>{const t=o.includes(e.id);return Nt("li",{className:xt({"mb-2":!e.visuallyHidden}),children:Nt(Fn,{direction:t?"out":"in",onTransitionEnd:t=>c(t,e),transitionClasses:n,children:Nt(Dn,{message:e,onDismiss:a},void 0,0,{fileName:Bn,lineNumber:206,columnNumber:15},this)},void 0,0,{fileName:Bn,lineNumber:201,columnNumber:13},this)},e.id,0,{fileName:Bn,lineNumber:189,columnNumber:11},this)}))},void 0,0,{
67
67
  fileName:Bn,lineNumber:180,columnNumber:5},this)}var Vn="/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/Link.tsx";function Un({children:e,classes:t,elementRef:n,underline:i="none",unstyled:o=!1,variant:r="brand",...s}){const a=!o;return Nt("a",{"data-component":"Link",rel:"noopener noreferrer",...s,className:xt(a&&{"focus-visible-ring rounded":!0,"no-underline hover:no-underline":"none"===i,"underline hover:underline":"always"===i,"no-underline hover:underline":"hover"===i},a&&"custom"!==r&&{"text-brand hover:text-brand-dark":"brand"===r,"text-color-text-light hover:text-brand":"text-light"===r,"text-color-text hover:text-brand-dark":"text"===r},t),ref:n,children:e},void 0,0,{fileName:Vn,lineNumber:37,columnNumber:5},this)}var qn="/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/PointerButton.tsx";function Wn({children:e,classes:t,elementRef:n,expanded:i,pressed:o,title:r,direction:s,...a}){return Nt(_n,{"data-component":"PointerButton",...a,
@@ -83,7 +83,7 @@ const n=t.ownerDocument.createRange();if(n.selectNodeContents(t),t===e.startCont
83
83
  i.setAttribute("y",(n.top-o.top).toString()),i.setAttribute("width",n.width.toString()),i.setAttribute("height",n.height.toString()),i.setAttribute("class",xt("hypothesis-svg-highlight",t)),e.classList.add("is-transparent"),e.svgHighlight=i,i}));i.append(...r)}(l,t),l}function yi(e,t){const n=e.parentNode;t.forEach((t=>n.insertBefore(t,e))),e.remove()}function wi(e){xi(e,!1);for(const t of e){if(t.parentNode){yi(t,Array.from(t.childNodes))}t.svgHighlight&&t.svgHighlight.remove()}}function xi(e,t){e.forEach((e=>{e.svgHighlight?function(e,t){const n=e.parentNode,i=e.getAttribute("data-focused-id");if(Boolean(i)!==t)if(t){e.setAttribute("data-focused-id",r(8));const t=e.cloneNode();t.setAttribute("data-is-focused","data-is-focused"),n.append(t)}else{const t=n.querySelector(`[data-focused-id="${i}"][data-is-focused]`);t?.remove(),e.removeAttribute("data-focused-id")}}(e.svgHighlight,t):e.classList.toggle("hypothesis-highlight-focused",t)}))}function Ci(e){Ei(Si(e)),function(e){for(const[t,n]of function(e){
84
84
  const t=new Map;for(const n of(e??document).getElementsByClassName("hypothesis-highlight-layer"))t.set(n,Array.from(n.querySelectorAll(".hypothesis-svg-highlight")));return t}(e)){n.every(((e,t,n)=>0===t||Ai(e)>=Ai(n[t-1])))||(n.sort(((e,t)=>Ai(e)-Ai(t))),t.replaceChildren(...n))}}(e)}const Ni=e=>"hypothesis-highlight"===e.tagName.toLowerCase();function Si(e){let t;return t=Ni(e)?Array.from(e.children).filter(Ni):Array.from(e.getElementsByTagName("hypothesis-highlight")).filter((e=>!e.parentElement||!Ni(e.parentElement))),t}function Ei(e,t="",n=0,i=0){for(const o of e){const e=bi.find((e=>o.classList.contains(e)))??"other-content",r=t&&e===t?i+1:0;o.setAttribute("data-nesting-level",`${n}`),o.setAttribute("data-cluster-level",`${r}`),o.svgHighlight&&(o.svgHighlight.setAttribute("data-nesting-level",`${n}`),o.svgHighlight.setAttribute("data-cluster-level",`${r}`)),Ei(Si(o),e,n+1,r)}}function Ai(e){
85
85
  return e.getAttribute("data-is-focused")?Number.MAX_SAFE_INTEGER:parseInt(e.getAttribute("data-nesting-level")??"0",10)}function ki(e){const t=[];return e.forEach((({annotation:e,highlights:n})=>{if(!n?.length)return;const{top:i,bottom:o}=function(e){const t=e.map((e=>e.getBoundingClientRect()));return t.reduce(((e,t)=>({top:Math.min(e.top,t.top),left:Math.min(e.left,t.left),bottom:Math.max(e.bottom,t.bottom),right:Math.max(e.right,t.right)})))}(n);i>=o||t.push({tag:e.$tag,top:i,bottom:o})})),t.sort(((e,t)=>e.top-t.top)),t}class Ti{constructor({contentContainer:e,hostRPC:t}){this._hostRPC=t,this._updatePending=!1,this._anchors=[],this._listeners=new i,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(e,"scroll",(()=>this.update()),{capture:!0})}destroy(){this._listeners.removeAll()}update(e){e&&(this._anchors=e),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const e=ki(this._anchors)
86
- ;this._hostRPC.call("anchorsChanged",e),this._updatePending=!1})))}}class Ri extends CustomEvent{constructor(e){super("hypothesis:layoutchange",{bubbles:!0,cancelable:!1,detail:e})}}const Pi=new Set;function Oi(...e){const t=e.join();Pi.has(t)||(console.warn(...e),Pi.add(t))}Oi.reset=()=>{Pi.clear()};const Ii=["styled_highlight_clusters"];class Mi extends h.TinyEmitter{constructor(e=Ii){super(),this._flags=new Map,this._knownFlags=e}update(e){this._flags.clear();for(const[t,n]of Object.entries(e))this._flags.set(t,n);this.emit("flagsChanged")}flagEnabled(e){return this._knownFlags.includes(e)?this._flags.get(e)??!1:(Oi("Looked up unknown feature",e),!1)}allFlags(){return Object.fromEntries(this._flags)}}function Li({cluster:e,label:t,onChange:n,currentStyles:i,highlightStyles:o}){const r=i[e],s="transparent"===r;return Nt("div",{className:"space-y-2",children:[Nt("div",{className:"flex items-center gap-x-2 text-annotator-base",children:Nt("div",{className:"grow text-color-text px-2 py-1 rounded",style:{
86
+ ;this._hostRPC.call("anchorsChanged",e),this._updatePending=!1})))}}class Ri extends CustomEvent{constructor(e){super("hypothesis:layoutchange",{bubbles:!0,cancelable:!1,detail:e})}}const Pi=new Set;function Ii(...e){const t=e.join();Pi.has(t)||(console.warn(...e),Pi.add(t))}Ii.reset=()=>{Pi.clear()};const Oi=["styled_highlight_clusters"];class Mi extends h.TinyEmitter{constructor(e=Oi){super(),this._flags=new Map,this._knownFlags=e}update(e){this._flags.clear();for(const[t,n]of Object.entries(e))this._flags.set(t,n);this.emit("flagsChanged")}flagEnabled(e){return this._knownFlags.includes(e)?this._flags.get(e)??!1:(Ii("Looked up unknown feature",e),!1)}allFlags(){return Object.fromEntries(this._flags)}}function Li({cluster:e,label:t,onChange:n,currentStyles:i,highlightStyles:o}){const r=i[e],s="transparent"===r;return Nt("div",{className:"space-y-2",children:[Nt("div",{className:"flex items-center gap-x-2 text-annotator-base",children:Nt("div",{className:"grow text-color-text px-2 py-1 rounded",style:{
87
87
  backgroundColor:o[r].color},children:t})}),Nt("div",{className:"flex items-center gap-x-2",children:Object.keys(o).map((t=>Nt("div",{className:"relative",children:[Nt("input",{className:xt("absolute w-6 h-6","opacity-[.00001]","cursor-pointer"),name:e,id:`hypothesis-${e}-${t}`,checked:r===t,onChange:n,type:"radio",value:t}),Nt("label",{className:"block",htmlFor:`${e}-${t}`,children:[Nt("div",{style:{backgroundColor:o[t].color},className:xt("block w-6 h-6 rounded-full flex items-center justify-center",{"border-2 border-slate-0":r!==t,"border-2 border-slate-3":r===t}),children:"transparent"===t&&Nt(Kt,{className:xt("w-3 h-3",{"text-slate-3":!s,"text-slate-7":s})})}),Nt("span",{className:"sr-only",children:t})]})]},`${e}-${t}`)))})]})}function Bi({active:e,availableStyles:t,currentStyles:n,onStyleChange:i}){const o=Qe((e=>{const t=e.target,n=t.name,o=t.value;i(n,o)}),[i]),[r,s]=je(!1);return e?Nt(Et,{classes:"overflow-hidden",children:Nt("div",{className:"flex flex-col text-annotator-base text-color-text",
88
88
  children:[Nt(_n,{classes:"rounded-none","data-testid":"control-toggle-button",onClick:()=>s(!r),title:r?"Hide highlight settings":"Show highlight settings",children:Nt(de,r?{children:[Nt(Mt,{}),Nt("span",{children:"Highlight Appearance"})]}:{children:[Nt(Ft,{}),Nt(Zt,{})]})}),r&&Nt(kt,{"data-testid":"cluster-style-controls",size:"sm",children:[Nt(Li,{highlightStyles:t,label:"My annotations",cluster:"user-annotations",onChange:o,currentStyles:n}),Nt(Li,{highlightStyles:t,label:"My highlights",cluster:"user-highlights",onChange:o,currentStyles:n}),Nt(Li,{highlightStyles:t,label:"Everybody's content",cluster:"other-content",onChange:o,currentStyles:n})]})]})}):null}const Di={transparent:{color:"transparent",secondColor:"transparent",thirdColor:"transparent"},pink:{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)",
89
89
  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)"}},Fi={"other-content":"yellow","user-annotations":"orange","user-highlights":"purple"};class Hi{constructor(e,t){this._element=e,this._features=t.features,this._container=new Kn("highlight-cluster-toolbar",(()=>this._render())),this._element.appendChild(this._container.element),Object.assign(this._container.element.style,{position:"fixed",top:`${this._element.offsetTop+4}px`,left:"4px"}),this.appliedStyles=Fi,this._init(),
@@ -108,24 +108,24 @@ this.features.off("flagsChanged",this._flagsChanged)}contentContainer(){return t
108
108
  ;if(o.forEach((({rect:e})=>{let i=t.get(e.left)??0;i+=1,t.set(e.left,i);let o=n.get(e.right)??0;o+=1,n.set(e.right,o)})),0===t.size||0===n.size)return null;const r=[...t.entries()].sort(((e,t)=>t[1]-e[1])),s=[...n.entries()].sort(((e,t)=>t[1]-e[1])),[a]=r[0],[l]=s[0];return{left:a,right:l}}(document.body);if(i){const o=Math.max(0,window.innerWidth-t-i.right);if(o>0){const e=Math.max(0,t-o);document.body.style.marginRight=`${e}px`}n(document.body)>e&&(document.body.style.marginLeft=`${e}px`),i.left<12&&(document.body.style.marginLeft="12px")}else document.body.style.marginLeft="",document.body.style.marginRight=""}))}_deactivateSideBySide(){U((()=>{document.body.style.marginLeft="",document.body.style.marginRight=""}))}async getMetadata(){return this._htmlMeta.getDocumentMetadata()}async uri(){return this._htmlMeta.uri()}async scrollToAnchor(e){const t=e.highlights?.[0];t&&await async function(e,{maxDuration:t=500}={}){const n=e.closest("body");n&&"BODY"!==n.tagName&&Object.defineProperty(n,"tagName",{
109
109
  value:"BODY",configurable:!0});const i=e.closest("details");i&&!i.hasAttribute("open")&&(i.open=!0),await new Promise((n=>fo(e,{time:t},n)))}(t)}}var vo,yo;var wo=function(){if(yo)return vo;yo=1;var t=NaN,n="[object Symbol]",i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),h=Object.prototype.toString,d=Math.max,f=Math.min,m=function(){return u.Date.now()};function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&h.call(e)==n}(e))return t;if(p(e)){var l="function"==typeof e.valueOf?e.valueOf():e;e=p(l)?l+"":l}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var c=r.test(e);return c||s.test(e)?a(e.slice(2),c?2:8):o.test(e)?t:+e}return vo=function(e,t,n){var i,o,r,s,a,l,c=0,u=!1,h=!1,_=!0
110
110
  ;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=i,r=o;return i=o=void 0,c=t,s=e.apply(r,n)}function v(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=r}function y(){var e=m();if(v(e))return w(e);a=setTimeout(y,function(e){var n=t-(e-l);return h?f(n,r-(e-c)):n}(e))}function w(e){return a=void 0,_&&i?b(e):(i=o=void 0,s)}function x(){var e=m(),n=v(e);if(i=arguments,o=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(y,t),u?b(e):s}(l);if(h)return a=setTimeout(y,t),b(l)}return void 0===a&&(a=setTimeout(y,t)),s}return t=g(t)||0,p(n)&&(u=!!n.leading,r=(h="maxWait"in n)?d(g(n.maxWait)||0,t):r,_="trailing"in n?!!n.trailing:_),x.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=o=a=void 0},x.flush=function(){return void 0===a?s:w(m())},x},vo}(),xo=t(wo);function Co(e,t,n,i=0){let o=i;for(;o<e.length&&t>0;)n(e[o])&&--t,++o;return o}function No(e,t,n,i){let o=0;for(let r=n;r<i;r++)t(e[r])&&++o;return o}function So(e,t,n,i,o){
111
- const r=No(e,o,0,n),s=No(e,o,n,i);let a=Co(t,r,o);for(;a<t.length&&!o(t[a]);)++a;return[a,Co(t,s,o,a)]}const Eo={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},Ao=new Map,ko=new Map;function To(e,t){return`${e}:${t}`}function Ro(e){const t="closest"in e?e:e.parentElement;return t?.closest(".textLayer")??null}function Po(){return PDFViewerApplication.pdfViewer}async function Oo(e){const t=Po();let n=t.getPageView(e);return n&&n.pdfPage||(n=await new Promise((n=>{const i=()=>{t.eventBus?t.eventBus.off("pagesloaded",i):document.removeEventListener("pagesloaded",i),n(t.getPageView(e))};t.eventBus?t.eventBus.on("pagesloaded",i):document.addEventListener("pagesloaded",i)}))),n}function Io(e){const t=Ao.get(e);if(t)return t;const n=(async()=>{const t=await Oo(e);return(await t.pdfPage.getTextContent({normalizeWhitespace:!0})).items.map((e=>e.str)).join("")})();return Ao.set(e,n),n}async function Mo(e){const t=Po();let n=0,i=0,o="";for(let r=0;r<t.pagesCount;r++)if(o=await Io(r),n=i,i+=o.length,i>=e)return{index:r,
112
- offset:n,text:o};return{index:t.pagesCount-1,offset:n,text:o}}function Lo(e){switch(e){case" ":case"\f":case"\n":case"\r":case"\t":case"\v":case" ":return!0;default:return!1}}const Bo=e=>!Lo(e);function Do(e){return void 0!==e.renderingDone?e.renderingDone:!!e.div&&null!==e.div.querySelector(".endOfContent")}async function Fo(e,t,n){const[i,o]=await Promise.all([Oo(e),Io(e)]);if(i.renderingState===Eo.FINISHED&&i.textLayer&&Do(i.textLayer)){const e=i.textLayer.textLayerDiv??i.textLayer.div;if(!e)throw new Error("Unable to find PDF.js text layer root");const r=e.textContent,[s,a]=So(o,r,t,n,Bo);Ho(r.slice(s,a))!==Ho(o.slice(t,n))&&Oi("Text layer text does not match page text. Highlights will be mis-aligned.");const l=new ai(e,s),c=new ai(e,a);return new li(l,c).toRange()}const r=function(e){let t=e.querySelector(ci);return t||(t=document.createElement("span"),t.classList.add("annotator-placeholder"),t.textContent="Loading annotations...",e.appendChild(t),t)}(i.div),s=document.createRange()
113
- ;return s.setStartBefore(r),s.setEndAfter(r),s}function Ho(e){let t="";for(let n=0;n<e.length;n++){const i=e[n];Lo(i)||(t+=i)}return t}async function Vo(e,t){const n=t.find((e=>"TextQuoteSelector"===e.type));if(!n)throw new Error("No quote selector found");const i=t.find((e=>"TextPositionSelector"===e.type));if(i){try{const{index:e,offset:t,text:o}=await Mo(i.start),r=i.start-t,s=i.end-t,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await Fo(e,r,s)}catch{}try{const e=To(n.exact,i.start),t=ko.get(e);if(t){const{pageIndex:e,anchor:n}=t;return await Fo(e,n.start,n.end)}}catch{}}return async function(e,t){const n=Po().pagesCount,i=Array(n).fill(0).map(((e,t)=>t));let o,r;if(t){const{index:e,offset:n}=await Mo(t);o=e,r=t-n,i.sort(((t,n)=>Math.abs(t-e)-Math.abs(n-e)))}const s=void 0!==e.prefix?Ho(e.prefix):void 0,a=void 0!==e.suffix?Ho(e.suffix):void 0,l=Ho(e.exact);let c;for(const e of i){const t=await Io(e),n=Ho(t);let i
111
+ const r=No(e,o,0,n),s=No(e,o,n,i);let a=Co(t,r,o);for(;a<t.length&&!o(t[a]);)++a;return[a,Co(t,s,o,a)]}const Eo={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},Ao=new Map,ko=new Map;function To(e,t){return`${e}:${t}`}function Ro(e){const t="closest"in e?e:e.parentElement;return t?.closest(".textLayer")??null}function Po(){return PDFViewerApplication.pdfViewer}async function Io(e){const t=Po();let n=t.getPageView(e);return n&&n.pdfPage||(n=await new Promise((n=>{const i=()=>{t.eventBus?t.eventBus.off("pagesloaded",i):document.removeEventListener("pagesloaded",i),n(t.getPageView(e))};t.eventBus?t.eventBus.on("pagesloaded",i):document.addEventListener("pagesloaded",i)}))),n}function Oo(e){const t=Ao.get(e);if(t)return t;const n=(async()=>{const t=await Io(e);return(await t.pdfPage.getTextContent({normalizeWhitespace:!0})).items.map((e=>e.str)).join("")})();return Ao.set(e,n),n}async function Mo(e){const t=Po();let n=0,i=0,o="";for(let r=0;r<t.pagesCount;r++)if(o=await Oo(r),n=i,i+=o.length,i>=e)return{index:r,
112
+ offset:n,text:o};return{index:t.pagesCount-1,offset:n,text:o}}function Lo(e){switch(e){case" ":case"\f":case"\n":case"\r":case"\t":case"\v":case" ":return!0;default:return!1}}const Bo=e=>!Lo(e);function Do(e){return void 0!==e.renderingDone?e.renderingDone:!!e.div&&null!==e.div.querySelector(".endOfContent")}async function Fo(e,t,n){const[i,o]=await Promise.all([Io(e),Oo(e)]);if(i.renderingState===Eo.FINISHED&&i.textLayer&&Do(i.textLayer)){const e=i.textLayer.textLayerDiv??i.textLayer.div;if(!e)throw new Error("Unable to find PDF.js text layer root");const r=e.textContent,[s,a]=So(o,r,t,n,Bo);Ho(r.slice(s,a))!==Ho(o.slice(t,n))&&Ii("Text layer text does not match page text. Highlights will be mis-aligned.");const l=new ai(e,s),c=new ai(e,a);return new li(l,c).toRange()}const r=function(e){let t=e.querySelector(ci);return t||(t=document.createElement("span"),t.classList.add("annotator-placeholder"),t.textContent="Loading annotations...",e.appendChild(t),t)}(i.div),s=document.createRange()
113
+ ;return s.setStartBefore(r),s.setEndAfter(r),s}function Ho(e){let t="";for(let n=0;n<e.length;n++){const i=e[n];Lo(i)||(t+=i)}return t}async function Vo(e,t){const n=t.find((e=>"TextQuoteSelector"===e.type));if(!n)throw new Error("No quote selector found");const i=t.find((e=>"TextPositionSelector"===e.type));if(i){try{const{index:e,offset:t,text:o}=await Mo(i.start),r=i.start-t,s=i.end-t,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await Fo(e,r,s)}catch{}try{const e=To(n.exact,i.start),t=ko.get(e);if(t){const{pageIndex:e,anchor:n}=t;return await Fo(e,n.start,n.end)}}catch{}}return async function(e,t){const n=Po().pagesCount,i=Array(n).fill(0).map(((e,t)=>t));let o,r;if(t){const{index:e,offset:n}=await Mo(t);o=e,r=t-n,i.sort(((t,n)=>Math.abs(t-e)-Math.abs(n-e)))}const s=void 0!==e.prefix?Ho(e.prefix):void 0,a=void 0!==e.suffix?Ho(e.suffix):void 0,l=Ho(e.exact);let c;for(const e of i){const t=await Oo(e),n=Ho(t);let i
114
114
  ;void 0!==o&&void 0!==r&&(e<o?i=n.length:e===o?[i]=So(t,n,r,r,Bo):i=0);const u=Xi(n,l,{prefix:s,suffix:a,hint:i});if(u&&(!c||u.score>c.match.score)){const[i,o]=So(n,t,u.start,u.end,Bo);c={page:e,match:{start:i,end:o,score:u.score}};const r=n.slice(u.start,u.end)===l,h=void 0!==s&&n.slice(Math.max(0,u.start-s.length),u.start)===s,d=void 0!==a&&n.slice(u.end,a.length)===a;if(r&&(h||d||void 0===s&&void 0===a))break}}if(c){const{page:n,match:i}=c;if(t){const o=To(e.exact,t);ko.set(o,{pageIndex:n,anchor:i})}return Fo(n,i.start,i.end)}throw new Error("Quote not found")}(n,i?.start)}function Uo(e){try{e=li.fromRange(e).toRange()}catch{throw new Error("Selection does not contain text")}const t=Ro(e.startContainer),n=Ro(e.endContainer);if(!t||!n)throw new Error("Selection is outside page text");if(t!==n)throw new Error("Selecting across page breaks is not supported");return[e,t]}async function qo(e,t){
115
- const[n,i]=Uo(t),o=ai.fromPoint(n.startContainer,n.startOffset).relativeTo(i),r=ai.fromPoint(n.endContainer,n.endOffset).relativeTo(i),s=function(e){let t=0;for(;e.previousSibling;)++t,e=e.previousSibling;return t}(i.parentNode),a=s+1,l=await async function(e){if(e>=Po().pagesCount)throw new Error("Invalid page index");let t=0;for(let n=0;n<e;n++)t+=(await Io(n)).length;return t}(s),c=await Oo(s);return[{type:"TextPositionSelector",start:l+o.offset,end:l+r.offset},eo.fromRange(e,n).toSelector(),{type:"PageSelector",index:s,label:c.pageLabel??a.toString()}]}function Wo({children:e}){return Nt("div",{className:"flex flex-col",children:e})}function $o({info:e}){let t=e.item.title;return e.item.subtitle&&(t+=`: ${e.item.subtitle}`),Nt("div",{className:xt("h-10 bg-white px-4 text-slate-7 text-annotator-base border-b","grid items-center","grid-cols-[100px_minmax(0,auto)]","2xl:grid-cols-[100px_minmax(0,auto)_minmax(0,auto)] 2xl:gap-x-3"),children:[Nt("div",{"data-testid":"content-logo",children:e.logo&&Nt(Un,{
115
+ const[n,i]=Uo(t),o=ai.fromPoint(n.startContainer,n.startOffset).relativeTo(i),r=ai.fromPoint(n.endContainer,n.endOffset).relativeTo(i),s=function(e){let t=0;for(;e.previousSibling;)++t,e=e.previousSibling;return t}(i.parentNode),a=s+1,l=await async function(e){if(e>=Po().pagesCount)throw new Error("Invalid page index");let t=0;for(let n=0;n<e;n++)t+=(await Oo(n)).length;return t}(s),c=await Io(s);return[{type:"TextPositionSelector",start:l+o.offset,end:l+r.offset},eo.fromRange(e,n).toSelector(),{type:"PageSelector",index:s,label:c.pageLabel??a.toString()}]}function Wo({children:e}){return Nt("div",{className:"flex flex-col",children:e})}function $o({info:e}){let t=e.item.title;return e.item.subtitle&&(t+=`: ${e.item.subtitle}`),Nt("div",{className:xt("h-10 bg-white px-4 text-slate-7 text-annotator-base border-b","grid items-center","grid-cols-[100px_minmax(0,auto)]","2xl:grid-cols-[100px_minmax(0,auto)_minmax(0,auto)] 2xl:gap-x-3"),children:[Nt("div",{"data-testid":"content-logo",children:e.logo&&Nt(Un,{
116
116
  href:e.logo.link,target:"_blank","data-testid":"logo-link",underline:"none",children:Nt("img",{alt:e.logo.title,src:e.logo.logo,"data-testid":"logo-image"})})}),Nt("div",{className:xt("hidden","2xl:block 2xl:whitespace-nowrap 2xl:overflow-hidden 2xl:text-ellipsis","font-semibold"),"data-testid":"content-container-info",title:e.container.title,children:e.container.title}),Nt("div",{className:xt("flex justify-center items-center gap-x-2"),"data-testid":"content-item-info",children:[Nt("div",{className:xt("hidden","2xl:block 2xl:grow")}),e.links.previousItem&&Nt(de,{children:[Nt(Un,{title:"Open previous item",href:e.links.previousItem,underline:"always",target:"_blank","data-testid":"content-previous-link",children:Nt("div",{className:"flex gap-x-1 items-center text-annotator-sm whitespace-nowrap",children:[Nt(Bt,{className:"w-em h-em"}),Nt("span",{children:"Previous"})]})}),Nt("div",{className:"text-annotator-sm",children:"|"})]}),Nt("div",{
117
117
  className:xt("min-w-0 whitespace-nowrap overflow-hidden text-ellipsis shrink font-medium"),children:Nt(Un,{title:t,href:e.links.currentItem,"data-testid":"content-item-link",target:"_blank",unstyled:!0,children:t})}),e.links.nextItem&&Nt(de,{children:[Nt("div",{className:"text-annotator-sm",children:"|"}),Nt(Un,{title:"Open next item",href:e.links.nextItem,underline:"always",target:"_blank","data-testid":"content-next-link",children:Nt("div",{className:"flex gap gap-x-1 items-center text-annotator-sm whitespace-nowrap",children:[Nt("span",{children:"Next"}),Nt(Ft,{className:"w-em h-em"})]})})]})]})]})}function zo(){return Nt("div",{className:"bg-white",role:"alert",children:Nt("div",{className:xt("flex items-center gap-x-2","border border-yellow-notice bg-yellow-notice/10 text-annotator-base"),children:[Nt("div",{className:"bg-yellow-notice text-white p-2",children:Nt(Vt,{className:"text-annotator-xl"})}),Nt("div",{children:[Nt("strong",{children:"This PDF does not contain selectable text:"})," ",Nt(Un,{
118
118
  target:"_blank",href:"https://web.hypothes.is/help/how-to-ocr-optimize-pdfs/",underline:"always",children:"Learn how to fix this"})," ","in order to annotate with Hypothesis."]})]})})}class jo{constructor(e){this._loaded=function(e){return e.initializedPromise?e.initializedPromise:e.initialized?Promise.resolve():new Promise((t=>{const n=setInterval((()=>{e.initialized&&(clearTimeout(n),t())}),5)}))}(e).then((async()=>{const t=await async function(e){return void 0!==e.downloadComplete?e.downloadComplete:(await e.pdfDocument.getDownloadInfo(),!0)}(e);return t?e:new Promise((t=>{const n=()=>{e.eventBus?(e.eventBus.off("documentload",n),e.eventBus.off("documentloaded",n)):window.removeEventListener("documentload",n),t(e)};e.eventBus?(e.eventBus.on("documentloaded",n),e.eventBus.on("documentload",n)):window.addEventListener("documentload",n)}))}))}getUri(){return this._loaded.then((e=>{let t=Go(e);return t||(t=Yo(Xo(e))),t}))}async getMetadata(){
119
119
  const e=await this._loaded,{info:t,contentDispositionFilename:n,metadata:i}=await e.pdfDocument.getMetadata(),o=Xo(e),r=Go(e);let s;s=i?.has("dc:title")&&"Untitled"!==i.get("dc:title")?i.get("dc:title"):t?.Title?t.Title:n||(r?function(e){const t=new URL(e),n=t.pathname.split("/");return n[n.length-1]}(r):"");const a=[{href:Yo(o)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:o}}}function Xo(e){return Array.isArray(e.pdfDocument.fingerprints)?e.pdfDocument.fingerprints[0]:e.pdfDocument.fingerprint}function Yo(e){return`urn:x-pdf:${e}`}function Go(e){if(!e.url)return null;const t=go(e.url);return 0!==t.indexOf("file://")?t:null}function Ko(e){const t=e.highlights?.[0];return t&&ui(t)}function Qo(e){return new Promise((t=>setTimeout(t,e)))}class Zo{constructor(){this._pdfjsContainer=document.querySelector("#outerContainer"),this._contentInfo=null,this._noTextWarning=!1,this._container=null}setContentInfo(e){this._contentInfo=e,this._update()}showNoTextWarning(e){this._noTextWarning=e,
120
120
  this._update()}destroy(){this._container?.destroy()}_update(){if(!(this._noTextWarning||this._contentInfo))return this._container?.destroy(),this._container=null,void(this._pdfjsContainer.style.height="");this._container||(this._container=new Kn("banner",(()=>this._render())),document.body.prepend(this._container.element)),this._container.render();const e=this._container.element.getBoundingClientRect().height;this._pdfjsContainer.style.height=`calc(100% - ${e}px)`}_render(){return Nt(Wo,{children:[this._contentInfo&&Nt($o,{info:this._contentInfo}),this._noTextWarning&&Nt(zo,{})]})}}class Jo extends h.TinyEmitter{constructor(e,t={}){super(),this._annotator=e;const n=window,o=n.PDFViewerApplication;this._pdfViewer=o.pdfViewer,this._pdfViewer.viewer.classList.add("has-transparent-text-layer"),this._pdfContainer=o.appConfig?.appContainer??document.body,this._pdfMetadata=new jo(o),this._observer=new MutationObserver(xo((()=>this._update()),100)),this._observer.observe(this._pdfViewer.viewer,{attributes:!0,
121
121
  attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=t.reanchoringMaxWait??3e3,this._banner=new Zo,this._checkForSelectableText(),this._sideBySideActive=!1,this._updateAnnotationLayerVisibility=()=>{const e=n.getSelection();this._pdfViewer.viewer.classList.toggle("is-selecting",!e.isCollapsed)},this._listeners=new i,this._listeners.add(document,"selectionchange",this._updateAnnotationLayerVisibility),this._destroyed=!1}destroy(){this.fitSideBySide({expanded:!1,width:0,toolbarWidth:0,height:window.innerHeight}),this._listeners.removeAll(),this._pdfViewer.viewer.classList.remove("has-transparent-text-layer"),this._observer.disconnect(),this._banner.destroy(),this._destroyed=!0}uri(){return this._pdfMetadata.getUri()}getMetadata(){return this._pdfMetadata.getMetadata()}showContentInfo(e){this._banner.setContentInfo(e)}anchor(e,t){return Vo(0,t)}getAnnotatableRange(e){try{const t=li.trimmedRange(e);if(function(e){try{return Uo(e),!0}catch{return!1}}(t))return t}catch(e){
122
- if(!(e instanceof RangeError))throw e}return null}canStyleClusteredHighlights(){return!0}describe(e,t){return qo(e,t)}async _checkForSelectableText(){try{await this.uri()}catch(e){return}if(!this._destroyed)try{const e=await async function(){const e=Po();let t=!1;for(let n=0;n<e.pagesCount;n++)if((await Io(n)).trim().length>0){t=!0;break}return t}();this._banner.showNoTextWarning(!e)}catch(e){console.warn("Unable to check for text in PDF:",e)}}_update(){const e=[],t=this._pdfViewer.pagesCount;for(let e=0;e<t;e++){const t=this._pdfViewer.getPageView(e);if(t?.textLayer&&Do(t.textLayer))switch(t.renderingState){case Eo.INITIAL:t.textLayer=null;break;case Eo.FINISHED:n=t.div,n.querySelector(ci)?.remove()}}var n;for(const t of this._annotator.anchors)if(t.highlights){if(e.includes(t.annotation))continue;for(let n=0;n<t.highlights.length;n++){const i=t.highlights[n];if(!document.body.contains(i)){t.highlights.splice(n,1),delete t.range,e.push(t.annotation);break}}}e.map((e=>this._annotator.anchor(e)))}
122
+ if(!(e instanceof RangeError))throw e}return null}canStyleClusteredHighlights(){return!0}describe(e,t){return qo(e,t)}async _checkForSelectableText(){try{await this.uri()}catch(e){return}if(!this._destroyed)try{const e=await async function(){const e=Po();let t=!1;for(let n=0;n<e.pagesCount;n++)if((await Oo(n)).trim().length>0){t=!0;break}return t}();this._banner.showNoTextWarning(!e)}catch(e){console.warn("Unable to check for text in PDF:",e)}}_update(){const e=[],t=this._pdfViewer.pagesCount;for(let e=0;e<t;e++){const t=this._pdfViewer.getPageView(e);if(t?.textLayer&&Do(t.textLayer))switch(t.renderingState){case Eo.INITIAL:t.textLayer=null;break;case Eo.FINISHED:n=t.div,n.querySelector(ci)?.remove()}}var n;for(const t of this._annotator.anchors)if(t.highlights){if(e.includes(t.annotation))continue;for(let n=0;n<t.highlights.length;n++){const i=t.highlights[n];if(!document.body.contains(i)){t.highlights.splice(n,1),delete t.range,e.push(t.annotation);break}}}e.map((e=>this._annotator.anchor(e)))}
123
123
  contentContainer(){return document.querySelector("#viewerContainer")}fitSideBySide(e){const t=window.innerWidth-e.width,n=e.expanded&&t>=680,i=n?e.width:e.toolbarWidth;this._pdfContainer.style.width=`calc(100% - ${i}px)`;const o=this._pdfViewer.currentScaleValue;return"auto"!==o&&"page-fit"!==o&&"page-width"!==o||(this._pdfViewer.currentScaleValue=o),this._pdfViewer.update(),this._sideBySideActive=n,n}sideBySideActive(){return this._sideBySideActive}async scrollToAnchor(e){const t=e.annotation,n=Ko(e),i=this._anchorOffset(e);if(null!==i&&(await po(this.contentContainer(),i),n)){const e=await this._waitForAnnotationToBeAnchored(t,this._reanchoringMaxWait);if(!e)return;const n=this._anchorOffset(e);if(null===n)return;await po(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(e,t){const n=Date.now();let i;do{i=this._annotator.anchors.find((t=>t.annotation===e)),i&&!Ko(i)||(i=null,await Qo(20))}while(!i&&Date.now()-n<t);return i??null}_anchorOffset(e){if(!e.highlights)return null
124
124
  ;return function(e,t){let n=0;for(;e!==t&&t.contains(e);)n+=e.offsetTop,e=e.offsetParent;return n}(e.highlights[0],this.contentContainer())}}function er(e){if(!e.includes("["))return e;let t="",n=!1,i=!1;for(const o of e)n||"^"!==o?(n||"["!==o?!n&&i&&"]"===o?i=!1:i||(t+=o):i=!0,n=!1):n=!0;return t}function tr(e){const t=er(e),n=t.indexOf("!");return-1===n?t:t.slice(0,n)}class nr{constructor(e,t,n){this._element=e,this._onFrameAdded=t,this._onFrameRemoved=n,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(xo((()=>{this._discoverFrames()}),40)),this._discoverFrames(),this._mutationObserver.observe(this._element,{childList:!0,subtree:!0,attributeFilter:["enable-annotation"]})}disconnect(){this._isDisconnected=!0,this._mutationObserver.disconnect()}async _addFrame(e){this._annotatableFrames.add(e);try{if(await ir(e),this._isDisconnected)return;e.contentWindow.addEventListener("unload",(()=>{this._removeFrame(e)})),this._onFrameAdded(e)}catch(t){
125
125
  console.warn(`Unable to inject the Hypothesis client (from '${document.location.href}' into a cross-origin frame '${e.src}')`)}}_removeFrame(e){this._annotatableFrames.delete(e),this._onFrameRemoved(e)}_discoverFrames(){const e=new Set(this._element.querySelectorAll("iframe[enable-annotation]"));for(const t of e)this._annotatableFrames.has(t)||this._addFrame(t);for(const t of this._annotatableFrames)e.has(t)||this._removeFrame(t)}}function ir(e){return new Promise(((t,n)=>{const i=or(e,((e,o)=>{i(),o?t(o):n(e)}))}))}function or(e,t,{pollInterval:n=10}={}){let i,o;const r=new WeakSet,s=()=>{clearTimeout(i),i=void 0},a=()=>{const n=e.contentDocument;if(n){if(!r.has(n)){if(r.add(n),s(),!function(e){return"about:blank"===e.contentDocument?.location.href&&e.hasAttribute("src")&&"about:blank"!==e.src}(e)){"interactive"===n.readyState||"complete"===n.readyState?t(null,n):n.addEventListener("DOMContentLoaded",(()=>t(null,n)))}e.contentDocument&&e.contentWindow?.addEventListener("unload",o)}}else{s()
126
126
  ;const n=e.isConnected?"Frame is cross-origin":"Frame is disconnected";t(new Error(n))}};let l=!1;o=()=>{s(),l||(i=setInterval(a,n))},e.addEventListener("load",a);const c=setTimeout(a,0);return()=>{l=!0,clearTimeout(c),s(),e.removeEventListener("load",a)}}class rr{constructor(e,t){this._config=t,this._frameObserver=new nr(e,(e=>sr(e,t)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function sr(e,t,n){if(null!==e.contentDocument.querySelector("script.js-hypothesis-config"))return;await ir(e);const{assetRoot:i,notebookAppUrl:o,profileAppUrl:s,sidebarAppUrl:a}=N(document),l={...t,assetRoot:i,notebookAppUrl:o,profileAppUrl:s,sidebarAppUrl:a,subFrameIdentifier:n??r(10)},c=document.createElement("script");c.className="js-hypothesis-config",c.setAttribute("data-remove-on-unload",""),c.type="application/json",c.innerText=JSON.stringify(l);const u=document.createElement("script");u.async=!0,u.src=t.clientUrl;const h=e.contentDocument;h.body.appendChild(c),h.body.appendChild(u)}class ar{
127
127
  constructor(e,t,n){if(t.length!==n.length)throw new Error("Char boxes length does not match text length");const o=e.parentNode,r=document.createElement("hypothesis-text-layer");o.insertBefore(r,e.nextSibling),o.style.position="relative",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.color="transparent",r.style.textAlign="left",r.style.mixBlendMode="multiply";const s="sans-serif";r.style.fontSize="16px",r.style.fontFamily=s;const a=document.createElement("canvas").getContext("2d");a.font=`16px ${s}`;const l=(e,t,n="px")=>`calc(var(--${e}-scale) * ${t}${n})`,c=function(e,t){const n=[];let i={text:"",rect:new DOMRect};const o=()=>{i.text.length>0&&(n.push(i),i={text:"",rect:new DOMRect})};for(const[n,r]of e.entries()){const e=t[n],s=/\s/.test(e);i.text.length>0&&!T(i.rect,r)&&o(),i.rect=P(i.rect,r),i.text+=s?" ":e,s&&o()}o();const r=[];let s={words:[],rect:new DOMRect};const a=()=>{s.words.length>0&&(r.push(s),s={words:[],rect:new DOMRect})};for(const e of n){
128
- const t=s.words[s.words.length-1];if(t){const n=O(t.rect),i=O(e.rect).x-n.x;(!T(t.rect,e.rect)||i<0)&&a()}s.words.push(e),s.rect=P(s.rect,e.rect)}a();const l=[];let c={lines:[],rect:new DOMRect};const u=()=>{c.lines.length>0&&(l.push(c),c={lines:[],rect:new DOMRect})};for(const e of r){const t=c.lines[c.lines.length-1];if(t){const n=O(t.rect),i=O(e.rect).y-n.y;(!R(t.rect,e.rect)||T(t.rect,e.rect)||i<0||i>4*e.rect.height)&&u()}c.lines.push(e),c.rect=P(c.rect,e.rect)}return u(),l}(t,n);for(const e of c){const t=document.createElement("hypothesis-text-column");t.style.display="block",t.style.position="absolute",t.style.left=l("x",e.rect.left),t.style.top=l("y",e.rect.top);let n=null;for(const i of e.lines){const o=document.createElement("hypothesis-text-line");o.style.display="block",o.style.marginLeft=l("x",i.rect.left-e.rect.left),o.style.height=l("y",i.rect.height),n&&(o.style.marginTop=l("y",i.rect.top-n.rect.bottom)),n=i,o.style.whiteSpace="nowrap";let r=null;for(const e of i.words){
128
+ const t=s.words[s.words.length-1];if(t){const n=I(t.rect),i=I(e.rect).x-n.x;(!T(t.rect,e.rect)||i<0)&&a()}s.words.push(e),s.rect=P(s.rect,e.rect)}a();const l=[];let c={lines:[],rect:new DOMRect};const u=()=>{c.lines.length>0&&(l.push(c),c={lines:[],rect:new DOMRect})};for(const e of r){const t=c.lines[c.lines.length-1];if(t){const n=I(t.rect),i=I(e.rect).y-n.y;(!R(t.rect,e.rect)||T(t.rect,e.rect)||i<0||i>4*e.rect.height)&&u()}c.lines.push(e),c.rect=P(c.rect,e.rect)}return u(),l}(t,n);for(const e of c){const t=document.createElement("hypothesis-text-column");t.style.display="block",t.style.position="absolute",t.style.left=l("x",e.rect.left),t.style.top=l("y",e.rect.top);let n=null;for(const i of e.lines){const o=document.createElement("hypothesis-text-line");o.style.display="block",o.style.marginLeft=l("x",i.rect.left-e.rect.left),o.style.height=l("y",i.rect.height),n&&(o.style.marginTop=l("y",i.rect.top-n.rect.bottom)),n=i,o.style.whiteSpace="nowrap";let r=null;for(const e of i.words){
129
129
  const t=document.createElement("hypothesis-text-word");t.style.display="inline-block",t.style.transformOrigin="top left",t.textContent=e.text,r&&(t.style.marginLeft=l("x",e.rect.left-r.rect.right)),r=e,t.style.width=l("x",e.rect.width),t.style.height=l("y",e.rect.height),t.style.whiteSpace="pre";const n=a.measureText(e.text),i=l("x",e.rect.width/n.width,""),s=l("y",e.rect.height/16,"");t.style.transform=`scale(${i}, ${s})`,o.append(t)}t.append(o)}r.append(t)}const u=()=>{const{width:t,height:n}=e.getBoundingClientRect();r.style.width=t+"px",r.style.height=n+"px",r.style.setProperty("--x-scale",`${t}`),r.style.setProperty("--y-scale",`${n}`)};u(),this.container=r,this._updateTextLayerSize=xo(u,{maxWait:50}),this._listeners=new i,"undefined"!=typeof ResizeObserver&&(this._imageSizeObserver=new ResizeObserver((()=>{this._updateTextLayerSize()})),this._imageSizeObserver.observe(e)),this._listeners.add(window,"resize",this._updateTextLayerSize)}updateSync(){this._updateTextLayerSize(),
130
130
  this._updateTextLayerSize.flush()}destroy(){this.container.remove(),this._listeners.removeAll(),this._updateTextLayerSize.cancel(),this._imageSizeObserver?.disconnect()}}function lr(e=document){return e.querySelector("mosaic-book")}function cr(e=window){if(lr(e.document))return"container";const t=e.frameElement?.ownerDocument;return t&&lr(t)?"content":null}class ur{constructor(e){const t=lr();if(!t)throw new Error("Book container element not found");const n=new WeakSet,i=t.shadowRoot,o=()=>{const t=i.querySelector("iframe");t&&!n.has(t)&&(n.add(t),or(t,((n,i)=>{if(n)return;const o=i.body;o&&!o.querySelector("#page-content")&&sr(t,e,"vitalsource-content")})))};o(),this._frameObserver=new MutationObserver(o),this._frameObserver.observe(i,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}}function hr(){return document.querySelector("img#pbk-page")}class dr extends h.TinyEmitter{constructor(e=document.body,t={}){super();const n=t.bookElement??lr(window.parent.document)
131
131
  ;if(!n)throw new Error("Failed to find <mosaic-book> element in container frame");this._bookElement=n;const o=new Mi;this._htmlIntegration=new bo({container:e,features:o}),this._listeners=new i;const r=["mouseup","mousedown","mouseout"];for(const e of r)this._listeners.add(document.documentElement,e,(e=>{e.stopPropagation()}));const s=window.frameElement;s&&function(e){if("no"!==e.getAttribute("scrolling"))return;const t=document.createElement("style");t.textContent="iframe { height: 100% !important; }",e.insertAdjacentElement("beforebegin",t);const n=()=>e.removeAttribute("scrolling");n(),new MutationObserver(n).observe(e,{attributes:!0})}(s);const a=hr(),l=window.innerPageData;if(a&&l){const e=l.glyphs.glyphs.map((e=>{const t=e.l/100,n=e.r/100,i=e.t/100,o=e.b/100;return new DOMRect(t,i,n-t,o-i)}));this._textLayer=new ar(a,e,l.words),this._textLayer.container.style.zIndex="100",this._sideBySideActive=!1}}getAnnotatableRange(e){return this._htmlIntegration.getAnnotatableRange(e)}destroy(){
@@ -143,26 +143,26 @@ this._portFinder.discover("sidebar").then((e=>{this._sidebarRPC.connect(e)})),th
143
143
  const i=await this._integration.anchor(this.element,t.selector),o=li.fromRange(i);n={annotation:e,target:t,range:o}}catch(i){n={annotation:e,target:t}}return n})));if(!this._annotations.has(e.$tag))return[];for(const e of n)t(e);return e.$orphan=n.length>0&&n.every((e=>e.target.selector&&!e.range)),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&&wi(t.highlights);this._updateAnchors(n,t)}_updateAnchors(e,t){this.anchors=e,this._clusterToolbar?.scheduleClusterUpdates(),t&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:e=!1}={}){const t=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(t.map((e=>this._integration.describe(i,e))))).map((e=>({source:n.uri,selector:e}))),s={uri:n.uri,document:n.metadata,target:o,$highlight:e,
144
144
  $cluster:e?"user-highlights":"user-annotations",$tag:"a:"+r(8)};return this._sidebarRPC.call("createAnnotation",s),this.anchor(s),wr(),s}_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);xi(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(),i=fi(n),o=gi(n);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=br(),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(e,{toggle:t=!1,focusInSidebar:n=!1}={}){
145
145
  t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){!function(e,t){e.classList.toggle("hypothesis-highlights-always-on",t)}(this.element,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){lt(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new pr(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function Nr(e,t){const n=new URL(e),i=new URLSearchParams;return i.append("config",JSON.stringify(t)),n.hash=i.toString(),n.toString()}function Sr(e,t){const n={}
146
- ;for(const[e,i]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=i&&(n[e]=i);n.origin=new URL(e).origin,n.version="1.1525.0";const i=new URL(window.location.href);if(i.hash="",n.hostURL=i.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 Er({closed:e,onClose:t,children:n,"data-testid":i,"aria-label":o}){const r=Ge(null);return Xe((()=>{e?r.current?.close():r.current?.showModal()}),[e]),Xe((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Nt("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":i,"aria-label":o,children:n})}function Ar({closed:e,children:t,...n}){return Nt("div",{...n,
146
+ ;for(const[e,i]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=i&&(n[e]=i);n.origin=new URL(e).origin,n.version="1.1526.0";const i=new URL(window.location.href);if(i.hash="",n.hostURL=i.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 Er({closed:e,onClose:t,children:n,"data-testid":i,"aria-label":o}){const r=Ge(null);return Xe((()=>{e?r.current?.close():r.current?.showModal()}),[e]),Xe((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Nt("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":i,"aria-label":o,children:n})}function Ar({closed:e,children:t,...n}){return Nt("div",{...n,
147
147
  className:xt("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Nt("div",{className:"relative w-full h-full",children:t})})}function kr({document_:e=document,...t}){return Nt(Ke((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?Er:Ar),[e]),{...t})}function Tr({config:e,groupId:t}){return Nt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:Nr(e.notebookAppUrl,{...Sr(e.notebookAppUrl,e),group:t})})}function Rr({eventBus:e,config:t}){const[n,i]=je(0),[o,r]=je(!0),[s,a]=je(null),l=Ge(""),c=Ge(null);Xe((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),Xe((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),Xe((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),i((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const u=Qe((()=>{r(!0),c.current?.publish("closeNotebook")}),[])
148
- ;return null===s?null:Nt(kr,{closed:o,onClose:u,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Nt("div",{className:"absolute right-0 m-3",children:Nt(yn,{title:"Close notebook",onClick:u,variant:"dark",classes:xt("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Nt(Ot,{className:"w-4 h-4"})})}),Nt(Tr,{config:t,groupId:s},n)]})}class Pr{constructor(e,t,n){this._container=new Kn("notebook",(()=>Nt(Rr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Or({eventBus:e,config:t}){const[n,i]=je(!0),o=Ge(null);Xe((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{i(!1)})),o.current=t,()=>{t.destroy()}}),[e]);const r=()=>{i(!0),o.current?.publish("closeProfile")};return n?null:Nt(kr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Nt("div",{className:"absolute right-0 m-3",children:Nt(yn,{
149
- title:"Close profile dialog",onClick:r,variant:"dark",classes:xt("!bg-transparent enabled:hover:!bg-grey-3"),children:Nt(Ot,{className:"w-4 h-4"})})}),Nt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Ir{constructor(e,t,n){this._container=new Kn("profile",(()=>Nt(Or,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}var Mr,Lr={exports:{}};var Br=(Mr||(Mr=1,function(e){!function(t,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l="function",c=Math.round,u=Math.abs,h=Date.now;function d(e,t,n){return setTimeout(v(e,n),t)}function f(e,t,n){return!!Array.isArray(e)&&(m(e,n[t],n),!0)}function m(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==o)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(e,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){
148
+ ;return null===s?null:Nt(kr,{closed:o,onClose:u,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Nt("div",{className:"absolute right-0 m-3",children:Nt(yn,{title:"Close notebook",onClick:u,variant:"dark",classes:xt("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Nt(It,{className:"w-4 h-4"})})}),Nt(Tr,{config:t,groupId:s},n)]})}class Pr{constructor(e,t,n){this._container=new Kn("notebook",(()=>Nt(Rr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Ir({eventBus:e,config:t}){const[n,i]=je(!0),o=Ge(null);Xe((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{i(!1)})),o.current=t,()=>{t.destroy()}}),[e]);const r=()=>{i(!0),o.current?.publish("closeProfile")};return n?null:Nt(kr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Nt("div",{className:"absolute right-0 m-3",children:Nt(yn,{
149
+ title:"Close profile dialog",onClick:r,variant:"dark",classes:xt("!bg-transparent enabled:hover:!bg-grey-3"),children:Nt(It,{className:"w-4 h-4"})})}),Nt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Or{constructor(e,t,n){this._container=new Kn("profile",(()=>Nt(Ir,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}var Mr,Lr={exports:{}};var Br=(Mr||(Mr=1,function(e){!function(t,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l="function",c=Math.round,u=Math.abs,h=Date.now;function d(e,t,n){return setTimeout(v(e,n),t)}function f(e,t,n){return!!Array.isArray(e)&&(m(e,n[t],n),!0)}function m(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==o)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(e,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){
150
150
  var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=t.console&&(t.console.warn||t.console.log);return r&&r.call(t.console,o,i),e.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===o||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var g=p((function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===o)&&(e[i[r]]=t[i[r]]),r++;return e}),"extend","Use `assign`."),_=p((function(e,t){return g(e,t,!0)}),"merge","Use `assign`.");function b(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==l?e.apply(t&&t[0]||o,t):e}
151
- function w(e,t){return e===o?t:e}function x(e,t,n){m(E(t),(function(t){e.addEventListener(t,n,!1)}))}function C(e,t,n){m(E(t),(function(t){e.removeEventListener(t,n,!1)}))}function N(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function E(e){return e.trim().split(/\s+/g)}function A(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function k(e){return Array.prototype.slice.call(e,0)}function T(e,t,n){for(var i=[],o=[],r=0;r<e.length;){var s=e[r][t];A(o,s)<0&&i.push(e[r]),o[r]=s,r++}return i=i.sort((function(e,n){return e[t]>n[t]})),i}function R(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:t)in e)return i;a++}return o}var P=1;function O(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}
152
- var I="ontouchstart"in t,M=R(t,"PointerEvent")!==o,L=I&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),B="touch",D="mouse",F=25,H=1,V=4,U=8,q=1,W=2,$=4,z=8,j=16,X=W|$,Y=z|j,G=X|Y,K=["x","y"],Q=["clientX","clientY"];function Z(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}function J(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,s=t&H&&i-r==0,a=t&(V|U)&&i-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=ee(t)),r>1&&!n.firstMultiple?n.firstMultiple=ee(t):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,l=a?a.center:s.center,c=t.center=te(i);t.timeStamp=h(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=re(l,c),t.distance=oe(l,c),function(e,t){var n=t.center,i=e.offsetDelta||{},o=e.prevDelta||{},r=e.prevInput||{}
151
+ function w(e,t){return e===o?t:e}function x(e,t,n){m(E(t),(function(t){e.addEventListener(t,n,!1)}))}function C(e,t,n){m(E(t),(function(t){e.removeEventListener(t,n,!1)}))}function N(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function E(e){return e.trim().split(/\s+/g)}function A(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function k(e){return Array.prototype.slice.call(e,0)}function T(e,t,n){for(var i=[],o=[],r=0;r<e.length;){var s=e[r][t];A(o,s)<0&&i.push(e[r]),o[r]=s,r++}return i=i.sort((function(e,n){return e[t]>n[t]})),i}function R(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:t)in e)return i;a++}return o}var P=1;function I(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}
152
+ var O="ontouchstart"in t,M=R(t,"PointerEvent")!==o,L=O&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),B="touch",D="mouse",F=25,H=1,V=4,U=8,q=1,W=2,$=4,z=8,j=16,X=W|$,Y=z|j,G=X|Y,K=["x","y"],Q=["clientX","clientY"];function Z(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}function J(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,s=t&H&&i-r==0,a=t&(V|U)&&i-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=ee(t)),r>1&&!n.firstMultiple?n.firstMultiple=ee(t):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,l=a?a.center:s.center,c=t.center=te(i);t.timeStamp=h(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=re(l,c),t.distance=oe(l,c),function(e,t){var n=t.center,i=e.offsetDelta||{},o=e.prevDelta||{},r=e.prevInput||{}
153
153
  ;t.eventType!==H&&r.eventType!==V||(o=e.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=o.x+(n.x-i.x),t.deltaY=o.y+(n.y-i.y)}(n,t),t.offsetDirection=ie(t.deltaX,t.deltaY);var d,f,m=ne(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=m.x,t.overallVelocityY=m.y,t.overallVelocity=u(m.x)>u(m.y)?m.x:m.y,t.scale=a?(d=a.pointers,oe((f=i)[0],f[1],Q)/oe(d[0],d[1],Q)):1,t.rotation=a?function(e,t){return re(t[1],t[0],Q)+re(e[1],e[0],Q)}(a.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,r,s,a=e.lastInterval||t,l=t.timeStamp-a.timeStamp;if(t.eventType!=U&&(l>F||a.velocity===o)){var c=t.deltaX-a.deltaX,h=t.deltaY-a.deltaY,d=ne(l,c,h);i=d.x,r=d.y,n=u(d.x)>u(d.y)?d.x:d.y,s=ie(c,h),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,s=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=s}(n,t);var p=e.element;N(t.srcEvent.target,p)&&(p=t.srcEvent.target),
154
- t.target=p}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function ee(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:t,center:te(t),deltaX:e.deltaX,deltaY:e.deltaY}}function te(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,o=0;o<t;)n+=e[o].clientX,i+=e[o].clientY,o++;return{x:c(n/t),y:c(i/t)}}function ne(e,t,n){return{x:t/e||0,y:n/e||0}}function ie(e,t){return e===t?q:u(e)>=u(t)?e<0?W:$:t<0?z:j}function oe(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return Math.sqrt(i*i+o*o)}function re(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return 180*Math.atan2(o,i)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){
155
- this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(O(this.element),this.evWin,this.domHandler)}};var se={mousedown:H,mousemove:2,mouseup:V},ae="mousedown",le="mousemove mouseup";function ce(){this.evEl=ae,this.evWin=le,this.pressed=!1,Z.apply(this,arguments)}b(ce,Z,{handler:function(e){var t=se[e.type];t&H&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=V),this.pressed&&(t&V&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:D,srcEvent:e}))}});var ue={pointerdown:H,pointermove:2,pointerup:V,pointercancel:U,pointerout:U},he={2:B,3:"pen",4:D,5:"kinect"},de="pointerdown",fe="pointermove pointerup pointercancel";function me(){this.evEl=de,this.evWin=fe,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(de="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),b(me,Z,{handler:function(e){
154
+ t.target=p}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function ee(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:t,center:te(t),deltaX:e.deltaX,deltaY:e.deltaY}}function te(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,o=0;o<t;)n+=e[o].clientX,i+=e[o].clientY,o++;return{x:c(n/t),y:c(i/t)}}function ne(e,t,n){return{x:t/e||0,y:n/e||0}}function ie(e,t){return e===t?q:u(e)>=u(t)?e<0?W:$:t<0?z:j}function oe(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return Math.sqrt(i*i+o*o)}function re(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return 180*Math.atan2(o,i)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(I(this.element),this.evWin,this.domHandler)},destroy:function(){
155
+ this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(I(this.element),this.evWin,this.domHandler)}};var se={mousedown:H,mousemove:2,mouseup:V},ae="mousedown",le="mousemove mouseup";function ce(){this.evEl=ae,this.evWin=le,this.pressed=!1,Z.apply(this,arguments)}b(ce,Z,{handler:function(e){var t=se[e.type];t&H&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=V),this.pressed&&(t&V&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:D,srcEvent:e}))}});var ue={pointerdown:H,pointermove:2,pointerup:V,pointercancel:U,pointerout:U},he={2:B,3:"pen",4:D,5:"kinect"},de="pointerdown",fe="pointermove pointerup pointercancel";function me(){this.evEl=de,this.evWin=fe,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(de="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),b(me,Z,{handler:function(e){
156
156
  var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),o=ue[i],r=he[e.pointerType]||e.pointerType,s=r==B,a=A(t,e.pointerId,"pointerId");o&H&&(0===e.button||s)?a<0&&(t.push(e),a=t.length-1):o&(V|U)&&(n=!0),a<0||(t[a]=e,this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:r,srcEvent:e}),n&&t.splice(a,1))}});var pe={touchstart:H,touchmove:2,touchend:V,touchcancel:U};function ge(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function _e(e,t){var n=k(e.touches),i=k(e.changedTouches);return t&(V|U)&&(n=T(n.concat(i),"identifier")),[n,i]}b(ge,Z,{handler:function(e){var t=pe[e.type];if(t===H&&(this.started=!0),this.started){var n=_e.call(this,e,t);t&(V|U)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:B,srcEvent:e})}}});var be={touchstart:H,touchmove:2,touchend:V,touchcancel:U},ve="touchstart touchmove touchend touchcancel";function ye(){
157
157
  this.evTarget=ve,this.targetIds={},Z.apply(this,arguments)}function we(e,t){var n=k(e.touches),i=this.targetIds;if(t&(2|H)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var o,r,s=k(e.changedTouches),a=[],l=this.target;if(r=n.filter((function(e){return N(e.target,l)})),t===H)for(o=0;o<r.length;)i[r[o].identifier]=!0,o++;for(o=0;o<s.length;)i[s[o].identifier]&&a.push(s[o]),t&(V|U)&&delete i[s[o].identifier],o++;return a.length?[T(r.concat(a),"identifier"),a]:void 0}b(ye,Z,{handler:function(e){var t=be[e.type],n=we.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:B,srcEvent:e})}});var xe=2500;function Ce(){Z.apply(this,arguments);var e=v(this.handler,this);this.touch=new ye(this.manager,e),this.mouse=new ce(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Ne(e,t){e&H?(this.primaryTouch=t.changedPointers[0].identifier,Se.call(this,t)):e&(V|U)&&Se.call(this,t)}function Se(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={
158
- x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)}),xe)}}function Ee(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var o=this.lastTouches[i],r=Math.abs(t-o.x),s=Math.abs(n-o.y);if(r<=25&&s<=25)return!0}return!1}b(Ce,Z,{handler:function(e,t,n){var i=n.pointerType==B,o=n.pointerType==D;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)Ne.call(this,t,n);else if(o&&Ee.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ae=R(a.style,"touchAction"),ke=Ae!==o,Te="compute",Re="auto",Pe="manipulation",Oe="none",Ie="pan-x",Me="pan-y",Le=function(){if(!ke)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!n||t.CSS.supports("touch-action",i)})),e}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){
159
- e==Te&&(e=this.compute()),ke&&this.manager.element.style&&Le[e]&&(this.manager.element.style[Ae]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return m(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(S(e,Oe))return Oe;var t=S(e,Ie),n=S(e,Me);return t&&n?Oe:t||n?t?Ie:Me:S(e,Pe)?Pe:Re}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,o=S(i,Oe)&&!Le[Oe],r=S(i,Me)&&!Le[Me],s=S(i,Ie)&&!Le[Ie];if(o){var a=1===e.pointers.length,l=e.distance<2,c=e.deltaTime<250;if(a&&l&&c)return}if(!s||!r)return o||r&&n&X||s&&n&Y?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var De=1,Fe=32;function He(e){this.options=r({},this.defaults,e||{}),this.id=P++,this.manager=null,this.options.enable=w(this.options.enable,!0),
158
+ x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)}),xe)}}function Ee(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var o=this.lastTouches[i],r=Math.abs(t-o.x),s=Math.abs(n-o.y);if(r<=25&&s<=25)return!0}return!1}b(Ce,Z,{handler:function(e,t,n){var i=n.pointerType==B,o=n.pointerType==D;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)Ne.call(this,t,n);else if(o&&Ee.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ae=R(a.style,"touchAction"),ke=Ae!==o,Te="compute",Re="auto",Pe="manipulation",Ie="none",Oe="pan-x",Me="pan-y",Le=function(){if(!ke)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){e[i]=!n||t.CSS.supports("touch-action",i)})),e}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){
159
+ e==Te&&(e=this.compute()),ke&&this.manager.element.style&&Le[e]&&(this.manager.element.style[Ae]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return m(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(S(e,Ie))return Ie;var t=S(e,Oe),n=S(e,Me);return t&&n?Ie:t||n?t?Oe:Me:S(e,Pe)?Pe:Re}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,o=S(i,Ie)&&!Le[Ie],r=S(i,Me)&&!Le[Me],s=S(i,Oe)&&!Le[Oe];if(o){var a=1===e.pointers.length,l=e.distance<2,c=e.deltaTime<250;if(a&&l&&c)return}if(!s||!r)return o||r&&n&X||s&&n&Y?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var De=1,Fe=32;function He(e){this.options=r({},this.defaults,e||{}),this.id=P++,this.manager=null,this.options.enable=w(this.options.enable,!0),
160
160
  this.state=De,this.simultaneous={},this.requireFail=[]}function Ve(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ue(e){return e==j?"down":e==z?"up":e==W?"left":e==$?"right":""}function qe(e,t){var n=t.manager;return n?n.get(e):e}function We(){He.apply(this,arguments)}function $e(){We.apply(this,arguments),this.pX=null,this.pY=null}function ze(){We.apply(this,arguments)}function je(){He.apply(this,arguments),this._timer=null,this._input=null}function Xe(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Ge(){He.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ke(e,t){return(t=t||{}).recognizers=w(t.recognizers,Ke.defaults.preset),new Qe(e,t)}function Qe(e,t){var n;this.options=r({},Ke.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,
161
- this.input=new((n=this).options.inputClass||(M?me:L?ye:I?Ce:ce))(n,J),this.touchAction=new Be(this,this.options.touchAction),Ze(this,!0),m(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function Ze(e,t){var n,i=e.element;i.style&&(m(e.options.cssProps,(function(o,r){n=R(i.style,r),t?(e.oldCssProps[n]=i.style[n],i.style[n]=o):i.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}He.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(f(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=qe(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return f(e,"dropRecognizeWith",this)||(e=qe(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(f(e,"requireFailure",this))return this;var t=this.requireFail;return-1===A(t,e=qe(e,this))&&(t.push(e),
161
+ this.input=new((n=this).options.inputClass||(M?me:L?ye:O?Ce:ce))(n,J),this.touchAction=new Be(this,this.options.touchAction),Ze(this,!0),m(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function Ze(e,t){var n,i=e.element;i.style&&(m(e.options.cssProps,(function(o,r){n=R(i.style,r),t?(e.oldCssProps[n]=i.style[n],i.style[n]=o):i.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}He.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(f(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=qe(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return f(e,"dropRecognizeWith",this)||(e=qe(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(f(e,"requireFailure",this))return this;var t=this.requireFail;return-1===A(t,e=qe(e,this))&&(t.push(e),
162
162
  e.requireFailure(this)),this},dropRequireFailure:function(e){if(f(e,"dropRequireFailure",this))return this;e=qe(e,this);var t=A(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<8&&i(t.options.event+Ve(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=8&&i(t.options.event+Ve(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Fe},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Fe|De)))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!y(this.options.enable,[this,t]))return this.reset(),void(this.state=Fe);56&this.state&&(this.state=De),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},b(We,He,{defaults:{pointers:1},
163
- attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,o=this.attrTest(e);return i&&(n&U||!o)?16|t:i||o?n&V?8|t:2&t?4|t:2:Fe}}),b($e,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:G},getTouchAction:function(){var e=this.options.direction,t=[];return e&X&&t.push(Me),e&Y&&t.push(Ie),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,o=e.direction,r=e.deltaX,s=e.deltaY;return o&t.direction||(t.direction&X?(o=0===r?q:r<0?W:$,n=r!=this.pX,i=Math.abs(e.deltaX)):(o=0===s?q:s<0?z:j,n=s!=this.pY,i=Math.abs(e.deltaY))),e.direction=o,n&&i>t.threshold&&o&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ue(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),b(ze,We,{defaults:{event:"pinch",threshold:0,pointers:2},
164
- getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),b(je,He,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Re]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,o=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(V|U)&&!o)this.reset();else if(e.eventType&H)this.reset(),this._timer=d((function(){this.state=8,this.tryEmit()}),t.time,this);else if(e.eventType&V)return 8;return Fe},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&V?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}}),b(Xe,We,{defaults:{event:"rotate",threshold:0,pointers:2},
165
- getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),b(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:X|Y,pointers:1},getTouchAction:function(){return $e.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(X|Y)?t=e.overallVelocity:n&X?t=e.overallVelocityX:n&Y&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&u(t)>this.options.velocity&&e.eventType&V},emit:function(e){var t=Ue(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),b(Ge,He,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Pe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,o=e.deltaTime<t.time
163
+ attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=6&t,o=this.attrTest(e);return i&&(n&U||!o)?16|t:i||o?n&V?8|t:2&t?4|t:2:Fe}}),b($e,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:G},getTouchAction:function(){var e=this.options.direction,t=[];return e&X&&t.push(Me),e&Y&&t.push(Oe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,o=e.direction,r=e.deltaX,s=e.deltaY;return o&t.direction||(t.direction&X?(o=0===r?q:r<0?W:$,n=r!=this.pX,i=Math.abs(e.deltaX)):(o=0===s?q:s<0?z:j,n=s!=this.pY,i=Math.abs(e.deltaY))),e.direction=o,n&&i>t.threshold&&o&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ue(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),b(ze,We,{defaults:{event:"pinch",threshold:0,pointers:2},
164
+ getTouchAction:function(){return[Ie]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),b(je,He,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Re]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,o=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(V|U)&&!o)this.reset();else if(e.eventType&H)this.reset(),this._timer=d((function(){this.state=8,this.tryEmit()}),t.time,this);else if(e.eventType&V)return 8;return Fe},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&V?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}}),b(Xe,We,{defaults:{event:"rotate",threshold:0,pointers:2},
165
+ getTouchAction:function(){return[Ie]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),b(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:X|Y,pointers:1},getTouchAction:function(){return $e.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(X|Y)?t=e.overallVelocity:n&X?t=e.overallVelocityX:n&Y&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&u(t)>this.options.velocity&&e.eventType&V},emit:function(e){var t=Ue(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),b(Ge,He,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Pe]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,o=e.deltaTime<t.time
166
166
  ;if(this.reset(),e.eventType&H&&0===this.count)return this.failTimeout();if(i&&o&&n){if(e.eventType!=V)return this.failTimeout();var r=!this.pTime||e.timeStamp-this.pTime<t.interval,s=!this.pCenter||oe(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,s&&r?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=d((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Fe},failTimeout:function(){return this._timer=d((function(){this.state=Fe}),this.options.interval,this),Fe},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ke.VERSION="2.0.7",Ke.defaults={domEvents:!1,touchAction:Te,enable:!0,inputTarget:null,inputClass:null,preset:[[Xe,{enable:!1}],[ze,{enable:!1},["rotate"]],[Ye,{direction:X}],[$e,{direction:X},["swipe"]],[Ge],[Ge,{event:"doubletap",taps:2},["tap"]],[je]],cssProps:{
167
167
  userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Qe.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,o=t.curRecognizer;(!o||o&&8&o.state)&&(o=t.curRecognizer=null);for(var r=0;r<i.length;)n=i[r],2===t.stopped||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(e),!o&&14&n.state&&(o=t.curRecognizer=n),r++}},get:function(e){if(e instanceof He)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(f(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},
168
168
  remove:function(e){if(f(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=A(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==o&&t!==o){var n=this.handlers;return m(E(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==o){var n=this.handlers;return m(E(e),(function(e){t?n[e]&&n[e].splice(A(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var i=n.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=t,t.target.dispatchEvent(i)}(e,t);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var o=0;o<i.length;)i[o](t),o++}},destroy:function(){this.element&&Ze(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ke,{INPUT_START:H,INPUT_MOVE:2,INPUT_END:V,INPUT_CANCEL:U,STATE_POSSIBLE:De,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,
@@ -170,7 +170,7 @@ STATE_FAILED:Fe,DIRECTION_NONE:q,DIRECTION_LEFT:W,DIRECTION_RIGHT:$,DIRECTION_UP
170
170
  const t=[...e.anchors].sort(((e,t)=>e.bottom-t.bottom)),n=t[t.length-1];o(n.tag)},onBlur:()=>i([]),onFocus:()=>i(l(e)),onMouseEnter:()=>i(l(e)),onMouseOut:()=>i([]),title:`Go up to next annotations (${e.anchors.length})`,children:e.anchors.length})}),n.map(((e,t)=>Nt("li",{className:"absolute right-0 pointer-events-auto mt-[-8px]",style:{top:e.position},children:Nt(Wn,{direction:"left",onClick:t=>r(l(e),t.metaKey||t.ctrlKey),onBlur:()=>i([]),onFocus:()=>i(l(e)),onMouseEnter:()=>i(l(e)),onMouseOut:()=>i([]),title:`Select nearby annotations (${e.anchors.length})`,children:e.anchors.length})},t))),a&&Nt("li",{className:"absolute right-0 pointer-events-auto",style:{top:t.position},children:Nt(Wn,{"data-testid":"down-navigation-button",direction:"down",onClick:()=>{const e=[...t.anchors].sort(((e,t)=>e.top-t.top)),n=e[0];o(n.tag)},onBlur:()=>i([]),onFocus:()=>i(l(t)),onMouseEnter:()=>i(l(t)),onMouseOut:()=>i([]),title:`Go up to next annotations (${t.anchors.length})`,children:t.anchors.length})})]})}class Fr{
171
171
  constructor(e,{onFocusAnnotations:t,onScrollToAnnotation:n,onSelectAnnotations:i}){this._positions=[],this._container=new Kn("bucket-bar",(()=>this._render())),Object.assign(this._container.element.style,{display:"block",flexGrow:"1",width:"100%"}),e.appendChild(this._container.element),this._onFocusAnnotations=t,this._onScrollToAnnotation=n,this._onSelectAnnotations=i,this._container.render()}destroy(){this._container.destroy()}update(e){this._positions=e,this._container.render()}_render(){const e=function(e,t){const n=[],i=[],o=[];let r=null;function s(e){const{bottom:t,top:n}=e;return{bottom:t,position:n+(t-n)/2,anchors:[e],top:n}}const a=t.getBoundingClientRect(),l=e.map((e=>({tag:e.tag,top:e.top-a.top,bottom:e.bottom-a.top})));for(const e of l){const t=(e.top+e.bottom)/2;if(t<30){n.push(e);continue}if(t>a.height-30){i.push(e);continue}if(!r){r=s(e);continue}const l=e.top>r.top&&e.bottom<r.bottom;if(e.top-r.bottom>60&&!l)o.push(r),r=s(e);else{const t=e.bottom>r.bottom?e.bottom:r.bottom,n=t-r.top
172
172
  ;r.anchors.push(e),r.bottom=t,r.position=r.top+n/2}}return r&&o.push(r),{above:{anchors:n,position:30},below:{anchors:i,position:a.height-30},buckets:o}}(this._positions,this._container.element);return Nt(Dr,{above:e.above,below:e.below,buckets:e.buckets,onFocusAnnotations:e=>this._onFocusAnnotations(e),onScrollToAnnotation:e=>this._onScrollToAnnotation(e),onSelectAnnotations:(e,t)=>this._onSelectAnnotations(e,t)})}}function Hr({emitter:e}){const[t,n]=je([]),i=Qe((e=>n((t=>[...t,e]))),[]),o=Qe((e=>n((t=>t.filter((t=>t.id!==e))))),[]);return Xe((()=>(e.subscribe("toastMessageAdded",i),e.subscribe("toastMessageDismissed",o),()=>{e.unsubscribe("toastMessageAdded",i),e.unsubscribe("toastMessageDismissed",o)})),[e,o,i]),Nt(Hn,{messages:t,onMessageDismiss:o})}function Vr({icon:e,...t}){return Nt(_n,{classes:xt("justify-center rounded","w-[30px] h-[30px]","shadow border bg-white text-grey-6 hover:text-grey-9"),...t,size:"custom",variant:"custom",children:Nt(e,{})})}function Ur({highlightsVisible:e}){
173
- return Nt("div",{className:"sr-only",role:"status","data-testid":"toolbar-status",children:e?"Highlights visible":"Highlights hidden"})}function qr({closeSidebar:e,createAnnotation:t,isSidebarOpen:n,sidebarContainerId:i,newAnnotationType:o,showHighlights:r,toggleHighlights:s,toggleSidebar:a,toggleSidebarRef:l,useMinimalControls:c=!1}){return Nt("div",{className:xt("absolute left-[-33px] w-[33px] z-2","text-px-base leading-none"),children:[c&&n&&Nt(_n,{classes:xt("transition-colors focus-visible-ring ring-inset","w-[27px] h-[27px] mt-[140px] ml-px-1.5","flex items-center justify-center bg-white border","text-grey-6 hover:text-grey-9 transition-colors","border-r-0","shadow-sidebar"),title:"Close annotation sidebar",onClick:e,unstyled:!0,children:Nt(Ot,{})}),!c&&Nt(de,{children:[Nt(_n,{classes:xt("transition-colors focus-visible-ring ring-inset","h-[40px] w-[33px] pl-[6px] rounded-bl","bg-white text-grey-5 hover:text-grey-9","border-l border-b"),elementRef:l,title:"Annotation sidebar",expanded:n,
173
+ return Nt("div",{className:"sr-only",role:"status","data-testid":"toolbar-status",children:e?"Highlights visible":"Highlights hidden"})}function qr({closeSidebar:e,createAnnotation:t,isSidebarOpen:n,sidebarContainerId:i,newAnnotationType:o,showHighlights:r,toggleHighlights:s,toggleSidebar:a,toggleSidebarRef:l,useMinimalControls:c=!1}){return Nt("div",{className:xt("absolute left-[-33px] w-[33px] z-2","text-px-base leading-none"),children:[c&&n&&Nt(_n,{classes:xt("transition-colors focus-visible-ring ring-inset","w-[27px] h-[27px] mt-[140px] ml-px-1.5","flex items-center justify-center bg-white border","text-grey-6 hover:text-grey-9 transition-colors","border-r-0","shadow-sidebar"),title:"Close annotation sidebar",onClick:e,unstyled:!0,children:Nt(It,{})}),!c&&Nt(de,{children:[Nt(_n,{classes:xt("transition-colors focus-visible-ring ring-inset","h-[40px] w-[33px] pl-[6px] rounded-bl","bg-white text-grey-5 hover:text-grey-9","border-l border-b"),elementRef:l,title:"Annotation sidebar",expanded:n,
174
174
  "aria-controls":i,onClick:a,unstyled:!0,children:Nt(n?Ft:Bt,{})}),Nt("div",{className:"space-y-px-1.5 mt-px-2",children:[Nt(Vr,{title:"Show highlights",icon:r?pn:Kt,pressed:r,onClick:s}),Nt(Vr,{title:"note"===o?"New page note":"New annotation",icon:"note"===o?rn:Rt,onClick:t})]}),Nt(Ur,{highlightsVisible:r})]})]})}class Wr{constructor(e,t){const{createAnnotation:n,setSidebarOpen:i,setHighlightsVisible:o}=t;this._container=e,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._sidebarContainerId=t.sidebarContainerId,this._closeSidebar=()=>i(!1),this._toggleSidebar=()=>i(!this._sidebarOpen),this._toggleHighlights=()=>o(!this._highlightsVisible),this._createAnnotation=()=>{n(),i(!0)},this._sidebarToggleButton={current:null},this.render()}getWidth(){return this._container.firstChild.getBoundingClientRect().width}set useMinimalControls(e){this._useMinimalControls=e,this.render()}get useMinimalControls(){return this._useMinimalControls}set sidebarOpen(e){
175
175
  this._sidebarOpen=e,this.render()}get sidebarOpen(){return this._sidebarOpen}set newAnnotationType(e){this._newAnnotationType=e,this.render()}get newAnnotationType(){return this._newAnnotationType}set highlightsVisible(e){this._highlightsVisible=e,this.render()}get highlightsVisible(){return this._highlightsVisible}get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){Re(Nt(qr,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,sidebarContainerId:this._sidebarContainerId,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const $r=280;class zr{constructor(e,t,n){if(this._emitter=t.createEmitter(),this._guestWithSelection=null,this._guestRPC=[],this._sidebarRPC=new x,this.iframe=function(e){
176
176
  const t=e.sidebarAppUrl,n=Nr(t,Sr(t,e)),i=document.createElement("iframe");return i.src=n,i.title="Hypothesis annotation viewer",i.className="sidebar-frame",i.allow="fullscreen; clipboard-write",i}(n),this._config=n,this.bucketBar=null,this.features=new Mi,n.externalContainerSelector)this.externalFrame=document.querySelector(n.externalContainerSelector)??e,this.externalFrame.appendChild(this.iframe);else{if(this.iframeContainer=document.createElement("div"),this.iframeContainer.style.display="none",this.iframeContainer.className="sidebar-container",this.iframeContainer.id="sidebar-container","clean"===n.theme)this.iframeContainer.classList.add("theme-clean");else{let e;n.bucketContainerSelector&&(e=document.querySelector(n.bucketContainerSelector),e||console.warn(`Custom bucket container "${n.bucketContainerSelector}" not found`));const t=document.createElement("div");t.setAttribute("data-testid","sidebar-edge"),
@@ -183,5 +183,5 @@ _setupGestures(){const e=this.toolbar.sidebarToggleButton;e&&(this._hammerManage
183
183
  this._guestRPC.forEach((e=>e.call("sidebarLayoutChanged",l)))}_onResize(){!0===this.toolbar.sidebarOpen&&(window.innerWidth<$r?this.close():this.open())}_onPan(e){const t=this.iframeContainer;if(t)switch(e.type){case"panstart":this._resetGestureState(),t.classList.add("sidebar-no-transition"),t.style.pointerEvents="none",this._gestureState.initial=parseInt(getComputedStyle(t).marginLeft);break;case"panend":t.classList.remove("sidebar-no-transition"),t.style.pointerEvents="",null===this._gestureState.final||this._gestureState.final<=-280?this.open():this.close(),this._resetGestureState();break;case"panleft":case"panright":{if("number"!=typeof this._gestureState.initial)return;const t=this._gestureState.initial,n=e.deltaX;this._gestureState.final=Math.min(Math.round(t+n),0),this._updateLayout();break}}}open(){if(this._sidebarRPC.call("sidebarOpened"),this.iframeContainer){const e=this.iframeContainer.getBoundingClientRect().width;this.iframeContainer.style.marginLeft=-1*e+"px",
184
184
  this.iframeContainer.classList.remove("sidebar-collapsed")}this.toolbar.sidebarOpen=!0,"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!0),this._updateLayoutState(!0)}close(){this._sidebarRPC.call("sidebarClosed"),this.iframeContainer&&(this.iframeContainer.style.marginLeft="",this.iframeContainer.classList.add("sidebar-collapsed")),this.toolbar.sidebarOpen=!1,"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!1),this._updateLayoutState(!1)}setHighlightsVisible(e){this.toolbar.highlightsVisible=e,this._sidebarRPC.call("setHighlightsVisible",e)}show(){this.iframeContainer?.classList.remove("is-hidden")}hide(){this.iframeContainer?.classList.add("is-hidden")}}class jr{constructor(e){this._emitter=e,this._subscriptions=[]}publish(e,...t){this._emitter.emit(e,...t)}subscribe(e,t){this._emitter.on(e,t),this._subscriptions.push([e,t])}unsubscribe(e,t){this._emitter.off(e,t),this._subscriptions=this._subscriptions.filter((([n,i])=>n!==e||i!==t))}destroy(){
185
185
  for(const[e,t]of this._subscriptions)this._emitter.off(e,t);this._subscriptions=[]}}class Xr{constructor(){this._emitter=new h.TinyEmitter}createEmitter(){return new jr(this._emitter)}}const Yr=document.querySelector('link[type="application/annotator+html"][rel="sidebar"]');new Promise((e=>{"loading"!==document.readyState&&e(),document.addEventListener("readystatechange",(()=>e()))})).then((function(){const e=X("annotator");let t=()=>{};const n=new Promise((e=>{t=e}));Yr.addEventListener("destroy",t);const i=e.subFrameIdentifier?window.parent:window,o=[];if(i===window){if(function(){const e=document.querySelectorAll(["hypothesis-sidebar","hypothesis-notebook","hypothesis-profile"].join(","));return e.forEach((e=>e.remove())),e.length>0}())return void console.warn("Hypothesis did not load because it found an existing instance on the page.");const e=function(e=navigator.userAgent){if(!w(e))return()=>{};const t=e=>{if("hypothesisPortClosed"===e.data?.type&&e.ports[0]){const t=e.ports[0];y(t,"close"),t.close()}}
186
- ;return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}();o.push({destroy:e});const t=X("sidebar"),n=new URL(t.sidebarAppUrl).origin,i=new g(n),r=new Xr,s=new zr(document.body,r,t),a=new Pr(document.body,r,X("notebook")),l=new Ir(document.body,r,X("profile"));i.on("frameConnected",((e,t)=>s.onFrameConnected(e,t))),o.push(i,s,a,l)}if("container"===cr()){const t=new ur(e);o.push(t)}else{const n=new rr(document.body,e),r=new Cr(document.body,e,i);r.on("hostDisconnected",t),o.push(n,r)}n.then((()=>{o.forEach((e=>e.destroy()));document.querySelectorAll("[data-hypothesis-asset]").forEach((e=>e.remove())),function(e=document){Array.from(e.querySelectorAll("script.js-hypothesis-config[data-remove-on-unload]")).forEach((e=>e.remove()))}()}))}))}();
186
+ ;return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}();o.push({destroy:e});const t=X("sidebar"),n=new URL(t.sidebarAppUrl).origin,i=new g(n),r=new Xr,s=new zr(document.body,r,t),a=new Pr(document.body,r,X("notebook")),l=new Or(document.body,r,X("profile"));i.on("frameConnected",((e,t)=>s.onFrameConnected(e,t))),o.push(i,s,a,l)}if("container"===cr()){const t=new ur(e);o.push(t)}else{const n=new rr(document.body,e),r=new Cr(document.body,e,i);r.on("hostDisconnected",t),o.push(n,r)}n.then((()=>{o.forEach((e=>e.destroy()));document.querySelectorAll("[data-hypothesis-asset]").forEach((e=>e.remove())),function(e=document){Array.from(e.querySelectorAll("script.js-hypothesis-config[data-remove-on-unload]")).forEach((e=>e.remove()))}()}))}))}();
187
187
  //# sourceMappingURL=annotator.bundle.js.map