hypothesis 1.1437.0 → 1.1438.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?f522a4","styles/annotator.css":"styles/annotator.css?51e5f8","styles/annotator.css.map":"styles/annotator.css.map?dcd4af","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?e8b77f","styles/sidebar.css.map":"styles/sidebar.css.map?7c1ede","styles/ui-playground.css.map":"styles/ui-playground.css.map?6edf64","styles/ui-playground.css":"styles/ui-playground.css?cd4790","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?b68d18","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?885080","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?00c531","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?476c34","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?61fd19"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1437.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var 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,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)e(s,i(t,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/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?c4fe17","styles/annotator.css":"styles/annotator.css?51e5f8","styles/annotator.css.map":"styles/annotator.css.map?dcd4af","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?e8b77f","styles/sidebar.css.map":"styles/sidebar.css.map?7c1ede","styles/ui-playground.css.map":"styles/ui-playground.css.map?6edf64","styles/ui-playground.css":"styles/ui-playground.css?cd4790","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?b68d18","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?885080","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?a7cfe2","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?cc5f36","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?476c34"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1438.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)e(s,i(t,u[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:d,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
@@ -1,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?f522a4",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?c4fe17",
3
3
  "styles/annotator.css": "styles/annotator.css?51e5f8",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?dcd4af",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
@@ -14,7 +14,7 @@
14
14
  "styles/ui-playground.css": "styles/ui-playground.css?cd4790",
15
15
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?b68d18",
16
16
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?885080",
17
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?00c531",
18
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?476c34",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?61fd19"
17
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a7cfe2",
18
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?cc5f36",
19
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?476c34"
20
20
  }
@@ -138,7 +138,7 @@ const e=this.anchors.find((e=>e.annotation.$tag===t));null!=e&&e.highlights&&awa
138
138
  this._sendDocumentInfo()}destroy(){var t;this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),function(t){Gn(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){this._contentReady&&(await this._contentReady,this._contentReady=void 0);const e=t=>{var e;const n=cr(t);if(!n)return;const i=Xn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&Kn(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{
139
139
  const i=await this._integration.anchor(this.element,e.selector),o=Bn.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&Gn(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,
140
140
  $highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+s(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),hr(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);Kn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Un(n),o=zn(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=ar(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){
141
- e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){oe(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function fr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function pr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1437.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),
141
+ e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){oe(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function fr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function pr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1438.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),
142
142
  Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function mr({config:t,groupId:e}){return _e("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:fr(t.notebookAppUrl,{...pr(t.notebookAppUrl,t),group:e})})}function gr({eventBus:t,config:e}){const[n,i]=Wt(0),[o,r]=Wt(!0),[s,a]=Wt(null),l=jt(""),c=jt(null);zt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),zt((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),zt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:_e("div",{
143
143
  className:me("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:_e("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[_e("div",{className:"absolute right-0 m-3",children:_e(nn,{title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:me("!bg-transparent enabled:hover:!bg-grey-3"),children:_e(Ne,{className:"w-4 h-4"})})}),_e(mr,{config:e,groupId:s},n)]})})}class _r{constructor(t,e,n){i(this,"_outerContainer",void 0),i(this,"_shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this._shadowRoot=Sn(this._outerContainer),Tt(_e(gr,{eventBus:e,config:n}),this._shadowRoot)}destroy(){Tt(null,this._shadowRoot),this._outerContainer.remove()}}function vr({eventBus:t,config:e}){const[n,i]=Wt(!0),o=jt(null);zt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{
144
144
  i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:_e("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:_e("div",{className:"relative w-full h-full","data-testid":"profile-inner",children:[_e("div",{className:"absolute right-0 m-3",children:_e(nn,{title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:me("!bg-transparent enabled:hover:!bg-grey-3"),children:_e(Ne,{className:"w-4 h-4"})})}),_e("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class br{constructor(t,e,n){i(this,"_outerContainer",void 0),i(this,"shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-profile"),t.appendChild(this._outerContainer),this.shadowRoot=Sn(this._outerContainer),Tt(_e(vr,{eventBus:e,config:n}),this.shadowRoot)}destroy(){Tt(null,this.shadowRoot),this._outerContainer.remove()}}var yr={exports:{}}
@@ -552,7 +552,7 @@ const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(cf).filter((e=>
552
552
  const a=null!==(n=o.position)&&void 0!==n?n:Number.MAX_SAFE_INTEGER,s=null!==(r=i.position)&&void 0!==r?r:Number.MAX_SAFE_INTEGER;return Math.sign(a-s)}};const gf=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:ff[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]:[]},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=uf(e,af);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
553
553
  },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"},cfi:{terms:r,operator:"or"},quote:{terms:i,operator:"and"},page:{terms:o,operator:"or"},since:{terms:d,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=(e,t)=>new tf(t,of[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new nf("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new nf(t.operator,r)})),o=new nf("and",r);return e.filter((e=>e.id&&o.matches(e))).map((e=>e.id))}([t],e).length>0}const r=Xp(e.annotations,n),o={annotation:0,note:0,
554
554
  orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(!e.annotation)return!1;if(Do(e.annotation))return!1;const n=hf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function vf(){const e=Ea(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=de((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return gf(s)}var bf=Kr((function({loadAnnotationsService:e,onLogin:t}){var n;const r=Ea(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",{rootThread:i}=vf(),a=r.profile().userid,[s,l]=ae(!1);return le((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),Oe(v,{children:[s&&Oe(Ta,{errorType:"annotation",onLoginRequest:t}),Oe(Hp,{threads:i.children})]})
555
- }),["loadAnnotationsService"]);class _f{constructor(e,t,n=window){var r,o,i;B(this,"version",void 0),B(this,"userAgent",void 0),B(this,"urls",void 0),B(this,"fingerprint",void 0),B(this,"account",void 0),B(this,"timestamp",void 0),B(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1437.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(o=o.metadata)||void 0===o?void 0:o.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString();const l=null===(i=t[0])||void 0===i?void 0:i.segment;if(l){const e=[];l.cfi&&e.push(["CFI",l.cfi]),l.url&&e.push(["URL",l.url]),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`}
555
+ }),["loadAnnotationsService"]);class _f{constructor(e,t,n=window){var r,o,i;B(this,"version",void 0),B(this,"userAgent",void 0),B(this,"urls",void 0),B(this,"fingerprint",void 0),B(this,"account",void 0),B(this,"timestamp",void 0),B(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1438.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(o=o.metadata)||void 0===o?void 0:o.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString();const l=null===(i=t[0])||void 0===i?void 0:i.segment;if(l){const e=[];l.cfi&&e.push(["CFI",l.cfi]),l.url&&e.push(["URL",l.url]),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`}
556
556
  asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}var yf="complete",wf="canceled";function xf(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function kf(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=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,m=c&&null!=c.leftOffset?c.leftOffset:0,p=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-=m,o-=p,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,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-=m,o-=p,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),
557
557
  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}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return xf(e,r.x,r.y),e._scrollSettings=null,t.end(yf);var a=1-t.ease(i);if(xf(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&kf(t.scrollAncestor),void kf(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(kf.bind(null,e))}}function Nf(e){return e.self===e}function Sf(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Af(){return!0}function Ef(e){if(e.assignedSlot)return Ef(e.assignedSlot)
558
558
  ;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}}var Tf=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{};var r=Ef(e),o=1,i=t.validTarget||Af,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var s=[];r;)if(t.debug&&console.log("Scrolling parent node",r),i(r,o)&&(a?a(r,Sf):Sf(r))&&(o++,s.push(r)),!(r=Ef(r))){l(yf);break}return s.reduce(((n,r,o)=>function(e,t,n,r,o){var i,a=!t._scrollSettings,s=t._scrollSettings,l=Date.now(),c={passive:!0};function u(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),
@@ -573,7 +573,7 @@ if(null!==o)throw new Error("Multiple non-modifier keys specified");o=e}}if(!o)t
573
573
  }),Oe("div",{className:"flex items-center lg:justify-self-end text-md font-medium",children:[Oe(eg,{}),Oe(Wf,{forcedVisibleCount:a,isFiltered:s,isLoading:l,resultCount:null!=c?c:0})]}),Oe("div",{className:"lg:col-span-2",children:[g&&Oe("div",{className:"py-4","data-testid":"notebook-messages",children:Oe(lr,{title:"Too many results to show",children:[Oe("p",{children:["This preview of the Notebook can show"," ",Oe("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."]}),Oe("p",{children:[Oe(Lr,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})]})}),Oe(Xf,{currentPage:p,isLoading:l,onChangePage:y,threads:u.children})]})]})}),["loadAnnotationsService","streamer"])
574
574
  ;function ng({classes:e,children:t,onClose:n=(()=>{}),...r}){return Oe("div",{className:X("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[Oe(ht,{className:"text-green-success w-em h-em p-[0.125em]"}),Oe("div",{className:"text-sm",children:t})]})}function rg(){const e=Ea(),[t,n]=ae(!1),[r,o]=ae(0);if(le((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),!e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return Oe($e,{"data-testid":"profile-container",classes:"overflow-hidden",children:[Oe("div",{className:X("h-12","px-3 border-b flex items-center"),children:[Oe("div",{className:"grow",children:Oe("h1",{className:"text-xl text-slate-7 font-normal",children:"Notifications"})}),Oe("ul",{className:"sr-only","aria-live":"polite",children:i&&Oe("li",{children:"Notification preferences saved"},r)}),r>0&&Oe(ng,{onClose:()=>o(0),children:"Saved"},r)]}),Oe(He,{children:Oe(Ve,{
575
575
  size:"lg",children:Oe(xr,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?Gn:void 0,icon:t?Gn:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function og({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&zo(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()];return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function ig(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function ag({documentMetadata:e,groupName:t,date:n=new Date}){const r=[ig(n)];return null!=e&&e.title?r.push(function(e,t){const n=Array.from(e);return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}function sg(){return Oe("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",
576
- children:Oe(pr,{size:"md"})})}function lg({userAnnotations:e}){return Oe("div",{className:"flex gap-x-2",children:[e.displayName,Oe("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const cg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"},{value:"html",title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"}];var ug=Kr((function({annotationsExporter:e,toastMessenger:t}){var n;const r=Ea(),o=r.focusedGroup(),i=o&&!r.isLoading(),a=r.defaultContentFrame(),s=r.savedAnnotations(),l=r.defaultAuthority(),c=r.isFeatureEnabled("client_display_names"),u=he((e=>rs(e,l,c)),[l,c]),d=de((()=>og({annotations:s,getDisplayName:u})),[s,u]),h=r.profile(),m=h.userid,p=de((()=>({
576
+ children:Oe(pr,{size:"md"})})}function lg({userAnnotations:e}){return Oe("div",{className:"flex gap-x-2",children:[e.displayName,Oe("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const cg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"html",title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"}];var ug=Kr((function({annotationsExporter:e,toastMessenger:t}){var n;const r=Ea(),o=r.focusedGroup(),i=o&&!r.isLoading(),a=r.defaultContentFrame(),s=r.savedAnnotations(),l=r.defaultAuthority(),c=r.isFeatureEnabled("client_display_names"),u=he((e=>rs(e,l,c)),[l,c]),d=de((()=>og({annotations:s,getDisplayName:u})),[s,u]),h=r.profile(),m=h.userid,p=de((()=>({
577
577
  annotations:s,displayName:"All annotations"})),[s]),[f,g]=ae(m),b=de((()=>{var e;return null!==(e=d.find((e=>e.userid===f)))&&void 0!==e?e:p}),[p,f,d]),_=r.isFeatureEnabled("export_formats"),[y,w]=ae(cg[0]),x=pe(),k=pe(),N=r.countDrafts(),S=de((()=>ag({documentMetadata:null==a?void 0:a.metadata,groupName:null==o?void 0:o.name})),[a,o]),[A,E]=ae(),T=he(((t,n)=>{var r;const i=null!==(r=null==b?void 0:b.annotations)&&void 0!==r?r:s;switch(t){case"json":{const t=e.buildJSONExportContent(i,{profile:h});return JSON.stringify(t,null,2)}case"txt":return e.buildTextExportContent(i,{groupName:null==o?void 0:o.name,defaultAuthority:l,displayNamesEnabled:c});case"csv":return e.buildCSVExportContent(i,{separator:"file"===n?",":"\t",groupName:null==o?void 0:o.name,defaultAuthority:l,displayNamesEnabled:c});case"html":return e.buildHTMLExportContent(i,{groupName:null==o?void 0:o.name,defaultAuthority:l,displayNamesEnabled:c});default:throw new Error(`Invalid format: ${t}`)}
578
578
  }),[e,l,c,s,null==o?void 0:o.name,h,null==b?void 0:b.annotations]),C=he((e=>{e.preventDefault();try{const e=y.value,t=`${null!=A?A:S}.${e}`,n=T(e,"file"),r=function(e){return{json:"application/json",txt:"text/plain",csv:"text/csv",html:"text/html"}[e]}(e);!function(e,t,n,r=document){const o=new Blob([e],{type:t}),i=URL.createObjectURL(o),a=r.createElement("a");a.setAttribute("href",i),a.setAttribute("download",n),a.style.visibility="hidden",r.body.appendChild(a),a.click(),r.body.removeChild(a),URL.revokeObjectURL(i)}(n,r,t)}catch(e){t.error(`Exporting annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,A,S,y.value,t]),M=he((async()=>{const e=y.value,n=T(e,"clipboard");try{"html"===e?await async function(e,t=navigator,n=document){const r=["text/html","text/plain"];if(t.clipboard.write){const n=r.reduce(((t,n)=>(t[n]=new Blob([e],{type:n}),t)),{});await t.clipboard.write([new ClipboardItem(n)])}else{const t=t=>{r.forEach((n=>{var r;return null===(r=t.clipboardData)||void 0===r?void 0:r.setData(n,e)})),
579
579
  t.preventDefault()};n.addEventListener("copy",t);try{n.execCommand("copy")}finally{n.removeEventListener("copy",t)}}}(n):await async function(e,t=navigator){await t.clipboard.writeText(e)}(n),t.success("Annotations copied")}catch(e){t.error(`Copying annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,y.value,t]);return i?Oe("form",{className:"space-y-3",onSubmit:C,"data-testid":"export-form",children:[s.length>0?Oe(v,{children:[Oe("p",{className:"text-color-text-light",children:[Oe(Lr,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Oe("div",{className:"flex flex-col gap-y-3",children:[Oe("label",{htmlFor:k,className:"font-medium",children:["Select which user","'","s annotations to export:"]}),Oe(Ir,{value:f,onChange:g,buttonId:k,buttonContent:Oe(lg,{userAnnotations:b}),"data-testid":"user-select",children:[Oe(Ir.Option,{
@@ -639,7 +639,7 @@ const n=Wo(e),r=Go(e),o=[`Created at: ${xp(new Date(e.created))}`,`Author: ${c(e
639
639
  }(Oe("html",{lang:"en",children:[Oe("head",{children:[Oe("title",{children:`Annotations on "${a}"`}),Oe("meta",{charSet:"UTF-8"})]}),Oe("body",{children:[Oe("section",{children:[Oe("h1",{children:"Summary"}),Oe("p",{children:Oe("time",{dateTime:o.toISOString(),children:xp(o)})}),Oe("p",{children:Oe("strong",{children:a})}),Oe("p",{children:Oe("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Oe("table",{children:Oe("tbody",{style:{verticalAlign:"top"},children:[Oe("tr",{children:[Oe("td",{children:"Group:"}),Oe("td",{children:t})]}),Oe("tr",{children:[Oe("td",{children:"Total users:"}),Oe("td",{children:s.length})]}),Oe("tr",{children:[Oe("td",{children:"Users:"}),Oe("td",{children:s.join(", ")})]}),Oe("tr",{children:[Oe("td",{children:"Total annotations:"}),Oe("td",{children:e.length})]}),Oe("tr",{children:[Oe("td",{children:"Total replies:"}),Oe("td",{children:l.length})]})]})})]}),Oe("hr",{}),Oe("section",{children:[Oe("h1",{children:"Annotations"}),e.map(((e,t)=>{
640
640
  const n=Wo(e),r=Go(e),o=Tm(e.text),i=o===`<p>${e.text}</p>`?e.text:o;return Oe("article",{children:[Oe("h2",{children:["Annotation ",t+1,":"]}),Oe("table",{children:Oe("tbody",{style:{verticalAlign:"top"},children:[Oe("tr",{children:[Oe("td",{children:"Created at:"}),Oe("td",{children:Oe("time",{dateTime:e.created,children:xp(new Date(e.created))})})]}),Oe("tr",{children:[Oe("td",{children:"Author:"}),Oe("td",{children:c(e)})]}),n&&Oe("tr",{children:[Oe("td",{children:"Page:"}),Oe("td",{children:n})]}),Oe("tr",{children:[Oe("td",{children:"Type:"}),Oe("td",{children:Uo(e)})]}),r&&Oe("tr",{children:[Oe("td",{children:"Quote:"}),Oe("td",{children:Oe("blockquote",{style:{margin:0},children:r})})]}),Oe("tr",{children:[Oe("td",{children:"Comment:"}),Oe("td",{dangerouslySetInnerHTML:{__html:i}})]}),e.tags.length>0&&Oe("tr",{children:[Oe("td",{children:"Tags:"}),Oe("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
641
641
  _exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>rs(e,n,t),{uri:i,title:a}=To(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>zo(e))),extractUsername:o}}}cb.$inject=[];class ub extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),B(this,"url",void 0),B(this,"response",void 0),B(this,"reason",void 0),this.url=e,this.response=t,this.reason=n}}async function db(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new ub(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new ub(e,n,"Failed to parse response")}var o;if(!n.ok)throw new ub(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}class hb{constructor(e,t,n){B(this,"_clientId",void 0),B(this,"search",void 0),B(this,"annotation",void 0),B(this,"group",void 0),B(this,"groups",void 0),B(this,"profile",void 0),
642
- 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)=>{o();try{const[o,i]=await Promise.all([e,n()]),l=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(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1437.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=Qi(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await db(m.toString(),{body:s?JSON.stringify(ib(s)):null,headers:c,method:l.method})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished})
642
+ 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)=>{o();try{const[o,i]=await Promise.all([e,n()]),l=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(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1438.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=Qi(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await db(m.toString(),{body:s?JSON.stringify(ib(s)):null,headers:c,method:l.method})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished})
643
643
  ;this.search=i("search"),this.annotation={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")},this.group={member:{delete:i("group.member.delete")},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")}}setClientId(e){this._clientId=e}}hb.$inject=["apiRoutes","auth","store"];var mb={};function pb(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))}var fb=pb;pb.prototype.reset=function(){this._attempts=1,
644
644
  this._timeouts=this._originalTimeouts.slice(0)},pb.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},pb.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),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},pb.prototype.attempt=function(e,t){this._fn=e,
645
645
  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)},pb.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},pb.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},pb.prototype.start=pb.prototype.try,pb.prototype.errors=function(){return this._errors},pb.prototype.attempts=function(){return this._attempts},pb.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=fb;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},
@@ -702,7 +702,7 @@ id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&tw(th
702
702
  }getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if("function"==typeof e){const t=e(this);return t instanceof Ew?t:this}return e instanceof Ew?(this._tags={...this._tags,...e._tags},this._extra={...this._extra,...e._extra},this._contexts={...this._contexts,...e._contexts},e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession),e._propagationContext&&(this._propagationContext=e._propagationContext)):Yb(e)&&(this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),
703
703
  e.requestSession&&(this._requestSession=e.requestSession),e.propagationContext&&(this._propagationContext=e.propagationContext)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Tw(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Py(),...e},o=this._breadcrumbs;return o.push(r),this._breadcrumbs=o.length>n?o.slice(-n):o,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){
704
704
  const{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:o,_user:i,_level:a,_fingerprint:s,_eventProcessors:l,_propagationContext:c,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:o,user:i,level:a,fingerprint:s||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},n=[]){kw(e,this.getScopeData());return Qy([...n,...Jy(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:V_();if(!this._client)return __.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}
705
- captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:V_();if(!this._client)return __.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:V_();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(__.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function Tw(){return{traceId:V_(),spanId:V_().substring(16)}}const Cw="7.94.1",Mw=parseFloat(Cw),Iw=100;class zw{constructor(e,t,n,r=Mw){let o,i;this._version=r,t?o=t:(o=new Ew,o.setClient(e)),n?i=n:(i=new Ew,i.setClient(e)),this._stack=[{scope:o}],e&&this.bindClient(e),this._isolationScope=i}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,
705
+ captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:V_();if(!this._client)return __.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:V_();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(__.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function Tw(){return{traceId:V_(),spanId:V_().substring(16)}}const Cw="7.98.0",Mw=parseFloat(Cw),Iw=100;class zw{constructor(e,t,n,r=Mw){let o,i;this._version=r,t?o=t:(o=new Ew,o.setClient(e)),n?i=n:(i=new Ew,i.setClient(e)),this._stack=[{scope:o}],e&&this.bindClient(e),this._isolationScope=i}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,
706
706
  t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){const t=this.pushScope();let n;try{n=e(t)}catch(e){throw this.popScope(),e}return Xb(n)?n.then((e=>(this.popScope(),e)),(e=>{throw this.popScope(),e})):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const n=this._lastEventId=t&&t.event_id?t.event_id:V_(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:n}),n}captureMessage(e,t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:V_(),o=new Error(e);return this.getScope().captureMessage(e,t,{
707
707
  originalException:e,syntheticException:o,...n,event_id:r}),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:V_();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,{...t,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=Iw}=r.getOptions&&r.getOptions()||{};if(i<=0)return;const a={timestamp:Py(),...e},s=o?b_((()=>o(a,t))):a;null!==s&&(r.emit&&r.emit("beforeAddBreadcrumb",s,t),n.addBreadcrumb(s,i))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}
708
708
  configureScope(e){const{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){const t=Ow(this);try{e(this)}finally{Ow(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return Ky&&__.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const n=this._callExtensionMethod("startTransaction",e,t);if(Ky&&!n){this.getClient()?__.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):__.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")}return n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&nw(t),this._sendSessionUpdate(),e.setSession()}startSession(e){
@@ -718,45 +718,45 @@ if(this._options.sendClientReports){const n=`${e}:${t}`;Ky&&__.log(`Adding outco
718
718
  ;if(a&&"number"==typeof o&&Math.random()>o)return this.recordDroppedEvent("sample_rate","error",e),Cy(new N_(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const c="replay_event"===s?"replay":s;return this._prepareEvent(e,t,n).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",c,e),new N_("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const o=function(e,t,n){const{beforeSend:r,beforeSendTransaction:o}=e;if(Kw(t)&&r)return r(t,n);if(Xw(t)&&o)return o(t,n);return t}(r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Xb(e))return e.then((e=>{if(!Yb(e)&&null!==e)throw new N_(n);return e}),(e=>{throw new N_(`${t} rejected with ${e}`)}));if(!Yb(e)&&null!==e)throw new N_(n);return e}(o,l)})).then((r=>{if(null===r)throw this.recordDroppedEvent("before_send",c,e),new N_(`${l} returned \`null\`, will not send event.`,"log");const o=n&&n.getSession()
719
719
  ;!i&&o&&this._updateSessionFromEvent(o,r);const a=r.transaction_info;if(i&&a&&r.transaction!==e.transaction){const e="custom";r.transaction_info={...a,source:e}}return this.sendEvent(r,t),r})).then(null,(e=>{if(e instanceof N_)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),new N_(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e){this._numProcessing++,e.then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e)))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,(e=>{Ky&&__.error("Error while sending event:",e)}));Ky&&__.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map((t=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e[t]}}))}}function Kw(e){return void 0===e.type}function Xw(e){return"transaction"===e.type}
720
720
  function Jw(e,t){!0===t.debug&&(Ky?__.enable():b_((()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})));fw().update(t.initialScope);const n=new e(t);!function(e){const t=Rw().getStackTop();t.client=e,t.scope.setClient(e)}(n),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(n)}const Zw=30;function Qw(e,t,n=Iy(e.bufferSize||Zw)){let r={};function o(o){const i=[];if(Hy(o,((t,n)=>{const o=Gy(n);if(function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,o)){const r=ex(t,n);e.recordDroppedEvent("ratelimit_backoff",o,r)}else i.push(t)})),0===i.length)return Ty();const a=Fy(o[0],i),s=t=>{Hy(a,((n,r)=>{const o=ex(n,r);e.recordDroppedEvent(t,Gy(r),o)}))};return n.add((()=>t({body:$y(a,e.textEncoder)}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ky&&__.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Yy(r,e),e)),(e=>{throw s("network_error"),e})))).then((e=>e),(e=>{
721
- if(e instanceof N_)return Ky&&__.error("Skipped sending event because buffer is full."),s("queue_overflow"),Ty();throw e}))}return o.__sentry__baseTransport__=!0,{send:o,flush:e=>n.drain(e)}}function ex(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}const tx=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],nx=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],rx="InboundFilters",ox=Gw(rx,((e={})=>({name:rx,setupOnce(){},processEvent(t,n,r){const o=r.getOptions(),i=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:tx],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:nx],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,o);return function(e,t){
722
- if(t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e))return Ky&&__.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if(e.type||!t||!t.length)return!1;return function(e){const t=[];e.message&&t.push(e.message);let n;try{n=e.exception.values[e.exception.values.length-1]}catch(e){}n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`));Ky&&0===t.length&&__.error(`Could not extract message for event ${Y_(e)}`);return t}(e).some((e=>n_(e,t)))}(e,t.ignoreErrors))return Ky&&__.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&n_(n,t)}(e,t.ignoreTransactions))return Ky&&__.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if(!t||!t.length)return!1;const n=ix(e);return!!n&&n_(n,t)
723
- }(e,t.denyUrls))return Ky&&__.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Y_(e)}.\nUrl: ${ix(e)}`),!0;if(!function(e,t){if(!t||!t.length)return!0;const n=ix(e);return!n||n_(n,t)}(e,t.allowUrls))return Ky&&__.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Y_(e)}.\nUrl: ${ix(e)}`),!0;return!1}(t,i)?null:t}})));function ix(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(t):null}catch(t){return Ky&&__.error(`Cannot extract url for event ${Y_(e)}`),null}}let ax;const sx="FunctionToString",lx=Gw(sx,(()=>({name:sx,setupOnce(){ax=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=T_(this)||this;return ax.apply(t,e)}}catch(e){}}}))),cx=l_;let ux=0;function dx(){return ux>0}function hx(e,t={},n){if("function"!=typeof e)return e;try{
724
- const t=e.__sentry_wrapped__;if(t)return t;if(T_(e))return e}catch(t){return e}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const o=r.map((e=>hx(e,t)));return e.apply(this,o)}catch(e){throw ux++,setTimeout((()=>{ux--})),function(...e){const t=Rw();if(2===e.length){const[n,r]=e;return n?t.withScope((()=>(t.getStackTop().scope=n,r(n)))):t.withScope(r)}t.withScope(e[0])}((n=>{n.addEventProcessor((e=>(t.mechanism&&(K_(e,void 0,void 0),X_(e,t.mechanism)),e.extra={...e.extra,arguments:r},e))),uw(e)})),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch(e){}E_(r,e),A_(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch(e){}return r}const mx="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function px(e,t){const n=gx(e,t),r={type:t&&t.name,value:bx(t)};return n.length&&(r.stacktrace={frames:n}),
725
- void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function fx(e,t){return{exception:{values:[px(e,t)]}}}function gx(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(vx.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch(e){}return[]}const vx=/Minified React error #\d+;/i;function bx(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function _x(e,t,n,r,o){let i;if(Ub(t)&&t.error){return fx(e,t.error)}if(qb(t)||$b(t,"DOMException")){const o=t;if("stack"in t)i=fx(e,t);else{const t=o.name||(qb(o)?"DOMError":"DOMException"),a=o.message?`${t}: ${o.message}`:t;i=yx(e,a,n,r),K_(i,a)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}if(jb(t))return fx(e,t);if(Yb(t)||Kb(t)){return i=function(e,t,n,r){const o=pw(),i=o&&o.getOptions().normalizeDepth,a={exception:{values:[{type:Kb(t)?t.constructor.name:r?"UnhandledRejection":"Error",
726
- value:wx(t,{isUnhandledRejection:r})}]},extra:{__serialized__:Sy(t,i)}};if(n){const t=gx(e,n);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,n,o),X_(i,{synthetic:!0}),i}return i=yx(e,t,n,r),K_(i,`${t}`,void 0),X_(i,{synthetic:!0}),i}function yx(e,t,n,r){const o={};if(r&&n){const r=gx(e,n);r.length&&(o.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(Vb(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return o.logentry={message:e,params:n},o}return o.message=t,o}function wx(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(C_(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return Qb(n[0],t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:Qb(r,t)}return""}(e),r=t?"promise rejection":"exception";if(Ub(e))return`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``;if(Kb(e)){return`Event \`${function(e){try{const t=Object.getPrototypeOf(e)
727
- ;return t?t.constructor.name:void 0}catch(e){}}(e)}\` (type=${e.type}) captured as ${r}`}return`Object captured as ${r} with keys: ${n}`}class xx extends Yw{constructor(e){const t=cx.SENTRY_SDK_SOURCE||"npm";e._metadata=e._metadata||{},e._metadata.sdk=e._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:`${t}:@sentry/browser`,version:Cw}],version:Cw},super(e),e.sendClientReports&&cx.document&&cx.document.addEventListener("visibilitychange",(()=>{"hidden"===cx.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,n,r){const o=_x(e,t,n&&n.syntheticException||void 0,r);return X_(o),o.level="error",n&&n.event_id&&(o.event_id=n.event_id),Ty(o)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,o){const i=yx(e,t,r&&r.syntheticException||void 0,o);return i.level=n,r&&r.event_id&&(i.event_id=r.event_id),Ty(i)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}
728
- captureUserFeedback(e){if(!this._isEnabled())return void(mx&&__.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const o={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:w_(r)}},i=function(e){return[{type:"user_report"},e]}(e);return Fy(o,[i])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(mx&&__.log("No outcomes to send"));if(!this._dsn)return void(mx&&__.log("No dsn provided, will not send outcomes"));mx&&__.log("Sending outcomes:",e);const t=(n=e,Fy((r=this._options.tunnel&&w_(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:o||Py(),discarded_events:n}]]));var n,r,o;this._sendEnvelope(t)}}let kx;function Nx(e,t=function(){
729
- if(kx)return kx;if(ly(cx.fetch))return kx=cx.fetch.bind(cx);const e=cx.document;let t=cx.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){mx&&__.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return kx=t.bind(cx)}()){let n=0,r=0;return Qw(e,(function(o){const i=o.body.length;n+=i,r++;const a={body:o.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,a).then((e=>(n-=i,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}})))}catch(e){return kx=void 0,n-=i,r--,Cy(e)}}))}const Sx=4;function Ax(e){return Qw(e,(function(t){return new My(((n,r)=>{const o=new XMLHttpRequest;o.onerror=r,o.onreadystatechange=()=>{o.readyState===Sx&&n({statusCode:o.status,headers:{
730
- "x-sentry-rate-limits":o.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":o.getResponseHeader("Retry-After")}})},o.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&o.setRequestHeader(t,e.headers[t]);o.send(t.body)}))}))}const Ex="?";function Tx(e,t,n,r){const o={filename:e,function:t,in_app:!0};return void 0!==n&&(o.lineno=n),void 0!==r&&(o.colno=r),o}const Cx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Mx=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ix=[30,e=>{const t=Cx.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Mx.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=Dx(t[1]||Ex,t[2]);return Tx(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],zx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Lx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ox=[50,e=>{const t=zx.exec(e)
731
- ;if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Lx.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]||Ex;return[n,e]=Dx(n,e),Tx(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],Rx=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Px=D_(...[Ix,Ox,[40,e=>{const t=Rx.exec(e);return t?Tx(t[2],t[1]||Ex,+t[3],t[4]?+t[4]:void 0):void 0}]]),Dx=(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]:Ex,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Fx="GlobalHandlers",Bx=Gw(Fx,((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:Fx,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(!function(e){!function(e){const t="error";$_(t,e),U_(t,my)}((t=>{const{stackParser:n,attachStacktrace:r}=$x();if(pw()!==e||dx())return;const{msg:o,url:i,line:a,column:s,error:l}=t,c=void 0===l&&Gb(o)?function(e,t,n,r){
732
- const o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let i=Ub(e)?e.message:e,a="Error";const s=i.match(o);s&&(a=s[1],i=s[2]);const l={exception:{values:[{type:a,value:i}]}};return Hx(l,t,n,r)}(o,i,a,s):Hx(_x(n,l||o,void 0,r,!1),i,a,s);c.level="error",dw(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})}))}(e),jx("onerror")),t.onunhandledrejection&&(!function(e){!function(e){const t="unhandledrejection";$_(t,e),U_(t,fy)}((t=>{const{stackParser:n,attachStacktrace:r}=$x();if(pw()!==e||dx())return;const o=function(e){if(Wb(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(e){}return e}(t),i=Wb(o)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:_x(n,o,void 0,r,!0);i.level="error",dw(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})}))}(e),jx("onunhandledrejection"))}}}))
733
- ;function Hx(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=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=Gb(t)&&t.length>0?t:function(){try{return d_.document.location.href}catch(e){return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function jx(e){mx&&__.log(`Global Handler attached: ${e}`)}function $x(){const e=pw();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}
734
- const Ux=["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"],qx="TryCatch",Gx=Gw(qx,((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:qx,setupOnce(){t.setTimeout&&S_(cx,"setTimeout",Vx),t.setInterval&&S_(cx,"setInterval",Vx),t.requestAnimationFrame&&S_(cx,"requestAnimationFrame",Wx),t.XMLHttpRequest&&"XMLHttpRequest"in cx&&S_(XMLHttpRequest.prototype,"send",Yx);const e=t.eventTarget;if(e){(Array.isArray(e)?e:Ux).forEach(Kx)}}}}));function Vx(e){return function(...t){const n=t[0];return t[0]=hx(n,{mechanism:{
735
- data:{function:B_(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function Wx(e){return function(t){return e.apply(this,[hx(t,{mechanism:{data:{function:"requestAnimationFrame",handler:B_(e)},handled:!1,type:"instrument"}})])}}function Yx(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&S_(n,e,(function(t){const n={mechanism:{data:{function:e,handler:B_(t)},handled:!1,type:"instrument"}},r=T_(t);return r&&(n.mechanism.data.handler=B_(r)),hx(t,n)}))})),e.apply(this,t)}}function Kx(e){const t=cx,n=t[e]&&t[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(S_(n,"addEventListener",(function(t){return function(n,r,o){try{"function"==typeof r.handleEvent&&(r.handleEvent=hx(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:B_(r),target:e},handled:!1,type:"instrument"}}))}catch(e){}return t.apply(this,[n,hx(r,{mechanism:{data:{function:"addEventListener",handler:B_(r),target:e},
736
- handled:!1,type:"instrument"}}),o])}})),S_(n,"removeEventListener",(function(e){return function(t,n,r){const o=n;try{const n=o&&o.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch(e){}return e.call(this,t,o,r)}})))}const Xx=1024,Jx="Breadcrumbs",Zx=Gw(Jx,((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Jx,setupOnce(){},setup(e){var n;t.console&&function(e){const t="console";$_(t,e),U_(t,G_)}(function(e){return function(t){if(pw()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:Oy(t.level),message:e_(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${e_(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}hw(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(pw()!==e)return;let r,o,i="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0
737
- ;a&&a>Xx&&(mx&&__.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=Xx),"string"==typeof i&&(i=[i]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=m_(t,{keyAttrs:i,maxStringLength:a}),o=function(e){if(!d_.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch(e){r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};o&&(s.data={"ui.component_name":o}),hw(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),$_("dom",n),U_("dom",oy)),t.xhr&&function(e){$_("xhr",e),U_("xhr",ky)}(function(e){return function(t){if(pw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,o=t.xhr[xy];if(!n||!r||!o)return;const{method:i,url:a,status_code:s,body:l}=o;hw({category:"xhr",data:{method:i,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:n,
738
- endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";$_(t,e),U_(t,cy)}(function(e){return function(t){if(pw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){hw({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,endTimestamp:r})}else{const e=t.response;hw({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&_y(function(e){return function(t){if(pw()!==e)return;let n=t.from,r=t.to;const o=zy(cx.location.href);let i=n?zy(n):void 0;const a=zy(r);i&&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),hw({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){pw()===e&&hw({
739
- category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Y_(t)},{event:t})}}(e))}}}));const Qx="LinkedErrors",ek=Gw(Qx,((e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:Qx,setupOnce(){},preprocessEvent(e,r,o){const i=o.getOptions();r_(px,i.stackParser,i.maxValueLength,n,t,e,r)}}})),tk="HttpContext",nk=Gw(tk,(()=>({name:tk,setupOnce(){},preprocessEvent(e){if(!cx.navigator&&!cx.location&&!cx.document)return;const t=e.request&&e.request.url||cx.location&&cx.location.href,{referrer:n}=cx.document||{},{userAgent:r}=cx.navigator||{},o={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},i={...e.request,...t&&{url:t},headers:o};e.request=i}}))),rk="Dedupe",ok=Gw(rk,(()=>{let e;return{name:rk,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){if(!t)return!1;if(function(e,t){const n=e.message,r=t.message;if(!n&&!r)return!1;if(n&&!r||!n&&r)return!1;if(n!==r)return!1;if(!ak(e,t))return!1;if(!ik(e,t))return!1;return!0
740
- }(e,t))return!0;if(function(e,t){const n=sk(t),r=sk(e);if(!n||!r)return!1;if(n.type!==r.type||n.value!==r.value)return!1;if(!ak(e,t))return!1;if(!ik(e,t))return!1;return!0}(e,t))return!0;return!1}(t,e))return mx&&__.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}}));function ik(e,t){let n=lk(e),r=lk(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],o=n[e];if(t.filename!==o.filename||t.lineno!==o.lineno||t.colno!==o.colno||t.function!==o.function)return!1}return!0}function ak(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(e){return!1}}function sk(e){return e.exception&&e.exception.values&&e.exception.values[0]}function lk(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}}const ck=[new ox,new lx,new Gx,new Zx,new Bx,new ek,new ok,new nk];function uk(e={}){
741
- void 0===e.defaultIntegrations&&(e.defaultIntegrations=ck),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),cx.SENTRY_RELEASE&&cx.SENTRY_RELEASE.id&&(e.release=cx.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:(n=e.stackParser||Px,Array.isArray(n)?D_(...n):n),integrations:Uw(e),transport:e.transport||(sy()?Nx:Ax)};var n;Jw(xx,t),e.autoSessionTracking&&function(){if(void 0===cx.document)return void(mx&&__.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));gw({ignoreDuration:!0}),_w(),_y((({from:e,to:t})=>{void 0!==e&&e!==t&&(gw({ignoreDuration:!0}),_w())}))}()}let dk=0;function hk(e,t){uw(e,{tags:{context:t}})}function mk(e){!function(e){Rw().setUser(e)}(e)}class pk{constructor(e,t,n){B(this,"_annotationsService",void 0),B(this,"_store",void 0),B(this,"_toastMessenger",void 0),this._store=e,this._annotationsService=t,
742
- 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){return e.length===t.length&&e.every(((e,n)=>t[n]===e))}(e.tags,t.tags)&&Go(e)===Go(t)}(e,t)));if(i)return{type:"duplicate",annotation:i};try{const r=function(e,t){var n,r;return{target:e.target,tags:e.tags,text:e.text,uri:null!==(n=null==t?void 0:t.uri)&&void 0!==n?n:e.uri,document:null!==(r=null==t?void 0:t.metadata)&&void 0!==r?r:e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=ls(e.permissions)?as(t,n):is(t);return{type:"import",annotation:await this._annotationsService.save(i)}}catch(e){
743
- return hk(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){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}}pk.$inject=["store","annotationsService","toastMessenger"]
744
- ;class fk{constructor(e,t,n,r){B(this,"_api",void 0),B(this,"_store",void 0),B(this,"_streamer",void 0),B(this,"_streamFilter",void 0),B(this,"_searchClient",void 0),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(),"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 qf(this._api.search,s),this._searchClient.on("resultCount",(e=>{this._store.setAnnotationResultCount(e)})),this._searchClient.on("results",(e=>{
745
- 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;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),zo(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),!zo(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}}
746
- fk.$inject=["api","store","streamer","streamFilter"];class gk{constructor(){B(this,"_store",void 0),this._store=new Map}getItem(e){var t;return null!==(t=this._store.get(e))&&void 0!==t?t:null}setItem(e,t){this._store.set(e,t)}removeItem(e){this._store.delete(e)}}class vk{constructor(e){B(this,"_storage",void 0);const t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch(e){this._storage=new gk}}getItem(e){return this._storage.getItem(e)}getObject(e){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)}}vk.$inject=["$window"];const bk={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class _k{constructor(e,t){B(this,"_storage",void 0),B(this,"_store",void 0),this._storage=e,this._store=t}init(){for(const[e,t]of Jo(bk)){
747
- const n=this._storage.getItem(t);this._store.setDefault(e,n)}Lb(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(const[n,r]of Jo(e))t[n]!==r&&n in bk&&this._storage.setItem(bk[n],r)}))}}_k.$inject=["localStorage","store"];class yk{constructor(e,t){B(this,"_window",void 0),B(this,"_store",void 0),B(this,"_didRegisterPopstateListener",void 0),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;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
748
- ;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()}}yk.$inject=["$window","store"];class wk{constructor(e,t){B(this,"_apiRoutes",void 0),B(this,"_store",void 0),this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links();this._store.updateLinks(e)}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}wk.$inject=["apiRoutes","store"];class xk{constructor(e,t,n,r,o){var i,a;B(this,"_store",void 0),B(this,"_api",void 0),B(this,"_auth",void 0),B(this,"_toastMessenger",void 0),B(this,"_authority",void 0),
749
- B(this,"_lastLoad",void 0),B(this,"_lastLoadTime",void 0),this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=qr(r))||void 0===a?void 0:a.authority)&&void 0!==i?i: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=vb((()=>{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?mk({id:e.userid}):mk(null)),e}async logout(){try{
750
- 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()}}xk.$inject=["store","api","auth","settings","toastMessenger"];class kk{constructor(){B(this,"_filter",void 0),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 Nk extends jf{constructor(e){super(),B(this,"_socket",void 0),B(this,"_messageQueue",void 0),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)
751
- ;const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},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 Sk{constructor(e,t,n,r,o){B(this,"_auth",void 0),B(this,"_groups",void 0),B(this,"_session",void 0),B(this,"_store",void 0),B(this,"_websocketURL",void 0),B(this,"_socket",void 0),B(this,"_reconnectSetUp",void 0),B(this,"_updateImmediately",void 0),B(this,"_configMessages",void 0),B(this,"_reconnectionAttempts",void 0),B(this,"clientId",void 0),this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=Wg(32),this._socket=null,
752
- this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&this._store.addAnnotations(e);const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})));t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){tv("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&tv("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()
753
- }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 tv("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){var n;this._configMessages[e]=t,null!==(n=this._socket)&&void 0!==n&&n.isConnected()&&this._socket.send(t)}async _reconnect(){var e;const t=await this._websocketURL;if(!t)return;let n,r;null===(e=this._socket)||void 0===e||e.close();try{n=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(n){const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new Nk(r);o.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(o)})),o.on("disconnect",(()=>{
754
- 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")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,Lb(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}Sk.$inject=["store","apiRoutes","auth","groups","session"];const Ak="hypothesis.user.tags.list",Ek="hypothesis.user.tags.map";class Tk{constructor(e){B(this,"_storage",void 0),this._storage=e}filter(e,t=null){const n=this._storage.getObject(Ak)||[];let r=0;return n.filter((n=>{
755
- if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${nv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(Ek)||{};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(Ek,t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject(Ak,n)}}Tk.$inject=["localStorage"];class Ck{constructor(e){B(this,"_store",void 0),this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}Ck.$inject=["store"];class Mk extends jf{constructor(e,t){super(),B(this,"_store",void 0),B(this,"_window",void 0),B(this,"_delayedMessageQueue",void 0),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))),
756
- 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:Wg(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)}}Mk.$inject=["store","$window"];const Ik=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),zk=function(e){
757
- const{version:t,origin:n}=Kg(e.location.href);return"1.1437.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1437.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 Lk(e,t){e.setClientId(t.clientId)}function Ok(e,t,n){e.load(),t.load(),n.sync()}function Rk(e,t,n){e.init(),t.init(),n.init()}function Pk(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}Ik.sentry&&zk&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;uk({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1437.0",
758
- beforeSend:(e,t)=>{if(dk>=5)return tv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++dk;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(e){}return e}});try{mw("host_config",Kg(window.location.href))}catch(e){}mw("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Eb(((e,t)=>{hk(e,t)}))}(Ik.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")}))}(document.body),Lk.$inject=["api","streamer"],Ok.$inject=["groups","session","router"],Rk.$inject=["autosaveService","persistedDefaults","serviceURL"],Pk.$inject=["frameSync","store","toastMessenger"];const Dk=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",sv)}(),async function(e,t=window){const n=function(e){
759
- const t=Kg(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:Xg,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Zg(t.origin),ancestorLevel:Jg(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:Qg(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await Yg(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services
760
- ;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=Yg(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),i.apiUrl=function(e){const t=qr(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(Ik).then((e=>{!function(e,t){const n=new U
721
+ if(e instanceof N_)return Ky&&__.error("Skipped sending event because buffer is full."),s("queue_overflow"),Ty();throw e}))}return o.__sentry__baseTransport__=!0,{send:o,flush:e=>n.drain(e)}}function ex(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}const tx=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],nx=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],rx="InboundFilters",ox=(e={})=>({name:rx,setupOnce(){},processEvent(t,n,r){const o=r.getOptions(),i=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:tx],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:nx],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,o);return function(e,t){if(t.ignoreInternal&&function(e){
722
+ try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e))return Ky&&__.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if(e.type||!t||!t.length)return!1;return function(e){const t=[];e.message&&t.push(e.message);let n;try{n=e.exception.values[e.exception.values.length-1]}catch(e){}n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`));Ky&&0===t.length&&__.error(`Could not extract message for event ${Y_(e)}`);return t}(e).some((e=>n_(e,t)))}(e,t.ignoreErrors))return Ky&&__.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&n_(n,t)}(e,t.ignoreTransactions))return Ky&&__.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Y_(e)}`),!0;if(function(e,t){if(!t||!t.length)return!1;const n=ix(e);return!!n&&n_(n,t)
723
+ }(e,t.denyUrls))return Ky&&__.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Y_(e)}.\nUrl: ${ix(e)}`),!0;if(!function(e,t){if(!t||!t.length)return!0;const n=ix(e);return!n||n_(n,t)}(e,t.allowUrls))return Ky&&__.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Y_(e)}.\nUrl: ${ix(e)}`),!0;return!1}(t,i)?null:t}});function ix(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(t):null}catch(t){return Ky&&__.error(`Cannot extract url for event ${Y_(e)}`),null}}let ax;Gw(rx,ox);const sx="FunctionToString",lx=()=>({name:sx,setupOnce(){ax=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=T_(this)||this;return ax.apply(t,e)}}catch(e){}}});Gw(sx,lx);const cx=l_;let ux=0;function dx(){return ux>0}function hx(e,t={},n){
724
+ if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(T_(e))return e}catch(t){return e}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const o=r.map((e=>hx(e,t)));return e.apply(this,o)}catch(e){throw ux++,setTimeout((()=>{ux--})),function(...e){const t=Rw();if(2===e.length){const[n,r]=e;return n?t.withScope((()=>(t.getStackTop().scope=n,r(n)))):t.withScope(r)}t.withScope(e[0])}((n=>{n.addEventProcessor((e=>(t.mechanism&&(K_(e,void 0,void 0),X_(e,t.mechanism)),e.extra={...e.extra,arguments:r},e))),uw(e)})),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch(e){}E_(r,e),A_(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch(e){}return r}const mx="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function px(e,t){const n=gx(e,t),r={type:t&&t.name,value:bx(t)}
725
+ ;return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function fx(e,t){return{exception:{values:[px(e,t)]}}}function gx(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(vx.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch(e){}return[]}const vx=/Minified React error #\d+;/i;function bx(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function _x(e,t,n,r,o){let i;if(Ub(t)&&t.error){return fx(e,t.error)}if(qb(t)||$b(t,"DOMException")){const o=t;if("stack"in t)i=fx(e,t);else{const t=o.name||(qb(o)?"DOMError":"DOMException"),a=o.message?`${t}: ${o.message}`:t;i=yx(e,a,n,r),K_(i,a)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}if(jb(t))return fx(e,t);if(Yb(t)||Kb(t)){return i=function(e,t,n,r){const o=pw(),i=o&&o.getOptions().normalizeDepth,a={exception:{values:[{
726
+ type:Kb(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:wx(t,{isUnhandledRejection:r})}]},extra:{__serialized__:Sy(t,i)}};if(n){const t=gx(e,n);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,n,o),X_(i,{synthetic:!0}),i}return i=yx(e,t,n,r),K_(i,`${t}`,void 0),X_(i,{synthetic:!0}),i}function yx(e,t,n,r){const o={};if(r&&n){const r=gx(e,n);r.length&&(o.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(Vb(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return o.logentry={message:e,params:n},o}return o.message=t,o}function wx(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(C_(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return Qb(n[0],t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:Qb(r,t)}return""}(e),r=t?"promise rejection":"exception";if(Ub(e))return`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``;if(Kb(e)){
727
+ return`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){}}(e)}\` (type=${e.type}) captured as ${r}`}return`Object captured as ${r} with keys: ${n}`}class xx extends Yw{constructor(e){!function(e,t,n=[t],r="npm"){const o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:n.map((e=>({name:`${r}:@sentry/${e}`,version:Cw}))),version:Cw}),e._metadata=o}(e,"browser",["browser"],cx.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&cx.document&&cx.document.addEventListener("visibilitychange",(()=>{"hidden"===cx.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,n,r){const o=_x(e,t,n&&n.syntheticException||void 0,r);return X_(o),o.level="error",n&&n.event_id&&(o.event_id=n.event_id),Ty(o)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,o){const i=yx(e,t,r&&r.syntheticException||void 0,o);return i.level=n,
728
+ r&&r.event_id&&(i.event_id=r.event_id),Ty(i)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(mx&&__.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const o={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:w_(r)}},i=function(e){return[{type:"user_report"},e]}(e);return Fy(o,[i])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(mx&&__.log("No outcomes to send"));if(!this._dsn)return void(mx&&__.log("No dsn provided, will not send outcomes"));mx&&__.log("Sending outcomes:",e);const t=(n=e,Fy((r=this._options.tunnel&&w_(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{
729
+ timestamp:o||Py(),discarded_events:n}]]));var n,r,o;this._sendEnvelope(t)}}let kx;function Nx(e,t=function(){if(kx)return kx;if(ly(cx.fetch))return kx=cx.fetch.bind(cx);const e=cx.document;let t=cx.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){mx&&__.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return kx=t.bind(cx)}()){let n=0,r=0;return Qw(e,(function(o){const i=o.body.length;n+=i,r++;const a={body:o.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,a).then((e=>(n-=i,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}})))}catch(e){return kx=void 0,n-=i,r--,Cy(e)}}))}const Sx=4;function Ax(e){return Qw(e,(function(t){return new My(((n,r)=>{
730
+ const o=new XMLHttpRequest;o.onerror=r,o.onreadystatechange=()=>{o.readyState===Sx&&n({statusCode:o.status,headers:{"x-sentry-rate-limits":o.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":o.getResponseHeader("Retry-After")}})},o.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&o.setRequestHeader(t,e.headers[t]);o.send(t.body)}))}))}const Ex="?";function Tx(e,t,n,r){const o={filename:e,function:t,in_app:!0};return void 0!==n&&(o.lineno=n),void 0!==r&&(o.colno=r),o}const Cx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Mx=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ix=[30,e=>{const t=Cx.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Mx.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=Dx(t[1]||Ex,t[2]);return Tx(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}
731
+ }],zx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Lx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ox=[50,e=>{const t=zx.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Lx.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]||Ex;return[n,e]=Dx(n,e),Tx(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],Rx=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Px=D_(...[Ix,Ox,[40,e=>{const t=Rx.exec(e);return t?Tx(t[2],t[1]||Ex,+t[3],t[4]?+t[4]:void 0):void 0}]]),Dx=(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]:Ex,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Fx=1024,Bx="Breadcrumbs",Hx=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Bx,setupOnce(){},setup(e){var n;t.console&&function(e){const t="console"
732
+ ;$_(t,e),U_(t,G_)}(function(e){return function(t){if(pw()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:Oy(t.level),message:e_(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${e_(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}hw(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(pw()!==e)return;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>Fx&&(mx&&__.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=Fx),"string"==typeof i&&(i=[i]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=m_(t,{keyAttrs:i,maxStringLength:a}),o=function(e){if(!d_.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null
733
+ ;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch(e){r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};o&&(s.data={"ui.component_name":o}),hw(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),$_("dom",n),U_("dom",oy)),t.xhr&&function(e){$_("xhr",e),U_("xhr",ky)}(function(e){return function(t){if(pw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,o=t.xhr[xy];if(!n||!r||!o)return;const{method:i,url:a,status_code:s,body:l}=o;hw({category:"xhr",data:{method:i,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";$_(t,e),U_(t,cy)}(function(e){return function(t){if(pw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){hw({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,
734
+ endTimestamp:r})}else{const e=t.response;hw({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&_y(function(e){return function(t){if(pw()!==e)return;let n=t.from,r=t.to;const o=zy(cx.location.href);let i=n?zy(n):void 0;const a=zy(r);i&&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),hw({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){pw()===e&&hw({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Y_(t)},{event:t})}}(e))}}};Gw(Bx,Hx);const jx="Dedupe",$x=()=>{let e;return{name:jx,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){if(!t)return!1;if(function(e,t){const n=e.message,r=t.message;if(!n&&!r)return!1;if(n&&!r||!n&&r)return!1;if(n!==r)return!1;if(!qx(e,t))return!1
735
+ ;if(!Ux(e,t))return!1;return!0}(e,t))return!0;if(function(e,t){const n=Gx(t),r=Gx(e);if(!n||!r)return!1;if(n.type!==r.type||n.value!==r.value)return!1;if(!qx(e,t))return!1;if(!Ux(e,t))return!1;return!0}(e,t))return!0;return!1}(t,e))return mx&&__.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}};function Ux(e,t){let n=Vx(e),r=Vx(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],o=n[e];if(t.filename!==o.filename||t.lineno!==o.lineno||t.colno!==o.colno||t.function!==o.function)return!1}return!0}function qx(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(e){return!1}}function Gx(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Vx(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}}Gw(jx,$x);const Wx="GlobalHandlers",Yx=(e={})=>{const t={onerror:!0,
736
+ onunhandledrejection:!0,...e};return{name:Wx,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(!function(e){!function(e){const t="error";$_(t,e),U_(t,my)}((t=>{const{stackParser:n,attachStacktrace:r}=Jx();if(pw()!==e||dx())return;const{msg:o,url:i,line:a,column:s,error:l}=t,c=void 0===l&&Gb(o)?function(e,t,n,r){const o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let i=Ub(e)?e.message:e,a="Error";const s=i.match(o);s&&(a=s[1],i=s[2]);const l={exception:{values:[{type:a,value:i}]}};return Kx(l,t,n,r)}(o,i,a,s):Kx(_x(n,l||o,void 0,r,!1),i,a,s);c.level="error",dw(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})}))}(e),Xx("onerror")),t.onunhandledrejection&&(!function(e){!function(e){const t="unhandledrejection";$_(t,e),U_(t,fy)}((t=>{const{stackParser:n,attachStacktrace:r}=Jx();if(pw()!==e||dx())return;const o=function(e){if(Wb(e))return e;const t=e;try{if("reason"in t)return t.reason
737
+ ;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(e){}return e}(t),i=Wb(o)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:_x(n,o,void 0,r,!0);i.level="error",dw(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})}))}(e),Xx("onunhandledrejection"))}}};function Kx(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=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=Gb(t)&&t.length>0?t:function(){try{return d_.document.location.href}catch(e){return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function Xx(e){mx&&__.log(`Global Handler attached: ${e}`)}function Jx(){const e=pw();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}Gw(Wx,Yx);const Zx="HttpContext",Qx=()=>({name:Zx,setupOnce(){},preprocessEvent(e){
738
+ if(!cx.navigator&&!cx.location&&!cx.document)return;const t=e.request&&e.request.url||cx.location&&cx.location.href,{referrer:n}=cx.document||{},{userAgent:r}=cx.navigator||{},o={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},i={...e.request,...t&&{url:t},headers:o};e.request=i}});Gw(Zx,Qx);const ek="LinkedErrors",tk=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:ek,setupOnce(){},preprocessEvent(e,r,o){const i=o.getOptions();r_(px,i.stackParser,i.maxValueLength,n,t,e,r)}}};Gw(ek,tk)
739
+ ;const nk=["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"],rk="TryCatch",ok=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:rk,setupOnce(){t.setTimeout&&S_(cx,"setTimeout",ik),t.setInterval&&S_(cx,"setInterval",ik),t.requestAnimationFrame&&S_(cx,"requestAnimationFrame",ak),t.XMLHttpRequest&&"XMLHttpRequest"in cx&&S_(XMLHttpRequest.prototype,"send",sk);const e=t.eventTarget;if(e){(Array.isArray(e)?e:nk).forEach(lk)}}}};function ik(e){return function(...t){const n=t[0];return t[0]=hx(n,{mechanism:{data:{
740
+ function:B_(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function ak(e){return function(t){return e.apply(this,[hx(t,{mechanism:{data:{function:"requestAnimationFrame",handler:B_(e)},handled:!1,type:"instrument"}})])}}function sk(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&S_(n,e,(function(t){const n={mechanism:{data:{function:e,handler:B_(t)},handled:!1,type:"instrument"}},r=T_(t);return r&&(n.mechanism.data.handler=B_(r)),hx(t,n)}))})),e.apply(this,t)}}function lk(e){const t=cx,n=t[e]&&t[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(S_(n,"addEventListener",(function(t){return function(n,r,o){try{"function"==typeof r.handleEvent&&(r.handleEvent=hx(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:B_(r),target:e},handled:!1,type:"instrument"}}))}catch(e){}return t.apply(this,[n,hx(r,{mechanism:{data:{function:"addEventListener",handler:B_(r),target:e},handled:!1,
741
+ type:"instrument"}}),o])}})),S_(n,"removeEventListener",(function(e){return function(t,n,r){const o=n;try{const n=o&&o.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch(e){}return e.call(this,t,o,r)}})))}Gw(rk,ok);const ck=[ox(),lx(),ok(),Hx(),Yx(),tk(),$x(),Qx()];function uk(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[...ck]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),cx.SENTRY_RELEASE&&cx.SENTRY_RELEASE.id&&(e.release=cx.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:(n=e.stackParser||Px,Array.isArray(n)?D_(...n):n),integrations:Uw(e),transport:e.transport||(sy()?Nx:Ax)};var n;Jw(xx,t),e.autoSessionTracking&&function(){if(void 0===cx.document)return void(mx&&__.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));gw({ignoreDuration:!0}),_w(),_y((({from:e,to:t})=>{void 0!==e&&e!==t&&(gw({
742
+ ignoreDuration:!0}),_w())}))}()}let dk=0;function hk(e,t){uw(e,{tags:{context:t}})}function mk(e){!function(e){Rw().setUser(e)}(e)}class pk{constructor(e,t,n){B(this,"_annotationsService",void 0),B(this,"_store",void 0),B(this,"_toastMessenger",void 0),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){return e.length===t.length&&e.every(((e,n)=>t[n]===e))}(e.tags,t.tags)&&Go(e)===Go(t)}(e,t)));if(i)return{type:"duplicate",annotation:i};try{const r=function(e,t){var n,r;return{target:e.target,tags:e.tags,text:e.text,uri:null!==(n=null==t?void 0:t.uri)&&void 0!==n?n:e.uri,
743
+ document:null!==(r=null==t?void 0:t.metadata)&&void 0!==r?r:e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=ls(e.permissions)?as(t,n):is(t);return{type:"import",annotation:await this._annotationsService.save(i)}}catch(e){return hk(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){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,
744
+ 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}}pk.$inject=["store","annotationsService","toastMessenger"];class fk{constructor(e,t,n,r){B(this,"_api",void 0),B(this,"_store",void 0),B(this,"_streamer",void 0),B(this,"_streamFilter",void 0),B(this,"_searchClient",void 0),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(),"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",{
745
+ filter:this._streamFilter.getFilter()}));const s={incremental:!0,separateReplies:!1,maxResults:r,sortBy:o,sortOrder:i};this._searchClient=new qf(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;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),zo(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}
746
+ const r=[t,...n.rows];if(this._store.addAnnotations(r),!zo(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}}fk.$inject=["api","store","streamer","streamFilter"];class gk{constructor(){B(this,"_store",void 0),this._store=new Map}getItem(e){var t;return null!==(t=this._store.get(e))&&void 0!==t?t:null}setItem(e,t){this._store.set(e,t)}removeItem(e){this._store.delete(e)}}class vk{constructor(e){B(this,"_storage",void 0);const t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch(e){this._storage=new gk}}getItem(e){return this._storage.getItem(e)}getObject(e){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){
747
+ this._storage.removeItem(e)}}vk.$inject=["$window"];const bk={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class _k{constructor(e,t){B(this,"_storage",void 0),B(this,"_store",void 0),this._storage=e,this._store=t}init(){for(const[e,t]of Jo(bk)){const n=this._storage.getItem(t);this._store.setDefault(e,n)}Lb(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(const[n,r]of Jo(e))t[n]!==r&&n in bk&&this._storage.setItem(bk[n],r)}))}}_k.$inject=["localStorage","store"];class yk{constructor(e,t){B(this,"_window",void 0),B(this,"_store",void 0),B(this,"_didRegisterPopstateListener",void 0),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;case"notebook":r="notebook";break
748
+ ;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()}}yk.$inject=["$window","store"];class wk{constructor(e,t){B(this,"_apiRoutes",void 0),B(this,"_store",void 0),this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links()
749
+ ;this._store.updateLinks(e)}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}wk.$inject=["apiRoutes","store"];class xk{constructor(e,t,n,r,o){var i,a;B(this,"_store",void 0),B(this,"_api",void 0),B(this,"_auth",void 0),B(this,"_toastMessenger",void 0),B(this,"_authority",void 0),B(this,"_lastLoad",void 0),B(this,"_lastLoadTime",void 0),this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=qr(r))||void 0===a?void 0:a.authority)&&void 0!==i?i: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=vb((()=>{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(){
750
+ 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?mk({id:e.userid}):mk(null)),e}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()}}xk.$inject=["store","api","auth","settings","toastMessenger"];class kk{constructor(){B(this,"_filter",void 0),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 Nk extends jf{constructor(e){super(),
751
+ B(this,"_socket",void 0),B(this,"_messageQueue",void 0),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")},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 Sk{constructor(e,t,n,r,o){B(this,"_auth",void 0),B(this,"_groups",void 0),B(this,"_session",void 0),B(this,"_store",void 0),B(this,"_websocketURL",void 0),B(this,"_socket",void 0),B(this,"_reconnectSetUp",void 0),B(this,"_updateImmediately",void 0),
752
+ B(this,"_configMessages",void 0),B(this,"_reconnectionAttempts",void 0),B(this,"clientId",void 0),this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=Wg(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&this._store.addAnnotations(e);const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})));t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){tv("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&tv("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":
753
+ 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 tv("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){var n;this._configMessages[e]=t,null!==(n=this._socket)&&void 0!==n&&n.isConnected()&&this._socket.send(t)}async _reconnect(){var e;const t=await this._websocketURL;if(!t)return;let n,r;null===(e=this._socket)||void 0===e||e.close();try{n=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(n){
754
+ const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new Nk(r);o.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(o)})),o.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")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,Lb(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}Sk.$inject=["store","apiRoutes","auth","groups","session"]
755
+ ;const Ak="hypothesis.user.tags.list",Ek="hypothesis.user.tags.map";class Tk{constructor(e){B(this,"_storage",void 0),this._storage=e}filter(e,t=null){const n=this._storage.getObject(Ak)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${nv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(Ek)||{};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(Ek,t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject(Ak,n)}}Tk.$inject=["localStorage"];class Ck{constructor(e){B(this,"_store",void 0),this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}Ck.$inject=["store"];class Mk extends jf{constructor(e,t){super(),B(this,"_store",void 0),B(this,"_window",void 0),
756
+ B(this,"_delayedMessageQueue",void 0),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:Wg(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)}}Mk.$inject=["store","$window"];const Ik=function(e){
757
+ 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),zk=function(e){const{version:t,origin:n}=Kg(e.location.href);return"1.1438.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1438.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 Lk(e,t){e.setClientId(t.clientId)}function Ok(e,t,n){e.load(),t.load(),n.sync()}function Rk(e,t,n){e.init(),t.init(),n.init()}function Pk(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{
758
+ autoDismiss:!1})}))}Ik.sentry&&zk&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;uk({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1438.0",beforeSend:(e,t)=>{if(dk>=5)return tv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++dk;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(e){}return e}});try{mw("host_config",Kg(window.location.href))}catch(e){}mw("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Eb(((e,t)=>{hk(e,t)}))}(Ik.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")}))}(document.body),Lk.$inject=["api","streamer"],
759
+ Ok.$inject=["groups","session","router"],Rk.$inject=["autosaveService","persistedDefaults","serviceURL"],Pk.$inject=["frameSync","store","toastMessenger"];const Dk=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",sv)}(),async function(e,t=window){const n=function(e){const t=Kg(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:Xg,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Zg(t.origin),ancestorLevel:Jg(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
760
+ ;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:Qg(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await Yg(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=Yg(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),i.apiUrl=function(e){const t=qr(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(Ik).then((e=>{!function(e,t){const n=new U
761
761
  ;n.register("annotationsExporter",cb).register("annotationsService",cv).register("annotationActivity",lv).register("api",hb).register("apiRoutes",_b).register("auth",xb).register("autosaveService",kb).register("frameSync",Pb).register("groups",Bb).register("importAnnotationsService",pk).register("loadAnnotationsService",fk).register("localStorage",vk).register("persistedDefaults",_k).register("router",yk).register("serviceURL",wk).register("session",xk).register("streamer",Sk).register("streamFilter",kk).register("tags",Tk).register("threadsService",Ck).register("toastMessenger",Mk).register("store",{factory:Aa}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Rk),n.run(Lk),n.run(Ok),n.run(av),n.run(Pk),P(Oe(Yr.Provider,{value:n,children:Oe(qg,{})}),t)}(e,Dk)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),P(Oe(Gg,{error:e}),t)}(e,Dk)));
762
762
  //# sourceMappingURL=sidebar.bundle.js.map