hypothesis 1.1561.0 → 1.1562.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 +1 -1
- package/build/manifest.json +7 -7
- package/build/scripts/annotator.bundle.js +9 -9
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +460 -461
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/scripts/ui-playground.bundle.js +464 -464
- package/build/scripts/ui-playground.bundle.js.map +1 -1
- package/package.json +1 -1
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?ab9820","styles/annotator.css":"styles/annotator.css?4a2cb6","styles/annotator.css.map":"styles/annotator.css.map?969663","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?d92c5a","styles/katex.min.css.map":"styles/katex.min.css.map?e7e03f","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?5068b6","styles/sidebar.css.map":"styles/sidebar.css.map?c64c75","styles/ui-playground.css.map":"styles/ui-playground.css.map?d1c947","styles/ui-playground.css":"styles/ui-playground.css?b9b933","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?35b5ab","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?1f8056","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?1ddb40","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?c69423","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?49c48f"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var o=s.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=e,t(o),s.head.appendChild(o)}function o(s,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=o.esModule,n=void 0===r||r,i=o.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(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,o,r){var n=s.createElement("link");n.rel=e,n.href=r,n.type="application/annotator+".concat(o),t(n),s.head.appendChild(n)}function n(s,e,o){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=o,"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=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),o=0;o<e.length;o++){var r=void 0;try{r=JSON.parse(e[o].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.1562.0/");if(document.querySelector("hypothesis-app")){!function(s,t){n(s,"fetch",t.apiUrl),n(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)o(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 d=l,h=a(d.notebookAppUrl||"https://hypothes.is/notebook"),u=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.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),n(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++)o(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,d=p;c<d.length;c++)e(s,i(t,d[c]))}}(document,{assetRoot:p,manifest:s,notebookAppUrl:h,profileAppUrl:u,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?ab9820",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?4a2cb6",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?969663",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
|
|
11
11
|
"styles/sidebar.css": "styles/sidebar.css?5068b6",
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?c64c75",
|
|
13
|
-
"styles/ui-playground.css": "styles/ui-playground.css?b9b933",
|
|
14
13
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?d1c947",
|
|
15
|
-
"
|
|
16
|
-
"scripts/
|
|
17
|
-
"scripts/
|
|
18
|
-
"scripts/
|
|
19
|
-
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?
|
|
14
|
+
"styles/ui-playground.css": "styles/ui-playground.css?b9b933",
|
|
15
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?35b5ab",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?1f8056",
|
|
17
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?1ddb40",
|
|
18
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?c69423",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?49c48f"
|
|
20
20
|
}
|
|
@@ -15,9 +15,9 @@ i.__e(e,t.__v)}}))}function B(e,t,n,r,s,a,l,c,d){var u,h,f,m,p,_,w,y=n.props,x=t
|
|
|
15
15
|
;var n=$.__H||($.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ne(e){return j=1,function(e,t,n){var o=te(q++,2);if(o.t=e,!o.__c&&(o.__=[pe(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=$,!$.u)){var i=function(e,t,n){if(!o.__c.__H)return!0;var i=o.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!r||r.call(this,e,t,n);var s=o.__c.props!==e;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),r&&r.call(this,e,t,n)||s};$.u=!0;var r=$.shouldComponentUpdate,s=$.componentWillUpdate;$.componentWillUpdate=function(e,t,n){if(this.__e){var o=r;r=void 0,i(e,t,n),r=o}s&&s.call(this,e,t,n)},$.shouldComponentUpdate=i}return o.__N||o.__}(pe,e)}function oe(e,t){var n=te(q++,3);!K.__s&&ge(n.__H,t)&&(n.__=e,n.i=t,$.__H.__h.push(n))}function ie(e,t){var n=te(q++,4);!K.__s&&ge(n.__H,t)&&(n.__=e,n.i=t,$.__h.push(n))}function re(e){
|
|
16
16
|
return j=5,se((function(){return{current:e}}),[])}function se(e,t){var n=te(q++,7);return ge(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ae(e,t){return j=8,se((function(){return e}),t)}function le(e){var t=$.context[e.__c],n=te(q++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub($)),t.props.value):e.__}function ce(){var e=te(q++,11);if(!e.__){for(var t=$.__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 de(){for(var e;e=X.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(fe),e.__H.__h.forEach(me),e.__H.__h=[]}catch(t){e.__H.__h=[],K.__e(t,e.__v)}}K.__b=function(e){$=null,Q&&Q(e)},K.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ee&&ee(e,t)},K.__r=function(e){G&&G(e),q=0;var t=($=e.__c).__H;t&&(W===$?(t.__h=[],$.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0}))):(t.__h.forEach(fe),t.__h.forEach(me),t.__h=[],q=0)),W=$},K.diffed=function(e){Y&&Y(e);var t=e.__c
|
|
17
17
|
;t&&t.__H&&(t.__H.__h.length&&(1!==X.push(t)&&z===K.requestAnimationFrame||((z=K.requestAnimationFrame)||he)(de)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.i=void 0}))),W=$=null},K.__c=function(e,t){t.some((function(e){try{e.__h.forEach(fe),e.__h=e.__h.filter((function(e){return!e.__||me(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],K.__e(n,e.__v)}})),J&&J(e,t)},K.unmount=function(e){Z&&Z(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{fe(e)}catch(e){t=e}})),n.__H=void 0,t&&K.__e(t,n.__v))};var ue="function"==typeof requestAnimationFrame;function he(e){var t,n=function(){clearTimeout(o),ue&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);ue&&(t=requestAnimationFrame(n))}function fe(e){var t=$,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),$=t}function me(e){var t=$;e.__c=e.__(),$=t}function ge(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function pe(e,t){return"function"==typeof t?t(e):t}function _e(e,t,n){return(t=function(e){
|
|
18
|
-
var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t
|
|
18
|
+
var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;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 be{constructor(){_e(this,"_listeners",void 0),this._listeners=new Map}add(e,t,n,o){e.addEventListener(t,n,o);const i=Symbol();return this._listeners.set(i,{eventTarget:e,eventType:t,listener:n,options:o}),i}remove(e){const t=this._listeners.get(e);if(t){const{eventTarget:n,eventType:o,listener:i,options:r}=t;n.removeEventListener(o,i,r),this._listeners.delete(e)}}removeAll(){this._listeners.forEach((({eventTarget:e,eventType:t,listener:n,options:o})=>{e.removeEventListener(t,n,o)})),this._listeners.clear()}}function we(e){e.focus()}
|
|
19
19
|
function ve(e,{autofocus:t=!1,loop:n=!0,horizontal:o=!0,vertical:i=!0,selector:r="a,button",containerVisible:s=!0,focusElement:a=we}={}){const l=re(null),c=function(e){const t=re({callback:e,call:(...e)=>t.current.callback(...e)});return t.current.callback=e,t.current.call}(a);oe((()=>{if(!s)return()=>{};if(!e.current)throw new Error("Container ref not set");const a=e.current,d=()=>{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},u=(e=d(),t=-1,n=!1,o)=>{t<0&&(t=e.findIndex((e=>0===e.tabIndex)))<0&&(t=0);for(const[i,r]of e.entries())r.tabIndex=i===t?0:-1,i===t&&n&&(l.current=r,c(r,o))},h=d(),f=l.current?h.indexOf(l.current):0;u(h,f,t);const m=new be;m.add(a,"focusin",(e=>{if(e.target===a&&l.current)return void c(l.current);const n=d(),o=n.indexOf(e.target);o>=0&&u(n,o,t)})),m.add(a,"keydown",(e=>{const t=d();let r=t.findIndex((e=>0===e.tabIndex)),s=!1
|
|
20
|
-
;o&&"ArrowLeft"===e.key||i&&"ArrowUp"===e.key?(0===r?r=n?t.length-1:r:--r,s=!0):o&&"ArrowRight"===e.key||i&&"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&&(u(t,r,!0,e),e.preventDefault(),e.stopPropagation())}));const g=new MutationObserver((()=>{u()}));return g.observe(a,{subtree:!0,attributes:!0,attributeFilter:["disabled"],childList:!0}),()=>{m.removeAll(),g.disconnect()}}),[t,e,c,o,n,r,i,s])}function ye(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 o=n.call(e,t
|
|
20
|
+
;o&&"ArrowLeft"===e.key||i&&"ArrowUp"===e.key?(0===r?r=n?t.length-1:r:--r,s=!0):o&&"ArrowRight"===e.key||i&&"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&&(u(t,r,!0,e),e.preventDefault(),e.stopPropagation())}));const g=new MutationObserver((()=>{u()}));return g.observe(a,{subtree:!0,attributes:!0,attributeFilter:["disabled"],childList:!0}),()=>{m.removeAll(),g.disconnect()}}),[t,e,c,o,n,r,i,s])}function ye(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 o=n.call(e,t);if("object"!=typeof o)return o;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 xe{constructor(e){ye(this,"_target",void 0),ye(this,"_value",void 0),this._target=e,this._value=null}
|
|
21
21
|
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 Ne(e){const t=re(new xe(e));return t.current.target=e,t.current}var Ce,Se={exports:{}};var Ee,ke=(Ce||(Ce=1,Ee=Se,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=o(e,n(i)))}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 i="";for(var r in n)e.call(n,r)&&n[r]&&(i=o(i,r));return i}function o(e,t){return t?e?e+" "+t:e+t:e}Ee.exports?(t.default=t,Ee.exports=t):window.classNames=t}()),Se.exports),Ae=t(ke);var Re=0
|
|
22
22
|
;function Pe(e,t,n,o,r,s){t||(t={});var a,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?a=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Re,__i:-1,__u:0,__source:r,__self:s};if("function"==typeof e&&(a=e.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return i.vnode&&i.vnode(d),d}U({}),U({});var Te="/home/runner/work/frontend-shared/frontend-shared/src/components/layout/Card.tsx";function Oe({children:e,classes:t,elementRef:n,active:o=!1,variant:i="raised",width:r="full",...s}){return Pe("div",{"data-component":"Card",...s,ref:n,className:Ae("rounded-lg border bg-white",{"shadow hover:shadow-md":"raised"===i,"shadow-md":o&&"raised"===i},{"w-full":"full"===r,"w-auto":"auto"===r},t),children:e},void 0,0,{fileName:Te,lineNumber:40,columnNumber:5},this)}var Le="/home/runner/work/frontend-shared/frontend-shared/src/components/layout/CardContent.tsx";function Me({children:e,classes:t,elementRef:n,size:o="md",...i}){return Pe("div",{
|
|
23
23
|
"data-component":"CardContent",...i,ref:n,className:Ae({"p-3 space-y-4":"md"===o,"p-2 space-y-3":"sm"===o,"p-4 space-y-6":"lg"===o},t),children:e},void 0,0,{fileName:Le,lineNumber:29,columnNumber:5},this)}var Ie="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Annotate.tsx";function Be(e){return Pe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","data-component":"AnnotateIcon",...e,children:Pe("path",{fill:"currentColor",
|
|
@@ -40,13 +40,13 @@ className:"w-em h-em"},void 0,0,{fileName:Ct,lineNumber:84,columnNumber:16},this
|
|
|
40
40
|
var At="/home/runner/work/frontend-shared/frontend-shared/src/components/input/Checkbox.tsx";function Rt({checked:e,defaultChecked:t=!1,icon:n=et,checkedIcon:o=Ge,onChange:i,...r}){const s="boolean"==typeof e,[a,l]=ne(t);return Pe(kt,{icon:n,checkedIcon:o,type:"checkbox",checked:s?e:a,onChange:function(e){null==i||i.call(this,e),s||l(e.target.checked)},...r},void 0,0,{fileName:At,lineNumber:65,columnNumber:5},this)}const Pt=U(null);var Tt="/home/runner/work/frontend-shared/frontend-shared/src/components/input/RadioGroup.tsx";function Ot({value:e,children:t,subtitle:n,disabled:o}){const i=le(Pt);if(!i)throw new Error("RadioGroup.Radio can only be used as RadioGroup child");const{selected:r,disabled:s=o,onChange:a}=i,l=!s&&r===e;return Pe("div",{role:"radio","aria-checked":l,"aria-disabled":s,className:Ae("focus-visible-ring rounded-lg px-3 py-2 flex-1 group",{"bg-grey-3/50":l,"hover:bg-grey-3/25":!l&&!s,"opacity-70":s,"cursor-pointer":!s}),"data-value":e,onClick:s?void 0:()=>a(e),onKeyDown:s?void 0:t=>{
|
|
41
41
|
["Enter"," "].includes(t.key)&&(t.preventDefault(),a(e))},tabIndex:-1,children:[Pe("div",{className:"flex items-center gap-x-1.5",children:[l?Pe(bt,{},void 0,0,{fileName:Tt,lineNumber:68,columnNumber:23},this):Pe(pt,{},void 0,0,{fileName:Tt,lineNumber:68,columnNumber:46},this),t]},void 0,0,{fileName:Tt,lineNumber:67,columnNumber:7},this),n&&Pe("div",{className:Ae("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:Tt,lineNumber:72,columnNumber:9},this)]},void 0,0,{fileName:Tt,lineNumber:40,columnNumber:5},this)}Ot.displayName="RadioGroup.Radio",Object.assign((function({direction:e="horizontal",children:t,selected:n,onChange:o,disabled:i,"aria-label":r,"aria-labelledby":s,name:a}){const l=re(null);return ve(l,{loop:!1,selector:'[role="radio"]:not([aria-disabled="true"])',focusElement:e=>{o(e.dataset.value),e.focus()}}),Pe(Pt.Provider,{value:{selected:n,disabled:i,onChange:o},children:[Pe("div",{"aria-label":r,"aria-labelledby":s,ref:l,
|
|
42
42
|
role:"radiogroup",className:Ae("w-full flex gap-1.5",{"flex-col":"vertical"===e}),children:t},void 0,0,{fileName:Tt,lineNumber:134,columnNumber:7},this),a&&Pe("input",{type:"hidden","data-testid":"hidden-input",name:a,value:n,disabled:i},void 0,0,{fileName:Tt,lineNumber:146,columnNumber:9},this)]},void 0,0,{fileName:Tt,lineNumber:131,columnNumber:5},this)}),{Radio:Ot,displayName:"RadioGroup"});var Lt="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/Popover.tsx";const Mt=".15rem",It=8;function Bt(e,t,n,o,i){oe((()=>{if(!i)return()=>{};const t=e.current,o=e=>{"open"===e.oldState&&"closed"===e.newState&&n()};return t.addEventListener("toggle",o),()=>t.removeEventListener("toggle",o)}),[i,n,e]);const r=o&&!i;!function(e,t,{enabled:n=!0}={}){oe((()=>{if(!n)return()=>{};const o=document.body,i=new be,r=n=>{e.current&&!n.composedPath().includes(e.current)&&t(n)};return i.add(o,"mousedown",r),i.add(o,"click",r),()=>{i.removeAll()}}),[e,n,t])}(e,(e=>{e.composedPath().includes(t.current)||n()
|
|
43
|
-
}),{enabled:r}),function(e,t,{enabled:n=!0}={}){oe((()=>{if(!n)return()=>{};const o=document.body,i=new be;return i.add(o,"keydown",(n=>{e.includes(n.key)&&t(n)})),()=>{i.removeAll()}}),[n,t,e])}(["Escape"],n,{enabled:r})}function Ft({anchorElementRef:e,children:t,open:n,onClose:o,align:i="left",classes:r,variant:s="panel",restoreFocusOnClose:a=!0,asNativePopover:
|
|
44
|
-
top:p?`calc(${w+l-m}px - ${Mt})`:`calc(${w+l+u}px + ${Mt})`,left:`${Math.max(It,y)}px`})}),[o,e,t,i]);ie((()=>{if(!n)return()=>{};const e=t.current;o&&e.togglePopover(!0);const i=r();if(!o)return i;const s=new be;s.add(document.body,"scroll",r,{capture:!0});const a=new ResizeObserver(r);return a.observe(e),()=>{o&&(null==e||e.togglePopover(!1)),i(),s.removeAll(),a.disconnect()}}),[r,o,n,t])}(e,
|
|
43
|
+
}),{enabled:r}),function(e,t,{enabled:n=!0}={}){oe((()=>{if(!n)return()=>{};const o=document.body,i=new be;return i.add(o,"keydown",(n=>{e.includes(n.key)&&t(n)})),()=>{i.removeAll()}}),[n,t,e])}(["Escape"],n,{enabled:r})}function Ft({anchorElementRef:e,children:t,open:n,onClose:o,align:i="left",classes:r,variant:s="panel",restoreFocusOnClose:a=!0,onScroll:l,asNativePopover:c=HTMLElement.prototype.hasOwnProperty("popover")}){const d=re(null);return function(e,t,n,o,i){const r=ae((()=>{const n=t.current,r=e.current,s=e=>{Object.assign(n.style,e);const t=Object.keys(e);return()=>t.map((e=>n.style[e]=""))},a=window.innerHeight,{top:l,bottom:c,left:d,height:u,width:h}=r.getBoundingClientRect(),f=a-c,{height:m,width:g}=n.getBoundingClientRect(),p=f<m&&l>f;if(!o)return s(p?{bottom:"100%",marginBottom:Mt}:{top:"100%",marginTop:Mt});const{top:_,width:b}=document.body.getBoundingClientRect(),w=Math.abs(_),v=(i?d+h:b-d)-It;let y=d;return g>v?y=i?It:y-(g-v):i&&g>h&&(y-=g-h),s({minWidth:`${h}px`,
|
|
44
|
+
top:p?`calc(${w+l-m}px - ${Mt})`:`calc(${w+l+u}px + ${Mt})`,left:`${Math.max(It,y)}px`})}),[o,e,t,i]);ie((()=>{if(!n)return()=>{};const e=t.current;o&&e.togglePopover(!0);const i=r();if(!o)return i;const s=new be;s.add(document.body,"scroll",r,{capture:!0});const a=new ResizeObserver(r);return a.observe(e),()=>{o&&(null==e||e.togglePopover(!1)),i(),s.removeAll(),a.disconnect()}}),[r,o,n,t])}(e,d,n,c,"right"===i),Bt(d,e,o,n,c),ie((()=>{const e=n?document.activeElement:null;return()=>{a&&e&&e.focus()}}),[n,a]),Pe("div",{className:Ae("absolute z-5","panel"===s&&["max-h-80 overflow-y-auto overflow-x-hidden","rounded border bg-white shadow hover:shadow-md focus-within:shadow-md"],c&&["max-w-[calc(100%-16px)]","p-0 m-0"],!c&&{hidden:!n,"right-0":"right"===i,"min-w-full":!0},r),ref:d,popover:c&&"auto",onScroll:l,"data-testid":"popover","data-component":"Popover",children:n&&t},void 0,0,{fileName:Lt,lineNumber:302,columnNumber:5},this)}const Dt=U(null)
|
|
45
45
|
;var Ht="/home/runner/work/frontend-shared/frontend-shared/src/components/input/Select.tsx";function Vt(e,t){return"function"==typeof e?e(t):e}function Ut({value:e,children:t,disabled:n=!1,classes:o,elementRef:i,title:r}){const s=re(null),a=re(null),l=Ne(i),c=e=>e.target===s.current||e.target===a.current,d=le(Dt);if(!d)throw new Error("Select.Option can only be used as Select or MultiSelect child");const{selectValue:u,value:h,multiple:f}=d,m=se((()=>!n&&(f?h.includes(e)||0===h.length&&void 0===e:h===e)),[h,n,f,e]),g=ae((()=>{const t={closeListbox:!0};u(f?void 0!==e?[e]:[]:e,t)}),[f,u,e]),p=ae((()=>{if(!f)return;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,f,u,e]);return Pe("li",{className:Ae("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},o),onClick:e=>{n||c(e)||g()},onKeyDown:e=>{
|
|
46
46
|
n||(["Enter"," "].includes(e.key)&&!c(e)?(e.preventDefault(),g()):s.current&&"ArrowRight"===e.key&&(e.preventDefault(),s.current.focus()))},role:"option","aria-disabled":n,"aria-selected":m,tabIndex:m?0:-1,ref:l,title:r,children:Pe("div",{className:Ae("flex justify-between items-center","w-full rounded",{"hover:bg-grey-1 group-focus-visible:ring":!n,"bg-grey-1 hover:bg-grey-2":m}),children:[Pe("div",{className:Ae("py-2 pl-3",{truncate:"truncate"===d.listboxOverflow,"whitespace-normal":"wrap"===d.listboxOverflow}),children:Vt(t,{selected:m,disabled:n})},void 0,0,{fileName:Ht,lineNumber:203,columnNumber:9},this),!f&&Pe("div",{className:"px-3",children:Pe(Ke,{className:Ae("text-grey-6 scale-125",{"opacity-0":!m})},void 0,0,{fileName:Ht,lineNumber:213,columnNumber:13},this)},void 0,0,{fileName:Ht,lineNumber:212,columnNumber:11},this),f&&Pe(Rt,{containerClasses:Ae("self-stretch px-3","text-lg",{"text-grey-6":m,"text-grey-3 hover:text-grey-6":!m}),checked:m,checkedIcon:Je,elementRef:s,containerRef:a,onChange:p,
|
|
47
|
-
onKeyDown:e=>{var t;"ArrowLeft"===e.key&&(e.preventDefault(),null===(t=l.current)||void 0===t||t.focus())}},void 0,0,{fileName:Ht,lineNumber:224,columnNumber:11},this)]},void 0,0,{fileName:Ht,lineNumber:193,columnNumber:7},this)},void 0,0,{fileName:Ht,lineNumber:146,columnNumber:5},this)}function qt({buttonContent:e,value:t,onChange:n,children:o,disabled:i,elementRef:r,buttonId:s,buttonClasses:a,listboxClasses:l,popoverClasses:c=l,containerClasses:d,onListboxScroll:u,right:
|
|
48
|
-
containerVisible:
|
|
49
|
-
lineNumber:
|
|
47
|
+
onKeyDown:e=>{var t;"ArrowLeft"===e.key&&(e.preventDefault(),null===(t=l.current)||void 0===t||t.focus())}},void 0,0,{fileName:Ht,lineNumber:224,columnNumber:11},this)]},void 0,0,{fileName:Ht,lineNumber:193,columnNumber:7},this)},void 0,0,{fileName:Ht,lineNumber:146,columnNumber:5},this)}function qt({buttonContent:e,value:t,onChange:n,children:o,disabled:i,elementRef:r,buttonId:s,buttonClasses:a,listboxClasses:l,popoverClasses:c=l,containerClasses:d,onListboxScroll:u,onPopoverScroll:h=u,right:f=!1,alignListbox:m=(f?"right":"left"),multiple:g,listboxOverflow:p="truncate","aria-label":_,"aria-labelledby":b,listboxAsPopover:w}){const v=re(null),y=re(null),[x,N]=ne(!1),C=ae((()=>N(!1)),[N]),S=ce(),E=Ne(r),k=ce(),A=ae(((e,t)=>{n(e),t.closeListbox&&C()}),[n,C]);return function(e,t,{enabled:n=!0}={}){oe((()=>{if(!n||!e.current)return()=>{};const o=new be;return o.add(e.current,"focusout",(n=>{const o=n;e.current&&!e.current.contains(o.relatedTarget)&&t(o)})),()=>{o.removeAll()}}),[e,n,t])}(v,C),ve(y,{horizontal:!1,
|
|
48
|
+
loop:!1,autofocus:!0,containerVisible:x,selector:'[role="option"]:not([aria-disabled="true"])'}),Pe("div",{className:Ae("relative w-full border rounded",{"border-grey-5":x},Nt,d),ref:v,children:[Pe("button",{id:null!=s?s:k,className:Ae("focus-visible-ring transition-colors whitespace-nowrap","w-full flex items-center justify-between gap-x-2","bg-grey-0 disabled:bg-grey-1 disabled:text-grey-6","text-left","rounded-[inherit]",a),type:"button",role:"combobox",disabled:i,"aria-expanded":x,"aria-haspopup":"listbox","aria-controls":S,"aria-label":_,"aria-labelledby":b,ref:E,onClick:()=>N((e=>!e)),onKeyDown:e=>{"ArrowDown"!==e.key||x||(e.preventDefault(),N(!0))},"data-testid":"select-toggle-button",children:[Pe("div",{className:"pl-2 py-2 truncate grow",children:e},void 0,0,{fileName:Ht,lineNumber:440,columnNumber:9},this),Pe("div",{className:"pr-2 py-2 text-grey-6",children:x?Pe(st,{},void 0,0,{fileName:Ht,lineNumber:442,columnNumber:26},this):Pe(lt,{},void 0,0,{fileName:Ht,lineNumber:442,columnNumber:49},this)
|
|
49
|
+
},void 0,0,{fileName:Ht,lineNumber:441,columnNumber:9},this)]},void 0,0,{fileName:Ht,lineNumber:407,columnNumber:7},this),Pe(Dt.Provider,{value:{value:t,selectValue:A,multiple:g,listboxOverflow:p},children:Pe(Ft,{anchorElementRef:v,open:x,onClose:C,asNativePopover:w,align:m,classes:c,onScroll:h,children:Pe("ul",{role:"listbox",id:S,ref:y,"aria-multiselectable":g,"aria-labelledby":null!=s?s:k,"aria-orientation":"vertical",children:o},void 0,0,{fileName:Ht,lineNumber:464,columnNumber:11},this)},void 0,0,{fileName:Ht,lineNumber:455,columnNumber:9},this)},void 0,0,{fileName:Ht,lineNumber:446,columnNumber:7},this)]},void 0,0,{fileName:Ht,lineNumber:398,columnNumber:5},this)}Ut.displayName="Select.Option",Object.assign((function(e){return qt({...e,multiple:!1})}),{Option:Ut,displayName:"Select"}),Object.assign((function(e){return qt({...e,multiple:!0})}),{Option:Ut,displayName:"MultiSelect"}),U({}),U(null);var $t="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/Callout.tsx"
|
|
50
50
|
;function Wt({children:e,classes:t,elementRef:n,icon:o,status:i="notice",size:r="md",variant:s="outlined",unstyled:a=!1,...l}){const c=!a,d=c&&"custom"!==s,u=c&&"custom"!==r;let h=o;if(!h)switch(i){case"success":h=Ke;break;case"error":h=De;break;default:h=je}const f=d&&u;return Pe("div",{"data-component":"Callout",...l,ref:n,className:Ae(c&&"flex items-center border",d&&{"rounded border":!0,"shadow hover:shadow-md cursor-pointer":"raised"===s,"border-yellow-notice":"notice"===i,"border-green-success":"success"===i,"border-red-error":"error"===i},d&&{"bg-yellow-notice":"notice"===i&&f,"bg-green-success":"success"===i&&f,"bg-red-error":"error"===i&&f,"bg-white":!f},t),children:[f&&Pe("div",{className:Ae({"p-2":"md"===r,"p-1.5":"sm"===r,"p-3":"lg"===r}),children:Pe(h,{"data-testid":"callout-icon",className:Ae("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:$t,lineNumber:95,columnNumber:11},this)},void 0,0,{fileName:$t,
|
|
51
51
|
lineNumber:88,columnNumber:9},this),Pe("div",{className:Ae(u&&{"p-2":"md"===r,"py-1.5 px-2":"sm"===r,"p-3":"lg"===r},c&&"grow",d&&"bg-white rounded-r"),children:e},void 0,0,{fileName:$t,lineNumber:105,columnNumber:7},this)]},void 0,0,{fileName:$t,lineNumber:64,columnNumber:5},this)}var zt="/home/runner/work/frontend-shared/frontend-shared/src/components/feedback/ToastMessages.tsx";function jt({message:e,onDismiss:t}){return Pe(Wt,{classes:Ae({"sr-only":e.visuallyHidden}),status:e.type,onClick:()=>t(e.id),variant:"raised",children:e.message},void 0,0,{fileName:zt,lineNumber:55,columnNumber:5},this)}const Xt=({direction:e,onTransitionEnd:t,children:n,transitionClasses:o={}})=>{const i="out"===e,r=re(null),s=se((()=>{const{transitionIn:e="animate-fade-in",transitionOut:t="animate-fade-out"}=o;return{[e]:!i,[t]:i}}),[i,o]);return Pe("div",{"data-testid":"animation-container",onAnimationEnd:n=>{n.target===r.current&&(null==t||t(null!=e?e:"in"))},ref:r,className:Ae("relative w-full container",s),children:n
|
|
52
52
|
},void 0,0,{fileName:zt,lineNumber:103,columnNumber:5},void 0)};function Kt({messages:e,onMessageDismiss:t,transitionClasses:n,setTimeout_:o=setTimeout}){const[i,r]=ne([]),s=re(new Map),a=ae((e=>r((t=>[...t,e]))),[]),l=ae((e=>{const t=o((()=>{a(e),s.current.delete(e)}),5e3);s.current.set(e,t)}),[a,o]),c=ae(((e,n)=>{var o;const i=null===(o=n.autoDismiss)||void 0===o||o;"in"===e&&i&&l(n.id),"out"===e&&(t(n.id),r((e=>e.filter((e=>e!==n.id)))))}),[l,t]);return ie((()=>{const e=s.current;return()=>{e.forEach((e=>clearTimeout(e)))}}),[]),Pe("ul",{"aria-live":"polite","aria-relevant":"additions",className:"w-full space-y-2","data-component":"ToastMessages",children:e.map((e=>{const t=i.includes(e.id);return Pe("li",{className:Ae({"mb-2":!e.visuallyHidden}),children:Pe(Xt,{direction:t?"out":"in",onTransitionEnd:t=>c(t,e),transitionClasses:n,children:Pe(jt,{message:e,onDismiss:a},void 0,0,{fileName:zt,lineNumber:206,columnNumber:15},this)},void 0,0,{fileName:zt,lineNumber:201,columnNumber:13},this)},e.id,0,{
|
|
@@ -108,7 +108,7 @@ this._sideBySideActive=!1,this._lastLayout=null,this._navObserver=new fi((()=>th
|
|
|
108
108
|
this.container.classList.toggle("hypothesis-sidebyside-active",this._sideBySideActive),n}sideBySideActive(){return this._sideBySideActive}_activateSideBySide(e){const t=e+12,n=e=>parseInt(window.getComputedStyle(e).marginLeft,10);Fn((()=>{document.body.style.marginLeft="",document.body.style.marginRight="";const e=n(document.body);document.body.style.marginRight=`${t}px`;const o=function(e){const t=new Map,n=new Map,o=Tn.join(","),i=Array.from(e.querySelectorAll(o)).map((e=>({rect:e.getBoundingClientRect(),textLength:e.textContent.length}))).filter((({rect:e})=>e.width>0&&e.height>0)).sort(((e,t)=>t.textLength-e.textLength)).slice(0,15);if(i.forEach((({rect:e})=>{let o=t.get(e.left)??0;o+=1,t.set(e.left,o);let i=n.get(e.right)??0;i+=1,n.set(e.right,i)})),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(o){const i=Math.max(0,window.innerWidth-t-o.right);if(i>0){
|
|
109
109
|
const e=Math.max(0,t-i);document.body.style.marginRight=`${e}px`}n(document.body)>e&&(document.body.style.marginLeft=`${e}px`),o.left<12&&(document.body.style.marginLeft="12px")}else document.body.style.marginLeft="",document.body.style.marginRight=""}))}_deactivateSideBySide(){Fn((()=>{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",{value:"BODY",configurable:!0});const o=e.closest("details");o&&!o.hasAttribute("open")&&(o.open=!0),await new Promise((n=>_i(e,{time:t},n)))}(t)}}var Ni,Ci;var Si=function(){if(Ci)return Ni;Ci=1
|
|
110
110
|
;var t=NaN,n="[object Symbol]",o=/^\s+|\s+$/g,i=/^[-+]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,d=l||c||Function("return this")(),u=Object.prototype.toString,h=Math.max,f=Math.min,m=function(){return d.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function p(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&u.call(e)==n}(e))return t;if(g(e)){var l="function"==typeof e.valueOf?e.valueOf():e;e=g(l)?l+"":l}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var c=r.test(e);return c||s.test(e)?a(e.slice(2),c?2:8):i.test(e)?t:+e}return Ni=function(e,t,n){var o,i,r,s,a,l,c=0,d=!1,u=!1,_=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=o,r=i;return o=i=void 0,c=t,s=e.apply(r,n)}function w(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=r}
|
|
111
|
-
function v(){var e=m();if(w(e))return y(e);a=setTimeout(v,function(e){var n=t-(e-l);return u?f(n,r-(e-c)):n}(e))}function y(e){return a=void 0,_&&o?b(e):(o=i=void 0,s)}function x(){var e=m(),n=w(e);if(o=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(v,t),d?b(e):s}(l);if(u)return a=setTimeout(v,t),b(l)}return void 0===a&&(a=setTimeout(v,t)),s}return t=p(t)||0,g(n)&&(d=!!n.leading,r=(u="maxWait"in n)?h(p(n.maxWait)||0,t):r,_="trailing"in n?!!n.trailing:_),x.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=i=a=void 0},x.flush=function(){return void 0===a?s:y(m())},x},Ni}(),Ei=t(Si);function ki(e,t,n,o=0){let i=o;for(;i<e.length&&t>0;)n(e[i])&&--t,++i;return i}function Ai(e,t,n,o){let i=0;for(let r=n;r<o;r++)t(e[r])&&++i;return i}function Ri(e,t,n,o,i){const r=Ai(e,i,0,n),s=Ai(e,i,n,o);let a=ki(t,r,i);for(;a<t.length&&!i(t[a]);)++a;return[a,ki(t,s,i,a)]}const Pi={INITIAL:0,
|
|
111
|
+
function v(){var e=m();if(w(e))return y(e);a=setTimeout(v,function(e){var n=t-(e-l);return u?f(n,r-(e-c)):n}(e))}function y(e){return a=void 0,_&&o?b(e):(o=i=void 0,s)}function x(){var e=m(),n=w(e);if(o=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(v,t),d?b(e):s}(l);if(u)return a=setTimeout(v,t),b(l)}return void 0===a&&(a=setTimeout(v,t)),s}return t=p(t)||0,g(n)&&(d=!!n.leading,r=(u="maxWait"in n)?h(p(n.maxWait)||0,t):r,_="trailing"in n?!!n.trailing:_),x.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=i=a=void 0},x.flush=function(){return void 0===a?s:y(m())},x},Ni}(),Ei=t(Si);function ki(e,t,n,o=0){let i=o;for(;i<e.length&&t>0;)n(e[i])&&--t,++i;return i}function Ai(e,t,n,o){let i=0;for(let r=n;r<o;r++)t(e[r])&&++i;return i}function Ri(e,t,n,o,i){const r=Ai(e,i,0,n),s=Ai(e,i,n,o);let a=ki(t,r,i);for(;a<t.length&&!i(t[a]);)++a;return[a,ki(t,s,i,a)]}const Pi={INITIAL:0,FINISHED:3},Ti=new Map,Oi=new Map;function Li(e,t){return`${e}:${t}`}function Mi(e){
|
|
112
112
|
const t="closest"in e?e:e.parentElement;return t?.closest(".textLayer")??null}function Ii(){return PDFViewerApplication.pdfViewer}async function Bi(e){const t=Ii();let n=t.getPageView(e);return n&&n.pdfPage||(n=await new Promise((n=>{const o=()=>{t.eventBus?t.eventBus.off("pagesloaded",o):document.removeEventListener("pagesloaded",o),n(t.getPageView(e))};t.eventBus?t.eventBus.on("pagesloaded",o):document.addEventListener("pagesloaded",o)}))),n}function Fi(e){const t=Ti.get(e);if(t)return t;const n=(async()=>{const t=await Bi(e);return(await t.pdfPage.getTextContent({normalizeWhitespace:!0})).items.map((e=>e.str)).join("")})();return Ti.set(e,n),n}async function Di(e){const t=Ii();let n=0,o=0,i="";for(let r=0;r<t.pagesCount;r++)if(i=await Fi(r),n=o,o+=i.length,o>=e)return{index:r,offset:n,text:i};return{index:t.pagesCount-1,offset:n,text:i}}function Hi(e){switch(e){case" ":case"\f":case"\n":case"\r":case"\t":case"\v":case" ":return!0;default:return!1}}const Vi=e=>!Hi(e);function Ui(e){
|
|
113
113
|
return void 0!==e.renderingDone?e.renderingDone:!!e.div&&null!==e.div.querySelector(".endOfContent")}async function qi(e,t,n){const[o,i]=await Promise.all([Bi(e),Fi(e)]);if(o.renderingState===Pi.FINISHED&&o.textLayer&&Ui(o.textLayer)){const e=o.textLayer.textLayerDiv??o.textLayer.div;if(!e)throw new Error("Unable to find PDF.js text layer root");const r=e.textContent,[s,a]=Ri(i,r,t,n,Vi);$i(r.slice(s,a))!==$i(i.slice(t,n))&&Fo("Text layer text does not match page text. Highlights will be mis-aligned.");const l=new ho(e,s),c=new ho(e,a);return new fo(l,c).toRange()}const r=function(e){let t=e.querySelector(mo);return t||(t=document.createElement("span"),t.classList.add("annotator-placeholder"),t.textContent="Loading annotations...",e.appendChild(t),t)}(o.div),s=document.createRange();return s.setStartBefore(r),s.setEndAfter(r),s}function $i(e){let t="";for(let n=0;n<e.length;n++){const o=e[n];Hi(o)||(t+=o)}return t}async function Wi(e,t){const n=t.find((e=>"TextQuoteSelector"===e.type))
|
|
114
114
|
;if(!n)throw new Error("No quote selector found");const o=t.find((e=>"TextPositionSelector"===e.type));if(o){try{const{index:e,offset:t,text:i}=await Di(o.start),r=o.start-t,s=o.end-t,a=i.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await qi(e,r,s)}catch{}try{const e=Li(n.exact,o.start),t=Oi.get(e);if(t){const{pageIndex:e,anchor:n}=t;return await qi(e,n.start,n.end)}}catch{}}return async function(e,t){const n=Ii().pagesCount,o=Array(n).fill(0).map(((e,t)=>t));let i,r;if(t){const{index:e,offset:n}=await Di(t);i=e,r=t-n,o.sort(((t,n)=>Math.abs(t-e)-Math.abs(n-e)))}const s=void 0!==e.prefix?$i(e.prefix):void 0,a=void 0!==e.suffix?$i(e.suffix):void 0,l=$i(e.exact);let c;for(const e of o){const t=await Fi(e),n=$i(t);let o;void 0!==i&&void 0!==r&&(e<i?o=n.length:e===i?[o]=Ri(t,n,r,r,Vi):o=0);const d=Jo(n,l,{prefix:s,suffix:a,hint:o});if(d&&(!c||d.score>c.match.score)){const[o,i]=Ri(n,t,d.start,d.end,Vi);c={page:e,match:{start:o,end:i,score:d.score}}
|
|
@@ -144,7 +144,7 @@ this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?
|
|
|
144
144
|
if(!t.selector||!t.selector.some((e=>"TextQuoteSelector"===e.type)))return{annotation:e,target:t};let n;try{const o=await this._integration.anchor(this.element,t.selector),i=fo.fromRange(o);n={annotation:e,target:t,range:i}}catch{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&&Eo(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(),o=this.element,i=(await Promise.all(t.map((e=>this._integration.describe(o,e))))).map((e=>({
|
|
145
145
|
source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+en(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Sr(),r}_hoverAnnotations(e){this._hoveredAnnotations.clear(),e.forEach((e=>this._hoveredAnnotations.add(e)));for(const t of this.anchors)if(t.highlights){const n=e.includes(t.annotation.$tag);ko(t.highlights,n)}this._sidebarRPC.call("hoverAnnotations",e)}_onSelection(e){const t=this._integration.getAnnotatableRange(e);if(!t)return void this._onClearSelection();const n=document.getSelection(),o=bo(n),i=yo(n);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=xr(),this._isAdderVisible=!0,this._adder.show(i,o)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}
|
|
146
146
|
selectAnnotations(e,{toggle:t=!1,focusInSidebar:n=!1}={}){t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){!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){zn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new wr(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function Ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function Rr(e,t){const n={}
|
|
147
|
-
;for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.
|
|
147
|
+
;for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1562.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const e=n.services[0];e.onLoginRequest&&(e.onLoginRequestProvided=!0),e.onLogoutRequest&&(e.onLogoutRequestProvided=!0),e.onSignupRequest&&(e.onSignupRequestProvided=!0),e.onProfileRequest&&(e.onProfileRequestProvided=!0),e.onHelpRequest&&(e.onHelpRequestProvided=!0)}return n}function Pr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=re(null);return oe((()=>{e?r.current?.close():r.current?.showModal()}),[e]),oe((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Pe("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function Tr({closed:e,children:t,...n}){return Pe("div",{...n,
|
|
148
148
|
className:Ae("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Pe("div",{className:"relative w-full h-full",children:t})})}function Or({document_:e=document,...t}){return Pe(se((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?Pr:Tr),[e]),{...t})}function Lr({config:e,groupId:t}){return Pe("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:Ar(e.notebookAppUrl,{...Rr(e.notebookAppUrl,e),group:t})})}function Mr({eventBus:e,config:t}){const[n,o]=ne(0),[i,r]=ne(!0),[s,a]=ne(null),l=re(""),c=re(null);oe((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),oe((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),oe((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const d=ae((()=>{r(!0),c.current?.publish("closeNotebook")}),[])
|
|
149
149
|
;return null===s?null:Pe(Or,{closed:i,onClose:d,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Pe("div",{className:"absolute right-0 m-3",children:Pe(St,{title:"Close notebook",onClick:d,variant:"dark",classes:Ae("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Pe(De,{className:"w-4 h-4"})})}),Pe(Lr,{config:t,groupId:s},n)]})}class Ir{constructor(e,t,n){this._container=new eo("notebook",(()=>Pe(Mr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Br({eventBus:e,config:t}){const[n,o]=ne(!0),i=re(null);oe((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{o(!1)})),i.current=t,()=>{t.destroy()}}),[e]);const r=()=>{o(!0),i.current?.publish("closeProfile")};return n?null:Pe(Or,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Pe("div",{className:"absolute right-0 m-3",children:Pe(St,{
|
|
150
150
|
title:"Close profile dialog",onClick:r,variant:"dark",classes:Ae("!bg-transparent enabled:hover:!bg-grey-3"),children:Pe(De,{className:"w-4 h-4"})})}),Pe("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Fr{constructor(e,t,n){this._container=new eo("profile",(()=>Pe(Br,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Dr({above:e,below:t,buckets:n,onFocusAnnotations:o,onScrollToAnnotation:i,onSelectAnnotations:r}){const s=e.anchors.length>0,a=t.anchors.length>0,l=e=>e.anchors.map((e=>e.tag));return Pe("ul",{className:"relative",children:[s&&Pe("li",{className:"absolute right-0 pointer-events-auto mt-[-11px]",style:{top:e.position},children:Pe(Jt,{"data-testid":"up-navigation-button",direction:"up",onClick:()=>{const t=[...e.anchors].sort(((e,t)=>e.bottom-t.bottom)),n=t[t.length-1];i(n.tag)},onBlur:()=>o([]),onFocus:()=>o(l(e)),onMouseEnter:()=>o(l(e)),onMouseOut:()=>o([]),
|