hypothesis 1.1619.0 → 1.1620.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 +2 -2
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +5 -5
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/highlights.css +1 -1
- package/build/styles/highlights.css.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?dc876a","styles/annotator.css":"styles/annotator.css?c7d4b9","styles/annotator.css.map":"styles/annotator.css.map?ffc171","styles/highlights.css":"styles/highlights.css?468946","styles/highlights.css.map":"styles/highlights.css.map?ee982b","styles/katex.min.css":"styles/katex.min.css?921c28","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?c949f4","styles/sidebar.css.map":"styles/sidebar.css.map?c4cba4","styles/ui-playground.css":"styles/ui-playground.css?6778a6","styles/ui-playground.css.map":"styles/ui-playground.css.map?0e6471","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3b9428","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?5c7ec6","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?5d518f","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?b0c97f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?77f32b"};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.1620.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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?dc876a",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?c7d4b9",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?ffc171",
|
|
5
|
-
"styles/highlights.css": "styles/highlights.css?
|
|
6
|
-
"styles/highlights.css.map": "styles/highlights.css.map?
|
|
5
|
+
"styles/highlights.css": "styles/highlights.css?468946",
|
|
6
|
+
"styles/highlights.css.map": "styles/highlights.css.map?ee982b",
|
|
7
7
|
"styles/katex.min.css": "styles/katex.min.css?921c28",
|
|
8
8
|
"styles/katex.min.css.map": "styles/katex.min.css.map?e7e03f",
|
|
9
9
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?c4cba4",
|
|
13
13
|
"styles/ui-playground.css": "styles/ui-playground.css?6778a6",
|
|
14
14
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?0e6471",
|
|
15
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?3b9428",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?5c7ec6",
|
|
15
17
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?5d518f",
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
17
|
-
"scripts/
|
|
18
|
-
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?77f32b",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?6c01fe"
|
|
18
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?b0c97f",
|
|
19
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?77f32b"
|
|
20
20
|
}
|
|
@@ -150,12 +150,12 @@ this._integration.canStyleClusteredHighlights?.()&&(this._clusterToolbar=new Ko(
|
|
|
150
150
|
this._sideBySideActive()||e.composedPath().some((e=>e instanceof Element&&e.localName.startsWith("hypothesis-")))||Tr(e.clientX,e.clientY).length||kr(window,this._hostFrame)&&this._sidebarLayout?.expanded&&window.innerWidth-e.clientX<this._sidebarLayout.width||this._sidebarRPC.call("closeSidebar")})),this._listeners.add(this.element,"mouseover",(({clientX:e,clientY:t})=>{const n=Tr(e,t);n.length&&this._highlightsVisible&&this._sidebarRPC.call("hoverAnnotations",n)})),this._listeners.add(this.element,"mouseout",(()=>{this._highlightsVisible&&this._sidebarRPC.call("hoverAnnotations",[])})),this._listeners.add(this.element,"keydown",(e=>{this._handleShortcut(e)})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async getDocumentInfo(){const[e,t,n]=await Promise.all([this._integration.uri(),this._integration.getMetadata(),this._integration.segmentInfo?.()]);return{uri:Ci(e),metadata:t,segmentInfo:n,persistent:this._integration.persistFrame?.()??!1}}async _sendDocumentInfo(){
|
|
151
151
|
this._integration.waitForFeatureFlags?.()&&await this._featureFlagsReceived;const e=await this.getDocumentInfo();this._sidebarRPC.call("documentInfoChanged",e)}_repositionAdder(){if(!this._isAdderVisible)return;const e=bo();e&&this._onSelection(e)}async _connectHost(e){this._hostRPC.on("clearSelection",(()=>{bo()&&(this._informHostOnNextSelectionClear=!1,Lr())})),this._hostRPC.on("createAnnotation",(({tool:e})=>this.createAnnotation(e))),this._hostRPC.on("hoverAnnotations",(e=>this._hoverAnnotations(e))),this._hostRPC.on("scrollToAnnotation",(e=>{this._scrollToAnnotation(e)})),this._hostRPC.on("selectAnnotations",((e,t)=>this.selectAnnotations(e,{toggle:t}))),this._hostRPC.on("sidebarLayoutChanged",(t=>{kr(window,e)&&this.fitSideBySide(t),this.element.dispatchEvent(new Ho({sidebarLayout:t,sideBySideActive:this._sideBySideActive()}))})),this._hostRPC.on("close",(()=>this.emit("hostDisconnected"))),this._notifySupportedToolsChanged();const t=await this._portFinder.discover("host");this._hostRPC.connect(t)}
|
|
152
152
|
_notifySupportedToolsChanged(){this._hostRPC.call("supportedToolsChanged",this._integration.supportedTools())}async _scrollToAnchor(e){const t=Mr(e);if(!t)return;let n;t instanceof Range?n=t:(n=new Range,n.selectNodeContents(t.anchor));const o=new Or(n);this.element.dispatchEvent(o)&&(await o.ready,await this._integration.scrollToAnchor(e))}async _scrollToAnnotation(e){const t=this.anchors.find((t=>t.annotation.$tag===e));t?.highlights&&await this._scrollToAnchor(t)}async _connectSidebar(){this._sidebarRPC.on("featureFlagsUpdated",(e=>this.features.update(e))),this._sidebarRPC.on("hoverAnnotations",(e=>this._hoverAnnotations(e))),this._sidebarRPC.on("scrollToAnnotation",(e=>{this._scrollToAnnotation(e)})),this._sidebarRPC.on("setHighlightsVisible",(e=>{this.setHighlightsVisible(e,!1)})),this._sidebarRPC.on("deleteAnnotation",(e=>this.detach(e))),this._sidebarRPC.on("loadAnnotations",(async e=>{try{await Promise.all(e.map((e=>this.anchor(e))))}catch(e){console.warn("Failed to anchor annotations:",e)}})),
|
|
153
|
-
this._sidebarRPC.on("showContentInfo",(e=>this._integration.showContentInfo?.(e))),this._sidebarRPC.on("setOutsideAssignmentNoticeVisible",(e=>{this._setOutsideAssignmentNoticeVisible(e)})),this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?.(e))),this._sidebarRPC.on("renderThumbnail",((e,t,n)=>{(async()=>{if(!this._integration.renderToBitmap)throw new Error("Thumbnail rendering not supported for document type");const n=this.anchors.find((t=>t.annotation.$tag===e));if(!n)throw new Error("Annotation not anchored in guest");return this._integration.renderToBitmap(n,t)})().then((e=>n(
|
|
153
|
+
this._sidebarRPC.on("showContentInfo",(e=>this._integration.showContentInfo?.(e))),this._sidebarRPC.on("setOutsideAssignmentNoticeVisible",(e=>{this._setOutsideAssignmentNoticeVisible(e)})),this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?.(e))),this._sidebarRPC.on("renderThumbnail",((e,t,n)=>{(async()=>{if(!this._integration.renderToBitmap)throw new Error("Thumbnail rendering not supported for document type");const n=this.anchors.find((t=>t.annotation.$tag===e));if(!n)throw new Error("Annotation not anchored in guest");return this._integration.renderToBitmap(n,t)})().then((e=>n({ok:!0,value:e}))).catch((e=>n({ok:!1,error:e.message})))})),this._portFinder.discover("sidebar").then((e=>{this._sidebarRPC.connect(e)})),this._sendDocumentInfo()}destroy(){var e;this._drawTool.destroy(),this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),
|
|
154
154
|
this._clusterToolbar?.destroy(),this._outsideAssignmentNotice?.destroy(),e=this.element,Eo(Array.from(e.querySelectorAll("hypothesis-highlight"))),this._integration.destroy(),super.destroy()}async anchor(e){this._contentReady&&(await this._contentReady,this._contentReady=void 0);const t=e=>{const t=Mr(e);if(!t)return;let n;n=t instanceof Range?So(t,e.annotation?.$cluster):function(e){const{shape:t,anchor:n}=e,o=getComputedStyle(n),i=parseInt(o.borderWidth),r=n.getBoundingClientRect(),s=new DOMRect(r.left,r.top,r.width-2*i,r.height-2*i),a=document.createElement("hypothesis-highlight");if(a.className="hypothesis-shape-highlight","rect"===t.type){const e=t.left*s.width-i,n=t.top*s.height-i,o=(t.right-t.left)*s.width,r=(t.bottom-t.top)*s.height;a.style.left=`${e}px`,a.style.top=`${n}px`,a.style.width=o-6+"px",a.style.height=r-6+"px"}else if("point"===t.type){const e=t.x*s.width-i,n=t.y*s.height-i;a.style.left=`${e}px`,a.style.top=`${n}px`,a.style.width="10px",a.style.height="10px"}return n.append(a),[a]}(t),
|
|
155
155
|
n.forEach((t=>{t._annotation=e.annotation})),e.highlights=n,this._hoveredAnnotations.has(e.annotation.$tag)&&Ro(n,!0)};this.detach(e.$tag,!1),this._annotations.add(e.$tag),e.target||(e.target=[]);const n=await Promise.all(e.target.map((async t=>{if(!t.selector||!t.selector.some((e=>"TextQuoteSelector"===e.type||"ShapeSelector"===e.type)))return{annotation:e,target:t};let n;try{const o=await this._integration.anchor(this.element,t.selector);if(o instanceof Range){const i=mo.fromRange(o);n={annotation:e,target:t,region:i}}else n={annotation:e,target:t,region:o}}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.region)),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)}
|
|
156
156
|
_updateAnchors(e,t){this.anchors=e,this._clusterToolbar?.scheduleClusterUpdates(),t&&this._bucketBarClient.update(this.anchors)}async createAnnotation(e){if("selection"===e)return this.createAnnotationFromSelection();if(["rect","point"].includes(e)){const t=await this._drawTool.draw(e),n=await this.getDocumentInfo(),o=[{source:n.uri,selector:await this._integration.describe(this.element,t)}],i={uri:n.uri,document:n.metadata,target:o,$tag:"a:"+on(8)};return this._sidebarRPC.call("createAnnotation",i),this.anchor(i),i}throw new Error("Unsupported annotation tool")}async createAnnotationFromSelection({highlight:e=!1}={}){const t=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(t.map((e=>this._integration.describe(o,e))))).map((e=>({source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+on(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),
|
|
157
157
|
Lr(),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);Ro(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=wo(n),i=xo(n);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Pr(),this._isAdderVisible=!0,this._adder.show(i,o)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(e,{toggle:t=!1,focusInSidebar:n=!1}={}){t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){
|
|
158
|
-
!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){jn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Er(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function Br(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function Dr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.
|
|
158
|
+
!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){jn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Er(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function Br(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function Dr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1620.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),
|
|
159
159
|
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 Fr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=se(null);return ie((()=>{e?r.current?.close():r.current?.showModal()}),[e]),ie((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Te("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function Hr({closed:e,children:t,...n}){return Te("div",{...n,className:ke("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Te("div",{className:"relative w-full h-full",children:t})})}function Vr({document_:e=document,...t}){return Te(ae((()=>function(e){
|
|
160
160
|
return"function"==typeof e.createElement("dialog").showModal}(e)?Fr:Hr),[e]),{...t})}function Ur({config:e,groupId:t}){return Te("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:Br(e.notebookAppUrl,{...Dr(e.notebookAppUrl,e),group:t})})}function qr({eventBus:e,config:t}){const[n,o]=oe(0),[i,r]=oe(!0),[s,a]=oe(null),l=se(""),c=se(null);ie((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ie((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),ie((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const h=le((()=>{r(!0),c.current?.publish("closeNotebook")}),[]);return null===s?null:Te(Vr,{closed:i,onClose:h,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Te("div",{className:"absolute right-0 m-3",children:Te(Rt,{title:"Close notebook",onClick:h,variant:"dark",
|
|
161
161
|
classes:ke("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Te(He,{className:"w-4 h-4"})})}),Te(Ur,{config:t,groupId:s},n)]})}class $r{constructor(e,t,n){this._container=new to("notebook",(()=>Te(qr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function zr({eventBus:e,config:t}){const[n,o]=oe(!0),i=se(null);ie((()=>{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:Te(Vr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Te("div",{className:"absolute right-0 m-3",children:Te(Rt,{title:"Close profile dialog",onClick:r,variant:"dark",classes:ke("!bg-transparent enabled:hover:!bg-grey-3"),children:Te(He,{className:"w-4 h-4"})})}),Te("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}
|