hypothesis 1.1723.0 → 1.1725.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-template.js +1 -1
- package/build/boot.js +1 -1
- package/build/manifest.json +9 -9
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/sidebar.bundle.js +41 -41
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css +1 -1
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +1 -1
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +1 -1
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +2 -2
package/build/boot-template.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?4426c3","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?728e30","styles/annotator.css.map":"styles/annotator.css.map?11ce1b","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?e31f39","styles/katex.min.css.map":"styles/katex.min.css.map?0511b4","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?ce361f","styles/sidebar.css.map":"styles/sidebar.css.map?99d088","styles/ui-playground.css":"styles/ui-playground.css?67f38a","styles/ui-playground.css.map":"styles/ui-playground.css.map?cb998a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?1b3407","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?ea08c1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?29d175"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"__ASSET_ROOT__");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"__NOTEBOOK_APP_URL__"),h=a(d.profileAppUrl||"__PROFILE_APP_URL__"),y=a(d.sidebarAppUrl||"__SIDEBAR_APP_URL__");!function(s,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)t(s,i(e,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?4426c3","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?a8ba5d","styles/annotator.css":"styles/annotator.css?728e30","styles/annotator.css.map":"styles/annotator.css.map?11ce1b","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?e31f39","styles/katex.min.css.map":"styles/katex.min.css.map?0511b4","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?ce361f","styles/sidebar.css.map":"styles/sidebar.css.map?99d088","styles/ui-playground.css":"styles/ui-playground.css?67f38a","styles/ui-playground.css.map":"styles/ui-playground.css.map?cb998a","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?1b3407","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?ea08c1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?a9e548","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?29d175"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1725.0/");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"https://hypothes.is/notebook"),h=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)t(s,i(e,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?4426c3",
|
|
3
3
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?a8ba5d",
|
|
4
|
-
"styles/annotator.css": "styles/annotator.css?
|
|
4
|
+
"styles/annotator.css": "styles/annotator.css?728e30",
|
|
5
|
+
"styles/annotator.css.map": "styles/annotator.css.map?11ce1b",
|
|
5
6
|
"styles/highlights.css": "styles/highlights.css?ef86d1",
|
|
6
|
-
"styles/annotator.css.map": "styles/annotator.css.map?2a66f1",
|
|
7
7
|
"styles/highlights.css.map": "styles/highlights.css.map?6ce8dd",
|
|
8
8
|
"styles/katex.min.css": "styles/katex.min.css?e31f39",
|
|
9
9
|
"styles/katex.min.css.map": "styles/katex.min.css.map?0511b4",
|
|
10
10
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?d58df4",
|
|
11
11
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?5a12c5",
|
|
12
|
-
"styles/sidebar.css": "styles/sidebar.css?
|
|
13
|
-
"styles/sidebar.css.map": "styles/sidebar.css.map?
|
|
14
|
-
"styles/ui-playground.css": "styles/ui-playground.css?
|
|
15
|
-
"styles/ui-playground.css.map": "styles/ui-playground.css.map?
|
|
12
|
+
"styles/sidebar.css": "styles/sidebar.css?ce361f",
|
|
13
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?99d088",
|
|
14
|
+
"styles/ui-playground.css": "styles/ui-playground.css?67f38a",
|
|
15
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?cb998a",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?1b3407",
|
|
16
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?ea08c1",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?ff87c0",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?a9e548",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?29d175"
|
|
20
20
|
}
|
|
@@ -149,7 +149,7 @@ this._contentReady&&(await this._contentReady,this._contentReady=void 0);const t
|
|
|
149
149
|
this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",e),n}detach(e,t=!0){this._annotations.delete(e);const n=[];for(const t of this.anchors)t.annotation.$tag!==e?n.push(t):t.highlights&&this._highlighter.removeHighlights(t.highlights);this._updateAnchors(n,t)}_updateAnchors(e,t){this.anchors=e,this._clusterToolbar?.scheduleClusterUpdates(),t&&this._bucketBarClient.update(this.anchors)}async createAnnotation(e){if("selection"===e)return this.createAnnotationFromSelection();if(!["rect","point"].includes(e))throw new Error("Unsupported annotation tool");{let t=!1;try{this._hostRPC.call("activeToolChanged",e);const t=await this._drawTool.draw(e),n=await this.getDocumentInfo(),o=[{source:n.uri,selector:await this._integration.describe(this.element,t)}],i={uri:n.uri,document:n.metadata,target:o,$tag:"a:"+Ct(8)};return this._sidebarRPC.call("createAnnotation",i),this.anchor(i),i}catch(e){if(e instanceof oo&&["canceled","restarted"].includes(e.kind))return t="restarted"===e.kind,
|
|
150
150
|
null;throw e}finally{t||this._hostRPC.call("activeToolChanged",null)}}}async createAnnotationFromSelection({highlight:e=!1}={}){const t=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(t.map((e=>this._integration.describe(o,e))))).map((e=>({source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+Ct(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),ir(),r}_hoverAnnotations(e){this._hoveredAnnotations.clear(),e.forEach((e=>this._hoveredAnnotations.add(e)));for(const t of this.anchors)if(t.highlights){const n=e.includes(t.annotation.$tag);this._highlighter.setHighlightsFocused(t.highlights,n)}this._sidebarRPC.call("hoverAnnotations",e)}_onSelection(e){const t=this._integration.getAnnotatableRange(e);if(!t)return void this._onClearSelection();const n=document.getSelection(),o=Hn(n),i=Un(n);i?(this.selectedRanges=[t],
|
|
151
151
|
this._hostRPC.call("textSelected"),this._commentsMode||(this._adder.annotationsForSelection=tr(),this._isAdderVisible=!0,this._adder.show(i,o))):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(e,{toggle:t=!1,focusInSidebar:n=!1}={}){t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){this._highlighter.setHighlightsVisible(e),this._highlightsVisible=e,t&&this._hostRPC.call("highlightsVisibleChanged",e)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(e){this._sidebarLayout=e,this._integration.fitSideBySide(e)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(e){dn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible&&!this._commentsMode)}
|
|
152
|
-
_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Ji(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function lr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.
|
|
152
|
+
_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new Ji(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function lr(e,t){const n={};for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1725.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const e=n.services[0];e.onLoginRequest&&(e.onLoginRequestProvided=!0),e.onLogoutRequest&&(e.onLogoutRequestProvided=!0),e.onSignupRequest&&(e.onSignupRequestProvided=!0),e.onProfileRequest&&(e.onProfileRequestProvided=!0),e.onHelpRequest&&(e.onHelpRequestProvided=!0)}return n}function cr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=ie(null);return ne((()=>{
|
|
153
153
|
e?r.current?.close():r.current?.showModal()}),[e]),ne((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Se("dialog",{ref:r,className:"relative m-5 w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function hr({closed:e,children:t,...n}){return Se("div",{...n,className:Ne("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Se("div",{className:"relative w-full h-full",children:t})})}function dr({document_:e=document,...t}){return Se(re((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?cr:hr),[e]),{...t})}function ur({config:e,groupId:t}){return Se("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:ar(e.notebookAppUrl,{...lr(e.notebookAppUrl,e),group:t})})}function fr({eventBus:e,config:t}){const[n,o]=te(0),[i,r]=te(!0),[s,a]=te(null),l=ie(""),c=ie(null)
|
|
154
154
|
;ne((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ne((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),ne((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const h=se((()=>{r(!0),c.current?.publish("closeNotebook")}),[]);return null===s?null:Se(dr,{closed:i,onClose:h,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Se("div",{className:"absolute right-0 m-3",children:Se(ot,{title:"Close notebook",onClick:h,variant:"dark",classes:Ne("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Se(Le,{className:"w-4 h-4"})})}),Se(ur,{config:t,groupId:s},n)]})}class pr{constructor(e,t,n){this._container=new vn("notebook",(()=>Se(fr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function gr({eventBus:e,config:t}){const[n,o]=te(!0),i=ie(null);ne((()=>{
|
|
155
155
|
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:Se(dr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Se("div",{className:"absolute right-0 m-3",children:Se(ot,{title:"Close profile dialog",onClick:r,variant:"dark",classes:Ne("!bg-transparent enabled:hover:!bg-grey-3"),children:Se(Le,{className:"w-4 h-4"})})}),Se("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class _r{constructor(e,t,n){this._container=new vn("profile",(()=>Se(gr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function mr({above:e,below:t,buckets:n,onFocusAnnotations:o,onScrollToAnnotation:i,onSelectAnnotations:r}){const s=e.anchors.length>0,a=t.anchors.length>0,l=e=>e.anchors.map((e=>e.tag));return Se("ul",{className:"relative",
|
|
@@ -537,7 +537,7 @@ var Ep=Jn((function({annotation:e,toastMessenger:t}){return Ve(ha,{annotation:e,
|
|
|
537
537
|
target:"_blank","aria-label":`Tag: ${n}`,title:`View annotations with tag: ${n}`,underline:"none",children:n}):Ve("span",{className:"text-color-text-light cursor-default","aria-label":`Tag: ${n}`,lang:"",children:n})}),t&&Ve("button",{className:Je("px-1.5 py-1 touch:p-2","border-l rounded rounded-l-none","text-grey-6 hover:text-color-text hover:bg-grey-2","transition-colors duration-200","focus-visible-ring ring-inset"),onClick:()=>{t(n)},title:`Remove tag: ${n}`,children:Ve(dt,{className:"font-base w-em h-em",title:`Remove ${n}`})})]})}function Ip({classes:e,setCollapsed:t,collapsed:n}){const r=n?"More":"Less";return Ve(dn,{classes:Je("text-grey-7 font-normal",e),expanded:!n,onClick:()=>t(!n),title:`Toggle visibility of full annotation text: Show ${r}`,children:Ve("div",{className:"flex items-center gap-x-2",children:[Ve(n?Et:yt,{className:"w-3 h-3"}),Ve("div",{children:r})]})})}var Op=Jn((function({annotation:e,settings:t}){
|
|
538
538
|
const[n,r]=ie(!0),[o,i]=ie(!1),a=Hi(),s=a.defaultAuthority(),l=a.getDraft(e),c=a.isFeatureEnabled("at_mentions"),u=l?.tags??e.tags,d=l?.text??e.text,h=d.length>0,p=u.length>0,m=Zn(["annotationFontFamily"],t),f=ue((()=>Lr(e.user,s)),[e,s]),g=f?"display-name":"username",v=e=>a.getLink("search.tag",{tag:e});return Ve("div",{className:"space-y-4",children:[h&&Ve(Aa,{inlineControl:!1,collapsed:n,collapsedHeight:400,onCollapsibleChanged:i,onToggleCollapsed:r,overflowThreshold:20,children:Ve(mp,{markdown:d,style:m,mentions:e.mentions,mentionsEnabled:c,mentionMode:g})}),(o||p)&&Ve("div",{className:"flex flex-row gap-x-2",children:[Ve("div",{className:"grow",children:p&&Ve(Mp,{children:u.map((e=>Ve(Np,{tag:e,href:f?void 0:v(e)},e)))})}),o&&Ve("div",{children:Ve(Ip,{classes:Je("-mt-3"),collapsed:n,setCollapsed:r})})]})]})}),["settings"])
|
|
539
539
|
;const zp=(e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0,Lp=String.raw`[\s,.;:|?!'"\-()[\]{}]`,Pp=new RegExp(`(^|${Lp})@([A-Za-z0-9_][A-Za-z0-9._]+[A-Za-z0-9_])(?=${Lp}|$)`,"g"),Rp=String.raw`[^\]^[]*`,Dp=new RegExp(`@\\[(${Rp})]`,"g");function jp(e,t){const n=document.createElement("a");return n.setAttribute("data-hyp-mention",""),n.setAttribute("data-userid",e),n.textContent=t,n.outerHTML}const Hp=/<a[^>]\bdata-hyp-mention\b[^>]*>@([^<]+)<\/a>/g;function Fp(e,t){const n=[...e.slice(0,t).matchAll(new RegExp(Lp,"g"))],r=n.length>0?Math.max(...n.map((e=>e.index))):-1,o=e.slice(t).search(new RegExp(Lp));return{start:r+1,end:-1===o?e.length:t+o}}function $p(e){return`@[${e.replace(/[[\]]/g,"")}]`}let Bp,qp=function(e){return e.ANCHOR_LINK="ANCHOR_LINK",e.IMAGE_LINK="IMAGE_LINK",e}({});function Up(e,t,n,r){let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,i+=r.length-n):i<=t||(o<=t&&i>=t+n?i+=r.length-n:o<t&&i<t+n?o=t:o<t+n&&i>t+n?i+=r.length-n:t<o&&t+n>i&&(o=t,i=t+n)),{
|
|
540
|
-
text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Gp(e,t=qp.ANCHOR_LINK){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===qp.IMAGE_LINK&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Up(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://insert-your-link-here
|
|
540
|
+
text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Gp(e,t=qp.ANCHOR_LINK){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===qp.IMAGE_LINK&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Up(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://example.com/insert-your-link-here";return r=Up(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Vp(e,t,n,r){void 0===n&&(n=t);const o=e.text.slice(e.selectionStart-t.length,e.selectionStart),i=e.text.slice(e.selectionEnd,e.selectionEnd+t.length);let a=e;return e.selectionStart===e.selectionEnd&&r&&(a=Up(e,e.selectionStart,0,r),a.selectionStart=a.selectionEnd-r.length),o===t&&i===n?(a=Up(a,a.selectionStart-t.length,t.length,""),a=Up(a,a.selectionEnd,n.length,"")):(a=Up(a,a.selectionStart,0,t),
|
|
541
541
|
a=Up(a,a.selectionEnd,0,n)),a}function Wp(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Kp(e,t,n,r){let o=function(e,t){const n=e.lastIndexOf("\n",t);return n<0?0:n+1}(e.text,t),i=Wp(e.text,t),a=0;for(;i<=Wp(e.text,n);){const t=i===e.text.length,s=i-o,l=Wp((e=r(e,o,i,a)).text,o)-o;if(n+=l-s,t)break;o=o+l+1,i=Wp(e.text,o),a+=1}return e}function Yp(e,t){const n=e.selectionStart,r=e.selectionEnd,o=e=>"function"==typeof t?t(e):t;let i=!0;return Kp(e,n,r,((e,t,n,r)=>{const a=o(r);return e.text.slice(t,t+a.length)!==a&&(i=!1),e})),Kp(e,n,r,i?(e,t,n,r)=>Up(e,t,o(r).length,""):(e,t,n,r)=>{const i=o(r);return e.text.slice(t,t+i.length)===i?e:Up(e,t,0,i)})}const Xp=!1;function Zp({user:e,usersListboxId:t,highlighted:n,mentionMode:r,onSelect:o,onHighlight:i}){const a="username"===r;return Ve("li",{id:`${t}-${e.username}`,className:Je("flex justify-between items-center gap-x-2 rounded p-2","leading-tight",{"bg-grey-2":n}),onClick:e=>{e.stopPropagation(),o()},onMouseMove:i,role:"option","aria-selected":n,
|
|
542
542
|
children:[a&&Ve("span",{className:"truncate","data-testid":`username-${e.username}`,children:e.username}),Ve("span",{className:Je({"text-color-text-light":a}),children:e.displayName})]},e.username)}function Qp({loadingUsers:e,users:t,onSelectUser:n,highlightedSuggestion:r,onHighlightSuggestion:o,usersListboxId:i,mentionMode:a,...s}){return Ve(Nn,{...s,classes:Je("p-1",["!max-h-96"]),children:Ve("ul",{className:"flex-col gap-y-0.5",role:"listbox","aria-orientation":"vertical",id:i,children:e?Ve("li",{className:"italic p-2","data-testid":"suggestions-loading-indicator",children:"Loading suggestions…"}):Ve(y,{children:[t.map(((e,t)=>Ve(Zp,{user:e,highlighted:r===t,mentionMode:a,usersListboxId:i,onSelect:()=>n(e),onHighlight:()=>o(t)},e.username))),0===t.length&&Ve("li",{className:"italic p-2","data-testid":"suggestions-fallback",children:"No matches. You can still write the username"})]})})})}const Jp={bold:"b",image:"g",italic:"i",link:"l",list:"u",math:"m",numlist:"o",quote:"q"}
|
|
543
543
|
;function em({disabled:e=!1,icon:t,label:n,onClick:r,shortcutKey:o,title:i="",classes:a}){const s=ue((()=>zp()?"Cmd":"Ctrl"),[]);let l=i;o&&(l+=` (${s}-${o.toUpperCase()})`);const c={disabled:e,onClick:r,title:l};return n?Ve(dn,{classes:Je("p-1.5 text-grey-7 hover:text-grey-9",a),...c,size:"custom",variant:"custom",children:n}):Ve(mn,{classes:Je("px-2 py-2.5",a),...c,children:t&&Ve(t,{className:"w-[10px] h-[10px] touch:w-[13px] touch:h-[13px]"})})}function tm({classes:e,containerRef:t,mentionsEnabled:n,usersForMentions:r,onEditText:o,onKeyDown:i,mentionMode:a,onInsertMentionSuggestion:s,...l}){const[c,u]=ie(!1),[d,h]=ie(),p=Ie(t),[m,f]=ie(0),g=ce(null),v=ue((()=>n?function(e,t,{mentionMode:n,maxUsers:r=10}){return void 0===e||"loading"===t.status?[]:t.users.filter((t=>{if(!e)return!0;const r=t.displayName??"";return("username"===n?`${t.username} ${r}`:r).toLowerCase().includes(e.toLowerCase())})).slice(0,r)}(d,r,{mentionMode:a}):[]),[d,a,n,r]),b=de((e=>{if(!n)return;const{x:t,y:r}=function(e){
|
|
@@ -582,7 +582,7 @@ const n=e.slice(0,e.indexOf(":"));if(!n)return[null,e];if(t.includes(n)){return[
|
|
|
582
582
|
case"oldest":return wf(yf(e),yf(t));case"location":return function(e,t){if(!e.annotation||!t.annotation)return function(e,t){return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Gr(e.annotation),r=Gr(t.annotation);if(n.cfi||r.cfi){const e="/0",t=Qm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=_f(n.pageIndex,r.pageIndex);if(0!==o)return o;const i=_f(n.top,r.top);if(0!==i)return i;const a=_f(n.charOffset,r.charOffset);if(0!==a)return a;return wf(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const kf=function(e){if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,sortCompareFn:(e,n)=>xf(e,n,{sortBy:t.sortKey})};if(!!t.filterQuery||Object.keys(t.filters).length>0){const e=function(e,t={}){const n=e=>{const n=t[e];return"string"==typeof n?[n]:[]
|
|
583
583
|
},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=ff(e,df);for(const e of h){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and",filterReplies:!0},cfi:{terms:r,operator:"or",filterReplies:!1},quote:{terms:i,operator:"and",filterReplies:!1},page:{terms:o,operator:"or",filterReplies:!1},since:{terms:d,operator:"and",filterReplies:!0},tag:{terms:a,operator:"and",filterReplies:!0},text:{terms:s,operator:"and",filterReplies:!0},uri:{terms:l,operator:"or",filterReplies:!1},user:{terms:c,
|
|
584
584
|
operator:"or",filterReplies:!0}}}(t.filterQuery||"",t.filters),r={},o={};for(const[t,n]of Object.entries(e))n.filterReplies?r[t]=n:o[t]=n;n.filterFn=e=>uf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&uf([e.annotation],o).length>0)}const r=Ym(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((n=>{if(!n.annotation&&!e.topAnnotationsPlaceholder)return!1;if(n.annotation&&Hr(n.annotation))return!1;const r=n.annotation?vf(n.annotation):"orphan";return o[r]+=1,r===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Sf(){const e=Hi(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=e.isFeatureEnabled("top_annos_placeholder"),l=ue((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a,topAnnotationsPlaceholder:s}}),[o,n,i,t,a,s]);return kf(l)}var Af,Tf,Ef=Jn((function({loadAnnotationsService:e,onLogin:t}){
|
|
585
|
-
const n=Hi(),r=n.routeParams().id??"",{rootThread:o}=Sf(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(Fi,{errorType:"annotation",onLoginRequest:t}),Ve(Hm,{threads:o.children})]})}),["loadAnnotationsService"]);class Cf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.
|
|
585
|
+
const n=Hi(),r=n.routeParams().id??"",{rootThread:o}=Sf(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(Fi,{errorType:"annotation",onLoginRequest:t}),Ve(Hm,{threads:o.children})]})}),["loadAnnotationsService"]);class Cf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.1725.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||r,this.fingerprint=t[0]?.metadata?.documentFingerprint??r,this.account=o,this.timestamp=(new Date).toString();const i=t[0]?.segment;if(i){const e=[];if(i.cfi&&e.push(["CFI",i.cfi]),i.pages){const t=`${i.pages.start}-${i.pages.end}`;e.push(["Pages",t])}i.url&&e.push(["URL",i.url]),
|
|
586
586
|
this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}var Mf=function(){if(Tf)return Af;Tf=1;var e="complete",t="canceled";function n(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function r(t){var o=t._scrollSettings;if(o){var i=o.maxSynchronousAlignments,a=function(e,t){var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,
|
|
587
587
|
a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect();var v=u.left-(n.left-t.scrollLeft),b=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=b+l*g-t.clientHeight*g,r-=p,o-=m,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(o,t),s=Date.now()-o.startTime,l=Math.min(1/o.time*s,1);if(o.endIterations>=i)return n(t,a.x,a.y),t._scrollSettings=null,o.end(e);var c=1-o.ease(l);if(n(t,a.x-a.differenceX*c,a.y-a.differenceY*c),s>=o.time)return o.endIterations++,o.scrollAncestor&&r(o.scrollAncestor),void r(t);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(r.bind(null,t))}}function o(e){return e.self===e}function i(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}
|
|
588
588
|
function a(){return!0}function s(e){if(e.assignedSlot)return s(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}return Af=function(n,l,c){if(n){"function"==typeof l&&(c=l,l=null),l||(l={}),l.time=isNaN(l.time)?1e3:l.time,l.ease=l.ease||function(e){return 1-Math.pow(1-e,e/2)},l.align=l.align||{};var u=s(n),d=1,h=l.validTarget||a,p=l.isScrollable;l.debug&&(console.log("About to scroll to",n),u||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var m=[];u;)if(l.debug&&console.log("Scrolling parent node",u),h(u,d)&&(p?p(u,i):i(u))&&(d++,m.push(u)),!(u=s(u))){f(e);break}return m.reduce(((e,i,a)=>function(e,n,i,a,s){var l,c=!n._scrollSettings,u=n._scrollSettings,d=Date.now(),h={passive:!0};function p(e){n._scrollSettings=null,
|
|
@@ -670,7 +670,7 @@ client_version:r.version,annotations:e.map(Eb)}}buildTextExportContent(e,{groupN
|
|
|
670
670
|
${u.join("\n\n")}`}buildCSVExportContent(e,{groupName:t="",defaultAuthority:n="",displayNamesEnabled:r=!1,separator:o=","}={}){const{uri:i,extractUsername:a}=this._exportCommon(e,{displayNamesEnabled:r,defaultAuthority:n}),s=e=>[Cb(new Date(e.created)),a(e),Qr(e)??"",i,t,Ur(e,this._settings),Kr(e)??Yr(e)??"",e.text,e.tags.join(",")].map((e=>function(e,t){return new RegExp(`["\n\r${t}]`).test(e)?`"${e.replace(/"/g,'""')}"`:e}(e,o))).join(o);return`${["Created at","Author","Page","URL","Group","Type","Quote/description","Comment","Tags"].join(o)}\n${e.map((e=>s(e))).join("\n")}`}buildHTMLExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const{uri:i,title:a,uniqueUsers:s,replies:l,extractUsername:c}=this._exportCommon(e,{displayNamesEnabled:n,defaultAuthority:r});return function(e,t,n){var r=Object.assign({},Sb,n||{});return r.jsx||(r.attributeHook=null),Zv(e,t,r)}(Ve("html",{lang:"en",children:[Ve("head",{children:[Ve("title",{
|
|
671
671
|
children:`Annotations on "${a}"`}),Ve("meta",{charSet:"UTF-8"})]}),Ve("body",{children:[Ve("section",{children:[Ve("h1",{children:"Summary"}),Ve("p",{children:Ve("time",{dateTime:o.toISOString(),children:Cb(o)})}),Ve("p",{children:Ve("strong",{children:a})}),Ve("p",{children:Ve("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Group:"}),Ve("td",{children:t})]}),Ve("tr",{children:[Ve("td",{children:"Total users:"}),Ve("td",{children:s.length})]}),Ve("tr",{children:[Ve("td",{children:"Users:"}),Ve("td",{children:s.join(", ")})]}),Ve("tr",{children:[Ve("td",{children:"Total annotations:"}),Ve("td",{children:e.length})]}),Ve("tr",{children:[Ve("td",{children:"Total replies:"}),Ve("td",{children:l.length})]})]})})]}),Ve("hr",{}),Ve("section",{children:[Ve("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Qr(e),r=Kr(e),o=Yr(e),i=ep(e.text),a=i===`<p>${e.text}</p>`?e.text:i
|
|
672
672
|
;return Ve("article",{children:[Ve("h2",{children:["Annotation ",t+1,":"]}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Created at:"}),Ve("td",{children:Ve("time",{dateTime:e.created,children:Cb(new Date(e.created))})})]}),Ve("tr",{children:[Ve("td",{children:"Author:"}),Ve("td",{children:c(e)})]}),n&&Ve("tr",{children:[Ve("td",{children:"Page:"}),Ve("td",{children:n})]}),Ve("tr",{children:[Ve("td",{children:"Type:"}),Ve("td",{children:Ur(e,this._settings)})]}),r&&Ve("tr",{children:[Ve("td",{children:"Quote:"}),Ve("td",{children:Ve("blockquote",{style:{margin:0},children:r})})]}),o&&Ve("tr",{children:[Ve("td",{children:"Description:"}),Ve("td",{children:o})]}),Ve("tr",{children:[Ve("td",{children:"Comment:"}),Ve("td",{dangerouslySetInnerHTML:{__html:a}})]}),e.tags.length>0&&Ve("tr",{children:[Ve("td",{children:"Tags:"}),Ve("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
|
|
673
|
-
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Zi(e,n,t),{uri:i,title:a}=Qi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Mb.$inject=["settings"];class Nb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
673
|
+
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Zi(e,n,t),{uri:i,title:a}=Qi(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Pr(e))),extractUsername:o}}}Mb.$inject=["settings"];class Nb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1725.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=ci(c.url,a),m=new URL(h);for(const[e,t]of Object.entries(p)){
|
|
674
674
|
const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await yp(m.toString(),{body:s?JSON.stringify(Eb(s)):null,headers:u,method:c.method,signal:l})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={read:i("annotation.read"),create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide"),moderate:i("annotation.moderate")},this.group={member:{delete:i("group.member.delete")},members:{read:i("group.members.read")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}
|
|
675
675
|
Nb.$inject=["apiRoutes","auth","store"];var Ib,Ob,zb,Lb,Pb,Rb={};function Db(){return zb||(zb=1,e=Rb,t=function(){if(Ob)return Ib;function e(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Ob=1,Ib=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),
|
|
676
676
|
this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){
|
|
@@ -698,7 +698,7 @@ logo:"data:image/svg+xml;utf8,"+encodeURIComponent('<?xml version="1.0" encoding
|
|
|
698
698
|
;const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:ly})}async _loadGroupsForUserAndDocument(){const e=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let t=null;"sidebar"===this._store.route()&&(t=await e()),this._setupAutoReload();const n=this._store.directLinkedAnnotationId();let r=null;n&&(r=this._api.annotation.get({id:n}).catch((()=>null)));const o=this._store.directLinkedGroupId();let i=null;o&&(i=this._fetchGroup(o).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),null))));const a={expand:ly},s=this._serviceConfig?.authority;s&&(a.authority=s),t&&(a.document_uri=t)
|
|
699
699
|
;const[l,c,u,d,h]=await Promise.all([this._api.profile.groups.read({expand:ly}),this._api.groups.list(a),this._auth.getAccessToken(),r,i]);h&&!c.some((e=>e.id===h.id))&&c.push(h);let p=null;if(d){p=d.group;const e=l.concat(c).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);c.push(e)}catch{this._toastMessenger.error("Unable to fetch group for linked annotation")}}const m=null!==u,f=await this._filterGroups(fv(l,c,t,this._settings),m,p,o),g=p||o||null;return this._addGroupsToStore(f,g),f}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:ly});let n=null;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}},o=await Promise.all(e.map((e=>t.find((t=>t.id===e||t.groupid===e))||r(e)))),i=o.filter((e=>null!==e)),a=this._store.directLinkedGroupId();return this._addGroupsToStore(i,a),n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){const e=this._serviceConfig?.groups;let t
|
|
700
700
|
;if(Array.isArray(e)||(n=e,"function"==typeof n?.then)){let n=[];try{n=await e}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}t=await this._loadServiceSpecifiedGroups(n)}else t=await this._loadGroupsForUserAndDocument();var n;const{groupsAllowlist:r}=this._settings;return r&&this._store.filterGroups(r),t}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){this._focusedMembersController?.abort();const e=this._store.newAnnotations().filter((e=>!Pr(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}async loadFocusedGroupMembers(){const e=this._store.focusedGroupId();if(!e)return;this._focusedMembersController?.abort(),this._focusedMembersController=new AbortController;const{signal:t}=this._focusedMembersController;this._store.startLoadingFocusedGroupMembers()
|
|
701
|
-
;const n=await this._fetchAllMembers(e,t);this._store.loadFocusedGroupMembers(t?.aborted?null:n)}async _fetchAllMembers(e,t){const n=await this._fetchMembers({groupId:e,signal:t}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}cy.$inject=["store","api","auth","settings","toastMessenger"];const uy="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,dy=globalThis,hy="10.
|
|
701
|
+
;const n=await this._fetchAllMembers(e,t);this._store.loadFocusedGroupMembers(t?.aborted?null:n)}async _fetchAllMembers(e,t){const n=await this._fetchMembers({groupId:e,signal:t}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}cy.$inject=["store","api","auth","settings","toastMessenger"];const uy="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,dy=globalThis,hy="10.23.0";function py(){return my(dy),dy}function my(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||hy,t[hy]=t[hy]||{}}function fy(e,t,n=dy){const r=n.__SENTRY__=n.__SENTRY__||{},o=r[hy]=r[hy]||{};return o[e]||(o[e]=t())}const gy=["debug","info","warn","error","log","assert","trace"],vy="Sentry Logger ",by={};function yy(e){if(!("console"in dy))return e()
|
|
702
702
|
;const t=dy.console,n={},r=Object.keys(by);r.forEach((e=>{const r=by[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function _y(){return xy().enabled}function wy(e,...t){uy&&_y()&&yy((()=>{dy.console[e](`${vy}[${e}]:`,...t)}))}function xy(){return uy?fy("loggerSettings",(()=>({enabled:!1}))):{enabled:!1}}const ky={enable:function(){xy().enabled=!0},disable:function(){xy().enabled=!1},isEnabled:_y,log:function(...e){wy("log",...e)},warn:function(...e){wy("warn",...e)},error:function(...e){wy("error",...e)}},Sy=50,Ay="?",Ty=/\(error: (.*)\)/,Ey=/captureMessage|captureException/;function Cy(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0,r=0)=>{const o=[],i=e.split("\n");for(let e=n;e<i.length;e++){let n=i[e];n.length>1024&&(n=n.slice(0,1024));const a=Ty.test(n)?n.replace(Ty,"$1"):n;if(!a.match(/\S*Error: /)){for(const e of t){const t=e(a);if(t){o.push(t);break}}if(o.length>=Sy+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e)
|
|
703
703
|
;/sentryWrapped/.test(My(t).function||"")&&t.pop();t.reverse(),Ey.test(My(t).function||"")&&(t.pop(),Ey.test(My(t).function||"")&&t.pop());return t.slice(0,Sy).map((e=>({...e,filename:e.filename||My(t).filename,function:e.function||Ay})))}(o.slice(r))}}function My(e){return e[e.length-1]||{}}const Ny="<anonymous>";function Iy(e){try{return e&&"function"==typeof e&&e.name||Ny}catch{return Ny}}function Oy(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)})),e}catch{return}}}const zy={},Ly={};function Py(e,t){zy[e]=zy[e]||[],zy[e].push(t)}function Ry(e,t){if(!Ly[e]){Ly[e]=!0;try{t()}catch(t){uy&&ky.error(`Error while instrumenting ${e}`,t)}}}function Dy(e,t){const n=e&&zy[e];if(n)for(const r of n)try{r(t)}catch(t){uy&&ky.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Iy(r)}\nError:`,t)}}let jy=null;function Hy(){jy=dy.onerror,dy.onerror=function(e,t,n,r,o){return Dy("error",{column:r,error:o,line:n,msg:e,url:t
|
|
704
704
|
}),!!jy&&jy.apply(this,arguments)},dy.onerror.__SENTRY_INSTRUMENTED__=!0}let Fy=null;function $y(){Fy=dy.onunhandledrejection,dy.onunhandledrejection=function(e){return Dy("unhandledrejection",e),!Fy||Fy.apply(this,arguments)},dy.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const By=Object.prototype.toString;function qy(e){switch(By.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Jy(e,Error)}}function Uy(e,t){return By.call(e)===`[object ${t}]`}function Gy(e){return Uy(e,"ErrorEvent")}function Vy(e){return Uy(e,"DOMError")}function Wy(e){return Uy(e,"String")}function Ky(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Yy(e){return null===e||Ky(e)||"object"!=typeof e&&"function"!=typeof e}function Xy(e){return Uy(e,"Object")}function Zy(e){return"undefined"!=typeof Event&&Jy(e,Event)}function Qy(e){
|
|
@@ -718,21 +718,21 @@ getCurrentScope:()=>j_().getScope(),getIsolationScope:()=>j_().getIsolationScope
|
|
|
718
718
|
})),e}),{});return cw(e)}(e);if(!t)return;const n=Object.entries(t).reduce(((e,[t,n])=>{if(t.match(sw)){e[t.slice(aw.length)]=n}return e}),{});return Object.keys(n).length>0?n:void 0}function cw(e){return e.split(",").map((e=>{const t=e.indexOf("=");if(-1===t)return[];return[e.slice(0,t),e.slice(t+1)].map((e=>{try{return decodeURIComponent(e.trim())}catch{return}}))})).reduce(((e,[t,n])=>(t&&n&&(e[t]=n),e)),{})}const uw=/^o(\d+)\./,dw=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function hw(e,t=!1){const{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r?`${r}/`:r}${a}`}function pw(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function mw(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(uw);return t?.[1]}(n)),r}function fw(e){
|
|
719
719
|
const t="string"==typeof e?function(e){const t=dw.exec(e);if(!t)return void yy((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,o="",i="",a="",s=""]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return pw({host:i,pass:o,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):pw(e);if(t&&function(e){if(!uy)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(ky.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(ky.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(ky.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(ky.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}const gw=1;let vw=!1;function bw(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:xw(e).parent_span_id,i=iw(e).scope;return{parent_span_id:o,
|
|
720
720
|
span_id:r?i?.getPropagationContext().propagationSpanId||O_():t,trace_id:n}}function yw(e){return e&&e.length>0?e.map((({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:o})=>({span_id:e,trace_id:t,sampled:n===gw,attributes:o,...r}))):void 0}function _w(e){return"number"==typeof e?ww(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ww(e.getTime()):E_()}function ww(e){return e>9999999999?e/1e3:e}function xw(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:o,name:i,endTime:a,status:s,links:l}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:_w(o),timestamp:_w(a)||void 0,status:kw(s),op:r[X_],origin:r[Z_],links:yw(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}
|
|
721
|
-
function kw(e){if(e&&e.code!==ew)return e.code===tw?"ok":e.message||"
|
|
722
|
-
release:n.release,public_key:r,trace_id:e,org_id:mw(t)};return t.emit("createDsc",o),o}function zw(e){const t=G_();if(!t)return{};const n=Aw(e),r=xw(n),o=r.data,i=n.spanContext().traceState,a=i?.get("sentry.sample_rate")??o[K_]??o[Y_];function s(e){return"number"!=typeof a&&"string"!=typeof a||(e.sample_rate=`${a}`),e}const l=n[Iw];if(l)return s(l);const c=i?.get("sentry.dsc"),u=c&&lw(c);if(u)return s(u);const d=Ow(e.spanContext().traceId,t),h=o[W_],p=r.description;return"url"!==h&&p&&(d.transaction=p),function(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=G_()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return t===gw}(n)),d.sample_rand=i?.get("sentry.sample_rand")??iw(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit("createDsc",d,n),d}function Lw(e,t=100,n=1/0){try{return Rw("",e,t,n)}catch(e){return{
|
|
723
|
-
function Pw(e,t=3,n=102400){const r=Lw(e,t);return o=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(o))>n?Pw(e,t-1,n):r;var o}function Rw(e,t,n=1/0,r=1/0,o=function(){const e=new WeakSet;function t(t){return!!e.has(t)||(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}()){const[i,a]=o;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(e_(t))return"[VueViewModel]";if(Xy(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Iy(t)}]`
|
|
721
|
+
function kw(e){if(e&&e.code!==ew)return e.code===tw?"ok":e.message||"internal_error"}const Sw="_sentryRootSpan";function Aw(e){return e[Sw]||e}function Tw(){vw||(yy((()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")})),vw=!0)}function Ew(e){ky.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Cw(e,t){if(!t?.length||!e.description)return!1;for(const r of t){if("string"==typeof(n=r)||n instanceof RegExp){if(l_(e.description,r))return uy&&Ew(e),!0;continue}if(!r.name&&!r.op)continue;const t=!r.name||l_(e.description,r.name),o=!r.op||e.op&&l_(e.op,r.op);if(t&&o)return uy&&Ew(e),!0}var n;return!1}function Mw(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}const Nw="production",Iw="_frozenDsc";function Ow(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={
|
|
722
|
+
environment:n.environment||Nw,release:n.release,public_key:r,trace_id:e,org_id:mw(t)};return t.emit("createDsc",o),o}function zw(e){const t=G_();if(!t)return{};const n=Aw(e),r=xw(n),o=r.data,i=n.spanContext().traceState,a=i?.get("sentry.sample_rate")??o[K_]??o[Y_];function s(e){return"number"!=typeof a&&"string"!=typeof a||(e.sample_rate=`${a}`),e}const l=n[Iw];if(l)return s(l);const c=i?.get("sentry.dsc"),u=c&&lw(c);if(u)return s(u);const d=Ow(e.spanContext().traceId,t),h=o[W_],p=r.description;return"url"!==h&&p&&(d.transaction=p),function(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=G_()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return t===gw}(n)),d.sample_rand=i?.get("sentry.sample_rand")??iw(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit("createDsc",d,n),d}function Lw(e,t=100,n=1/0){try{return Rw("",e,t,n)}catch(e){return{
|
|
723
|
+
ERROR:`**non-serializable** (${e})`}}}function Pw(e,t=3,n=102400){const r=Lw(e,t);return o=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(o))>n?Pw(e,t-1,n):r;var o}function Rw(e,t,n=1/0,r=1/0,o=function(){const e=new WeakSet;function t(t){return!!e.has(t)||(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}()){const[i,a]=o;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(e_(t))return"[VueViewModel]";if(Xy(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Iy(t)}]`
|
|
724
724
|
;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return s.replace("object ","");if(i(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return Rw("",c.toJSON(),l-1,r,o)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=m_(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=Rw(e,t,l-1,r,o),d++}return a(t),u}function Dw(e,t=[]){return[e,t]}function jw(e,t){const[n,r]=e;return[n,[...r,t]]}function Hw(e,t){const n=e[1]
|
|
725
725
|
;for(const e of n){if(t(e,e[0].type))return!0}return!1}function Fw(e){const t=my(dy);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function $w(e){const[t,n]=e;let r=JSON.stringify(t);function o(e){"string"==typeof r?r="string"==typeof e?r+e:[Fw(r),e]:r.push("string"==typeof e?Fw(e):e)}for(const e of n){const[t,n]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Lw(n))}o(e)}}return"string"==typeof r?r:function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function Bw(e){const t="string"==typeof e.data?Fw(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const qw={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",
|
|
726
726
|
profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function Uw(e){return qw[e]}function Gw(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Vw(e,t,n,r){const o=Gw(n),i=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const a=function(e,t,n,r){const o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:hw(r)},...o&&{trace:o}}}(e,o,r,t);delete e.sdkProcessingMetadata;return Dw(a,[[{type:i},e]])}function Ww(e){return new Yw((t=>{t(e)}))}
|
|
727
727
|
function Kw(e){return new Yw(((t,n)=>{n(e)}))}class Yw{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(e,t){return new Yw(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new Yw(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}_executeHandlers(){if(0===this._state)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(1===this._state&&e[1](this._value),2===this._state&&e[2](this._value),e[0]=!0)}))}_runExecutor(e){const t=(e,t)=>{0===this._state&&(Qy(t)?t.then(n,r):(this._state=e,this._value=t,this._executeHandlers()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function Xw(e,t,n,r=0){try{const o=Zw(t,n,e,r);return Qy(o)?o:Ww(o)}catch(e){return Kw(e)}}function Zw(e,t,n,r){const o=n[r];if(!e||!o)return e;const i=o({...e},t)
|
|
728
728
|
;return uy&&null===i&&ky.log(`Event processor "${o.id||"?"}" dropped event`),Qy(i)?i.then((e=>Zw(e,t,n,r+1))):Zw(i,t,n,r+1)}function Qw(e,t){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;!function(e,t){const{extra:n,tags:r,user:o,contexts:i,level:a,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra});Object.keys(r).length&&(e.tags={...r,...e.tags});Object.keys(o).length&&(e.user={...o,...e.user});Object.keys(i).length&&(e.contexts={...i,...e.contexts});a&&(e.level=a);s&&"transaction"!==e.type&&(e.transaction=s)}(e,t),r&&function(e,t){e.contexts={trace:bw(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:zw(t),...e.sdkProcessingMetadata};const n=Aw(t),r=xw(n).description;r&&!e.transaction&&"transaction"===e.type&&(e.transaction=r)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t));e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){
|
|
729
729
|
const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,o),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,i)}function Jw(e,t){const{extra:n,tags:r,user:o,contexts:i,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:p,span:m}=t;ex(e,"extra",n),ex(e,"tags",r),ex(e,"user",o),ex(e,"contexts",i),e.sdkProcessingMetadata=N_(e.sdkProcessingMetadata,s,2),a&&(e.level=a),p&&(e.transactionName=p),m&&(e.span=m),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function ex(e,t,n){e[t]=N_(e[t],n,1)}let tx,nx,rx,ox;function ix(e,t,n,r,o,i){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||b_(),timestamp:t.timestamp||A_()
|
|
730
|
-
},c=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:o,maxValueLength:i
|
|
731
|
-
}))}))}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new R_;return n.update(t),n}(r,n.captureContext);n.mechanism&&x_(l,n.mechanism);const d=o?o.getEventProcessors():[],h=fy("globalScope",(()=>new R_)).getScopeData();if(i){Jw(h,i.getScopeData())}if(u){Jw(h,u.getScopeData())}const p=[...n.attachments||[],...h.attachments];p.length&&(n.attachments=p),Qw(l,h);return Xw([...d,...h.eventProcessors],l,n).then((e=>(e&&function(e){const t={};if(e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))})),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach((([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})}))}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{
|
|
732
|
-
...e.data&&{data:Lw(e.data,t,n)}})))},...e.user&&{user:Lw(e.user,t,n)},...e.contexts&&{contexts:Lw(e.contexts,t,n)},...e.extra&&{extra:Lw(e.extra,t,n)}};e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Lw(e.contexts.trace.data,t,n)));e.spans&&(r.spans=e.spans.map((e=>({...e,...e.data&&{data:Lw(e.data,t,n)}}))));e.contexts?.flags&&r.contexts&&(r.contexts.flags=Lw(e.contexts.flags,3,n));return r}(e,a,s):e)))}function ax(e){if(e)return function(e){return e instanceof R_||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>sx.includes(e)))}(e)?{captureContext:e}:e}const sx=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function lx(e,t){return q_().captureException(e,ax(t))}function cx(e,t){return q_().captureEvent(e,t)}function ux(e,t){U_().setExtra(e,t)}function dx(e){const t=U_(),n=q_(),{userAgent:r}=dy.navigator||{},o=C_({user:n.getUser()||t.getUser(),...r&&{
|
|
733
|
-
;return"ok"===i?.status&&M_(i,{status:"exited"}),hx(),t.setSession(o),o}function hx(){const e=U_(),t=q_().getSession()||e.getSession();t&&function(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),M_(e,n)}(t),px(),e.setSession()}function px(){const e=U_(),t=G_(),n=e.getSession();n&&t&&t.captureSession(n)}function mx(e=!1){e?hx():px()}const fx="7";function gx(e,t,n){return t||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){const n={sentry_version:fx};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(e,n)}`}const vx=[];function bx(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach((e=>{e.isDefaultInstance=!0})),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t
|
|
734
|
-
;return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.values(t)}(r)}function yx(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function _x(e,t,n){if(n[t.name])uy&&ky.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===vx.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),vx.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}uy&&ky.log(`Integration installed: ${t.name}`)}}function wx(e,t){const n=t??function(e){return xx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=hw(r)),
|
|
735
|
-
item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());xx().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function xx(){return fy("clientToLogBufferMap",(()=>new WeakMap))}function kx(e,t){const n=t??function(e){return Sx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=hw(r)),Dw(o,[(i=e,[{type:"trace_metric",item_count:i.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());Sx().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function Sx(){return fy("clientToMetricBufferMap",(()=>new WeakMap))}function Ax(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}
|
|
730
|
+
},c=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:o,maxValueLength:i}=t;e.environment=e.environment||n||Nw,!e.release&&r&&(e.release=r);!e.dist&&o&&(e.dist=o);const a=e.request;a?.url&&(a.url=i?a_(a.url,i):a.url)}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),o&&o.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=dy._sentryDebugIds,n=dy._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(ox&&r.length===nx&&o.length===rx)return ox;nx=r.length,rx=o.length,ox={},tx||(tx={});const i=(t,n)=>{for(const r of t){const t=n[r],o=tx?.[r];if(o&&ox&&t)ox[o[0]]=t,tx&&(tx[r]=[o[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const o=n[e],i=o?.filename;if(i&&ox&&tx){ox[i]=t,tx[r]=[i,t];break}}}}};return t&&i(r,t),n&&i(o,n),ox}(t);e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{
|
|
731
|
+
e.filename&&(e.debug_id=n[e.filename])}))}))}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new R_;return n.update(t),n}(r,n.captureContext);n.mechanism&&x_(l,n.mechanism);const d=o?o.getEventProcessors():[],h=fy("globalScope",(()=>new R_)).getScopeData();if(i){Jw(h,i.getScopeData())}if(u){Jw(h,u.getScopeData())}const p=[...n.attachments||[],...h.attachments];p.length&&(n.attachments=p),Qw(l,h);return Xw([...d,...h.eventProcessors],l,n).then((e=>(e&&function(e){const t={};if(e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))})),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach((([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})}))}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{
|
|
732
|
+
breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:Lw(e.data,t,n)}})))},...e.user&&{user:Lw(e.user,t,n)},...e.contexts&&{contexts:Lw(e.contexts,t,n)},...e.extra&&{extra:Lw(e.extra,t,n)}};e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Lw(e.contexts.trace.data,t,n)));e.spans&&(r.spans=e.spans.map((e=>({...e,...e.data&&{data:Lw(e.data,t,n)}}))));e.contexts?.flags&&r.contexts&&(r.contexts.flags=Lw(e.contexts.flags,3,n));return r}(e,a,s):e)))}function ax(e){if(e)return function(e){return e instanceof R_||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>sx.includes(e)))}(e)?{captureContext:e}:e}const sx=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function lx(e,t){return q_().captureException(e,ax(t))}function cx(e,t){return q_().captureEvent(e,t)}function ux(e,t){U_().setExtra(e,t)}function dx(e){const t=U_(),n=q_(),{userAgent:r}=dy.navigator||{},o=C_({user:n.getUser()||t.getUser(),...r&&{
|
|
733
|
+
userAgent:r},...e}),i=t.getSession();return"ok"===i?.status&&M_(i,{status:"exited"}),hx(),t.setSession(o),o}function hx(){const e=U_(),t=q_().getSession()||e.getSession();t&&function(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),M_(e,n)}(t),px(),e.setSession()}function px(){const e=U_(),t=G_(),n=e.getSession();n&&t&&t.captureSession(n)}function mx(e=!1){e?hx():px()}const fx="7";function gx(e,t,n){return t||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){const n={sentry_version:fx};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(e,n)}`}const vx=[];function bx(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach((e=>{e.isDefaultInstance=!0})),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t
|
|
734
|
+
;return function(e){const t={};return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.values(t)}(r)}function yx(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function _x(e,t,n){if(n[t.name])uy&&ky.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===vx.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),vx.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}uy&&ky.log(`Integration installed: ${t.name}`)}}function wx(e,t){const n=t??function(e){return xx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=hw(r)),
|
|
735
|
+
Dw(o,[(i=e,[{type:"log",item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());xx().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function xx(){return fy("clientToLogBufferMap",(()=>new WeakMap))}function kx(e,t){const n=t??function(e){return Sx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=hw(r)),Dw(o,[(i=e,[{type:"trace_metric",item_count:i.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());Sx().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function Sx(){return fy("clientToMetricBufferMap",(()=>new WeakMap))}function Ax(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}
|
|
736
736
|
const Tx="Not capturing exception because it's already been captured.",Ex="Discarded session because of missing or non-string release",Cx=Symbol.for("SentryInternalError"),Mx=Symbol.for("SentryDoNotSendEventError");function Nx(e){return{message:e,[Cx]:!0}}function Ix(e){return{message:e,[Mx]:!0}}function Ox(e){return!!e&&"object"==typeof e&&Cx in e}function zx(e){return!!e&&"object"==typeof e&&Mx in e}function Lx(e,t,n,r,o){let i,a=0;e.on(n,(()=>{a=0,clearTimeout(i)})),e.on(t,(t=>{a+=r(t),a>=8e5?o(e):(clearTimeout(i),i=setTimeout((()=>{o(e)}),5e3))})),e.on("flush",(()=>{o(e)}))}class Px{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=fw(e.dsn):uy&&ky.warn("No DSN provided, client will not send events."),this._dsn){const t=gx(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),
|
|
737
737
|
...e.transportOptions,url:t})}this._options.enableLogs&&Lx(this,"afterCaptureLog","flushLogs",Hx,wx),this._options._experiments?.enableMetrics&&Lx(this,"afterCaptureMetric","flushMetrics",jx,kx)}captureException(e,t,n){const r=b_();if(k_(e))return uy&&ky.log(Tx),r;const o={event_id:r,...t};return this._process(this.eventFromException(e,o).then((e=>this._captureEvent(e,o,n)))),o.event_id}captureMessage(e,t,n,r){const o={event_id:b_(),...n},i=Ky(e)?e:String(e),a=Yy(e)?this.eventFromMessage(i,t,o):this.eventFromException(e,o);return this._process(a.then((e=>this._captureEvent(e,o,r)))),o.event_id}captureEvent(e,t,n){const r=b_();if(t?.originalException&&k_(t.originalException))return uy&&ky.log(Tx),r;const o={event_id:r,...t},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,s=i.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,s)),o.event_id}captureSession(e){this.sendSession(e),M_(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){
|
|
738
738
|
return this._options._metadata}getTransport(){return this._transport}async flush(e){const t=this._transport;if(!t)return!0;this.emit("flush");const n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some((({name:e})=>e.startsWith("Spotlight"))))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];_x(this,e,this._integrations),t||yx(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Vw(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=jw(n,Bw(e));this.sendEnvelope(n).then((t=>this.emit("afterSendEvent",e,t)))}sendSession(e){const{release:t,environment:n=Nw}=this._options;if("aggregates"in e){
|
|
@@ -761,37 +761,37 @@ release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Ak.SENTRY_RELEASE
|
|
|
761
761
|
}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,o){const i=jk(e,t,r?.syntheticException||void 0,o);return i.level=n,r?.event_id&&(i.event_id=r.event_id),Ww(i)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n,r)}}const $k="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Bk=dy,qk=1e3;let Uk,Gk,Vk,Wk;function Kk(){if(!Bk.document)return;const e=Dy.bind(null,"dom"),t=Yk(e,!0);Bk.document.addEventListener("click",t,!1),Bk.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const n=Bk,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(u_(r,"addEventListener",(function(t){return function(n,r,o){if("click"===n||"keypress"==n)try{const r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},i=r[n]=r[n]||{refCount:0};if(!i.handler){const r=Yk(e);i.handler=r,
|
|
762
762
|
t.call(this,n,r,o)}i.refCount++}catch{}return t.call(this,n,r,o)}})),u_(r,"removeEventListener",(function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.__sentry_instrumentation_handlers__||{},o=n[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}})))}))}function Yk(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;d_(n,"_sentryCaptured",!0),r&&!r._sentryId&&d_(r,"_sentryId",b_());const o="keypress"===n.type?"input":n.type;if(!function(e){if(e.type!==Gk)return!1;try{if(!e.target||e.target._sentryId!==Vk)return!1}catch{}return!0}(n)){e({event:n,name:o,global:t}),Gk=n.type,Vk=r?r._sentryId:void 0}clearTimeout(Uk),Uk=Bk.setTimeout((()=>{
|
|
763
763
|
Vk=void 0,Gk=void 0}),qk)}}function Xk(e){const t="history";Py(t,e),Ry(t,Zk)}function Zk(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Wk,o=function(e){try{return new URL(e,Bk.location.origin).toString()}catch{return e}}(String(n));if(Wk=o,r===o)return e.apply(this,t);Dy("history",{from:r,to:o})}return e.apply(this,t)}}Bk.addEventListener("popstate",(()=>{const e=Bk.location.href,t=Wk;if(Wk=e,t===e)return;Dy("history",{from:t,to:e})})),"history"in bk&&bk.history&&(u_(Bk.history,"pushState",e),u_(Bk.history,"replaceState",e))}const Qk={};const Jk="__sentry_xhr_v3__";function eS(){if(!Bk.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,o=1e3*E_(),i=Wy(n[0])?n[0].toUpperCase():void 0,a=function(e){if(Wy(e))return e;try{return e.toString()}catch{}return}(n[1]);if(!i||!a)return e.apply(t,n);t[Jk]={method:i,url:a,request_headers:{}},"POST"===i&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const s=()=>{
|
|
764
|
-
const e=t[Jk];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}Dy("xhr",{endTimestamp:1e3*E_(),startTimestamp:o,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(s(),e.apply(t,n))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,o]=n,i=t[Jk];return i&&Wy(r)&&Wy(o)&&(i.request_headers[r.toLowerCase()]=o),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[Jk];if(!r)return e.apply(t,n);void 0!==n[0]&&(r.body=n[0]);return Dy("xhr",{startTimestamp:1e3*E_(),xhr:t}),e.apply(t,n)}})}function
|
|
765
|
-
$k&&ky.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Qk[e]=n.bind(Bk):n}("fetch")){let n=0,r=0;return Kx(e,(async function(o){const i=o.body.length;n+=i,r++;const a={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,a);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw Qk["fetch"]=void 0,e}finally{n-=i,r--}}))}function
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
;let r,o,i="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>
|
|
764
|
+
const e=t[Jk];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}Dy("xhr",{endTimestamp:1e3*E_(),startTimestamp:o,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(s(),e.apply(t,n))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,o]=n,i=t[Jk];return i&&Wy(r)&&Wy(o)&&(i.request_headers[r.toLowerCase()]=o),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[Jk];if(!r)return e.apply(t,n);void 0!==n[0]&&(r.body=n[0]);return Dy("xhr",{startTimestamp:1e3*E_(),xhr:t}),e.apply(t,n)}})}const tS=40;function nS(e,t=function(e){const t=Qk[e];if(t)return t;let n=Bk[e];if(yk(n))return Qk[e]=n.bind(Bk);const r=Bk.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const o=t.contentWindow;o?.[e]&&(n=o[e]),r.head.removeChild(t)}catch(t){
|
|
765
|
+
$k&&ky.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Qk[e]=n.bind(Bk):n}("fetch")){let n=0,r=0;return Kx(e,(async function(o){const i=o.body.length;n+=i,r++;const a={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,a);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw Qk["fetch"]=void 0,e}finally{n-=i,r--}}),Ux(e.bufferSize||tS))}function rS(e,t,n,r){const o={filename:e,function:"<anonymous>"===t?Ay:t,in_app:!0};return void 0!==n&&(o.lineno=n),void 0!==r&&(o.colno=r),o}
|
|
766
|
+
const oS=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,iS=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,aS=/\((\S*)(?::(\d+))(?::(\d+))\)/,sS=/at (.+?) ?\(data:(.+?),/,lS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,cS=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,uS=Cy(...[[30,e=>{const t=e.match(sS);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=oS.exec(e);if(n){const[,e,t,r]=n;return rS(e,Ay,+t,+r)}const r=iS.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=aS.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=dS(r[1]||Ay,r[2]);return rS(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=lS.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=cS.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Ay;return[n,e]=dS(n,e),
|
|
767
|
+
rS(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]),dS=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Ay,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},hS="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,pS=1024,mS=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";Py(t,e),Ry(t,dk)}(function(e){return function(t){if(G_()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:hk(t.level),message:s_(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${s_(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Qx(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(G_()!==e)return
|
|
768
|
+
;let r,o,i="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>pS&&(hS&&ky.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=pS),"string"==typeof i&&(i=[i]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=r_(t,{keyAttrs:i,maxStringLength:a}),o=function(e){if(!t_.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};o&&(s.data={"ui.component_name":o}),Qx(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),Py("dom",n),Ry("dom",Kk)),t.xhr&&function(e){Py("xhr",e),Ry("xhr",eS)}(function(e){return function(t){if(G_()!==e)return
|
|
769
769
|
;const{startTimestamp:n,endTimestamp:r}=t,o=t.xhr[Jk];if(!n||!r||!o)return;const{method:i,url:a,status_code:s,body:l}=o,c={method:i,url:a,status_code:s},u={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:c,type:"http",level:vk(s)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Qx(d,u)}}(e)),t.fetch&&wk(function(e){return function(t){if(G_()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.fetchData.method,t.fetchData.url,t.error){const o=t.fetchData,i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,i),Qx(a,i)}else{const o=t.response,i={...t.fetchData,status_code:o?.status};t.fetchData.request_body_size,t.fetchData.response_body_size,o?.status;const a={input:t.args,response:o,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,type:"http",level:vk(i.status_code)}
|
|
770
770
|
;e.emit("beforeOutgoingRequestBreadcrumb",s,a),Qx(s,a)}}}(e)),t.history&&Xk(function(e){return function(t){if(G_()!==e)return;let n=t.from,r=t.to;const o=Yx(Ak.location.href);let i=n?Yx(n):void 0;const a=Yx(r);i?.path||(i=o),o.protocol===a.protocol&&o.host===a.host&&(r=a.relative),o.protocol===i.protocol&&o.host===i.host&&(n=i.relative),Qx({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){G_()===e&&Qx({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:__(t)},{event:t})}}(e))}}}
|
|
771
|
-
;const
|
|
772
|
-
;if(!r?.hasOwnProperty?.("addEventListener"))return;u_(r,"addEventListener",(function(n){return function(r,o,i){try{"function"==typeof o.handleEvent&&(o.handleEvent=Ck(o.handleEvent,{mechanism:{data:{handler:Iy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,o),n.apply(this,[r,Ck(o,{mechanism:{data:{handler:Iy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),i])}})),u_(r,"removeEventListener",(function(e){return function(t,n,r){try{const o=n.__sentry_wrapped__;o&&e.call(this,t,o,r)}catch{}return e.call(this,t,n,r)}}))}(e,t)))}}}};function
|
|
773
|
-
handler:Iy(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function
|
|
774
|
-
;const{msg:o,url:i,line:a,column:s,error:l}=t,c=function(e,t,n,r){const o=e.exception=e.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=r,u=n,d=function(e){if(!Wy(e)||0===e.length)return;if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return`<data:${t?t[1]:"text/javascript"}${e.includes("base64,")?",base64":""}>`}return e.slice(0,1024)}(t)??i_();0===l.length&&l.push({colno:c,filename:d,function:Ay,in_app:!0,lineno:u});return e}(Dk(n,l||o,void 0,r,!1),i,a,s);c.level="error",cx(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}))}(e),
|
|
775
|
-
values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:Dk(n,o,void 0,r,!0);i.level="error",cx(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}))}(e),
|
|
776
|
-
;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=i_(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Ak===Ak.top&&r.some((e=>n.startsWith(`${e}://`))))}()&&(
|
|
777
|
-
return e.length===t.length&&e.every(((e,n)=>t[n]===e))}(e.tags,t.tags)&&Kr(e)===Kr(t)}(e,t)));if(i)return{type:"duplicate",annotation:i};try{const r=function(e,t){return{target:e.target,tags:e.tags,text:e.text,uri:t?.uri??e.uri,document:t?.metadata??e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=Ap(e.permissions)?kp(t,n):xp(t);return{type:"import",annotation:await this._annotationsService.save(i)}}catch(e){return
|
|
778
|
-
const t=e.filter((e=>"error"===e.type)),n=t.length>0?`${t.length} imports failed (${t[0].error.message})`:"",r=e.filter((e=>"import"===e.type)).length,o=r>0?`${r} annotations imported`:"",i=e.filter((e=>"duplicate"===e.type)).length,a=i>0?`${i} duplicates skipped`:"";let s;return s=0===t.length?r>0?"success":"notice":r>0?"notice":"error",{messageType:s,message:[o,n,a].filter((e=>e.length>0)).join(", ")}}(a);return"success"===c?this._toastMessenger.success(u):"notice"===c?this._toastMessenger.notice(u,{autoDismiss:!1}):"error"===c&&this._toastMessenger.error(u,{autoDismiss:!1}),a}}
|
|
771
|
+
;const fS=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],gS=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&u_(Ak,"setTimeout",vS),t.setInterval&&u_(Ak,"setInterval",vS),t.requestAnimationFrame&&u_(Ak,"requestAnimationFrame",bS),t.XMLHttpRequest&&"XMLHttpRequest"in Ak&&u_(XMLHttpRequest.prototype,"send",yS);const e=t.eventTarget;if(e){(Array.isArray(e)?e:fS).forEach((e=>function(e,t){const n=Ak,r=n[e]?.prototype
|
|
772
|
+
;if(!r?.hasOwnProperty?.("addEventListener"))return;u_(r,"addEventListener",(function(n){return function(r,o,i){try{"function"==typeof o.handleEvent&&(o.handleEvent=Ck(o.handleEvent,{mechanism:{data:{handler:Iy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,o),n.apply(this,[r,Ck(o,{mechanism:{data:{handler:Iy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),i])}})),u_(r,"removeEventListener",(function(e){return function(t,n,r){try{const o=n.__sentry_wrapped__;o&&e.call(this,t,o,r)}catch{}return e.call(this,t,n,r)}}))}(e,t)))}}}};function vS(e){return function(...t){const n=t[0];return t[0]=Ck(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Iy(e)}`}}),e.apply(this,t)}}function bS(e){return function(t){return e.apply(this,[Ck(t,{mechanism:{data:{
|
|
773
|
+
handler:Iy(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function yS(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&u_(n,e,(function(t){const n={mechanism:{data:{handler:Iy(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=p_(t);return r&&(n.mechanism.data.handler=Iy(r)),Ck(t,n)}))})),e.apply(this,t)}}const _S=()=>({name:"BrowserSession",setupOnce(){void 0!==Ak.document?(dx({ignoreDuration:!0}),mx(),Xk((({from:e,to:t})=>{void 0!==e&&e!==t&&(dx({ignoreDuration:!0}),mx())}))):hS&&ky.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),wS=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(!function(e){!function(e){const t="error";Py(t,e),Ry(t,Hy)}((t=>{const{stackParser:n,attachStacktrace:r}=kS();if(G_()!==e||Ek())return
|
|
774
|
+
;const{msg:o,url:i,line:a,column:s,error:l}=t,c=function(e,t,n,r){const o=e.exception=e.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=r,u=n,d=function(e){if(!Wy(e)||0===e.length)return;if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return`<data:${t?t[1]:"text/javascript"}${e.includes("base64,")?",base64":""}>`}return e.slice(0,1024)}(t)??i_();0===l.length&&l.push({colno:c,filename:d,function:Ay,in_app:!0,lineno:u});return e}(Dk(n,l||o,void 0,r,!1),i,a,s);c.level="error",cx(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}))}(e),xS("onerror")),t.onunhandledrejection&&(!function(e){!function(e){const t="unhandledrejection";Py(t,e),Ry(t,$y)}((t=>{const{stackParser:n,attachStacktrace:r}=kS();if(G_()!==e||Ek())return;const o=function(e){if(Yy(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),i=Yy(o)?{exception:{
|
|
775
|
+
values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:Dk(n,o,void 0,r,!0);i.level="error",cx(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}))}(e),xS("onunhandledrejection"))}}};function xS(e){hS&&ky.log(`Global Handler attached: ${e}`)}function kS(){const e=G_();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const SS=()=>({name:"HttpContext",preprocessEvent(e){if(!Ak.navigator&&!Ak.location&&!Ak.document)return;const t=function(){const e=i_(),{referrer:t}=Ak.document||{},{userAgent:n}=Ak.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),AS=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,o){sk(Mk,o.getOptions().stackParser,n,t,e,r)}}};function TS(){return!!function(){if(void 0===Ak.window)return!1;const e=Ak;if(e.nw)return!1
|
|
776
|
+
;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=i_(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Ak===Ak.top&&r.some((e=>n.startsWith(`${e}://`))))}()&&(hS&&yy((()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")})),!0)}let ES=0;function CS(e,t){lx(e,{tags:{context:t}})}function MS(e){!function(e){U_().setUser(e)}(e)}class NS{constructor(e,t,n){this._store=e,this._annotationsService=t,this._toastMessenger=n}async import(e){this._store.beginImport(e.length);const t=this._store.profile().userid;if(!t)throw new Error("Cannot import when logged out");const n=this._store.focusedGroupId();if(!n)throw new Error("Cannot import when no group is selected");const r=this._store.allAnnotations(),o=this._store.defaultContentFrame(),i=async e=>{const i=r.find((t=>function(e,t){return e.text===t.text&&!!function(e,t){
|
|
777
|
+
return e.length===t.length&&e.every(((e,n)=>t[n]===e))}(e.tags,t.tags)&&Kr(e)===Kr(t)}(e,t)));if(i)return{type:"duplicate",annotation:i};try{const r=function(e,t){return{target:e.target,tags:e.tags,text:e.text,uri:t?.uri??e.uri,document:t?.metadata??e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=Ap(e.permissions)?kp(t,n):xp(t);return{type:"import",annotation:await this._annotationsService.save(i)}}catch(e){return CS(e,"annotation-import"),{type:"error",error:e}}},a=[],s=e.map(((e,t)=>({ann:e,index:t}))),l=[];for(;s.length>0;){const e=s.shift(),t=i(e.ann).then((t=>{this._store.completeImport(1),a[e.index]=t})).then((()=>{const e=l.indexOf(t);-1!==e&&l.splice(e,1)}));l.push(t),l.length>=5&&await Promise.race(l)}await Promise.all(l);const{messageType:c,message:u}=function(e){
|
|
778
|
+
const t=e.filter((e=>"error"===e.type)),n=t.length>0?`${t.length} imports failed (${t[0].error.message})`:"",r=e.filter((e=>"import"===e.type)).length,o=r>0?`${r} annotations imported`:"",i=e.filter((e=>"duplicate"===e.type)).length,a=i>0?`${i} duplicates skipped`:"";let s;return s=0===t.length?r>0?"success":"notice":r>0?"notice":"error",{messageType:s,message:[o,n,a].filter((e=>e.length>0)).join(", ")}}(a);return"success"===c?this._toastMessenger.success(u):"notice"===c?this._toastMessenger.notice(u,{autoDismiss:!1}):"error"===c&&this._toastMessenger.error(u,{autoDismiss:!1}),a}}NS.$inject=["store","annotationsService","toastMessenger"];class IS{constructor(e,t,n,r){this._api=e,this._store=t,this._streamer=n,this._streamFilter=r,this._searchClient=null}load({groupId:e,uris:t,onError:n,maxResults:r,sortBy:o,sortOrder:i,streamFilterBy:a="uri"}){if(this._store.removeAnnotations(this._store.savedAnnotations()),this._searchClient&&this._searchClient.cancel(),
|
|
779
779
|
"group"===a)this._streamFilter.resetFilter().addClause("/group","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()});else t&&t.length>0&&(this._streamFilter.resetFilter().addClause("/uri","one_of",t),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}));const s={incremental:!0,separateReplies:!1,maxResults:r,sortBy:o,sortOrder:i};this._searchClient=new Uf(this._api.search,s),this._searchClient.on("resultCount",(e=>{this._store.setAnnotationResultCount(e)})),this._searchClient.on("results",(e=>{e.length&&this._store.addAnnotations(e)})),this._searchClient.on("error",(e=>{"function"==typeof n?n(e):console.error(e)})),this._searchClient.on("end",(()=>{this._searchClient=null,t&&t.length>0&&this._store.frames().forEach((e=>{t.indexOf(e.uri)>=0&&this._store.updateFrameAnnotationFetchStatus(e.uri,!0)})),this._store.annotationFetchFinished()})),this._store.annotationFetchStarted(),this._searchClient.get({group:e,uri:t})}async loadThread(e){let t,n
|
|
780
|
-
;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),Pr(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}const r=[t,...n.rows];if(this._store.addAnnotations(r),!Pr(t)){const e=t.id;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}
|
|
781
|
-
const t=this._storage.getItem(e);return t?JSON.parse(t):null}setItem(e,t){this._storage.setItem(e,t)}setObject(e,t){const n=JSON.stringify(t);this._storage.setItem(e,n)}removeItem(e){this._storage.removeItem(e)}}
|
|
782
|
-
;case"notebook":r="notebook";break;case"user-profile":r="profile";break;case"stream":r="stream";break;default:r="sidebar"}return{route:r,params:n}}routeUrl(e,t={}){let n;const r={...t};switch(e){case"annotation":{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"profile":n="/user-profile";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(const[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){this._window.history.pushState({},"",this.routeUrl(e,t)),this.sync()}}
|
|
783
|
-
}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}
|
|
784
|
-
async logout(){try{return await this._auth.logout(),this.reload()}catch(e){throw this._toastMessenger.error("Log out failed"),new Error(e)}}reload(){return this._lastLoad=null,this._lastLoadTime=null,this.load()}}
|
|
785
|
-
this._socket.onerror=e=>{this.emit("error",e)},this._socket.onmessage=e=>{this.emit("message",e)}}close(){this._socket.close(1e3)}send(e){this._messageQueue.push(e),this.isConnected()&&this.sendMessages()}isConnected(){return this._socket.readyState===WebSocket.OPEN}sendMessages(){for(;this._messageQueue.length>0;){const e=JSON.stringify(this._messageQueue.shift());this._socket.send(e)}}}class
|
|
780
|
+
;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),Pr(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}const r=[t,...n.rows];if(this._store.addAnnotations(r),!Pr(t)){const e=t.id;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}IS.$inject=["api","store","streamer","streamFilter"];class OS{constructor(){this._store=new Map}getItem(e){return this._store.get(e)??null}setItem(e,t){this._store.set(e,t)}removeItem(e){this._store.delete(e)}}class zS{constructor(e){const t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch{this._storage=new OS}}getItem(e){return this._storage.getItem(e)}getObject(e){
|
|
781
|
+
const t=this._storage.getItem(e);return t?JSON.parse(t):null}setItem(e,t){this._storage.setItem(e,t)}setObject(e,t){const n=JSON.stringify(t);this._storage.setItem(e,n)}removeItem(e){this._storage.removeItem(e)}}zS.$inject=["$window"];const LS={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class PS{constructor(e,t){this._storage=e,this._store=t}init(){for(const[e,t]of no(LS)){const n=this._storage.getItem(t);this._store.setDefault(e,n)}ry(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(const[n,r]of no(e))t[n]!==r&&n in LS&&this._storage.setItem(LS[n],r)}))}}PS.$inject=["localStorage","store"];class RS{constructor(e,t){this._window=e,this._store=t,this._didRegisterPopstateListener=!1}currentRoute(){const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(const[e,r]of t)n[e]=r;"client"===e[0]&&e.shift();let r;switch(e[0].replace(/\.html$/,"")){case"a":r="annotation",n.id=e[1]||"";break
|
|
782
|
+
;case"notebook":r="notebook";break;case"user-profile":r="profile";break;case"stream":r="stream";break;default:r="sidebar"}return{route:r,params:n}}routeUrl(e,t={}){let n;const r={...t};switch(e){case"annotation":{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"profile":n="/user-profile";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(const[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){this._window.history.pushState({},"",this.routeUrl(e,t)),this.sync()}}RS.$inject=["$window","store"];class DS{constructor(e,t){this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links();this._store.updateLinks(e)
|
|
783
|
+
}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}DS.$inject=["apiRoutes","store"];class jS{constructor(e,t,n,r,o){this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=Kn(r)?.authority??null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=Hb((()=>{const e=this._authority?{authority:this._authority}:{};return this._api.profile.read(e)})).then((e=>(this.update(e),this._lastLoadTime=Date.now(),e))).catch((e=>{throw this._lastLoadTime=null,e}))),this._lastLoad}async dismissSidebarTutorial(){const e=await this._api.profile.update({},{preferences:{show_sidebar_tutorial:!1}});this.update(e)}update(e){const t=this._store.profile(),n=e.userid!==t.userid;return this._store.updateProfile(e),this._lastLoad=Promise.resolve(e),this._lastLoadTime=Date.now(),n&&(e.userid?MS({id:e.userid}):MS(null)),e}
|
|
784
|
+
async logout(){try{return await this._auth.logout(),this.reload()}catch(e){throw this._toastMessenger.error("Log out failed"),new Error(e)}}reload(){return this._lastLoad=null,this._lastLoadTime=null,this.load()}}jS.$inject=["store","api","auth","settings","toastMessenger"];class HS{constructor(){this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}}}addClause(e,t,n,r=!1){return this._filter.clauses.push({field:e,operator:t,value:n,case_sensitive:r}),this}getFilter(){return this._filter}resetFilter(){return this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}},this}}class FS extends $f{constructor(e){super(),this._messageQueue=[],this._socket=new WebSocket(e),this._socket.onopen=e=>{this.sendMessages(),this.emit("open",e)},this._socket.onclose=e=>{if(1e3===e.code||1001===e.code)return void this.emit("close",e);const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},
|
|
785
|
+
this._socket.onerror=e=>{this.emit("error",e)},this._socket.onmessage=e=>{this.emit("message",e)}}close(){this._socket.close(1e3)}send(e){this._messageQueue.push(e),this.isConnected()&&this.sendMessages()}isConnected(){return this._socket.readyState===WebSocket.OPEN}sendMessages(){for(;this._messageQueue.length>0;){const e=JSON.stringify(this._messageQueue.shift());this._socket.send(e)}}}class $S{constructor(e,t,n,r,o,i){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=tv(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1,this._window=i}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&(this._store.addAnnotations(e),this._store.highlightAnnotations(e.map((({id:e})=>e)).filter(Boolean)),this._window.setTimeout((()=>this._store.highlightAnnotations([])),5e3));const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})))
|
|
786
786
|
;t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){cv("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&cv("Check that your H service is configured to allow WebSocket connections from "+window.location.origin)}_handleSocketMessage(e){const t=JSON.parse(e.data);if(t)if("annotation-notification"===t.type){const e=t.payload;switch(t.options.action){case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else cv("Received unsupported notification",t.type)}_sendClientConfig(e){
|
|
787
|
-
Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){this._configMessages[e]=t,this._socket?.isConnected()&&this._socket.send(t)}async _reconnect(){const e=await this._websocketURL;if(!e)return;let t,n;this._socket?.close();try{t=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(t){const r=new URL(e);r.searchParams.set("access_token",t),n=r.toString()}else n=e;const r=new
|
|
788
|
-
value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,ry(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}
|
|
789
|
-
;this._storage.setObject(
|
|
790
|
-
return[...this.#t.keys()]}}
|
|
791
|
-
;const
|
|
792
|
-
n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}
|
|
793
|
-
ux("host_config",rv(window.location.href))}catch{}ux("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Xb(((e,t)=>{
|
|
787
|
+
Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){this._configMessages[e]=t,this._socket?.isConnected()&&this._socket.send(t)}async _reconnect(){const e=await this._websocketURL;if(!e)return;let t,n;this._socket?.close();try{t=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(t){const r=new URL(e);r.searchParams.set("access_token",t),n=r.toString()}else n=e;const r=new FS(n);r.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(r)})),r.on("disconnect",(()=>{if(++this._reconnectionAttempts,this._reconnectionAttempts<10){const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),r.on("error",(t=>this._handleSocketError(e,t))),r.on("message",(e=>this._handleSocketMessage(e))),this._socket=r,this.setConfig("client-id",{messageType:"client_id",
|
|
788
|
+
value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,ry(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}$S.$inject=["store","apiRoutes","auth","groups","session","$window"];const BS="hypothesis.user.tags.list",qS="hypothesis.user.tags.map";class US{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(BS)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${hv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(qS)||{};e.forEach((e=>{t[e]?(t[e].count+=1,t[e].updated=Date.now()):t[e]={text:e,count:1,updated:Date.now()}})),this._storage.setObject(qS,t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)))
|
|
789
|
+
;this._storage.setObject(BS,n)}}US.$inject=["localStorage"];class GS{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}GS.$inject=["store"];class VS{#t=new Map;#n=30;#r;constructor(e){this.#r=e}get cacheSize(){return this.#n}set cacheSize(e){this.#n=e,this.#o()}#o(){for(const e of this.#t.keys()){const t=this.#t.get(e);if(t&&URL.revokeObjectURL(t.url),this.#t.delete(e),this.#t.size<=this.cacheSize)break}}async fetch(e,t={}){const n=this.get(e);if(n)return n;const r=await this.#r.requestThumbnail(e,t),o=await async function(e){const t=new OffscreenCanvas(e.width,e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height);const n=await t.convertToBlob();return URL.createObjectURL(n)}(r),i={url:o,width:r.width,height:r.height};return this.#t.set(e,i),this.#t.size>this.cacheSize&&this.#o(),i}get(e){const t=this.#t.get(e);return t?(this.#t.delete(e),this.#t.set(e,t),t):null}cachedThumbnailTags(){
|
|
790
|
+
return[...this.#t.keys()]}}VS.$inject=["frameSync"];class WS extends $f{constructor(e,t){super(),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:tv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}WS.$inject=["store","$window"]
|
|
791
|
+
;const KS=function(e){for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),YS=function(e){const{version:t,origin:n}=rv(e.location.href);return"1.1725.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1725.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function XS(e,t){e.setClientId(t.clientId)}function ZS(e){e.sync()}function QS(e,t){e.load(),t.load()}function JS(e,t,n){e.init(),t.init(),n.init()}function eA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{
|
|
792
|
+
n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}KS.sentry&&YS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;!function(e={}){const t=!e.skipBrowserExtensionCheck&&TS(),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||uS,Array.isArray(r)?Cy(...r):r),integrations:bx({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[ok(),tk(),gS(),mS(),wS(),AS(),pk(),SS(),_S()]:e.defaultIntegrations}),transport:e.transport||nS};var r;Bx(Fk,n)}({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1725.0",beforeSend:(e,t)=>{if(ES>=5)return cv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++ES;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch{}return e}});try{
|
|
793
|
+
ux("host_config",rv(window.location.href))}catch{}ux("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Xb(((e,t)=>{CS(e,t)}))}(KS.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),XS.$inject=["api","streamer"],ZS.$inject=["router"],QS.$inject=["groups","session"],JS.$inject=["autosaveService","persistedDefaults","serviceURL"],eA.$inject=["frameSync","store","toastMessenger"];const tA=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",yv)}(),async function(e,t=window){const n=function(e){const t=rv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl","commentsMode","groupsAllowlist"],r={openSidebar:ov,requestConfigFromFrame:e=>{
|
|
794
794
|
if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:av(t.origin),ancestorLevel:iv(t.ancestorLevel)}}},o={};for(const[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:sv(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await nv(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=nv(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,r)}else o=n;const i={...e,...o};return r&&(i.rpc=r),
|
|
795
|
-
i.apiUrl=function(e){const t=Kn(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(
|
|
796
|
-
H(Ve(Qn.Provider,{value:n,children:Ve(Qg,{})}),t)}(e,
|
|
795
|
+
i.apiUrl=function(e){const t=Kn(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(KS).then((e=>{!function(e,t){const n=new U;n.register("analytics",_v).register("annotationsExporter",Mb).register("annotationsService",xv).register("annotationActivity",wv).register("api",Nb).register("apiRoutes",$b).register("auth",Ub).register("autosaveService",Gb).register("dashboard",Vb).register("frameSync",ay).register("groups",cy).register("importAnnotationsService",NS).register("loadAnnotationsService",IS).register("localStorage",zS).register("persistedDefaults",PS).register("router",RS).register("serviceURL",DS).register("session",jS).register("streamer",$S).register("streamFilter",HS).register("tags",US).register("threadsService",GS).register("thumbnailService",VS).register("toastMessenger",WS).register("store",{factory:ji}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(ZS),n.run(JS),n.run(XS),n.run(QS),n.run(bv),n.run(eA),
|
|
796
|
+
H(Ve(Qn.Provider,{value:n,children:Ve(Qg,{})}),t)}(e,tA)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),H(Ve(Jg,{error:e}),t)}(e,tA)));
|
|
797
797
|
//# sourceMappingURL=sidebar.bundle.js.map
|