hypothesis 1.978.0 → 1.982.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/boot.js +1 -1
- package/build/manifest.json +9 -9
- package/build/scripts/annotator.bundle.js +115 -114
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +172 -172
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ t.__v!==r.__v&&(d.__d=!1),d.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach((functio
|
|
|
7
7
|
n.__e(e,t.__v)}}))}function L(e,n,r,o,i,a,s,c){var u,h,p,m=r.props,f=n.props,v=n.type,y=0;if("svg"===v&&(i=!0),null!=a)for(;y<a.length;y++)if((u=a[y])&&"setAttribute"in u==!!v&&(v?u.localName===v:3===u.nodeType)){e=u,a[y]=null;break}if(null==e){if(null===v)return document.createTextNode(f);e=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,f.is&&f),a=null,c=!1}if(null===v)m===f||c&&e.data===f||(e.data=f);else{if(a=a&&t.call(e.childNodes),h=(m=r.props||l).dangerouslySetInnerHTML,p=f.dangerouslySetInnerHTML,!c){if(null!=a)for(m={},y=0;y<e.attributes.length;y++)m[e.attributes[y].name]=e.attributes[y].value;(p||h)&&(p&&(h&&p.__html==h.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)}(e,f,m,i,c),p)n.__k=[];else if(y=n.props.children,
|
|
8
8
|
b(e,Array.isArray(y)?y:[y],n,r,o,i&&"foreignObject"!==v,a,s,a?a[0]:r.__k&&g(r,0),c),null!=a)for(y=a.length;y--;)null!=a[y]&&d(a[y]);c||("value"in f&&void 0!==(y=f.value)&&(y!==m.value||y!==e.value||"progress"===v&&!y)&&C(e,"value",y,m.value,!1),"checked"in f&&void 0!==(y=f.checked)&&y!==e.checked&&C(e,"checked",y,m.checked,!1))}return e}function M(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(e){n.__e(e,r)}}function z(e,t,r){var o,i;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||M(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&z(o[i],t,"function"!=typeof e.type);r||null==e.__e||d(e.__e),e.__e=e.__d=void 0}function O(e,t,n){return this.constructor(e,n)}function I(e,r,o){var i,a,s;n.__&&n.__(e,r),a=(i="function"==typeof o)?null:o&&o.__k||r.__k,s=[],T(r,e=(!i&&o||r).__k=function(e,n,r){var o,i,a,s={};for(a in n)"key"==a?o=n[a]:"ref"==a?i=n[a]:s[a]=n[a]
|
|
9
9
|
;if(arguments.length>2&&(s.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===s[a]&&(s[a]=e.defaultProps[a]);return p(e,s,o,i,null)}(m,null,[e]),a||l,l,void 0!==r.ownerSVGElement,!i&&o?[o]:a?null:r.firstChild?t.call(r.childNodes):null,s,!i&&o?o:a?a.__e:r.firstChild,i),N(s,e)}function R(e){const t=new URL(e).hash.slice(1),n=new URLSearchParams(t).get("config");return JSON.parse(n||"{}")}function P({services:e}){return Array.isArray(e)&&e[0]?e[0]:null}function D(e){const t=P(e);if(t){if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}return e.apiUrl}function B(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function F(e){return parseInt(e)}function j(e){return e&&"function"==typeof e.toString?e.toString():""}function H(e){
|
|
10
|
-
const t=R(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:B,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:j(t.origin),ancestorLevel:F(t.ancestorLevel)}}};return Object.keys(t).reduce(((e,o)=>(-1!==n.indexOf(o)&&null!==t[o]&&(r[o]?e[o]=r[o](t[o]):e[o]=t[o]),e)),{})}function
|
|
10
|
+
const t=R(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:B,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:j(t.origin),ancestorLevel:F(t.ancestorLevel)}}};return Object.keys(t).reduce(((e,o)=>(-1!==n.indexOf(o)&&null!==t[o]&&(r[o]?e[o]=r[o](t[o]):e[o]=t[o]),e)),{})}function q(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function U(e){const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t).map(q).join("")}function $(e,t,n,r=[],o=2e3,i=window){const a=U(10),s={jsonrpc:"2.0",method:n,params:r,id:a};try{e.postMessage(s,t)}catch(e){return Promise.reject(e)}let l;const c=new Promise(((e,n)=>{l=r=>{if(r.origin!==t)return;if(!(r.data instanceof Object)||"2.0"!==r.data.jsonrpc||r.data.id!==a)return;const{error:o,result:i}=r.data
|
|
11
11
|
;void 0!==o?n(o):void 0!==i?e(i):n(new Error("RPC reply had no result or error"))},i.addEventListener("message",l)})),u=[c];var h,d;return o&&u.push((h=o,d=`Request to ${t} timed out`,new Promise(((e,t)=>{setTimeout((()=>t(new Error(d))),h)})))),Promise.race(u).then((e=>(i.removeEventListener("message",l),e))).catch((e=>{throw i.removeEventListener("message",l),e}))}function G(e,t=window){let n;return n=function(e,t=window){const n=[];for(let r of function(e){if(e===e.top)return[];const t=[];do{e=e.parent,t.push(e)}while(e!==e.top);return t}(t)){const t=$(r,e,"requestConfig",[],3e3);n.push(t)}return 0===n.length&&n.push(Promise.reject(new Error("Client is top frame"))),Promise.race(n)}(H(t).requestConfigFromFrame,t),n.then((t=>{const n=Object.assign({},e,t);return n.apiUrl=D(n),n}))}function V(e,t){const n={...e,...t};return n.apiUrl=D(n),n}async function W(e,t,n){return async function(e,t){Array.isArray(e.services)&&e.services.forEach(((e,n)=>{
|
|
12
12
|
"$rpc:requestGroups"===e.groups&&(e.groups=t("requestGroups",[n],null).catch((()=>{throw new Error("Unable to fetch groups")})))}));return e}(V(e,await $(t,n,"requestConfig",[],3e3)),((e,r=[],o=3e3)=>$(t,n,e,r,o)))}t=c.slice,n={__e:function(e,t){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},r=0,f.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),y(this))},f.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),y(this))},f.prototype.render=m,o=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_.__r=0,s=0;let Y={};function K(...e){const t=e.join();t in Y||(console.warn(...e),Y[t]=!0)}
|
|
13
13
|
K.reset=()=>{Y={}};var X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Z=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};function J(e,t,n,r){const o=t.find((e=>"__world__"===e.id));o&&e.unshift(o);const i=e.map((e=>e.id));t=t.filter((e=>!i.includes(e.id))),t.forEach((e=>e.isMember=!1)),e.forEach((e=>e.isMember=!0));const a=e.concat(t);return a.forEach((e=>{e.canLeave=!!function(e){const t=P(e);return!t||!!t.allowLeavingGroups}(r)&&"private"===e.type})),a.forEach((e=>e.isScopedToUri=function(e,t){if(e.scopes&&e.scopes.uri_patterns.length>0&&t)return function(e,t){return void 0!==t.find((t=>e.match(t.split("*").map(Z).join(".*"))))}(t,e.scopes.uri_patterns);return!0}(e,n))),a}let Q=[];function ee(e,t,n){const r=(e=>({changeFocusModeUser:t=>{var n;e.changeFocusModeUser(t)
|
|
@@ -18,15 +18,15 @@ return ge(e,"DOMError")}function _e(e){return ge(e,"String")}function be(e){retu
|
|
|
18
18
|
(n=s.className)&&_e(n))for(r=n.split(/\s+/),a=0;a<r.length;a++)l.push("."+r[a]);var u=["type","name","title","alt"];for(a=0;a<u.length;a++)o=u[a],(i=s.getAttribute(o))&&l.push("["+o+'="'+i+'"]');return l.join("")}var Te=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){return e.__proto__=t,e}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n]);return e});var Ne=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return r.message=t,r.name=n.prototype.constructor.name,Te(r,n.prototype),r}return re(t,e),t}(Error),Le=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Me(e,t){void 0===t&&(t=!1);var n=e.host,r=e.path,o=e.pass,i=e.port,a=e.projectId;return e.protocol+"://"+e.publicKey+(t&&o?":"+o:"")+"@"+n+(i?":"+i:"")+"/"+(r?r+"/":r)+a}function ze(e){return"user"in e&&!("publicKey"in e)&&(e.publicKey=e.user),{user:e.publicKey||"",protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",
|
|
19
19
|
path:e.path||"",projectId:e.projectId}}function Oe(e){var t="string"==typeof e?function(e){var t=Le.exec(e);if(!t)throw new Ne("Invalid Sentry Dsn: "+e);var n=se(t.slice(1),6),r=n[0],o=n[1],i=n[2],a=void 0===i?"":i,s=n[3],l=n[4],c=void 0===l?"":l,u="",h=n[5],d=h.split("/");if(d.length>1&&(u=d.slice(0,-1).join("/"),h=d.pop()),h){var p=h.match(/^\d+/);p&&(h=p[0])}return ze({host:s,pass:a,path:u,projectId:h,port:c,protocol:r,publicKey:o})}(e):ze(e);return function(e){if(ue()){var t=e.port,n=e.projectId,r=e.protocol;if(["protocol","publicKey","host","projectId"].forEach((function(t){if(!e[t])throw new Ne("Invalid Sentry Dsn: "+t+" missing")})),!n.match(/^\d+$/))throw new Ne("Invalid Sentry Dsn: Invalid projectId "+n);if(!function(e){return"http"===e||"https"===e}(r))throw new Ne("Invalid Sentry Dsn: Invalid protocol "+r);if(t&&isNaN(parseInt(t,10)))throw new Ne("Invalid Sentry Dsn: Invalid port "+t)}}(t),t}var Ie=pe(),Re="Sentry Logger ";function Pe(e){var t=pe();if(!("console"in t))return e()
|
|
20
20
|
;var n=t.console,r={};["debug","info","warn","error","log","assert"].forEach((function(e){e in t.console&&n[e].__sentry_original__&&(r[e]=n[e],n[e]=n[e].__sentry_original__)}));var o=e();return Object.keys(r).forEach((function(e){n[e]=r[e]})),o}var De=function(){function e(){this._enabled=!1}return e.prototype.disable=function(){this._enabled=!1},e.prototype.enable=function(){this._enabled=!0},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&Pe((function(){Ie.console.log(Re+"[Log]: "+e.join(" "))}))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&Pe((function(){Ie.console.warn(Re+"[Warn]: "+e.join(" "))}))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._enabled&&Pe((function(){Ie.console.error(Re+"[Error]: "+e.join(" "))}))},e}();Ie.__SENTRY__=Ie.__SENTRY__||{};var Be=Ie.__SENTRY__.logger||(Ie.__SENTRY__.logger=new De);function Fe(e){try{
|
|
21
|
-
return e&&"function"==typeof e&&e.name||"<anonymous>"}catch(e){return"<anonymous>"}}function je(e,t){return void 0===t&&(t=0),"string"!=typeof e||0===t||e.length<=t?e:e.substr(0,t)+"..."}function He(e,t){if(!Array.isArray(e))return"";for(var n=[],r=0;r<e.length;r++){var o=e[r];try{n.push(String(o))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function
|
|
21
|
+
return e&&"function"==typeof e&&e.name||"<anonymous>"}catch(e){return"<anonymous>"}}function je(e,t){return void 0===t&&(t=0),"string"!=typeof e||0===t||e.length<=t?e:e.substr(0,t)+"..."}function He(e,t){if(!Array.isArray(e))return"";for(var n=[],r=0;r<e.length;r++){var o=e[r];try{n.push(String(o))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function qe(e,t){return!!_e(e)&&(ge(t,"RegExp")?t.test(e):"string"==typeof t&&-1!==e.indexOf(t))}function Ue(e,t,n){if(t in e){var r=e[t],o=n(r);if("function"==typeof o)try{Ge(o,r)}catch(e){}e[t]=o}}function $e(e,t,n){Object.defineProperty(e,t,{value:n})}function Ge(e,t){var n=t.prototype||{};e.prototype=t.prototype=n,$e(e,"__sentry_original__",t)}function Ve(e){return e.__sentry_original__}function We(e){if(fe(e)){var t=e,n={message:t.message,name:t.name,stack:t.stack};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}if(xe(e)){var o=e,i={};i.type=o.type;try{
|
|
22
22
|
i.target=ke(o.target)?Ae(o.target):Object.prototype.toString.call(o.target)}catch(e){i.target="<unknown>"}try{i.currentTarget=ke(o.currentTarget)?Ae(o.currentTarget):Object.prototype.toString.call(o.currentTarget)}catch(e){i.currentTarget="<unknown>"}for(var a in"undefined"!=typeof CustomEvent&&Ce(e,CustomEvent)&&(i.detail=o.detail),o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a]);return i}return e}function Ye(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}function Ke(e,t,n){void 0===t&&(t=3),void 0===n&&(n=102400);var r=Je(e,t);return Ye(r)>n?Ke(e,t-1,n):r}function Xe(e,t){
|
|
23
23
|
return"domain"===t&&e&&"object"==typeof e&&e._events?"[Domain]":"domainEmitter"===t?"[DomainEmitter]":"undefined"!=typeof global&&e===global?"[Global]":"undefined"!=typeof window&&e===window?"[Window]":"undefined"!=typeof document&&e===document?"[Document]":we(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n?"[SyntheticEvent]":"number"==typeof e&&e!=e?"[NaN]":void 0===e?"[undefined]":"function"==typeof e?"[Function: "+Fe(e)+"]":"symbol"==typeof e?"["+String(e)+"]":"bigint"==typeof e?"[BigInt: "+String(e)+"]":e;var n}function Ze(e,t,n,r){if(void 0===n&&(n=1/0),void 0===r&&(r=function(){var e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(n){if(e)return!!t.has(n)||(t.add(n),!1);for(var r=0;r<t.length;r++)if(t[r]===n)return!0;return t.push(n),!1},function(n){if(e)t.delete(n);else for(var r=0;r<t.length;r++)if(t[r]===n){t.splice(r,1);break}}]}()),0===n)return function(e){if("string"==typeof e)return e;var t=Object.prototype.toString.call(e)
|
|
24
24
|
;if("[object Object]"===t)return"[Object]";if("[object Array]"===t)return"[Array]";var n=Xe(e);return be(n)?n:t}(t);if(null!=t&&"function"==typeof t.toJSON)return t.toJSON();var o=Xe(t,e);if(be(o))return o;var i=We(t),a=Array.isArray(t)?[]:{};if(r[0](t))return"[Circular ~]";for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(a[s]=Ze(s,i[s],n-1,r));return r[1](t),a}function Je(e,t){try{return JSON.parse(JSON.stringify(e,(function(e,n){return Ze(e,n,t)})))}catch(e){return"**non-serializable**"}}function Qe(e,t){void 0===t&&(t=40);var n=Object.keys(We(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return je(n[0],t);for(var r=n.length;r>0;r--){var o=n.slice(0,r).join(", ");if(!(o.length>t))return r===n.length?o:je(o,t)}return""}function et(e){var t,n;if(we(e)){var r=e,o={};try{for(var i=ae(Object.keys(r)),a=i.next();!a.done;a=i.next()){var s=a.value;void 0!==r[s]&&(o[s]=et(r[s]))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}
|
|
25
|
-
return o}return Array.isArray(e)?e.map(et):e}function tt(){if(!("fetch"in pe()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function nt(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function rt(){if(!tt())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(e){return!1}}var ot,it=pe(),at={},st={};function lt(e){if(!st[e])switch(st[e]=!0,e){case"console":!function(){if(!("console"in it))return;["debug","info","warn","error","log","assert"].forEach((function(e){e in it.console&&
|
|
26
|
-
var n=it[t]&&it[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(
|
|
27
|
-
method:_e(t[0])?t[0].toUpperCase():t[0],url:t[1]};_e(o)&&"POST"===i.method&&o.match(/sentry_key/)&&(r.__sentry_own_request__=!0);var a=function(){if(4===r.readyState){try{i.status_code=r.status}catch(e){}ut("xhr",{args:t,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:r})}};return"onreadystatechange"in r&&"function"==typeof r.onreadystatechange?
|
|
28
|
-
n.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(t=nt(r.contentWindow.fetch)),n.head.removeChild(r)}catch(e){ue()&&Be.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return t}())return;
|
|
29
|
-
return e.apply(this,t)}}it.onpopstate=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=it.location.href,o=ot;if(ot=r,ut("history",{from:o,to:r}),e)try{return e.apply(this,t)}catch(e){}},
|
|
25
|
+
return o}return Array.isArray(e)?e.map(et):e}function tt(){if(!("fetch"in pe()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function nt(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function rt(){if(!tt())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(e){return!1}}var ot,it=pe(),at={},st={};function lt(e){if(!st[e])switch(st[e]=!0,e){case"console":!function(){if(!("console"in it))return;["debug","info","warn","error","log","assert"].forEach((function(e){e in it.console&&Ue(it.console,e,(function(t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];ut("console",{args:n,level:e}),t&&Function.prototype.apply.call(t,it.console,n)}}))}))}();break;case"dom":!function(){if(!("document"in it))return;var e=ut.bind(null,"dom"),t=ft(e,!0);it.document.addEventListener("click",t,!1),it.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((function(t){
|
|
26
|
+
var n=it[t]&&it[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(Ue(n,"addEventListener",(function(t){return function(n,r,o){if("click"===n||"keypress"==n)try{var i=this,a=i.__sentry_instrumentation_handlers__=i.__sentry_instrumentation_handlers__||{},s=a[n]=a[n]||{refCount:0};if(!s.handler){var l=ft(e);s.handler=l,t.call(this,n,l,o)}s.refCount+=1}catch(e){}return t.call(this,n,r,o)}})),Ue(n,"removeEventListener",(function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{var o=this,i=o.__sentry_instrumentation_handlers__||{},a=i[t];a&&(a.refCount-=1,a.refCount<=0&&(e.call(this,t,a.handler,r),a.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete o.__sentry_instrumentation_handlers__)}catch(e){}return e.call(this,t,n,r)}})))}))}();break;case"xhr":!function(){if(!("XMLHttpRequest"in it))return;var e=XMLHttpRequest.prototype;Ue(e,"open",(function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this,o=t[1],i=r.__sentry_xhr__={
|
|
27
|
+
method:_e(t[0])?t[0].toUpperCase():t[0],url:t[1]};_e(o)&&"POST"===i.method&&o.match(/sentry_key/)&&(r.__sentry_own_request__=!0);var a=function(){if(4===r.readyState){try{i.status_code=r.status}catch(e){}ut("xhr",{args:t,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:r})}};return"onreadystatechange"in r&&"function"==typeof r.onreadystatechange?Ue(r,"onreadystatechange",(function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return a(),e.apply(r,t)}})):r.addEventListener("readystatechange",a),e.apply(r,t)}})),Ue(e,"send",(function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.__sentry_xhr__&&void 0!==t[0]&&(this.__sentry_xhr__.body=t[0]),ut("xhr",{args:t,startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}}))}();break;case"fetch":!function(){if(!function(){if(!tt())return!1;var e=pe();if(nt(e.fetch))return!0;var t=!1,n=e.document;if(n&&"function"==typeof n.createElement)try{var r=n.createElement("iframe");r.hidden=!0,
|
|
28
|
+
n.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(t=nt(r.contentWindow.fetch)),n.head.removeChild(r)}catch(e){ue()&&Be.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return t}())return;Ue(it,"fetch",(function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r={args:t,fetchData:{method:ht(t),url:dt(t)},startTimestamp:Date.now()};return ut("fetch",ie({},r)),e.apply(it,t).then((function(e){return ut("fetch",ie(ie({},r),{endTimestamp:Date.now(),response:e})),e}),(function(e){throw ut("fetch",ie(ie({},r),{endTimestamp:Date.now(),error:e})),e}))}}))}();break;case"history":!function(){if(!function(){var e=pe(),t=e.chrome,n=t&&t.app&&t.app.runtime,r="history"in e&&!!e.history.pushState&&!!e.history.replaceState;return!n&&r}())return;var e=it.onpopstate;function t(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.length>2?t[2]:void 0;if(r){var o=ot,i=String(r);ot=i,ut("history",{from:o,to:i})}
|
|
29
|
+
return e.apply(this,t)}}it.onpopstate=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=it.location.href,o=ot;if(ot=r,ut("history",{from:o,to:r}),e)try{return e.apply(this,t)}catch(e){}},Ue(it.history,"pushState",t),Ue(it.history,"replaceState",t)}();break;case"error":gt=it.onerror,it.onerror=function(e,t,n,r,o){return ut("error",{column:r,error:o,line:n,msg:e,url:t}),!!gt&>.apply(this,arguments)};break;case"unhandledrejection":vt=it.onunhandledrejection,it.onunhandledrejection=function(e){return ut("unhandledrejection",e),!vt||vt.apply(this,arguments)};break;default:Be.warn("unknown instrumentation type:",e)}}function ct(e,t){at[e]=at[e]||[],at[e].push(t),lt(e)}function ut(e,t){var n,r;if(e&&at[e])try{for(var o=ae(at[e]||[]),i=o.next();!i.done;i=o.next()){var a=i.value;try{a(t)}catch(t){ue()&&Be.error("Error while triggering instrumentation handler.\nType: "+e+"\nName: "+Fe(a)+"\nError: "+t)}}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{
|
|
30
30
|
if(n)throw n.error}}}function ht(e){return void 0===e&&(e=[]),"Request"in it&&Ce(e[0],Request)&&e[0].method?String(e[0].method).toUpperCase():e[1]&&e[1].method?String(e[1].method).toUpperCase():"GET"}function dt(e){return void 0===e&&(e=[]),"string"==typeof e[0]?e[0]:"Request"in it&&Ce(e[0],Request)?e[0].url:String(e[0])}var pt,mt;function ft(e,t){return void 0===t&&(t=!1),function(n){if(n&&mt!==n&&!function(e){if("keypress"!==e.type)return!1;try{var t=e.target;if(!t||!t.tagName)return!0;if("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable)return!1}catch(e){}return!0}(n)){var r="keypress"===n.type?"input":n.type;(void 0===pt||function(e,t){if(!e)return!0;if(e.type!==t.type)return!0;try{if(e.target!==t.target)return!0}catch(e){}return!1}(mt,n))&&(e({event:n,name:r,global:t}),mt=n),clearTimeout(pt),pt=it.setTimeout((function(){pt=void 0}),1e3)}}}var gt=null;var vt=null;function yt(){var e=pe(),t=e.crypto||e.msCrypto;if(void 0!==t&&t.getRandomValues){var n=new Uint16Array(8);t.getRandomValues(n),
|
|
31
31
|
n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function _t(e){if(!e)return{};var t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};var n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+n+r}}function bt(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function wt(e){var t=e.message,n=e.event_id;if(t)return t;var r=bt(e);return r?r.type&&r.value?r.type+": "+r.value:r.type||r.value||n||"<unknown>":n||"<unknown>"}function xt(e,t,n){var r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=n||"Error")}function kt(e,t){var n=bt(e);if(n){var r=n.mechanism;if(n.mechanism=ie(ie(ie({},{type:"generic",
|
|
32
32
|
handled:!0}),r),t),t&&"data"in t){var o=ie(ie({},r&&r.data),t.data);n.mechanism.data=o}}}function St(e){if(e&&e.__sentry_captured__)return!0;try{$e(e,"__sentry_captured__",!0)}catch(e){}return!1}function Ct(e){return new Et((function(t){t(e)}))}function At(e){return new Et((function(t,n){n(e)}))}var Et=function(){function e(e){var t=this;this._state=0,this._handlers=[],this._resolve=function(e){t._setResult(1,e)},this._reject=function(e){t._setResult(2,e)},this._setResult=function(e,n){0===t._state&&(Se(n)?n.then(t._resolve,t._reject):(t._state=e,t._value=n,t._executeHandlers()))},this._executeHandlers=function(){if(0!==t._state){var e=t._handlers.slice();t._handlers=[],e.forEach((function(e){e[0]||(1===t._state&&e[1](t._value),2===t._state&&e[2](t._value),e[0]=!0)}))}};try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}return e.prototype.then=function(t,n){var r=this;return new e((function(e,o){r._handlers.push([!1,function(n){if(t)try{e(t(n))}catch(e){o(e)}else e(n)},function(t){if(n)try{e(n(t))
|
|
@@ -43,9 +43,9 @@ status:this.status,errors:this.errors,did:"number"==typeof this.did||"string"==t
|
|
|
43
43
|
return this.getStackTop().scope},e.prototype.getStack=function(){return this._stack},e.prototype.getStackTop=function(){return this._stack[this._stack.length-1]},e.prototype.captureException=function(e,t){var n=this._lastEventId=yt(),r=t;if(!t){var o=void 0;try{throw new Error("Sentry syntheticException")}catch(e){o=e}r={originalException:e,syntheticException:o}}return this._invokeClient("captureException",e,ie(ie({},r),{event_id:n})),n},e.prototype.captureMessage=function(e,t,n){var r=this._lastEventId=yt(),o=n;if(!n){var i=void 0;try{throw new Error(e)}catch(e){i=e}o={originalException:e,syntheticException:i}}return this._invokeClient("captureMessage",e,t,ie(ie({},o),{event_id:r})),r},e.prototype.captureEvent=function(e,t){var n=yt();return"transaction"!==e.type&&(this._lastEventId=n),this._invokeClient("captureEvent",e,ie(ie({},t),{event_id:n})),n},e.prototype.lastEventId=function(){return this._lastEventId},e.prototype.addBreadcrumb=function(e,t){var n=this.getStackTop(),r=n.scope,o=n.client;if(r&&o){
|
|
44
44
|
var i=o.getOptions&&o.getOptions()||{},a=i.beforeBreadcrumb,s=void 0===a?null:a,l=i.maxBreadcrumbs,c=void 0===l?100:l;if(!(c<=0)){var u=Ot(),h=ie({timestamp:u},e),d=s?Pe((function(){return s(h,t)})):h;null!==d&&r.addBreadcrumb(d,c)}}},e.prototype.setUser=function(e){var t=this.getScope();t&&t.setUser(e)},e.prototype.setTags=function(e){var t=this.getScope();t&&t.setTags(e)},e.prototype.setExtras=function(e){var t=this.getScope();t&&t.setExtras(e)},e.prototype.setTag=function(e,t){var n=this.getScope();n&&n.setTag(e,t)},e.prototype.setExtra=function(e,t){var n=this.getScope();n&&n.setExtra(e,t)},e.prototype.setContext=function(e,t){var n=this.getScope();n&&n.setContext(e,t)},e.prototype.configureScope=function(e){var t=this.getStackTop(),n=t.scope,r=t.client;n&&r&&e(n)},e.prototype.run=function(e){var t=Ht(this);try{e(this)}finally{Ht(t)}},e.prototype.getIntegration=function(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){
|
|
45
45
|
return Be.warn("Cannot retrieve integration "+e.id+" from the current Hub"),null}},e.prototype.startSpan=function(e){return this._callExtensionMethod("startSpan",e)},e.prototype.startTransaction=function(e,t){return this._callExtensionMethod("startTransaction",e,t)},e.prototype.traceHeaders=function(){return this._callExtensionMethod("traceHeaders")},e.prototype.captureSession=function(e){if(void 0===e&&(e=!1),e)return this.endSession();this._sendSessionUpdate()},e.prototype.endSession=function(){var e=this.getStackTop(),t=e&&e.scope,n=t&&t.getSession();n&&n.close(),this._sendSessionUpdate(),t&&t.setSession()},e.prototype.startSession=function(e){var t=this.getStackTop(),n=t.scope,r=t.client,o=r&&r.getOptions()||{},i=o.release,a=o.environment,s=(pe().navigator||{}).userAgent,l=new Bt(ie(ie(ie({release:i,environment:a},n&&{user:n.getUser()}),s&&{userAgent:s}),e));if(n){var c=n.getSession&&n.getSession();c&&"ok"===c.status&&c.update({status:"exited"}),this.endSession(),n.setSession(l)}return l},
|
|
46
|
-
e.prototype._sendSessionUpdate=function(){var e=this.getStackTop(),t=e.scope,n=e.client;if(t){var r=t.getSession&&t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}},e.prototype._invokeClient=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop(),i=o.scope,a=o.client;a&&a[e]&&(t=a)[e].apply(t,le(n,[i]))},e.prototype._callExtensionMethod=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=jt(),o=r.__SENTRY__;if(o&&o.extensions&&"function"==typeof o.extensions[e])return o.extensions[e].apply(this,t);Be.warn("Extension method "+e+" couldn't be found, doing nothing.")},e}();function jt(){var e=pe();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function Ht(e){var t=jt(),n=$t(t);return Gt(t,e),n}function
|
|
47
|
-
;if(!
|
|
48
|
-
function Zt(e,t){return""+Xt(e)+e.projectId+"/"+t+"/"}function Jt(e){return t={sentry_key:e.publicKey,sentry_version:"7"},Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&");var t}function Qt(e){return function(e){return Zt(e,"store")}(e)+"?"+Jt(e)}function en(e,t){return t||function(e){return Zt(e,"envelope")}(e)+"?"+Jt(e)}var tn=[];function nn(e){return e.reduce((function(e,t){return e.every((function(e){return t.name!==e.name}))&&e.push(t),e}),[])}function rn(e){var t={};return function(e){var t=e.defaultIntegrations&&le(e.defaultIntegrations)||[],n=e.integrations,r=le(nn(t));Array.isArray(n)?r=le(r.filter((function(e){return n.every((function(t){return t.name!==e.name}))})),nn(n)):"function"==typeof n&&(r=n(r),r=Array.isArray(r)?r:[r]);var o=r.map((function(e){return e.name})),i="Debug";return-1!==o.indexOf(i)&&r.push.apply(r,le(r.splice(o.indexOf(i),1))),r}(e).forEach((function(e){t[e.name]=e,function(e){-1===tn.indexOf(e.name)&&(e.setupOnce(Dt,
|
|
46
|
+
e.prototype._sendSessionUpdate=function(){var e=this.getStackTop(),t=e.scope,n=e.client;if(t){var r=t.getSession&&t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}},e.prototype._invokeClient=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.getStackTop(),i=o.scope,a=o.client;a&&a[e]&&(t=a)[e].apply(t,le(n,[i]))},e.prototype._callExtensionMethod=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=jt(),o=r.__SENTRY__;if(o&&o.extensions&&"function"==typeof o.extensions[e])return o.extensions[e].apply(this,t);Be.warn("Extension method "+e+" couldn't be found, doing nothing.")},e}();function jt(){var e=pe();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function Ht(e){var t=jt(),n=$t(t);return Gt(t,e),n}function qt(){var e=jt();return Ut(e)&&!$t(e).isOlderThan(4)||Gt(e,new Ft),he()?function(e){try{var t=jt().__SENTRY__,n=t&&t.extensions&&t.extensions.domain&&t.extensions.domain.active;if(!n)return $t(e)
|
|
47
|
+
;if(!Ut(n)||$t(n).isOlderThan(4)){var r=$t(e).getStackTop();Gt(n,new Ft(r.client,Rt.clone(r.scope)))}return $t(n)}catch(t){return $t(e)}}(e):$t(e)}function Ut(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function $t(e){return e&&e.__SENTRY__&&e.__SENTRY__.hub||(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=new Ft),e.__SENTRY__.hub}function Gt(e,t){return!!e&&(e.__SENTRY__=e.__SENTRY__||{},e.__SENTRY__.hub=t,!0)}function Vt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=qt();if(r&&r[e])return r[e].apply(r,le(t));throw new Error("No hub defined or "+e+" was not found on the hub, please open a bug report.")}function Wt(e,t){var n;try{throw new Error("Sentry syntheticException")}catch(e){n=e}return Vt("captureException",e,{captureContext:t,originalException:e,syntheticException:n})}function Yt(e,t){Vt("setExtra",e,t)}function Kt(e){Vt("withScope",e)}function Xt(e){var t=e.protocol?e.protocol+":":"",n=e.port?":"+e.port:"";return t+"//"+e.host+n+(e.path?"/"+e.path:"")+"/api/"}
|
|
48
|
+
function Zt(e,t){return""+Xt(e)+e.projectId+"/"+t+"/"}function Jt(e){return t={sentry_key:e.publicKey,sentry_version:"7"},Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&");var t}function Qt(e){return function(e){return Zt(e,"store")}(e)+"?"+Jt(e)}function en(e,t){return t||function(e){return Zt(e,"envelope")}(e)+"?"+Jt(e)}var tn=[];function nn(e){return e.reduce((function(e,t){return e.every((function(e){return t.name!==e.name}))&&e.push(t),e}),[])}function rn(e){var t={};return function(e){var t=e.defaultIntegrations&&le(e.defaultIntegrations)||[],n=e.integrations,r=le(nn(t));Array.isArray(n)?r=le(r.filter((function(e){return n.every((function(t){return t.name!==e.name}))})),nn(n)):"function"==typeof n&&(r=n(r),r=Array.isArray(r)?r:[r]);var o=r.map((function(e){return e.name})),i="Debug";return-1!==o.indexOf(i)&&r.push.apply(r,le(r.splice(o.indexOf(i),1))),r}(e).forEach((function(e){t[e.name]=e,function(e){-1===tn.indexOf(e.name)&&(e.setupOnce(Dt,qt),
|
|
49
49
|
tn.push(e.name),Be.log("Integration installed: "+e.name))}(e)})),$e(t,"initialized",!0),t}var on="Not capturing exception because it's already been captured.",an=function(){function e(e,t){this._integrations={},this._numProcessing=0,this._backend=new e(t),this._options=t,t.dsn&&(this._dsn=Oe(t.dsn))}return e.prototype.captureException=function(e,t,n){var r=this;if(!St(e)){var o=t&&t.event_id;return this._process(this._getBackend().eventFromException(e,t).then((function(e){return r._captureEvent(e,t,n)})).then((function(e){o=e}))),o}Be.log(on)},e.prototype.captureMessage=function(e,t,n,r){var o=this,i=n&&n.event_id,a=be(e)?this._getBackend().eventFromMessage(String(e),t,n):this._getBackend().eventFromException(e,n);return this._process(a.then((function(e){return o._captureEvent(e,n,r)})).then((function(e){i=e}))),i},e.prototype.captureEvent=function(e,t,n){if(!(t&&t.originalException&&St(t.originalException))){var r=t&&t.event_id;return this._process(this._captureEvent(e,t,n).then((function(e){r=e}))),r}
|
|
50
50
|
Be.log(on)},e.prototype.captureSession=function(e){this._isEnabled()?"string"!=typeof e.release?ue()&&Be.warn("Discarded session because of missing or non-string release"):(this._sendSession(e),e.update({init:!1})):ue()&&Be.warn("SDK not enabled, will not capture session.")},e.prototype.getDsn=function(){return this._dsn},e.prototype.getOptions=function(){return this._options},e.prototype.getTransport=function(){return this._getBackend().getTransport()},e.prototype.flush=function(e){var t=this;return this._isClientDoneProcessing(e).then((function(n){return t.getTransport().close(e).then((function(e){return n&&e}))}))},e.prototype.close=function(e){var t=this;return this.flush(e).then((function(e){return t.getOptions().enabled=!1,e}))},e.prototype.setupIntegrations=function(){this._isEnabled()&&!this._integrations.initialized&&(this._integrations=rn(this._options))},e.prototype.getIntegration=function(e){try{return this._integrations[e.id]||null}catch(t){
|
|
51
51
|
return Be.warn("Cannot retrieve integration "+e.id+" from the current Client"),null}},e.prototype._updateSessionFromEvent=function(e,t){var n,r,o=!1,i=!1,a=t.exception&&t.exception.values;if(a){i=!0;try{for(var s=ae(a),l=s.next();!l.done;l=s.next()){var c=l.value.mechanism;if(c&&!1===c.handled){o=!0;break}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}var u="ok"===e.status;(u&&0===e.errors||u&&o)&&(e.update(ie(ie({},o&&{status:"crashed"}),{errors:e.errors||Number(i||o)})),this.captureSession(e))},e.prototype._sendSession=function(e){this._getBackend().sendSession(e)},e.prototype._isClientDoneProcessing=function(e){var t=this;return new Et((function(n){var r=0,o=setInterval((function(){0==t._numProcessing?(clearInterval(o),n(!0)):(r+=1,e&&r>=e&&(clearInterval(o),n(!1)))}),1)}))},e.prototype._getBackend=function(){return this._backend},e.prototype._isEnabled=function(){return!1!==this.getOptions().enabled&&void 0!==this._dsn},
|
|
@@ -55,8 +55,8 @@ if(!this._isEnabled())return At(new Ne("SDK not enabled, will not capture event.
|
|
|
55
55
|
})).then(null,(function(e){if(e instanceof Ne)throw e;throw r.captureException(e,{data:{__sentry__:!0},originalException:e}),new Ne("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: "+e)}))},e.prototype._process=function(e){var t=this;this._numProcessing+=1,e.then((function(e){return t._numProcessing-=1,e}),(function(e){return t._numProcessing-=1,e}))},e}();var sn=function(){function e(){}return e.prototype.sendEvent=function(e){return Ct({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:"skipped"})},e.prototype.close=function(e){return Ct(!0)},e}(),ln=function(){function e(e){this._options=e,this._options.dsn||Be.warn("No DSN provided, backend will not do anything."),this._transport=this._setupTransport()}return e.prototype.eventFromException=function(e,t){throw new Ne("Backend has to implement `eventFromException` method")},e.prototype.eventFromMessage=function(e,t,n){
|
|
56
56
|
throw new Ne("Backend has to implement `eventFromMessage` method")},e.prototype.sendEvent=function(e){this._transport.sendEvent(e).then(null,(function(e){ue()&&Be.error("Error while sending event: "+e)}))},e.prototype.sendSession=function(e){this._transport.sendSession?this._transport.sendSession(e).then(null,(function(e){ue()&&Be.error("Error while sending session: "+e)})):ue()&&Be.warn("Dropping session because custom transport doesn't implement sendSession")},e.prototype.getTransport=function(){return this._transport},e.prototype._setupTransport=function(){return new sn},e}();function cn(e){if(e.metadata&&e.metadata.sdk){var t=e.metadata.sdk;return{name:t.name,version:t.version}}}function un(e,t){var n,r=cn(t),o=e.type||"event",i="transaction"===o||!!t.tunnel,a=(e.sdkProcessingMetadata||{}).transactionSampling||{},s=a.method,l=a.rate;!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=le(e.sdk.integrations||[],t.integrations||[]),
|
|
57
57
|
e.sdk.packages=le(e.sdk.packages||[],t.packages||[]))}(e,t.metadata.sdk),e.tags=e.tags||{},e.extra=e.extra||{},e.sdkProcessingMetadata&&e.sdkProcessingMetadata.baseClientNormalized||(e.tags.skippedNormalization=!0),delete e.sdkProcessingMetadata;try{n=JSON.stringify(e)}catch(t){e.tags.JSONStringifyError=!0,e.extra.JSONStringifyError=t;try{n=JSON.stringify(Je(e))}catch(e){var c=e;n=JSON.stringify({message:"JSON.stringify error after renormalization",extra:{message:c.message,stack:c.stack}})}}var u={body:n,type:o,url:i?en(t.dsn,t.tunnel):Qt(t.dsn)};if(i){var h=JSON.stringify(ie(ie({event_id:e.event_id,sent_at:(new Date).toISOString()},r&&{sdk:r}),!!t.tunnel&&{dsn:Me(t.dsn)}))+"\n"+JSON.stringify({type:o,sample_rates:[{id:s,rate:l}]})+"\n"+u.body;u.body=h}return u}var hn,dn=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){hn=Function.prototype.toString,Function.prototype.toString=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ve(this)||this
|
|
58
|
-
;return hn.apply(n,e)}},e.id="FunctionToString",e}(),pn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],mn=function(){function e(t){void 0===t&&(t={}),this._options=t,this.name=e.id}return e.prototype.setupOnce=function(){Dt((function(t){var n=
|
|
59
|
-
!0):!this._isAllowedUrl(e,t)&&(ue()&&Be.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: "+wt(e)+".\nUrl: "+this._getEventFilterUrl(e)),!0)},e.prototype._isSentryError=function(e,t){if(!t.ignoreInternal)return!1;try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1},e.prototype._isIgnoredError=function(e,t){return!(!t.ignoreErrors||!t.ignoreErrors.length)&&this._getPossibleEventMessages(e).some((function(e){return t.ignoreErrors.some((function(t){return
|
|
58
|
+
;return hn.apply(n,e)}},e.id="FunctionToString",e}(),pn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],mn=function(){function e(t){void 0===t&&(t={}),this._options=t,this.name=e.id}return e.prototype.setupOnce=function(){Dt((function(t){var n=qt();if(!n)return t;var r=n.getIntegration(e);if(r){var o=n.getClient(),i=o?o.getOptions():{},a="function"==typeof r._mergeOptions?r._mergeOptions(i):{};return"function"!=typeof r._shouldDropEvent?t:r._shouldDropEvent(t,a)?null:t}return t}))},e.prototype._shouldDropEvent=function(e,t){return this._isSentryError(e,t)?(ue()&&Be.warn("Event dropped due to being internal Sentry Error.\nEvent: "+wt(e)),!0):this._isIgnoredError(e,t)?(ue()&&Be.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: "+wt(e)),!0):this._isDeniedUrl(e,t)?(ue()&&Be.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: "+wt(e)+".\nUrl: "+this._getEventFilterUrl(e)),
|
|
59
|
+
!0):!this._isAllowedUrl(e,t)&&(ue()&&Be.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: "+wt(e)+".\nUrl: "+this._getEventFilterUrl(e)),!0)},e.prototype._isSentryError=function(e,t){if(!t.ignoreInternal)return!1;try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1},e.prototype._isIgnoredError=function(e,t){return!(!t.ignoreErrors||!t.ignoreErrors.length)&&this._getPossibleEventMessages(e).some((function(e){return t.ignoreErrors.some((function(t){return qe(e,t)}))}))},e.prototype._isDeniedUrl=function(e,t){if(!t.denyUrls||!t.denyUrls.length)return!1;var n=this._getEventFilterUrl(e);return!!n&&t.denyUrls.some((function(e){return qe(n,e)}))},e.prototype._isAllowedUrl=function(e,t){if(!t.allowUrls||!t.allowUrls.length)return!0;var n=this._getEventFilterUrl(e);return!n||t.allowUrls.some((function(e){return qe(n,e)}))},e.prototype._mergeOptions=function(e){return void 0===e&&(e={}),{
|
|
60
60
|
allowUrls:le(this._options.whitelistUrls||[],this._options.allowUrls||[],e.whitelistUrls||[],e.allowUrls||[]),denyUrls:le(this._options.blacklistUrls||[],this._options.denyUrls||[],e.blacklistUrls||[],e.denyUrls||[]),ignoreErrors:le(this._options.ignoreErrors||[],e.ignoreErrors||[],pn),ignoreInternal:void 0===this._options.ignoreInternal||this._options.ignoreInternal}},e.prototype._getPossibleEventMessages=function(e){if(e.message)return[e.message];if(e.exception)try{var t=e.exception.values&&e.exception.values[0]||{},n=t.type,r=void 0===n?"":n,o=t.value,i=void 0===o?"":o;return[""+i,r+": "+i]}catch(t){return ue()&&Be.error("Cannot extract message for event "+wt(e)),[]}return[]},e.prototype._getLastValidUrl=function(e){void 0===e&&(e=[]);for(var t=e.length-1;t>=0;t--){var n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null},e.prototype._getEventFilterUrl=function(e){try{if(e.stacktrace)return this._getLastValidUrl(e.stacktrace.frames);var t;try{
|
|
61
61
|
t=e.exception.values[0].stacktrace.frames}catch(e){}return t?this._getLastValidUrl(t):null}catch(t){return ue()&&Be.error("Cannot extract url for event "+wt(e)),null}},e.id="InboundFilters",e}(),fn=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,gn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,yn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_n=/\((\S*)(?::(\d+))(?::(\d+))\)/,bn=/Minified React error #\d+;/i;function wn(e){var t=null,n=0;e&&("number"==typeof e.framesToPop?n=e.framesToPop:bn.test(e.message)&&(n=1));try{if(t=function(e){if(!e||!e.stacktrace)return null
|
|
62
62
|
;for(var t,n=e.stacktrace,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,i=n.split("\n"),a=[],s=0;s<i.length;s+=2){var l=null;(t=r.exec(i[s]))?l={url:t[2],func:t[3],args:[],line:+t[1],column:null}:(t=o.exec(i[s]))&&(l={url:t[6],func:t[3]||t[4],args:t[5]?t[5].split(","):[],line:+t[1],column:+t[2]}),l&&(!l.func&&l.line&&(l.func="?"),a.push(l))}if(!a.length)return null;return{message:Sn(e),name:e.name,stack:a}}(e),t)return kn(t,n)}catch(e){}try{if(t=function(e){var t,n;if(!e||!e.stack)return null;for(var r,o,i,a=[],s=e.stack.split("\n"),l=0;l<s.length;++l){if(o=fn.exec(s[l])){var c=o[2]&&0===o[2].indexOf("native");o[2]&&0===o[2].indexOf("eval")&&(r=_n.exec(o[2]))&&(o[2]=r[1],o[3]=r[2],o[4]=r[3]);var u=o[2]&&0===o[2].indexOf("address at ")?o[2].substr("address at ".length):o[2],h=o[1]||"?";h=(t=se(xn(h,u),2))[0],i={url:u=t[1],func:h,args:c?[o[2]]:[],line:o[3]?+o[3]:null,column:o[4]?+o[4]:null}
|
|
@@ -69,19 +69,19 @@ reason:n[1],category:r,quantity:e[t]}}))});try{On(t,n)}catch(e){Be.error(e)}}els
|
|
|
69
69
|
;this._rateLimits[f||"all"]=new Date(i+d)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return!0}return!!s&&(this._rateLimits.all=new Date(i+function(e,t){if(!t)return 6e4;var n=parseInt(""+t,10);if(!isNaN(n))return 1e3*n;var r=Date.parse(""+t);return isNaN(r)?6e4:r-e}(i,s)),!0)},e}(),Dn=function(e){function t(t,n){void 0===n&&(n=zn());var r=e.call(this,t)||this;return r._fetch=n,r}return re(t,e),t.prototype._sendRequest=function(e,t){var n=this;if(this._isRateLimited(e.type))return this.recordLostEvent("ratelimit_backoff",e.type),Promise.reject({event:t,type:e.type,reason:"Transport for "+e.type+" requests locked till "+this._disabledUntil(e.type)+" due to too many requests.",status:429});var r={body:e.body,method:"POST",referrerPolicy:rt()?"origin":""};return void 0!==this.options.fetchParameters&&Object.assign(r,this.options.fetchParameters),
|
|
70
70
|
void 0!==this.options.headers&&(r.headers=this.options.headers),this._buffer.add((function(){return new Et((function(t,o){n._fetch(e.url,r).then((function(r){var i={"x-sentry-rate-limits":r.headers.get("X-Sentry-Rate-Limits"),"retry-after":r.headers.get("Retry-After")};n._handleResponse({requestType:e.type,response:r,headers:i,resolve:t,reject:o})})).catch(o)}))})).then(void 0,(function(t){throw t instanceof Ne?n.recordLostEvent("queue_overflow",e.type):n.recordLostEvent("network_error",e.type),t}))},t}(Pn),Bn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return re(t,e),t.prototype._sendRequest=function(e,t){var n=this;return this._isRateLimited(e.type)?(this.recordLostEvent("ratelimit_backoff",e.type),Promise.reject({event:t,type:e.type,reason:"Transport for "+e.type+" requests locked till "+this._disabledUntil(e.type)+" due to too many requests.",status:429})):this._buffer.add((function(){return new Et((function(t,r){var o=new XMLHttpRequest
|
|
71
71
|
;for(var i in o.onreadystatechange=function(){if(4===o.readyState){var i={"x-sentry-rate-limits":o.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":o.getResponseHeader("Retry-After")};n._handleResponse({requestType:e.type,response:o,headers:i,resolve:t,reject:r})}},o.open("POST",e.url),n.options.headers)Object.prototype.hasOwnProperty.call(n.options.headers,i)&&o.setRequestHeader(i,n.options.headers[i]);o.send(e.body)}))})).then(void 0,(function(t){throw t instanceof Ne?n.recordLostEvent("queue_overflow",e.type):n.recordLostEvent("network_error",e.type),t}))},t}(Pn),Fn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return re(t,e),t.prototype.eventFromException=function(e,t){return function(e,t,n){var r=Tn(t,n&&n.syntheticException||void 0,{attachStacktrace:e.attachStacktrace});return kt(r),r.level=oe.Error,n&&n.event_id&&(r.event_id=n.event_id),Ct(r)}(this._options,e,t)},t.prototype.eventFromMessage=function(e,t,n){return void 0===t&&(t=oe.Info),function(e,t,n,r){
|
|
72
|
-
void 0===n&&(n=oe.Info);var o=Nn(t,r&&r.syntheticException||void 0,{attachStacktrace:e.attachStacktrace});return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Ct(o)}(this._options,e,t,n)},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var t=ie(ie({},this._options.transportOptions),{dsn:this._options.dsn,tunnel:this._options.tunnel,sendClientReports:this._options.sendClientReports,_metadata:this._options._metadata});return this._options.transport?new this._options.transport(t):tt()?new Dn(t):new Bn(t)},t}(ln),jn=pe(),Hn=0;function
|
|
72
|
+
void 0===n&&(n=oe.Info);var o=Nn(t,r&&r.syntheticException||void 0,{attachStacktrace:e.attachStacktrace});return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Ct(o)}(this._options,e,t,n)},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var t=ie(ie({},this._options.transportOptions),{dsn:this._options.dsn,tunnel:this._options.tunnel,sendClientReports:this._options.sendClientReports,_metadata:this._options._metadata});return this._options.transport?new this._options.transport(t):tt()?new Dn(t):new Bn(t)},t}(ln),jn=pe(),Hn=0;function qn(){return Hn>0}function Un(){Hn+=1,setTimeout((function(){Hn-=1}))}function $n(e,t,n){if(void 0===t&&(t={}),"function"!=typeof e)return e;try{var r=e.__sentry_wrapped__;if(r)return r;if(Ve(e))return e}catch(t){return e}var o=function(){var r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);var o=r.map((function(e){return $n(e,t)}));return e.apply(this,o)}catch(e){throw Un(),
|
|
73
73
|
Kt((function(n){n.addEventProcessor((function(e){return t.mechanism&&(xt(e,void 0,void 0),kt(e,t.mechanism)),e.extra=ie(ie({},e.extra),{arguments:r}),e})),Wt(e)})),e}};try{for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(o[i]=e[i])}catch(e){}Ge(o,e),$e(e,"__sentry_wrapped__",o);try{Object.getOwnPropertyDescriptor(o,"name").configurable&&Object.defineProperty(o,"name",{get:function(){return e.name}})}catch(e){}return o}function Gn(e){if(void 0===e&&(e={}),jn.document)if(e.eventId)if(e.dsn){var t=jn.document.createElement("script");t.async=!0,t.src=function(e,t){var n=Oe(e),r=Xt(n)+"embed/error-page/",o="dsn="+Me(n);for(var i in t)if("dsn"!==i)if("user"===i){if(!t.user)continue;t.user.name&&(o+="&name="+encodeURIComponent(t.user.name)),t.user.email&&(o+="&email="+encodeURIComponent(t.user.email))}else o+="&"+encodeURIComponent(i)+"="+encodeURIComponent(t[i]);return r+"?"+o}(e.dsn,e),e.onLoad&&(t.onload=e.onLoad);var n=jn.document.head||jn.document.body;n&&n.appendChild(t)
|
|
74
|
-
}else ue()&&Be.error("Missing dsn option in showReportDialog call");else ue()&&Be.error("Missing eventId option in showReportDialog call")}var Vn=function(){function e(t){this.name=e.id,this._installFunc={onerror:Wn,onunhandledrejection:Yn},this._options=ie({onerror:!0,onunhandledrejection:!0},t)}return e.prototype.setupOnce=function(){Error.stackTraceLimit=50;var e=this._options;for(var t in e){var n=this._installFunc[t];n&&e[t]&&(Xn(t),n(),this._installFunc[t]=void 0)}},e.id="GlobalHandlers",e}();function Wn(){ct("error",(function(e){var t=se(Jn(),2),n=t[0],r=t[1];if(n.getIntegration(Vn)){var o=e.msg,i=e.url,a=e.line,s=e.column,l=e.error;if(!(
|
|
75
|
-
isRejection:!1}),i,a,s);Zn(n,l,c,"onerror")}}}))}function Yn(){ct("unhandledrejection",(function(e){var t=se(Jn(),2),n=t[0],r=t[1];if(n.getIntegration(Vn)){var o=e;try{"reason"in e?o=e.reason:"detail"in e&&"reason"in e.detail&&(o=e.detail.reason)}catch(e){}if(
|
|
76
|
-
kt(n,{handled:!1,type:r}),e.captureEvent(n,{originalException:t})}function Jn(){var e=
|
|
77
|
-
this._options.XMLHttpRequest&&"XMLHttpRequest"in e&&
|
|
78
|
-
;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(
|
|
79
|
-
this._options.console&&ct("console",ar),this._options.dom&&ct("dom",function(e){function t(t){var n,r="object"==typeof e?e.serializeAttribute:void 0;"string"==typeof r&&(r=[r]);try{n=t.event.target?Ae(t.event.target,r):Ae(t.event,r)}catch(e){n="<unknown>"}0!==n.length&&
|
|
80
|
-
;
|
|
81
|
-
if(!(n.exception&&n.exception.values&&r&&Ce(r.originalException,Error)))return n;var o=hr(t,r.originalException,e);return n.exception.values=le(o,n.exception.values),n}(r._key,r._limit,t,n):t}))},e.id="LinkedErrors",e}();function hr(e,t,n,r){if(void 0===r&&(r=[]),!Ce(t[n],Error)||r.length+1>=e)return r;var o=Cn(wn(t[n]));return hr(e,t[n],n,le([o],r))}var dr=pe(),pr=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){Dt((function(t){if(
|
|
74
|
+
}else ue()&&Be.error("Missing dsn option in showReportDialog call");else ue()&&Be.error("Missing eventId option in showReportDialog call")}var Vn=function(){function e(t){this.name=e.id,this._installFunc={onerror:Wn,onunhandledrejection:Yn},this._options=ie({onerror:!0,onunhandledrejection:!0},t)}return e.prototype.setupOnce=function(){Error.stackTraceLimit=50;var e=this._options;for(var t in e){var n=this._installFunc[t];n&&e[t]&&(Xn(t),n(),this._installFunc[t]=void 0)}},e.id="GlobalHandlers",e}();function Wn(){ct("error",(function(e){var t=se(Jn(),2),n=t[0],r=t[1];if(n.getIntegration(Vn)){var o=e.msg,i=e.url,a=e.line,s=e.column,l=e.error;if(!(qn()||l&&l.__sentry_own_request__)){var c=void 0===l&&_e(o)?function(e,t,n,r){var o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,i=ve(e)?e.message:e,a="Error",s=i.match(o);s&&(a=s[1],i=s[2]);return Kn({exception:{values:[{type:a,value:i}]}},t,n,r)}(o,i,a,s):Kn(Tn(l||o,void 0,{attachStacktrace:r,
|
|
75
|
+
isRejection:!1}),i,a,s);c.level=oe.Error,Zn(n,l,c,"onerror")}}}))}function Yn(){ct("unhandledrejection",(function(e){var t=se(Jn(),2),n=t[0],r=t[1];if(n.getIntegration(Vn)){var o=e;try{"reason"in e?o=e.reason:"detail"in e&&"reason"in e.detail&&(o=e.detail.reason)}catch(e){}if(qn()||o&&o.__sentry_own_request__)return!0;var i=be(o)?{exception:{values:[{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o)}]}}:Tn(o,void 0,{attachStacktrace:r,isRejection:!0});i.level=oe.Error,Zn(n,o,i,"onunhandledrejection")}}))}function Kn(e,t,n,r){var 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,h=_e(t)&&t.length>0?t:function(){var e=pe();try{return e.document.location.href}catch(e){return""}}();return 0===l.length&&l.push({colno:c,filename:h,function:"?",in_app:!0,lineno:u}),e}function Xn(e){ue()&&Be.log("Global Handler attached: "+e)}
|
|
76
|
+
function Zn(e,t,n,r){kt(n,{handled:!1,type:r}),e.captureEvent(n,{originalException:t})}function Jn(){var e=qt(),t=e.getClient();return[e,t&&t.getOptions().attachStacktrace]}var Qn=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],er=function(){function e(t){this.name=e.id,this._options=ie({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t)}return e.prototype.setupOnce=function(){var e=pe();this._options.setTimeout&&Ue(e,"setTimeout",tr),this._options.setInterval&&Ue(e,"setInterval",tr),this._options.requestAnimationFrame&&Ue(e,"requestAnimationFrame",nr),
|
|
77
|
+
this._options.XMLHttpRequest&&"XMLHttpRequest"in e&&Ue(XMLHttpRequest.prototype,"send",rr);var t=this._options.eventTarget;t&&(Array.isArray(t)?t:Qn).forEach(or)},e.id="TryCatch",e}();function tr(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0];return t[0]=$n(r,{mechanism:{data:{function:Fe(e)},handled:!0,type:"instrument"}}),e.apply(this,t)}}function nr(e){return function(t){return e.call(this,$n(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Fe(e)},handled:!0,type:"instrument"}}))}}function rr(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this,o=["onload","onerror","onprogress","onreadystatechange"];return o.forEach((function(e){e in r&&"function"==typeof r[e]&&Ue(r,e,(function(t){var n={mechanism:{data:{function:e,handler:Fe(t)},handled:!0,type:"instrument"}},r=Ve(t);return r&&(n.mechanism.data.handler=Fe(r)),$n(t,n)}))})),e.apply(this,t)}}function or(e){var t=pe(),n=t[e]&&t[e].prototype
|
|
78
|
+
;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(Ue(n,"addEventListener",(function(t){return function(n,r,o){try{"function"==typeof r.handleEvent&&(r.handleEvent=$n(r.handleEvent.bind(r),{mechanism:{data:{function:"handleEvent",handler:Fe(r),target:e},handled:!0,type:"instrument"}}))}catch(e){}return t.call(this,n,$n(r,{mechanism:{data:{function:"addEventListener",handler:Fe(r),target:e},handled:!0,type:"instrument"}}),o)}})),Ue(n,"removeEventListener",(function(e){return function(t,n,r){var o=n;try{var i=o&&o.__sentry_wrapped__;i&&e.call(this,t,i,r)}catch(e){}return e.call(this,t,o,r)}})))}var ir=function(){function e(t){this.name=e.id,this._options=ie({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t)}return e.prototype.addSentryBreadcrumb=function(e){this._options.sentry&&qt().addBreadcrumb({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:wt(e)},{event:e})},e.prototype.setupOnce=function(){
|
|
79
|
+
this._options.console&&ct("console",ar),this._options.dom&&ct("dom",function(e){function t(t){var n,r="object"==typeof e?e.serializeAttribute:void 0;"string"==typeof r&&(r=[r]);try{n=t.event.target?Ae(t.event.target,r):Ae(t.event,r)}catch(e){n="<unknown>"}0!==n.length&&qt().addBreadcrumb({category:"ui."+t.name,message:n},{event:t.event,name:t.name,global:t.global})}return t}(this._options.dom)),this._options.xhr&&ct("xhr",sr),this._options.fetch&&ct("fetch",lr),this._options.history&&ct("history",cr)},e.id="Breadcrumbs",e}();function ar(e){var t={category:"console",data:{arguments:e.args,logger:"console"},level:Nt(e.level),message:He(e.args," ")};if("assert"===e.level){if(!1!==e.args[0])return;t.message="Assertion failed: "+(He(e.args.slice(1)," ")||"console.assert"),t.data.arguments=e.args.slice(1)}qt().addBreadcrumb(t,{input:e.args,level:e.level})}function sr(e){if(e.endTimestamp){if(e.xhr.__sentry_own_request__)return;var t=e.xhr.__sentry_xhr__||{},n=t.method,r=t.url,o=t.status_code,i=t.body
|
|
80
|
+
;qt().addBreadcrumb({category:"xhr",data:{method:n,url:r,status_code:o},type:"http"},{xhr:e.xhr,input:i})}else;}function lr(e){e.endTimestamp&&(e.fetchData.url.match(/sentry_key/)&&"POST"===e.fetchData.method||(e.error?qt().addBreadcrumb({category:"fetch",data:e.fetchData,level:oe.Error,type:"http"},{data:e.error,input:e.args}):qt().addBreadcrumb({category:"fetch",data:ie(ie({},e.fetchData),{status_code:e.response.status}),type:"http"},{input:e.args,response:e.response})))}function cr(e){var t=pe(),n=e.from,r=e.to,o=_t(t.location.href),i=_t(n),a=_t(r);i.path||(i=o),o.protocol===a.protocol&&o.host===a.host&&(r=a.relative),o.protocol===i.protocol&&o.host===i.host&&(n=i.relative),qt().addBreadcrumb({category:"navigation",data:{from:n,to:r}})}var ur=function(){function e(t){void 0===t&&(t={}),this.name=e.id,this._key=t.key||"cause",this._limit=t.limit||5}return e.prototype.setupOnce=function(){Dt((function(t,n){var r=qt().getIntegration(e);return r?function(e,t,n,r){
|
|
81
|
+
if(!(n.exception&&n.exception.values&&r&&Ce(r.originalException,Error)))return n;var o=hr(t,r.originalException,e);return n.exception.values=le(o,n.exception.values),n}(r._key,r._limit,t,n):t}))},e.id="LinkedErrors",e}();function hr(e,t,n,r){if(void 0===r&&(r=[]),!Ce(t[n],Error)||r.length+1>=e)return r;var o=Cn(wn(t[n]));return hr(e,t[n],n,le([o],r))}var dr=pe(),pr=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){Dt((function(t){if(qt().getIntegration(e)){if(!dr.navigator&&!dr.location&&!dr.document)return t;var n=t.request&&t.request.url||dr.location&&dr.location.href,r=(dr.document||{}).referrer,o=(dr.navigator||{}).userAgent,i=ie(ie(ie({},t.request&&t.request.headers),r&&{Referer:r}),o&&{"User-Agent":o}),a=ie(ie({},n&&{url:n}),{headers:i});return ie(ie({},t),{request:a})}return t}))},e.id="UserAgent",e}(),mr=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(t,n){t((function(t){var r=n().getIntegration(e);if(r){try{if(function(e,t){if(!t)return!1
|
|
82
82
|
;if(function(e,t){var n=e.message,r=t.message;if(!n&&!r)return!1;if(n&&!r||!n&&r)return!1;if(n!==r)return!1;if(!gr(e,t))return!1;if(!fr(e,t))return!1;return!0}(e,t))return!0;if(function(e,t){var n=vr(t),r=vr(e);if(!n||!r)return!1;if(n.type!==r.type||n.value!==r.value)return!1;if(!gr(e,t))return!1;if(!fr(e,t))return!1;return!0}(e,t))return!0;return!1}(t,r._previousEvent))return Be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){return r._previousEvent=t}return r._previousEvent=t}return t}))},e.id="Dedupe",e}();function fr(e,t){var n=yr(e),r=yr(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(n=n,(r=r).length!==n.length)return!1;for(var o=0;o<r.length;o++){var i=r[o],a=n[o];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function gr(e,t){var n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return!(n.join("")!==r.join(""))}catch(e){return!1}}function vr(e){
|
|
83
|
-
return e.exception&&e.exception.values&&e.exception.values[0]}function yr(e){var t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}else if(e.stacktrace)return e.stacktrace.frames}var _r=function(e){function t(t){void 0===t&&(t={});return t._metadata=t._metadata||{},t._metadata.sdk=t._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:"6.17.
|
|
84
|
-
;function wr(e){if(void 0===e&&(e={}),void 0===e.defaultIntegrations&&(e.defaultIntegrations=br),void 0===e.release){var t=pe();t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id&&(e.release=t.SENTRY_RELEASE.id)}void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0),function(e,t){!0===t.debug&&Be.enable();var n=
|
|
83
|
+
return e.exception&&e.exception.values&&e.exception.values[0]}function yr(e){var t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}else if(e.stacktrace)return e.stacktrace.frames}var _r=function(e){function t(t){void 0===t&&(t={});return t._metadata=t._metadata||{},t._metadata.sdk=t._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:"6.17.4"}],version:"6.17.4"},e.call(this,Fn,t)||this}return re(t,e),t.prototype.showReportDialog=function(e){void 0===e&&(e={}),pe().document&&(this._isEnabled()?Gn(ie(ie({},e),{dsn:e.dsn||this.getDsn()})):Be.error("Trying to call showReportDialog with Sentry Client disabled"))},t.prototype._prepareEvent=function(t,n,r){return t.platform=t.platform||"javascript",e.prototype._prepareEvent.call(this,t,n,r)},t.prototype._sendEvent=function(t){var n=this.getIntegration(ir);n&&n.addSentryBreadcrumb(t),e.prototype._sendEvent.call(this,t)},t}(an),br=[new mn,new dn,new er,new ir,new Vn,new ur,new mr,new pr]
|
|
84
|
+
;function wr(e){if(void 0===e&&(e={}),void 0===e.defaultIntegrations&&(e.defaultIntegrations=br),void 0===e.release){var t=pe();t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id&&(e.release=t.SENTRY_RELEASE.id)}void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0),function(e,t){!0===t.debug&&Be.enable();var n=qt(),r=n.getScope();r&&r.update(t.initialScope);var o=new e(t);n.bindClient(o)}(_r,e),e.autoSessionTracking&&function(){if(void 0===pe().document)return void(ue()&&Be.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));var e=qt();if(!e.captureSession)return;xr(e),ct("history",(function(e){var t=e.from,n=e.to;void 0!==t&&t!==n&&xr(qt())}))}()}function xr(e){e.startSession({ignoreDuration:!0}),e.captureSession()}function kr(e){const t=t=>{const{data:n}=t;if(n&&"hypothesis-error"===(null==n?void 0:n.type)){const{context:t,error:r}=n;e(r instanceof Error?r:function(e){const t=new Error(e.message);return t.stack=e.stack,t
|
|
85
85
|
}(r),t)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}let Sr=0;function Cr(e){!function(e){Vt("setUser",e)}(e)}!function(){function e(e){var t=!0,n=!1,r=null,o={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function i(e){return!!(e&&e!==document&&"HTML"!==e.nodeName&&"BODY"!==e.nodeName&&"classList"in e&&"contains"in e.classList)}function a(e){var t=e.type,n=e.tagName;return!("INPUT"!==n||!o[t]||e.readOnly)||"TEXTAREA"===n&&!e.readOnly||!!e.isContentEditable}function s(e){e.classList.contains("focus-visible")||(e.classList.add("focus-visible"),e.setAttribute("data-focus-visible-added",""))}function l(e){e.hasAttribute("data-focus-visible-added")&&(e.classList.remove("focus-visible"),e.removeAttribute("data-focus-visible-added"))}function c(n){n.metaKey||n.altKey||n.ctrlKey||(i(e.activeElement)&&s(e.activeElement),t=!0)}function u(e){t=!1}function h(e){
|
|
86
86
|
i(e.target)&&(t||a(e.target))&&s(e.target)}function d(e){i(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(r),r=window.setTimeout((function(){n=!1}),100),l(e.target))}function p(e){"hidden"===document.visibilityState&&(n&&(t=!0),m())}function m(){document.addEventListener("mousemove",g),document.addEventListener("mousedown",g),document.addEventListener("mouseup",g),document.addEventListener("pointermove",g),document.addEventListener("pointerdown",g),document.addEventListener("pointerup",g),document.addEventListener("touchmove",g),document.addEventListener("touchstart",g),document.addEventListener("touchend",g)}function f(){document.removeEventListener("mousemove",g),document.removeEventListener("mousedown",g),document.removeEventListener("mouseup",g),document.removeEventListener("pointermove",g),document.removeEventListener("pointerdown",g),document.removeEventListener("pointerup",g),
|
|
87
87
|
document.removeEventListener("touchmove",g),document.removeEventListener("touchstart",g),document.removeEventListener("touchend",g)}function g(e){e.target.nodeName&&"html"===e.target.nodeName.toLowerCase()||(t=!1,f())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",u,!0),document.addEventListener("pointerdown",u,!0),document.addEventListener("touchstart",u,!0),document.addEventListener("visibilitychange",p,!0),m(),e.addEventListener("focus",h,!0),e.addEventListener("blur",d,!0),e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host?e.host.setAttribute("data-js-focus-visible",""):e.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var t;window.applyFocusVisiblePolyfill=e;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(e){
|
|
@@ -93,20 +93,20 @@ if(void 0!==r.__k&&void 0!==r.__e)throw new Error("Invalid type passed to create
|
|
|
93
93
|
void 0!==n.ref&&"function"!=typeof n.ref&&"object"!=typeof n.ref&&!("$$typeof"in n))throw new Error('Component\'s "ref" property should be a function, or an object created by createRef(), but got ['+typeof n.ref+"] instead\n"+Dr(n)+"\n\n"+Or(n));if("string"==typeof n.type)for(var i in n.props)if("o"===i[0]&&"n"===i[1]&&"function"!=typeof n.props[i]&&null!=n.props[i])throw new Error("Component's \""+i+'" property should be a function, but got ['+typeof n.props[i]+"] instead\n"+Dr(n)+"\n\n"+Or(n));if("function"==typeof n.type&&n.type.propTypes){if("Lazy"===n.type.displayName&&l&&!l.lazyPropTypes.has(n.type)){var a="PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ";try{var s=n.type();l.lazyPropTypes.set(n.type,!0),console.warn(a+"Component wrapped in lazy() is "+Er(s))}catch(n){console.warn(a+"We will log the wrapped component's name once it is loaded.")}}var c=n.props;n.type.__f&&delete(c=function(e,t){for(var n in t)e[n]=t[n];return e}({},c)).ref,function(e,t,n,r,o){
|
|
94
94
|
Object.keys(e).forEach((function(n){var i;try{i=e[n](t,n,r,"prop",null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){i=e}!i||i.message in Ar||(Ar[i.message]=!0,console.error("Failed prop type: "+i.message+(o&&"\n"+o()||"")))}))}(n.type.propTypes,c,0,Er(n),(function(){return Or(n)}))}t&&t(n)},n.__h=function(t,n,r){if(!t||!e)throw new Error("Hook can only be invoked from render methods.");s&&s(t,n,r)};var u=function(e,t){return{get:function(){var n="get"+e+t;c&&c.indexOf(n)<0&&(c.push(n),console.warn("getting vnode."+e+" is deprecated, "+t))},set:function(){var n="set"+e+t;c&&c.indexOf(n)<0&&(c.push(n),console.warn("setting vnode."+e+" is not allowed, "+t))}}},h={nodeName:u("nodeName","use vnode.type"),attributes:u("attributes","use vnode.props"),children:u("children","use vnode.props.children")},d=Object.create({},h);n.vnode=function(e){var t=e.props;if(null!==e.type&&null!=t&&("__source"in t||"__self"in t)){var n=e.props={};for(var r in t){var i=t[r]
|
|
95
95
|
;"__source"===r?e.__source=i:"__self"===r?e.__self=i:n[r]=i}}e.__proto__=d,o&&o(e)},n.diffed=function(t){if(t.__k&&t.__k.forEach((function(e){if(e&&void 0===e.type){delete e.__,delete e.__b;var n=Object.keys(e).join(",");throw new Error("Objects are not valid as a child. Encountered an object with the keys {"+n+"}.\n\n"+Or(t))}})),e=!1,r&&r(t),null!=t.__k)for(var n=[],o=0;o<t.__k.length;o++){var i=t.__k[o];if(i&&null!=i.key){var a=i.key;if(-1!==n.indexOf(a)){console.error('Following component has two or more children with the same key attribute: "'+a+'". This may cause glitches and misbehavior in rendering process. Component: \n\n'+Dr(t)+"\n\n"+Or(t));break}n.push(a)}}}}();var Br={exports:{}};!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&e.push(a)}
|
|
96
|
-
}else if("object"===i)if(o.toString===Object.prototype.toString)for(var s in o)t.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Br);var Fr,jr,Hr,
|
|
96
|
+
}else if("object"===i)if(o.toString===Object.prototype.toString)for(var s in o)t.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Br);var Fr,jr,Hr,qr=Br.exports,Ur=0,$r=[],Gr=n.__b,Vr=n.__r,Wr=n.diffed,Yr=n.__c,Kr=n.unmount;function Xr(e,t){n.__h&&n.__h(jr,e,Ur||t),Ur=0;var r=jr.__H||(jr.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Zr(e){return Ur=1,Jr(uo,e)}function Jr(e,t,n){var r=Xr(Fr++,2);return r.t=e,r.__c||(r.__=[n?n(t):uo(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=jr),r.__}function Qr(e,t){var r=Xr(Fr++,3);!n.__s&&co(r.__H,t)&&(r.__=e,r.__H=t,jr.__H.__h.push(r))}function eo(e,t){var r=Xr(Fr++,4);!n.__s&&co(r.__H,t)&&(r.__=e,r.__H=t,jr.__h.push(r))}function to(e){return Ur=5,no((function(){return{current:e}}),[])}function no(e,t){var n=Xr(Fr++,7);return co(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ro(e,t){return Ur=8,
|
|
97
97
|
no((function(){return e}),t)}function oo(e){var t=jr.context[e.__c],n=Xr(Fr++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(jr)),t.props.value):e.__}function io(){for(var e;e=$r.shift();)if(e.__P)try{e.__H.__h.forEach(so),e.__H.__h.forEach(lo),e.__H.__h=[]}catch(t){e.__H.__h=[],n.__e(t,e.__v)}}n.__b=function(e){jr=null,Gr&&Gr(e)},n.__r=function(e){Vr&&Vr(e),Fr=0;var t=(jr=e.__c).__H;t&&(t.__h.forEach(so),t.__h.forEach(lo),t.__h=[])},n.diffed=function(e){Wr&&Wr(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==$r.push(t)&&Hr===n.requestAnimationFrame||((Hr=n.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),ao&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ao&&(t=requestAnimationFrame(n))})(io)),jr=null},n.__c=function(e,t){t.some((function(e){try{e.__h.forEach(so),e.__h=e.__h.filter((function(e){return!e.__||lo(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n.__e(r,e.__v)}})),Yr&&Yr(e,t)},n.unmount=function(e){Kr&&Kr(e);var t,r=e.__c
|
|
98
98
|
;r&&r.__H&&(r.__H.__.forEach((function(e){try{so(e)}catch(e){t=e}})),t&&n.__e(t,r.__v))};var ao="function"==typeof requestAnimationFrame;function so(e){var t=jr,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),jr=t}function lo(e){var t=jr;e.__c=e.__(),jr=t}function co(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function uo(e,t){return"function"==typeof t?t(e):t}var ho=0;function po(e,t,r,o,i){var a,s,l={};for(s in t)"ref"==s?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--ho,__source:o,__self:i};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return n.vnode&&n.vnode(c),c}const mo=new Map;function fo({name:e,className:t="",inline:n=!1,title:r=""}){const o=mo.get(e);if(!o)throw new Error(`Icon "${e.toString()}" is not registered`);const i=to();eo((()=>{const e=i.current.querySelector("svg");e&&e.setAttribute("class",t)}),[t,o]);const a={}
|
|
99
|
-
;return r&&(a.title=r),po("span",{className:
|
|
99
|
+
;return r&&(a.title=r),po("span",{className:qr("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":n}),dangerouslySetInnerHTML:{__html:o},ref:i,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function go(e,t){const n="string"==typeof e?Symbol(e):e;return mo.set(n,t),n}var vo="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js";function yo({buttonRef:e,classes:t,className:n,icon:r,iconPosition:o="left",size:i="medium",variant:a="normal",expanded:s,pressed:l,type:c="button",...u}){var h;const d=null!==(h=null==u?void 0:u.role)&&void 0!==h?h:"button",p={"aria-label":u.title};return"tab"===d?p["aria-selected"]=l:(p["aria-pressed"]=l,p["aria-expanded"]=s),po("button",{ref:e,className:qr(n,`${n}--${i}`,`${n}--${a}`,{[`${n}--icon-${o}`]:r},t),type:c,...p,...u},void 0,!1,{fileName:vo,lineNumber:82,columnNumber:5})}function _o({className:e="Hyp-IconButton",...t}){const{icon:n}=t;return po(yo,{className:e,...t,
|
|
100
100
|
children:po(fo,{name:n},void 0,!1,{fileName:vo,lineNumber:109,columnNumber:7})},void 0,!1,{fileName:vo,lineNumber:108,columnNumber:5})}function bo({children:e,className:t="Hyp-LabeledButton",...n}){const{icon:r,iconPosition:o="left"}=n;return po(yo,{className:t,...n,children:[r&&"left"===o&&po(fo,{name:r},void 0,!1,{fileName:vo,lineNumber:127,columnNumber:43}),e,r&&"right"===o&&po(fo,{name:r},void 0,!1,{fileName:vo,lineNumber:129,columnNumber:44})]},void 0,!0,{fileName:vo,lineNumber:126,columnNumber:5})}function wo(e){return po(yo,{className:"Hyp-LinkButton",...e},void 0,!1,{fileName:vo,lineNumber:140,columnNumber:10})}
|
|
101
|
-
go("checkbox",' <svg\n width="32"\n height="32"\n viewBox="-4 -4 39 39"\n aria-hidden="true"\n focusable="false"\n >\n <rect\n class="hyp-svg-checkbox--background"\n width="35"\n height="35"\n x="-2"\n y="-2"\n stroke="currentColor"\n fill="none"\n stroke-width="3"\n rx="5"\n ry="5"\n />\n <polyline\n class="hyp-svg-checkbox--checkmark"\n points="4,14 12,23 28,5"\n stroke="transparent"\n stroke-width="5"\n fill="none"\n />\n</svg>');var xo="/home/runner/work/frontend-shared/frontend-shared/src/components/containers.js";function ko({children:e,classes:t="",containerRef:n}){return po("div",{className:
|
|
101
|
+
go("checkbox",' <svg\n width="32"\n height="32"\n viewBox="-4 -4 39 39"\n aria-hidden="true"\n focusable="false"\n >\n <rect\n class="hyp-svg-checkbox--background"\n width="35"\n height="35"\n x="-2"\n y="-2"\n stroke="currentColor"\n fill="none"\n stroke-width="3"\n rx="5"\n ry="5"\n />\n <polyline\n class="hyp-svg-checkbox--checkmark"\n points="4,14 12,23 28,5"\n stroke="transparent"\n stroke-width="5"\n fill="none"\n />\n</svg>');var xo="/home/runner/work/frontend-shared/frontend-shared/src/components/containers.js";function ko({children:e,classes:t="",containerRef:n}){return po("div",{className:qr("Hyp-Frame",t),ref:n,children:e},void 0,!1,{fileName:xo,lineNumber:26,columnNumber:5})}function So({children:e,direction:t="row",classes:n="",containerRef:r}){return po("div",{className:qr(`Hyp-Actions--${t}`,n),ref:r,children:e},void 0,!1,{fileName:xo,lineNumber:72,columnNumber:5})}
|
|
102
102
|
var Co='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l3.536-3.536L8 8 4.464 4.464 8 8zm0 0l-3.536 3.536L8 8l3.536 3.536L8 8z"></path></g></svg>\n',Ao="/home/runner/work/frontend-shared/frontend-shared/src/components/Dialog.js";const Eo=go("cancel",Co);let To=0;function No(e){const[t]=Zr((()=>(++To,`${e}-${To}`)));return t}function Lo({buttons:e,cancelLabel:t="Cancel",children:n,contentClass:r,icon:o,initialFocus:i,onCancel:a,role:s="dialog",title:l,withCancelButton:c=!0,withCloseButton:u=!0}){const h=No("dialog-description"),d=No("dialog-title"),p=to();Qr((()=>{if(null!==i){const e=null==i?void 0:i.current;e&&!e.disabled?e.focus():p.current.focus()}}),[]),eo((()=>{const e=p.current.querySelector("p");e&&(e.id=h,
|
|
103
|
-
p.current.setAttribute("aria-describedby",h))}),[h]);const m=a&&c,f=e||m;return po("div",{"aria-labelledby":d,className:
|
|
104
|
-
fileName:Ao,lineNumber:160,columnNumber:13}),e]},void 0,!0,{fileName:Ao,lineNumber:158,columnNumber:9})]},void 0,!0,{fileName:Ao,lineNumber:125,columnNumber:5})}function Mo({name:e,classes:t="",containerClasses:n="",title:r=""}){const o=mo.get(e);if(!o)throw new Error(`Icon "${e.toString()}" is not registered`);const i=to();eo((()=>{const e=i.current.querySelector("svg");e&&e.setAttribute("class",
|
|
103
|
+
p.current.setAttribute("aria-describedby",h))}),[h]);const m=a&&c,f=e||m;return po("div",{"aria-labelledby":d,className:qr("Hyp-Dialog",{"Hyp-Dialog--closeable":a&&u},r),ref:p,role:s,tabIndex:-1,children:[po("header",{className:"Hyp-Dialog__header",children:[o&&po("div",{className:"Hyp-Dialog__header-icon",children:po(fo,{name:o,title:l,"data-testid":"header-icon"},void 0,!1,{fileName:Ao,lineNumber:139,columnNumber:13})},void 0,!1,{fileName:Ao,lineNumber:138,columnNumber:11}),po("h2",{className:"Hyp-Dialog__title",id:d,children:l},void 0,!1,{fileName:Ao,lineNumber:142,columnNumber:9}),a&&u&&po("div",{className:"Hyp-Dialog__close",children:po(_o,{"data-testid":"close-button",icon:Eo,title:"Close",onClick:a},void 0,!1,{fileName:Ao,lineNumber:147,columnNumber:13})},void 0,!1,{fileName:Ao,lineNumber:146,columnNumber:11})]},void 0,!0,{fileName:Ao,lineNumber:136,columnNumber:7}),n,f&&po("div",{className:"Hyp-Dialog__actions",children:[m&&po(bo,{"data-testid":"cancel-button",onClick:a,children:t},void 0,!1,{
|
|
104
|
+
fileName:Ao,lineNumber:160,columnNumber:13}),e]},void 0,!0,{fileName:Ao,lineNumber:158,columnNumber:9})]},void 0,!0,{fileName:Ao,lineNumber:125,columnNumber:5})}function Mo({name:e,classes:t="",containerClasses:n="",title:r=""}){const o=mo.get(e);if(!o)throw new Error(`Icon "${e.toString()}" is not registered`);const i=to();eo((()=>{const e=i.current.querySelector("svg");e&&e.setAttribute("class",qr("Hyp-Icon",t))}),[t,o]);const a={};return r&&(a.title=r),po("span",{className:n,dangerouslySetInnerHTML:{__html:o},ref:i,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Icon.js",lineNumber:60,columnNumber:5})}function zo({children:e,classes:t="",linkRef:n,...r}){return po("a",{className:qr("Hyp-Link",t),ref:n,rel:"noopener noreferrer",...r,children:e},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Link.js",lineNumber:24,columnNumber:5})}function Oo(e){const t={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",
|
|
105
105
|
Spacebar:" ",Del:"Delete"};return t[e]?t[e]:e}function Io(e,t,n,{useCapture:r=!1}={}){return t.forEach((t=>e.addEventListener(t,n,r))),()=>{t.forEach((t=>e.removeEventListener(t,n,r)))}}function Ro(e,t,n){Qr((()=>{if(!t)return()=>{};const r=Io(document.body,["keydown"],(e=>{"Escape"===Oo(e.key)&&n()})),o=Io(document.body,["focus"],(t=>{e.current&&!e.current.contains(t.target)&&n()}),{useCapture:!0}),i=Io(document.body,["mousedown","click"],(t=>{e.current&&!e.current.contains(t.target)&&n()}),{useCapture:!0});return()=>{r(),i(),o()}}),[e,t,n])}var Po="/home/runner/work/frontend-shared/frontend-shared/src/components/Modal.js";function Do({children:e,onCancel:t,...n}){const r=to();return Ro(r,!0,(()=>{t&&t()})),po(m,{children:[po("div",{className:"Hyp-Modal__overlay"},void 0,!1,{fileName:Po,lineNumber:39,columnNumber:7}),po("div",{className:"Hyp-Modal",ref:r,children:po(Lo,{onCancel:t,...n,children:e},void 0,!1,{fileName:Po,lineNumber:41,columnNumber:9})},void 0,!1,{fileName:Po,lineNumber:40,columnNumber:7})]
|
|
106
|
-
},void 0,!0)}function Bo({message:e,confirmAction:t,onConfirm:n,onCancel:r,...o}){return po(Do,{onCancel:r,buttons:[po(bo,{onClick:n,variant:"primary","data-testid":"confirm-button",children:t},"ok",!1,{fileName:Po,lineNumber:76,columnNumber:9})],...o,children:po("p",{children:e},void 0,!1,{fileName:Po,lineNumber:87,columnNumber:7})},void 0,!1,{fileName:Po,lineNumber:73,columnNumber:5})}var Fo="/home/runner/work/frontend-shared/frontend-shared/src/components/Panel.js";const jo=go("cancel",Co);function Ho({children:e,icon:t,onClose:n,title:r}){const o=!!n;return po("div",{className:
|
|
106
|
+
},void 0,!0)}function Bo({message:e,confirmAction:t,onConfirm:n,onCancel:r,...o}){return po(Do,{onCancel:r,buttons:[po(bo,{onClick:n,variant:"primary","data-testid":"confirm-button",children:t},"ok",!1,{fileName:Po,lineNumber:76,columnNumber:9})],...o,children:po("p",{children:e},void 0,!1,{fileName:Po,lineNumber:87,columnNumber:7})},void 0,!1,{fileName:Po,lineNumber:73,columnNumber:5})}var Fo="/home/runner/work/frontend-shared/frontend-shared/src/components/Panel.js";const jo=go("cancel",Co);function Ho({children:e,icon:t,onClose:n,title:r}){const o=!!n;return po("div",{className:qr("Hyp-Panel",{"Hyp-Panel--closeable":o}),children:[po("header",{className:"Hyp-Panel__header",children:[t&&po("div",{className:"Hyp-Panel__header-icon",children:po(fo,{name:t,title:r},void 0,!1,{fileName:Fo,lineNumber:37,columnNumber:13})},void 0,!1,{fileName:Fo,lineNumber:36,columnNumber:11}),po("h2",{className:"Hyp-Panel__title",children:r},void 0,!1,{fileName:Fo,lineNumber:40,columnNumber:9}),o&&po("div",{
|
|
107
107
|
className:"Hyp-Panel__close",children:po(_o,{icon:jo,title:"Close",onClick:n},void 0,!1,{fileName:Fo,lineNumber:43,columnNumber:13})},void 0,!1,{fileName:Fo,lineNumber:42,columnNumber:11})]},void 0,!0,{fileName:Fo,lineNumber:34,columnNumber:7}),po("div",{className:"Hyp-Panel__content",children:e},void 0,!1,{fileName:Fo,lineNumber:47,columnNumber:7})]},void 0,!0,{fileName:Fo,lineNumber:29,columnNumber:5})}
|
|
108
|
-
const
|
|
109
|
-
;function
|
|
108
|
+
const qo=go("spinner",'<svg viewBox="0 0 64 64">\n <g stroke-width="6" stroke="currentColor" stroke-linecap="round">\n <line y1="16" y2="28" transform="translate(32,32) rotate(180)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(225)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".15;0;1;.8;.65;.45;.3;.15" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(270)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".3;.15;0;1;.8;.65;.45;.3" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(315)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".45;.3;.15;0;1;.85;.65;.45" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(0)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".65;.45;.3;.15;0;1;.8;.65;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(45)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".8;.65;.45;.3;.15;0;1;.8" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(90)">\n <animate attributeName="stroke-opacity" dur="750ms" values="1;.85;.6;.45;.3;.15;0;1;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(135)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n </g>\n</svg>')
|
|
109
|
+
;function Uo({classes:e="",size:t="medium"}){return po(Mo,{name:qo,containerClasses:qr(`Hyp-Spinner--${t}`,e)},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Spinner.js",lineNumber:32,columnNumber:5})}var $o="/home/runner/work/frontend-shared/frontend-shared/src/components/TextInput.js";function Go({classes:e="",inputRef:t,hasError:n=!1,type:r="text",...o}){return po("input",{className:qr("Hyp-TextInput",{"has-error":n},e),...o,ref:t,type:r},void 0,!1,{fileName:$o,lineNumber:39,columnNumber:5})}function Vo({children:e,classes:t=""}){return po("div",{className:qr("Hyp-TextInputWithButton",t),children:e},void 0,!1,{fileName:$o,lineNumber:67,columnNumber:5})}
|
|
110
110
|
var Wo='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4l4 4-4 4"></path></g></svg>',Yo='<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg width="24px" height="28px" viewBox="0 0 24 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <rect fill="#ffffff" stroke="none" width="17.14407" height="16.046612" x="3.8855932" y="3.9449153" />\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M0,2.00494659 C0,0.897645164 0.897026226,0 2.00494659,0 L21.9950534,0 C23.1023548,0 24,0.897026226 24,2.00494659 L24,21.9950534 C24,23.1023548 23.1029738,24 21.9950534,24 L2.00494659,24 C0.897645164,24 0,23.1029738 0,21.9950534 L0,2.00494659 Z M9,24 L12,28 L15,24 L9,24 Z M7.00811294,4 L4,4 L4,20 L7.00811294,20 L7.00811294,15.0028975 C7.00811294,12.004636 8.16824717,12.0097227 9,12 C10,12.0072451 11.0189302,12.0606714 11.0189302,14.003477 L11.0189302,20 L14.0270431,20 L14.0270431,13.1087862 C14.0270433,10 12,9.00309038 10,9.00309064 C8.01081726,9.00309091 8,9.00309086 7.00811294,11.0019317 L7.00811294,4 Z M19,19.9869002 C20.1045695,19.9869002 21,19.0944022 21,17.9934501 C21,16.892498 20.1045695,16 19,16 C17.8954305,16 17,16.892498 17,17.9934501 C17,19.0944022 17.8954305,19.9869002 19,19.9869002 Z" fill="currentColor"></path>\n </g>\n</svg>\n'
|
|
111
111
|
;const Ko={add:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M8.99302964,2.86682521 L9,3 L9,6.999 L13,7 C13.5522847,7 14,7.44771525 14,8 C14,8.51283584 13.6139598,8.93550716 13.1166211,8.99327227 L13,9 L9,9 L9,13 C9,14.2873563 7.13555291,14.3317479 7.00697036,13.1331748 L7,13 L7,9 L3,9 C2.44771525,9 2,8.55228475 2,8 C2,7.48716416 2.38604019,7.06449284 2.88337887,7.00672773 L3,7 L7,7 L7,3 C7,1.71264368 8.86444709,1.66825208 8.99302964,2.86682521 Z"></path></svg>',
|
|
112
112
|
annotate:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="nonzero" d="M15 0c.27 0 .505.099.703.297A.961.961 0 0116 1v15l-4-3H1a.974.974 0 01-.703-.29A.953.953 0 010 12V1C0 .719.096.482.29.29A.966.966 0 011 0h14zM7 3l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C4.156 5.229 4 6 4 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188C4.729 8.854 5.082 9 5.5 9c.417 0 .77-.146 1.063-.438C6.854 8.271 7 7.918 7 7.5c0-.417-.146-.77-.438-1.063A1.447 1.447 0 005.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L7 4V3zm5 0l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C9.156 5.229 9 6 9 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188c.291.291.645.437 1.062.437.417 0 .77-.146 1.063-.438.291-.291.437-.645.437-1.062 0-.417-.146-.77-.438-1.063A1.447 1.447 0 0010.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L12 4V3z"/>\n</svg>\n',
|
|
@@ -149,7 +149,7 @@ const mi=(e,t)=>e.annotation&&t.annotation?e.annotation.created<t.annotation.cre
|
|
|
149
149
|
return!(!Ai(e)||Li(e))}function Oi(e){if(e){const t=e.target||[];for(let e=0;e<t.length;e++){const n=t[e].selector||[];for(const e of n)if("TextPositionSelector"===e.type)return e.start}}return Number.POSITIVE_INFINITY}function Ii(e){if(0===e.target.length)return null;const t=e.target[0];if(!t.selector)return null;const n=t.selector.find((e=>"TextQuoteSelector"===e.type));return n?n.exact:null}
|
|
150
150
|
const Ri=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u08FE\u0900-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C82\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D02\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26]/g
|
|
151
151
|
;function Pi(e){return"string"!=typeof e?e:function(e){return e.replace(Ri,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class Di{constructor(e,t,n){this.field=e,this.term=t,this.checker=n}matches(e){const t=this.checker;if(t.autofalse&&t.autofalse(e))return!1;let n=t.value(e);return n=Array.isArray(n)?n.map(Pi):Pi(n),t.match(this.term,n)}}class Bi{constructor(e,t){this.operator=e,this.filters=t}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}const Fi={quote:{autofalse:e=>(e.references||[]).length>0,value:e=>Ii(e)||"",match:(e,t)=>t.indexOf(e)>-1},since:{autofalse:e=>"string"!=typeof e.updated,value:e=>new Date(e.updated),match:(e,t)=>(Date.now()-t)/1e3<=e},tag:{autofalse:e=>!Array.isArray(e.tags),value:e=>e.tags,match:(e,t)=>t.includes(e)},text:{autofalse:e=>"string"!=typeof e.text,value:e=>e.text,match:(e,t)=>t.indexOf(e)>-1},uri:{autofalse:e=>"string"!=typeof e.uri,value:e=>e.uri,match:(e,t)=>t.indexOf(e)>-1},user:{
|
|
152
|
-
autofalse:e=>"string"!=typeof e.user,value:e=>e.user+" "+function(e){return e.user_info&&e.user_info.display_name||""}(e),match:(e,t)=>t.indexOf(e)>-1}};function ji(e){return Li(e)?"orphan":Mi(e)?"note":"annotation"}function Hi(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+Hi(n,t)),n?1:0)}function
|
|
152
|
+
autofalse:e=>"string"!=typeof e.user,value:e=>e.user+" "+function(e){return e.user_info&&e.user_info.display_name||""}(e),match:(e,t)=>t.indexOf(e)>-1}};function ji(e){return Li(e)?"orphan":Mi(e)?"note":"annotation"}function Hi(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+Hi(n,t)),n?1:0)}function qi(e){return Hi(e,!1)}function Ui(e){return Hi(e,!0)}function $i(e){const t=e.filter((e=>!!e.annotation)).map((e=>e.annotation));if(t.length)return t;const n=[];if(e.forEach((e=>{e.children&&n.push(...e.children)})),n.length)return $i(n);throw new Error("Thread contains no annotations")}function Gi(e){return $i([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function Vi(e){return $i([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}const Wi={Newest:function(e,t){const n=Gi(e),r=Gi(t);return n>r?-1:n<r?1:0},Oldest:function(e,t){const n=Vi(e),r=Vi(t);return n<r?-1:n>r?1:0},Location:function(e,t){if(!e.annotation||!t.annotation)return function(e,t){
|
|
153
153
|
return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Oi(e.annotation),r=Oi(t.annotation);return n<r?-1:n>r?1:0}};const Yi=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:Wi[t.sortKey]},r=!!t.filterQuery||Object.keys(t.filters).length>0;if(r){const e=function(e,t={}){let n;const r=[],o=[],i=[],a=[],s=[],l=[],c=t.user?[t.user]:[];if(e){n=vi(e);for(const e of n){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"quote":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";i.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":
|
|
154
154
|
c.push(n);break;default:r.push(e)}}}return{any:{terms:r,operator:"and"},quote:{terms:o,operator:"and"},since:{terms:i,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=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{const n=t.terms.map(Pi);let r;if("any"===e){const e=["quote","text","tag","user"];r=n.map((t=>new Bi("or",e.map((e=>new Di(e,t,Fi[e]))))))}else r=n.map((t=>new Di(e,t,Fi[e])));return new Bi(t.operator,r)})),r=new Bi("and",n);return e.filter((e=>e.id&&r.matches(e))).map((e=>e.id))}([t],e).length>0}return!r&&"sidebar"===e.route&&(n.threadFilterFn=e=>{return!!e.annotation&&(n=e.annotation,r=t.selectedTab,!Ei(n)&&ji(n)===r);var n,r}),fi(e.annotations,n)}));function Ki(){const e=ii(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a=no((()=>({annotations:t,route:r,selection:{...o,
|
|
155
155
|
filterQuery:n,filters:i}})),[t,n,r,o,i]);return Yi(a)}var Xi=/^\s+|\s+$/g,Zi=/^[-+]0x[0-9a-f]+$/i,Ji=/^0b[01]+$/i,Qi=/^0o[0-7]+$/i,ea=parseInt,ta="object"==typeof X&&X&&X.Object===Object&&X,na="object"==typeof self&&self&&self.Object===Object&&self,ra=ta||na||Function("return this")(),oa=Object.prototype.toString,ia=Math.max,aa=Math.min,sa=function(){return ra.Date.now()};function la(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ca(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==oa.call(e)}(e))return NaN;if(la(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=la(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Xi,"");var n=Ji.test(e);return n||Qi.test(e)?ea(e.slice(2),n?2:8):Zi.test(e)?NaN:+e}var ua=function(e,t,n){var r,o,i,a,s,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}
|
|
@@ -160,33 +160,33 @@ var Sa=ri((function({annotation:e,toastMessenger:t,group:n,shareUri:r}){const o=
|
|
|
160
160
|
children:[po("div",{className:"hyp-u-layout-row annotation-share-panel__inputs",children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share this annotation",type:"text",value:r,readOnly:!0,inputRef:s}),po(_o,{icon:"copy",title:"Copy share link to clipboard",onClick:()=>{try{ba(r),t.success("Copied share link to clipboard")}catch(e){t.error("Unable to copy link")}},variant:"dark"})]})}),po("div",i?{className:"annotation-share-panel__details",children:p}:{className:"annotation-share-panel__details",children:"This annotation cannot be shared in its original context because it was made on a document that is not available on the web. This link shares the annotation by itself."}),h&&po(xa,{shareURI:r})]}),po(Mo,{name:"pointer",classes:"annotation-share-panel__arrow"})]})]})}),["toastMessenger"]);var Ca=ri((function({annotation:e,annotationsService:t,onReply:n,settings:r,toastMessenger:o}){const i=ii(),a=i.profile(),s=i.getGroup(e.group),l=i.isLoggedIn(),c=t=>function(e,t,n){return-1!==e[t].indexOf(n||"")
|
|
161
161
|
}(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=P(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=P(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return ma(e.uri)?null!==(t=null!==(n=null===(r=e.links)||void 0===r?void 0:r.incontext)&&void 0!==n?n:null===(o=e.links)||void 0===o?void 0:o.html)&&void 0!==t?t:null:null!==(i=null===(a=e.links)||void 0===a?void 0:a.html)&&void 0!==i?i:null}(e);return po("div",{className:"AnnotationActionBar hyp-u-layout-row text-xl font-medium",children:[h&&po(_o,{icon:"edit",title:"Edit",onClick:()=>{i.createDraft(e,{tags:e.tags,text:e.text,isPrivate:_a(e.permissions)})}}),u&&po(_o,{icon:"trash",title:"Delete",onClick:async()=>{if(await Xo({title:"Delete annotation?",message:"Are you sure you want to delete this annotation?",confirmAction:"Delete"}))try{await t.delete(e)}catch(e){o.error(e.message)}}}),po(_o,{icon:"reply",title:"Reply",onClick:()=>{
|
|
162
162
|
l?n():i.openSidebarPanel("loginPrompt")}}),p&&po(Sa,{annotation:e,group:s,shareUri:p}),d&&!e.flagged&&po(_o,{icon:"flag",title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&po(_o,{pressed:!0,icon:"flag--active",title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function Aa({isCollapsed:e,setCollapsed:t,linkStyle:n={}}){return po("div",{className:"Excerpt__inline-controls",children:po("div",{className:"Excerpt__toggle-container",children:po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:()=>t(!e),expanded:!e,title:"Toggle visibility of full excerpt text",style:n,variant:"dark",children:e?"More":"Less"})})})}const Ea=()=>{};var Ta=ri((function({children:e,collapse:t=!1,collapsedHeight:n,inlineControls:r=!0,onCollapsibleChanged:o=Ea,onToggleCollapsed:i=Ea,overflowThreshold:a=0,settings:s={}}){const[l,c]=Zr(!0),u=to(),[h,d]=Zr(0),p=ro((()=>{
|
|
163
|
-
const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);eo((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new ha;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return po("div",{className:"Excerpt",style:g,children:[po("div",{className:"Excerpt__content",ref:u,children:e}),po("div",{role:"presentation",onClick:()=>v(!1),className:
|
|
163
|
+
const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);eo((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new ha;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return po("div",{className:"Excerpt",style:g,children:[po("div",{className:"Excerpt__content",ref:u,children:e}),po("div",{role:"presentation",onClick:()=>v(!1),className:qr({Excerpt__shadow:!0,"Excerpt__shadow--transparent":r,"is-hidden":!f}),title:"Show the full excerpt"}),m&&r&&po(Aa,{isCollapsed:l,setCollapsed:v,
|
|
164
164
|
linkStyle:ti(["selectionFontFamily"],s)})]})}),["settings"]);function Na(e,t=16/9){const n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";const n=document.createElement("div");return n.style.paddingBottom=1/t*100+"%",n.style.position="relative",n.appendChild(e),n}(n,t)}function La(e){const t=/(\d+)([hms]?)/g,n={h:3600,m:60,s:1};let r,o=0;for(;null!==(r=t.exec(e));)r[2]?o+=Number(r[1])*n[r[2]]:o+=+r[1];return o.toString()}function Ma(e,t){const n=function(e){const t=["end","start","t"],n=new URLSearchParams(e.search),r=new URLSearchParams;for(let[e,o]of n)t.includes(e)&&("t"===e?r.append("start",La(o)):r.append(e,o));r.sort();let o=r.toString();return o&&(o=`?${o}`),o}(t);return Na(`https://www.youtube.com/embed/${e}${n}`)}function za(e,t,n,{aspectRatio:r}={}){return o=>{if(o.hostname!==e)return null
|
|
165
165
|
;const i=t.exec(o.pathname);if(!i)return null;const a=i[1];return Na(n(a),r)}}const Oa=[function(e){if("www.youtube.com"!==e.hostname)return null;if(!/\/watch\/?/.test(e.pathname))return null;const t=/[&?]v=([^&#]+)/.exec(e.search);return t?Ma(t[1],e):null},function(e){if("youtu.be"!==e.hostname)return null;const t=/^\/([^/]+)\/?$/.exec(e.pathname);return t?Ma(t[1],e):null},za("vimeo.com",/^\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),za("vimeo.com",/^\/channels\/[^/]+\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),za("flipgrid.com",/^\/s\/([^/]+)$/,(e=>`https://flipgrid.com/s/${e}?embed=true`)),function(e){if("archive.org"!==e.hostname)return null;const t=/^\/(embed|details)\/(.+)/.exec(e.pathname);if(!t)return null;let n=t[2];const r=new URLSearchParams(e.search);let o=r.get("start"),i=r.get("end");if(!o){const e=n.match(/\/start\/([^/]+)/);e&&(o=e[1],n=n.replace(e[0],""))}if(!i){const e=n.match(/\/end\/([^/]+)/);e&&(i=e[1],n=n.replace(e[0],""))}
|
|
166
|
-
const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),Na(a.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?function(e){const t=document.createElement("audio");return t.controls=!0,t.src=e,t}(e.href):null}];function Ia(e){if(e.href!==e.textContent&&decodeURI(e.href)!==e.textContent)return null;const t=function(e){let t,n;for(n=0;n<Oa.length;n++)if(t=Oa[n](e),t)return t;return null}(e);return t&&e.parentElement.replaceChild(t,e),t}var Ra=Object.hasOwnProperty,Pa=Object.setPrototypeOf,Da=Object.isFrozen,Ba=Object.getPrototypeOf,Fa=Object.getOwnPropertyDescriptor,ja=Object.freeze,Ha=Object.seal,
|
|
167
|
-
if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Va,Wa=rs(Array.prototype.forEach),Ya=rs(Array.prototype.pop),Ka=rs(Array.prototype.push),Xa=rs(String.prototype.toLowerCase),Za=rs(String.prototype.match),Ja=rs(String.prototype.replace),Qa=rs(String.prototype.indexOf),es=rs(String.prototype.trim),ts=rs(RegExp.prototype.test),ns=(Va=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ga(Va,t)});function rs(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return $a(e,t,r)}}function os(e,t){Pa&&Pa(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=Xa(r);o!==r&&(Da(t)||(t[n]=o),r=o)}e[r]=!0}return e}function is(e){var t=
|
|
166
|
+
const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),Na(a.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?function(e){const t=document.createElement("audio");return t.controls=!0,t.src=e,t}(e.href):null}];function Ia(e){if(e.href!==e.textContent&&decodeURI(e.href)!==e.textContent)return null;const t=function(e){let t,n;for(n=0;n<Oa.length;n++)if(t=Oa[n](e),t)return t;return null}(e);return t&&e.parentElement.replaceChild(t,e),t}var Ra=Object.hasOwnProperty,Pa=Object.setPrototypeOf,Da=Object.isFrozen,Ba=Object.getPrototypeOf,Fa=Object.getOwnPropertyDescriptor,ja=Object.freeze,Ha=Object.seal,qa=Object.create,Ua="undefined"!=typeof Reflect&&Reflect,$a=Ua.apply,Ga=Ua.construct;$a||($a=function(e,t,n){return e.apply(t,n)}),ja||(ja=function(e){return e}),Ha||(Ha=function(e){return e}),Ga||(Ga=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){
|
|
167
|
+
if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Va,Wa=rs(Array.prototype.forEach),Ya=rs(Array.prototype.pop),Ka=rs(Array.prototype.push),Xa=rs(String.prototype.toLowerCase),Za=rs(String.prototype.match),Ja=rs(String.prototype.replace),Qa=rs(String.prototype.indexOf),es=rs(String.prototype.trim),ts=rs(RegExp.prototype.test),ns=(Va=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ga(Va,t)});function rs(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return $a(e,t,r)}}function os(e,t){Pa&&Pa(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=Xa(r);o!==r&&(Da(t)||(t[n]=o),r=o)}e[r]=!0}return e}function is(e){var t=qa(null),n=void 0;for(n in e)$a(Ra,e,[n])&&(t[n]=e[n]);return t}function as(e,t){for(;null!==e;){var n=Fa(e,t);if(n){if(n.get)return rs(n.get);if("function"==typeof n.value)return rs(n.value)}e=Ba(e)}
|
|
168
168
|
return function(e){return console.warn("fallback value for",e),null}}
|
|
169
169
|
var ss=ja(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ls=ja(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),cs=ja(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),us=ja(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),hs=ja(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),ds=ja(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ps=ja(["#text"]),ms=ja(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),fs=ja(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),gs=ja(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),vs=ja(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ys=Ha(/\{\{[\s\S]*|[\s\S]*\}\}/gm),_s=Ha(/<%[\s\S]*|[\s\S]*%>/gm),bs=Ha(/^data-[\-\w.\u00B7-\uFFFF]/),ws=Ha(/^aria-[\-\w]+$/),xs=Ha(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ks=Ha(/^(?:\w+script|data):/i),Ss=Ha(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){
|
|
170
170
|
return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function As(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var Es=function(){return"undefined"==typeof window?null:window},Ts=function(e,t){if("object"!==(void 0===e?"undefined":Cs(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};var Ns=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Es(),n=function(t){return e(t)};if(n.version="2.3.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n
|
|
171
|
-
;var r=t.document,o=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,g=as(f,"cloneNode"),v=as(f,"nextSibling"),y=as(f,"childNodes"),_=as(f,"parentNode");if("function"==typeof a){var b=o.createElement("template");b.content&&b.content.ownerDocument&&(o=b.content.ownerDocument)}var w=Ts(m,r),x=w?w.createHTML(""):"",k=o,S=k.implementation,C=k.createNodeIterator,A=k.createDocumentFragment,E=k.getElementsByTagName,T=r.importNode,N={};try{N=is(o).documentMode?o.documentMode:{}}catch(e){}var L={};n.isSupported="function"==typeof _&&S&&void 0!==S.createHTMLDocument&&9!==N;var M=ys,z=_s,O=bs,I=ws,R=ks,P=Ss,D=xs,B=null,F=os({},[].concat(As(ss),As(ls),As(cs),As(hs),As(ps))),j=null,H=os({},[].concat(As(ms),As(fs),As(gs),As(vs))),
|
|
172
|
-
writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),
|
|
173
|
-
be&&be===e||(e&&"object"===(void 0===e?"undefined":Cs(e))||(e={}),e=is(e),B="ALLOWED_TAGS"in e?os({},e.ALLOWED_TAGS):F,j="ALLOWED_ATTR"in e?os({},e.ALLOWED_ATTR):H,ce="ADD_URI_SAFE_ATTR"in e?os(is(ue),e.ADD_URI_SAFE_ATTR):ue,se="ADD_DATA_URI_TAGS"in e?os(is(le),e.ADD_DATA_URI_TAGS):le,ie="FORBID_CONTENTS"in e?os({},e.FORBID_CONTENTS):ae,
|
|
174
|
-
e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(
|
|
171
|
+
;var r=t.document,o=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,g=as(f,"cloneNode"),v=as(f,"nextSibling"),y=as(f,"childNodes"),_=as(f,"parentNode");if("function"==typeof a){var b=o.createElement("template");b.content&&b.content.ownerDocument&&(o=b.content.ownerDocument)}var w=Ts(m,r),x=w?w.createHTML(""):"",k=o,S=k.implementation,C=k.createNodeIterator,A=k.createDocumentFragment,E=k.getElementsByTagName,T=r.importNode,N={};try{N=is(o).documentMode?o.documentMode:{}}catch(e){}var L={};n.isSupported="function"==typeof _&&S&&void 0!==S.createHTMLDocument&&9!==N;var M=ys,z=_s,O=bs,I=ws,R=ks,P=Ss,D=xs,B=null,F=os({},[].concat(As(ss),As(ls),As(cs),As(hs),As(ps))),j=null,H=os({},[].concat(As(ms),As(fs),As(gs),As(vs))),q=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{
|
|
172
|
+
writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),U=null,$=null,G=!0,V=!0,W=!1,Y=!1,K=!1,X=!1,Z=!1,J=!1,Q=!1,ee=!1,te=!0,ne=!0,re=!1,oe={},ie=null,ae=os({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),se=null,le=os({},["audio","video","img","source","image","track"]),ce=null,ue=os({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",de="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml",me=pe,fe=!1,ge=void 0,ve=["application/xhtml+xml","text/html"],ye="text/html",_e=void 0,be=null,we=o.createElement("form"),xe=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){
|
|
173
|
+
be&&be===e||(e&&"object"===(void 0===e?"undefined":Cs(e))||(e={}),e=is(e),B="ALLOWED_TAGS"in e?os({},e.ALLOWED_TAGS):F,j="ALLOWED_ATTR"in e?os({},e.ALLOWED_ATTR):H,ce="ADD_URI_SAFE_ATTR"in e?os(is(ue),e.ADD_URI_SAFE_ATTR):ue,se="ADD_DATA_URI_TAGS"in e?os(is(le),e.ADD_DATA_URI_TAGS):le,ie="FORBID_CONTENTS"in e?os({},e.FORBID_CONTENTS):ae,U="FORBID_TAGS"in e?os({},e.FORBID_TAGS):{},$="FORBID_ATTR"in e?os({},e.FORBID_ATTR):{},oe="USE_PROFILES"in e&&e.USE_PROFILES,G=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=e.SAFE_FOR_TEMPLATES||!1,K=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,ee=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,te=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||D,me=e.NAMESPACE||pe,e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),
|
|
174
|
+
e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(q.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ge=ge=-1===ve.indexOf(e.PARSER_MEDIA_TYPE)?ye:e.PARSER_MEDIA_TYPE,_e="application/xhtml+xml"===ge?function(e){return e}:Xa,Y&&(V=!1),Q&&(J=!0),oe&&(B=os({},[].concat(As(ps))),j=[],!0===oe.html&&(os(B,ss),os(j,ms)),!0===oe.svg&&(os(B,ls),os(j,fs),os(j,vs)),!0===oe.svgFilters&&(os(B,cs),os(j,fs),os(j,vs)),!0===oe.mathMl&&(os(B,hs),os(j,gs),os(j,vs))),e.ADD_TAGS&&(B===F&&(B=is(B)),os(B,e.ADD_TAGS)),e.ADD_ATTR&&(j===H&&(j=is(j)),os(j,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&os(ce,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ie===ae&&(ie=is(ie)),os(ie,e.FORBID_CONTENTS)),ne&&(B["#text"]=!0),K&&os(B,["html","head","body"]),B.table&&(os(B,["tbody"]),delete U.tbody),ja&&ja(e),be=e)
|
|
175
175
|
},Se=os({},["mi","mo","mn","ms","mtext"]),Ce=os({},["foreignobject","desc","title","annotation-xml"]),Ae=os({},ls);os(Ae,cs),os(Ae,us);var Ee=os({},hs);os(Ee,ds);var Te=function(e){var t=_(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});var n=Xa(e.tagName),r=Xa(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===pe?"svg"===n:t.namespaceURI===he?"svg"===n&&("annotation-xml"===r||Se[r]):Boolean(Ae[n]);if(e.namespaceURI===he)return t.namespaceURI===pe?"math"===n:t.namespaceURI===de?"math"===n&&Ce[r]:Boolean(Ee[n]);if(e.namespaceURI===pe){if(t.namespaceURI===de&&!Ce[r])return!1;if(t.namespaceURI===he&&!Se[r])return!1;var o=os({},["title","style","font","a","script"]);return!Ee[n]&&(o[n]||!Ae[n])}return!1},Ne=function(e){Ka(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=x}catch(t){e.remove()}}},Le=function(e,t){try{Ka(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ka(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),
|
|
176
176
|
"is"===e&&!j[e])if(J||Q)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,n=void 0;if(Z)e="<remove></remove>"+e;else{var r=Za(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=w?w.createHTML(e):e;if(me===pe)try{t=(new p).parseFromString(i,ge)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(me,"template",null);try{t.documentElement.innerHTML=fe?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),me===pe?E.call(t,K?"html":"body")[0]:K?t.documentElement:a},ze=function(e){return C.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Oe=function(e){
|
|
177
|
-
return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Ie=function(e){return"object"===(void 0===s?"undefined":Cs(s))?e instanceof s:e&&"object"===(void 0===e?"undefined":Cs(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,r){L[e]&&Wa(L[e],(function(e){e.call(n,t,r,be)}))},Pe=function(e){var t=void 0;if(Re("beforeSanitizeElements",e,null),Oe(e))return Ne(e),!0;if(Za(e.nodeName,/[\u0080-\uFFFF]/))return Ne(e),!0;var r=_e(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:r,allowedTags:B}),!Ie(e.firstElementChild)&&(!Ie(e.content)||!Ie(e.content.firstElementChild))&&ts(/<[/\w]/g,e.innerHTML)&&ts(/<[/\w]/g,e.textContent))return Ne(e),!0;if("select"===r&&ts(/<template/i,e.innerHTML))return Ne(e),!0;if(!B[r]||
|
|
178
|
-
var o=_(e)||e.parentNode,i=y(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(g(i[a],!0),v(e))}if(!
|
|
179
|
-
if(!(Be(e)&&(
|
|
177
|
+
return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Ie=function(e){return"object"===(void 0===s?"undefined":Cs(s))?e instanceof s:e&&"object"===(void 0===e?"undefined":Cs(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,r){L[e]&&Wa(L[e],(function(e){e.call(n,t,r,be)}))},Pe=function(e){var t=void 0;if(Re("beforeSanitizeElements",e,null),Oe(e))return Ne(e),!0;if(Za(e.nodeName,/[\u0080-\uFFFF]/))return Ne(e),!0;var r=_e(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:r,allowedTags:B}),!Ie(e.firstElementChild)&&(!Ie(e.content)||!Ie(e.content.firstElementChild))&&ts(/<[/\w]/g,e.innerHTML)&&ts(/<[/\w]/g,e.textContent))return Ne(e),!0;if("select"===r&&ts(/<template/i,e.innerHTML))return Ne(e),!0;if(!B[r]||U[r]){if(ne&&!ie[r]){
|
|
178
|
+
var o=_(e)||e.parentNode,i=y(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(g(i[a],!0),v(e))}if(!U[r]&&Be(r)){if(q.tagNameCheck instanceof RegExp&&ts(q.tagNameCheck,r))return!1;if(q.tagNameCheck instanceof Function&&q.tagNameCheck(r))return!1}return Ne(e),!0}return e instanceof l&&!Te(e)?(Ne(e),!0):"noscript"!==r&&"noembed"!==r||!ts(/<\/no(script|embed)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,t=Ja(t,M," "),t=Ja(t,z," "),e.textContent!==t&&(Ka(n.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Ne(e),!0)},De=function(e,t,n){if(te&&("id"===t||"name"===t)&&(n in o||n in we))return!1;if(V&&!$[t]&&ts(O,t));else if(G&&ts(I,t));else if(!j[t]||$[t]){
|
|
179
|
+
if(!(Be(e)&&(q.tagNameCheck instanceof RegExp&&ts(q.tagNameCheck,e)||q.tagNameCheck instanceof Function&&q.tagNameCheck(e))&&(q.attributeNameCheck instanceof RegExp&&ts(q.attributeNameCheck,t)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(t))||"is"===t&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&ts(q.tagNameCheck,n)||q.tagNameCheck instanceof Function&&q.tagNameCheck(n))))return!1}else if(ce[t]);else if(ts(D,Ja(n,P,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Qa(n,"data:")||!se[e]){if(W&&!ts(R,Ja(n,P,"")));else if(n)return!1}else;return!0},Be=function(e){return e.indexOf("-")>0},Fe=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;Re("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j};for(i=a.length;i--;){var l=t=a[i],c=l.name,u=l.namespaceURI;if(r=es(t.value),o=_e(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,s),
|
|
180
180
|
r=s.attrValue,!s.forceKeepAttr&&(Le(c,e),s.keepAttr))if(ts(/\/>/i,r))Le(c,e);else{Y&&(r=Ja(r,M," "),r=Ja(r,z," "));var h=_e(e.nodeName);if(De(h,o,r))try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),Ya(n.removed)}catch(e){}}}Re("afterSanitizeAttributes",e,null)}},je=function e(t){var n=void 0,r=ze(t);for(Re("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Re("uponSanitizeShadowNode",n,null),Pe(n)||(n.content instanceof i&&e(n.content),Fe(n));Re("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var a=void 0,l=void 0,c=void 0,u=void 0,h=void 0;if((fe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ie(e)){if("function"!=typeof e.toString)throw ns("toString is not a function");if("string"!=typeof(e=e.toString()))throw ns("dirty is not a string, aborting")}if(!n.isSupported){if("object"===Cs(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Ie(e))return t.toStaticHTML(e.outerHTML)}return e}if(X||ke(o),n.removed=[],"string"==typeof e&&(re=!1),re){
|
|
181
|
-
if(e.nodeName){var d=_e(e.nodeName);if(!B[d]||
|
|
181
|
+
if(e.nodeName){var d=_e(e.nodeName);if(!B[d]||U[d])throw ns("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)1===(l=(a=Me("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!J&&!Y&&!K&&-1===e.indexOf("<"))return w&&ee?w.createHTML(e):e;if(!(a=Me(e)))return J?null:ee?x:""}a&&Z&&Ne(a.firstChild);for(var p=ze(re?e:a);c=p.nextNode();)3===c.nodeType&&c===u||Pe(c)||(c.content instanceof i&&je(c.content),Fe(c),u=c);if(u=null,re)return e;if(J){if(Q)for(h=A.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return j.shadowroot&&(h=T.call(r,h,!0)),h}var m=K?a.outerHTML:a.innerHTML;return Y&&(m=Ja(m,M," "),m=Ja(m,z," ")),w&&ee?w.createHTML(m):m},n.setConfig=function(e){ke(e),X=!0},n.clearConfig=function(){be=null,X=!1},n.isValidAttribute=function(e,t,n){be||ke({});var r=_e(e),o=_e(t);return De(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(L[e]=L[e]||[],Ka(L[e],t))},
|
|
182
182
|
n.removeHook=function(e){L[e]&&Ya(L[e])},n.removeHooks=function(e){L[e]&&(L[e]=[])},n.removeAllHooks=function(){L={}},n}(),Ls=/["'&<>]/,Ms=function(e){var t,n=""+e,r=Ls.exec(n);if(!r)return n;var o="",i=0,a=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}a!==i&&(o+=n.substring(a,i)),a=i+1,o+=t}return a!==i?o+n.substring(a,i):o};class zs{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new zs(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class Os{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new Os(t,zs.range(this,e))}}class Is{constructor(e,t){this.position=void 0;var n,r="KaTeX parse error: "+e,o=t&&t.loc;if(o&&o.start<=o.end){var i=o.lexer.input
|
|
183
183
|
;n=o.start;var a=o.end;n===i.length?r+=" at end of input: ":r+=" at position "+(n+1)+": ";var s=i.slice(n,a).replace(/[^]/g,"$&̲");r+=(n>15?"…"+i.slice(n-15,n):i.slice(0,n))+s+(a+15<i.length?i.slice(a,a+15)+"…":i.slice(a))}var l=new Error(r);return l.name="ParseError",l.__proto__=Is.prototype,l.position=n,l}}Is.prototype.__proto__=Error.prototype;var Rs=/([A-Z])/g,Ps={"&":"&",">":">","<":"<",'"':""","'":"'"},Ds=/[&><"']/g;var Bs=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},Fs={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(Ds,(e=>Ps[e]))},hyphenate:function(e){return e.replace(Rs,"-$1").toLowerCase()},getBaseElem:Bs,isCharacterBox:function(e){var t=Bs(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(e);return null!=t?t[1]:"_relative"}
|
|
184
184
|
},js={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",
|
|
185
185
|
cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],
|
|
186
|
-
description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function Hs(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class
|
|
186
|
+
description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function Hs(e){if(e.default)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class qs{constructor(e){for(var t in this.displayMode=void 0,
|
|
187
187
|
this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},js)if(js.hasOwnProperty(t)){var n=js[t];this[t]=void 0!==e[t]?n.processor?n.processor(e[t]):e[t]:Hs(n)}}reportNonstrict(e,t,n){var r=this.strict;if("function"==typeof r&&(r=r(e,t,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new Is("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n);"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]")}}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(e){r="error"}
|
|
188
|
-
return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){e.url&&!e.protocol&&(e.protocol=Fs.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}class
|
|
189
|
-
var $s=[new
|
|
188
|
+
return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){e.url&&!e.protocol&&(e.protocol=Fs.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}class Us{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return $s[Gs[this.id]]}sub(){return $s[Vs[this.id]]}fracNum(){return $s[Ws[this.id]]}fracDen(){return $s[Ys[this.id]]}cramp(){return $s[Ks[this.id]]}text(){return $s[Xs[this.id]]}isTight(){return this.size>=2}}
|
|
189
|
+
var $s=[new Us(0,0,!1),new Us(1,0,!0),new Us(2,1,!1),new Us(3,1,!0),new Us(4,2,!1),new Us(5,2,!0),new Us(6,3,!1),new Us(7,3,!0)],Gs=[4,5,4,5,6,7,6,7],Vs=[5,5,5,5,7,7,7,7],Ws=[2,3,4,5,6,7,6,7],Ys=[3,3,5,5,7,7,7,7],Ks=[1,1,3,3,5,5,7,7],Xs=[0,1,2,3,2,3,2,3],Zs={DISPLAY:$s[0],TEXT:$s[2],SCRIPT:$s[4],SCRIPTSCRIPT:$s[6]},Js=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var Qs=[];function el(e){for(var t=0;t<Qs.length;t+=2)if(e>=Qs[t]&&e<=Qs[t+1])return!0;return!1}Js.forEach((e=>e.blocks.forEach((e=>Qs.push(...e)))));var tl={
|
|
190
190
|
doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
|
|
191
191
|
doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
|
|
192
192
|
leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
|
|
@@ -274,23 +274,23 @@ this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.
|
|
|
274
274
|
;for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e="<img src='"+this.src+" 'alt='"+this.alt+"' ",t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=Fs.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+Fs.escape(t)+'"'),e+="'/>"}}var Sl={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class Cl{constructor(e,t,n,r,o,i,a,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=o||0,this.width=i||0,this.classes=a||[],this.style=s||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<Js.length;t++)for(var n=Js[t],r=0;r<n.blocks.length;r++){var o=n.blocks[r];if(e>=o[0]&&e<=o[1])return n.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),
|
|
275
275
|
/[îïíì]/.test(this.text)&&(this.text=Sl[this.text])}hasClass(e){return Fs.contains(this.classes,e)}toNode(){var e=document.createTextNode(this.text),t=null;for(var n in this.italic>0&&((t=document.createElement("span")).style.marginRight=gl(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=vl(this.classes)),this.style)this.style.hasOwnProperty(n)&&((t=t||document.createElement("span")).style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=Fs.escape(vl(this.classes)),t+='"');var n="";for(var r in this.italic>0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=Fs.hyphenate(r)+":"+this.style[r]+";");n&&(e=!0,t+=' style="'+Fs.escape(n)+'"');var o=Fs.escape(this.text);return e?(t+=">",t+=o,t+="</span>"):o}}class Al{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){
|
|
276
276
|
var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+"='"+this.attributes[t]+"'");e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class El{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",tl[this.pathName]),e}toMarkup(){return this.alternate?"<path d='"+this.alternate+"'/>":"<path d='"+tl[this.pathName]+"'/>"}}class Tl{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){
|
|
277
|
-
var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+"='"+this.attributes[t]+"'");return e+="/>"}}function Nl(e){if(e instanceof Cl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var Ll={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ml={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},zl={math:{},text:{}};function Ol(e,t,n,r,o,i){zl[e][o]={font:t,group:n,replace:r},i&&r&&(zl[e][r]=zl[e][o])}var Il="math",Rl="text",Pl="main",Dl="ams",Bl="accent-token",Fl="bin",jl="close",Hl="mathord",
|
|
277
|
+
var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+"='"+this.attributes[t]+"'");return e+="/>"}}function Nl(e){if(e instanceof Cl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var Ll={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ml={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},zl={math:{},text:{}};function Ol(e,t,n,r,o,i){zl[e][o]={font:t,group:n,replace:r},i&&r&&(zl[e][r]=zl[e][o])}var Il="math",Rl="text",Pl="main",Dl="ams",Bl="accent-token",Fl="bin",jl="close",Hl="mathord",ql="op-token",Ul="open",$l="rel",Gl="textord";Ol(Il,Pl,$l,"≡","\\equiv",!0),Ol(Il,Pl,$l,"≺","\\prec",!0),Ol(Il,Pl,$l,"≻","\\succ",!0),Ol(Il,Pl,$l,"∼","\\sim",!0),Ol(Il,Pl,$l,"⊥","\\perp"),Ol(Il,Pl,$l,"⪯","\\preceq",!0),
|
|
278
278
|
Ol(Il,Pl,$l,"⪰","\\succeq",!0),Ol(Il,Pl,$l,"≃","\\simeq",!0),Ol(Il,Pl,$l,"∣","\\mid",!0),Ol(Il,Pl,$l,"≪","\\ll",!0),Ol(Il,Pl,$l,"≫","\\gg",!0),Ol(Il,Pl,$l,"≍","\\asymp",!0),Ol(Il,Pl,$l,"∥","\\parallel"),Ol(Il,Pl,$l,"⋈","\\bowtie",!0),Ol(Il,Pl,$l,"⌣","\\smile",!0),Ol(Il,Pl,$l,"⊑","\\sqsubseteq",!0),Ol(Il,Pl,$l,"⊒","\\sqsupseteq",!0),Ol(Il,Pl,$l,"≐","\\doteq",!0),Ol(Il,Pl,$l,"⌢","\\frown",!0),Ol(Il,Pl,$l,"∋","\\ni",!0),Ol(Il,Pl,$l,"∝","\\propto",!0),Ol(Il,Pl,$l,"⊢","\\vdash",!0),Ol(Il,Pl,$l,"⊣","\\dashv",!0),Ol(Il,Pl,$l,"∋","\\owns"),Ol(Il,Pl,"punct",".","\\ldotp"),Ol(Il,Pl,"punct","⋅","\\cdotp"),Ol(Il,Pl,Gl,"#","\\#"),Ol(Rl,Pl,Gl,"#","\\#"),Ol(Il,Pl,Gl,"&","\\&"),Ol(Rl,Pl,Gl,"&","\\&"),Ol(Il,Pl,Gl,"ℵ","\\aleph",!0),Ol(Il,Pl,Gl,"∀","\\forall",!0),Ol(Il,Pl,Gl,"ℏ","\\hbar",!0),Ol(Il,Pl,Gl,"∃","\\exists",!0),Ol(Il,Pl,Gl,"∇","\\nabla",!0),Ol(Il,Pl,Gl,"♭","\\flat",!0),Ol(Il,Pl,Gl,"ℓ","\\ell",!0),Ol(Il,Pl,Gl,"♮","\\natural",!0),Ol(Il,Pl,Gl,"♣","\\clubsuit",!0),Ol(Il,Pl,Gl,"℘","\\wp",!0),Ol(Il,Pl,Gl,"♯","\\sharp",!0),
|
|
279
|
-
Ol(Il,Pl,Gl,"♢","\\diamondsuit",!0),Ol(Il,Pl,Gl,"ℜ","\\Re",!0),Ol(Il,Pl,Gl,"♡","\\heartsuit",!0),Ol(Il,Pl,Gl,"ℑ","\\Im",!0),Ol(Il,Pl,Gl,"♠","\\spadesuit",!0),Ol(Il,Pl,Gl,"§","\\S",!0),Ol(Rl,Pl,Gl,"§","\\S"),Ol(Il,Pl,Gl,"¶","\\P",!0),Ol(Rl,Pl,Gl,"¶","\\P"),Ol(Il,Pl,Gl,"†","\\dag"),Ol(Rl,Pl,Gl,"†","\\dag"),Ol(Rl,Pl,Gl,"†","\\textdagger"),Ol(Il,Pl,Gl,"‡","\\ddag"),Ol(Rl,Pl,Gl,"‡","\\ddag"),Ol(Rl,Pl,Gl,"‡","\\textdaggerdbl"),Ol(Il,Pl,jl,"⎱","\\rmoustache",!0),Ol(Il,Pl,
|
|
279
|
+
Ol(Il,Pl,Gl,"♢","\\diamondsuit",!0),Ol(Il,Pl,Gl,"ℜ","\\Re",!0),Ol(Il,Pl,Gl,"♡","\\heartsuit",!0),Ol(Il,Pl,Gl,"ℑ","\\Im",!0),Ol(Il,Pl,Gl,"♠","\\spadesuit",!0),Ol(Il,Pl,Gl,"§","\\S",!0),Ol(Rl,Pl,Gl,"§","\\S"),Ol(Il,Pl,Gl,"¶","\\P",!0),Ol(Rl,Pl,Gl,"¶","\\P"),Ol(Il,Pl,Gl,"†","\\dag"),Ol(Rl,Pl,Gl,"†","\\dag"),Ol(Rl,Pl,Gl,"†","\\textdagger"),Ol(Il,Pl,Gl,"‡","\\ddag"),Ol(Rl,Pl,Gl,"‡","\\ddag"),Ol(Rl,Pl,Gl,"‡","\\textdaggerdbl"),Ol(Il,Pl,jl,"⎱","\\rmoustache",!0),Ol(Il,Pl,Ul,"⎰","\\lmoustache",!0),Ol(Il,Pl,jl,"⟯","\\rgroup",!0),Ol(Il,Pl,Ul,"⟮","\\lgroup",!0),Ol(Il,Pl,Fl,"∓","\\mp",!0),Ol(Il,Pl,Fl,"⊖","\\ominus",!0),Ol(Il,Pl,Fl,"⊎","\\uplus",!0),Ol(Il,Pl,Fl,"⊓","\\sqcap",!0),Ol(Il,Pl,Fl,"∗","\\ast"),Ol(Il,Pl,Fl,"⊔","\\sqcup",!0),Ol(Il,Pl,Fl,"◯","\\bigcirc",!0),Ol(Il,Pl,Fl,"∙","\\bullet"),Ol(Il,Pl,Fl,"‡","\\ddagger"),Ol(Il,Pl,Fl,"≀","\\wr",!0),Ol(Il,Pl,Fl,"⨿","\\amalg"),Ol(Il,Pl,Fl,"&","\\And"),Ol(Il,Pl,$l,"⟵","\\longleftarrow",!0),Ol(Il,Pl,$l,"⇐","\\Leftarrow",!0),Ol(Il,Pl,$l,"⟸","\\Longleftarrow",!0),
|
|
280
280
|
Ol(Il,Pl,$l,"⟶","\\longrightarrow",!0),Ol(Il,Pl,$l,"⇒","\\Rightarrow",!0),Ol(Il,Pl,$l,"⟹","\\Longrightarrow",!0),Ol(Il,Pl,$l,"↔","\\leftrightarrow",!0),Ol(Il,Pl,$l,"⟷","\\longleftrightarrow",!0),Ol(Il,Pl,$l,"⇔","\\Leftrightarrow",!0),Ol(Il,Pl,$l,"⟺","\\Longleftrightarrow",!0),Ol(Il,Pl,$l,"↦","\\mapsto",!0),Ol(Il,Pl,$l,"⟼","\\longmapsto",!0),Ol(Il,Pl,$l,"↗","\\nearrow",!0),Ol(Il,Pl,$l,"↩","\\hookleftarrow",!0),Ol(Il,Pl,$l,"↪","\\hookrightarrow",!0),Ol(Il,Pl,$l,"↘","\\searrow",!0),Ol(Il,Pl,$l,"↼","\\leftharpoonup",!0),Ol(Il,Pl,$l,"⇀","\\rightharpoonup",!0),Ol(Il,Pl,$l,"↙","\\swarrow",!0),Ol(Il,Pl,$l,"↽","\\leftharpoondown",!0),Ol(Il,Pl,$l,"⇁","\\rightharpoondown",!0),Ol(Il,Pl,$l,"↖","\\nwarrow",!0),Ol(Il,Pl,$l,"⇌","\\rightleftharpoons",!0),Ol(Il,Dl,$l,"≮","\\nless",!0),Ol(Il,Dl,$l,"","\\@nleqslant"),Ol(Il,Dl,$l,"","\\@nleqq"),Ol(Il,Dl,$l,"⪇","\\lneq",!0),Ol(Il,Dl,$l,"≨","\\lneqq",!0),Ol(Il,Dl,$l,"","\\@lvertneqq"),Ol(Il,Dl,$l,"⋦","\\lnsim",!0),Ol(Il,Dl,$l,"⪉","\\lnapprox",!0),Ol(Il,Dl,$l,"⊀","\\nprec",!0),
|
|
281
281
|
Ol(Il,Dl,$l,"⋠","\\npreceq",!0),Ol(Il,Dl,$l,"⋨","\\precnsim",!0),Ol(Il,Dl,$l,"⪹","\\precnapprox",!0),Ol(Il,Dl,$l,"≁","\\nsim",!0),Ol(Il,Dl,$l,"","\\@nshortmid"),Ol(Il,Dl,$l,"∤","\\nmid",!0),Ol(Il,Dl,$l,"⊬","\\nvdash",!0),Ol(Il,Dl,$l,"⊭","\\nvDash",!0),Ol(Il,Dl,$l,"⋪","\\ntriangleleft"),Ol(Il,Dl,$l,"⋬","\\ntrianglelefteq",!0),Ol(Il,Dl,$l,"⊊","\\subsetneq",!0),Ol(Il,Dl,$l,"","\\@varsubsetneq"),Ol(Il,Dl,$l,"⫋","\\subsetneqq",!0),Ol(Il,Dl,$l,"","\\@varsubsetneqq"),Ol(Il,Dl,$l,"≯","\\ngtr",!0),Ol(Il,Dl,$l,"","\\@ngeqslant"),Ol(Il,Dl,$l,"","\\@ngeqq"),Ol(Il,Dl,$l,"⪈","\\gneq",!0),Ol(Il,Dl,$l,"≩","\\gneqq",!0),Ol(Il,Dl,$l,"","\\@gvertneqq"),Ol(Il,Dl,$l,"⋧","\\gnsim",!0),Ol(Il,Dl,$l,"⪊","\\gnapprox",!0),Ol(Il,Dl,$l,"⊁","\\nsucc",!0),Ol(Il,Dl,$l,"⋡","\\nsucceq",!0),Ol(Il,Dl,$l,"⋩","\\succnsim",!0),Ol(Il,Dl,$l,"⪺","\\succnapprox",!0),Ol(Il,Dl,$l,"≆","\\ncong",!0),Ol(Il,Dl,$l,"","\\@nshortparallel"),Ol(Il,Dl,$l,"∦","\\nparallel",!0),Ol(Il,Dl,$l,"⊯","\\nVDash",!0),Ol(Il,Dl,$l,"⋫","\\ntriangleright"),
|
|
282
282
|
Ol(Il,Dl,$l,"⋭","\\ntrianglerighteq",!0),Ol(Il,Dl,$l,"","\\@nsupseteqq"),Ol(Il,Dl,$l,"⊋","\\supsetneq",!0),Ol(Il,Dl,$l,"","\\@varsupsetneq"),Ol(Il,Dl,$l,"⫌","\\supsetneqq",!0),Ol(Il,Dl,$l,"","\\@varsupsetneqq"),Ol(Il,Dl,$l,"⊮","\\nVdash",!0),Ol(Il,Dl,$l,"⪵","\\precneqq",!0),Ol(Il,Dl,$l,"⪶","\\succneqq",!0),Ol(Il,Dl,$l,"","\\@nsubseteqq"),Ol(Il,Dl,Fl,"⊴","\\unlhd"),Ol(Il,Dl,Fl,"⊵","\\unrhd"),Ol(Il,Dl,$l,"↚","\\nleftarrow",!0),Ol(Il,Dl,$l,"↛","\\nrightarrow",!0),Ol(Il,Dl,$l,"⇍","\\nLeftarrow",!0),Ol(Il,Dl,$l,"⇏","\\nRightarrow",!0),Ol(Il,Dl,$l,"↮","\\nleftrightarrow",!0),Ol(Il,Dl,$l,"⇎","\\nLeftrightarrow",!0),Ol(Il,Dl,$l,"△","\\vartriangle"),Ol(Il,Dl,Gl,"ℏ","\\hslash"),Ol(Il,Dl,Gl,"▽","\\triangledown"),Ol(Il,Dl,Gl,"◊","\\lozenge"),Ol(Il,Dl,Gl,"Ⓢ","\\circledS"),Ol(Il,Dl,Gl,"®","\\circledR"),Ol(Rl,Dl,Gl,"®","\\circledR"),Ol(Il,Dl,Gl,"∡","\\measuredangle",!0),Ol(Il,Dl,Gl,"∄","\\nexists"),Ol(Il,Dl,Gl,"℧","\\mho"),Ol(Il,Dl,Gl,"Ⅎ","\\Finv",!0),Ol(Il,Dl,Gl,"⅁","\\Game",!0),Ol(Il,Dl,Gl,"‵","\\backprime"),
|
|
283
|
-
Ol(Il,Dl,Gl,"▲","\\blacktriangle"),Ol(Il,Dl,Gl,"▼","\\blacktriangledown"),Ol(Il,Dl,Gl,"■","\\blacksquare"),Ol(Il,Dl,Gl,"⧫","\\blacklozenge"),Ol(Il,Dl,Gl,"★","\\bigstar"),Ol(Il,Dl,Gl,"∢","\\sphericalangle",!0),Ol(Il,Dl,Gl,"∁","\\complement",!0),Ol(Il,Dl,Gl,"ð","\\eth",!0),Ol(Rl,Pl,Gl,"ð","ð"),Ol(Il,Dl,Gl,"╱","\\diagup"),Ol(Il,Dl,Gl,"╲","\\diagdown"),Ol(Il,Dl,Gl,"□","\\square"),Ol(Il,Dl,Gl,"□","\\Box"),Ol(Il,Dl,Gl,"◊","\\Diamond"),Ol(Il,Dl,Gl,"¥","\\yen",!0),Ol(Rl,Dl,Gl,"¥","\\yen",!0),Ol(Il,Dl,Gl,"✓","\\checkmark",!0),Ol(Rl,Dl,Gl,"✓","\\checkmark"),Ol(Il,Dl,Gl,"ℶ","\\beth",!0),Ol(Il,Dl,Gl,"ℸ","\\daleth",!0),Ol(Il,Dl,Gl,"ℷ","\\gimel",!0),Ol(Il,Dl,Gl,"ϝ","\\digamma",!0),Ol(Il,Dl,Gl,"ϰ","\\varkappa"),Ol(Il,Dl,
|
|
283
|
+
Ol(Il,Dl,Gl,"▲","\\blacktriangle"),Ol(Il,Dl,Gl,"▼","\\blacktriangledown"),Ol(Il,Dl,Gl,"■","\\blacksquare"),Ol(Il,Dl,Gl,"⧫","\\blacklozenge"),Ol(Il,Dl,Gl,"★","\\bigstar"),Ol(Il,Dl,Gl,"∢","\\sphericalangle",!0),Ol(Il,Dl,Gl,"∁","\\complement",!0),Ol(Il,Dl,Gl,"ð","\\eth",!0),Ol(Rl,Pl,Gl,"ð","ð"),Ol(Il,Dl,Gl,"╱","\\diagup"),Ol(Il,Dl,Gl,"╲","\\diagdown"),Ol(Il,Dl,Gl,"□","\\square"),Ol(Il,Dl,Gl,"□","\\Box"),Ol(Il,Dl,Gl,"◊","\\Diamond"),Ol(Il,Dl,Gl,"¥","\\yen",!0),Ol(Rl,Dl,Gl,"¥","\\yen",!0),Ol(Il,Dl,Gl,"✓","\\checkmark",!0),Ol(Rl,Dl,Gl,"✓","\\checkmark"),Ol(Il,Dl,Gl,"ℶ","\\beth",!0),Ol(Il,Dl,Gl,"ℸ","\\daleth",!0),Ol(Il,Dl,Gl,"ℷ","\\gimel",!0),Ol(Il,Dl,Gl,"ϝ","\\digamma",!0),Ol(Il,Dl,Gl,"ϰ","\\varkappa"),Ol(Il,Dl,Ul,"┌","\\@ulcorner",!0),Ol(Il,Dl,jl,"┐","\\@urcorner",!0),Ol(Il,Dl,Ul,"└","\\@llcorner",!0),Ol(Il,Dl,jl,"┘","\\@lrcorner",!0),Ol(Il,Dl,$l,"≦","\\leqq",!0),Ol(Il,Dl,$l,"⩽","\\leqslant",!0),Ol(Il,Dl,$l,"⪕","\\eqslantless",!0),Ol(Il,Dl,$l,"≲","\\lesssim",!0),Ol(Il,Dl,$l,"⪅","\\lessapprox",!0),
|
|
284
284
|
Ol(Il,Dl,$l,"≊","\\approxeq",!0),Ol(Il,Dl,Fl,"⋖","\\lessdot"),Ol(Il,Dl,$l,"⋘","\\lll",!0),Ol(Il,Dl,$l,"≶","\\lessgtr",!0),Ol(Il,Dl,$l,"⋚","\\lesseqgtr",!0),Ol(Il,Dl,$l,"⪋","\\lesseqqgtr",!0),Ol(Il,Dl,$l,"≑","\\doteqdot"),Ol(Il,Dl,$l,"≓","\\risingdotseq",!0),Ol(Il,Dl,$l,"≒","\\fallingdotseq",!0),Ol(Il,Dl,$l,"∽","\\backsim",!0),Ol(Il,Dl,$l,"⋍","\\backsimeq",!0),Ol(Il,Dl,$l,"⫅","\\subseteqq",!0),Ol(Il,Dl,$l,"⋐","\\Subset",!0),Ol(Il,Dl,$l,"⊏","\\sqsubset",!0),Ol(Il,Dl,$l,"≼","\\preccurlyeq",!0),Ol(Il,Dl,$l,"⋞","\\curlyeqprec",!0),Ol(Il,Dl,$l,"≾","\\precsim",!0),Ol(Il,Dl,$l,"⪷","\\precapprox",!0),Ol(Il,Dl,$l,"⊲","\\vartriangleleft"),Ol(Il,Dl,$l,"⊴","\\trianglelefteq"),Ol(Il,Dl,$l,"⊨","\\vDash",!0),Ol(Il,Dl,$l,"⊪","\\Vvdash",!0),Ol(Il,Dl,$l,"⌣","\\smallsmile"),Ol(Il,Dl,$l,"⌢","\\smallfrown"),Ol(Il,Dl,$l,"≏","\\bumpeq",!0),Ol(Il,Dl,$l,"≎","\\Bumpeq",!0),Ol(Il,Dl,$l,"≧","\\geqq",!0),Ol(Il,Dl,$l,"⩾","\\geqslant",!0),Ol(Il,Dl,$l,"⪖","\\eqslantgtr",!0),Ol(Il,Dl,$l,"≳","\\gtrsim",!0),Ol(Il,Dl,$l,"⪆","\\gtrapprox",!0),
|
|
285
285
|
Ol(Il,Dl,Fl,"⋗","\\gtrdot"),Ol(Il,Dl,$l,"⋙","\\ggg",!0),Ol(Il,Dl,$l,"≷","\\gtrless",!0),Ol(Il,Dl,$l,"⋛","\\gtreqless",!0),Ol(Il,Dl,$l,"⪌","\\gtreqqless",!0),Ol(Il,Dl,$l,"≖","\\eqcirc",!0),Ol(Il,Dl,$l,"≗","\\circeq",!0),Ol(Il,Dl,$l,"≜","\\triangleq",!0),Ol(Il,Dl,$l,"∼","\\thicksim"),Ol(Il,Dl,$l,"≈","\\thickapprox"),Ol(Il,Dl,$l,"⫆","\\supseteqq",!0),Ol(Il,Dl,$l,"⋑","\\Supset",!0),Ol(Il,Dl,$l,"⊐","\\sqsupset",!0),Ol(Il,Dl,$l,"≽","\\succcurlyeq",!0),Ol(Il,Dl,$l,"⋟","\\curlyeqsucc",!0),Ol(Il,Dl,$l,"≿","\\succsim",!0),Ol(Il,Dl,$l,"⪸","\\succapprox",!0),Ol(Il,Dl,$l,"⊳","\\vartriangleright"),Ol(Il,Dl,$l,"⊵","\\trianglerighteq"),Ol(Il,Dl,$l,"⊩","\\Vdash",!0),Ol(Il,Dl,$l,"∣","\\shortmid"),Ol(Il,Dl,$l,"∥","\\shortparallel"),Ol(Il,Dl,$l,"≬","\\between",!0),Ol(Il,Dl,$l,"⋔","\\pitchfork",!0),Ol(Il,Dl,$l,"∝","\\varpropto"),Ol(Il,Dl,$l,"◀","\\blacktriangleleft"),Ol(Il,Dl,$l,"∴","\\therefore",!0),Ol(Il,Dl,$l,"∍","\\backepsilon"),Ol(Il,Dl,$l,"▶","\\blacktriangleright"),Ol(Il,Dl,$l,"∵","\\because",!0),
|
|
286
286
|
Ol(Il,Dl,$l,"⋘","\\llless"),Ol(Il,Dl,$l,"⋙","\\gggtr"),Ol(Il,Dl,Fl,"⊲","\\lhd"),Ol(Il,Dl,Fl,"⊳","\\rhd"),Ol(Il,Dl,$l,"≂","\\eqsim",!0),Ol(Il,Pl,$l,"⋈","\\Join"),Ol(Il,Dl,$l,"≑","\\Doteq",!0),Ol(Il,Dl,Fl,"∔","\\dotplus",!0),Ol(Il,Dl,Fl,"∖","\\smallsetminus"),Ol(Il,Dl,Fl,"⋒","\\Cap",!0),Ol(Il,Dl,Fl,"⋓","\\Cup",!0),Ol(Il,Dl,Fl,"⩞","\\doublebarwedge",!0),Ol(Il,Dl,Fl,"⊟","\\boxminus",!0),Ol(Il,Dl,Fl,"⊞","\\boxplus",!0),Ol(Il,Dl,Fl,"⋇","\\divideontimes",!0),Ol(Il,Dl,Fl,"⋉","\\ltimes",!0),Ol(Il,Dl,Fl,"⋊","\\rtimes",!0),Ol(Il,Dl,Fl,"⋋","\\leftthreetimes",!0),Ol(Il,Dl,Fl,"⋌","\\rightthreetimes",!0),Ol(Il,Dl,Fl,"⋏","\\curlywedge",!0),Ol(Il,Dl,Fl,"⋎","\\curlyvee",!0),Ol(Il,Dl,Fl,"⊝","\\circleddash",!0),Ol(Il,Dl,Fl,"⊛","\\circledast",!0),Ol(Il,Dl,Fl,"⋅","\\centerdot"),Ol(Il,Dl,Fl,"⊺","\\intercal",!0),Ol(Il,Dl,Fl,"⋒","\\doublecap"),Ol(Il,Dl,Fl,"⋓","\\doublecup"),Ol(Il,Dl,Fl,"⊠","\\boxtimes",!0),Ol(Il,Dl,$l,"⇢","\\dashrightarrow",!0),Ol(Il,Dl,$l,"⇠","\\dashleftarrow",!0),Ol(Il,Dl,$l,"⇇","\\leftleftarrows",!0),
|
|
287
287
|
Ol(Il,Dl,$l,"⇆","\\leftrightarrows",!0),Ol(Il,Dl,$l,"⇚","\\Lleftarrow",!0),Ol(Il,Dl,$l,"↞","\\twoheadleftarrow",!0),Ol(Il,Dl,$l,"↢","\\leftarrowtail",!0),Ol(Il,Dl,$l,"↫","\\looparrowleft",!0),Ol(Il,Dl,$l,"⇋","\\leftrightharpoons",!0),Ol(Il,Dl,$l,"↶","\\curvearrowleft",!0),Ol(Il,Dl,$l,"↺","\\circlearrowleft",!0),Ol(Il,Dl,$l,"↰","\\Lsh",!0),Ol(Il,Dl,$l,"⇈","\\upuparrows",!0),Ol(Il,Dl,$l,"↿","\\upharpoonleft",!0),Ol(Il,Dl,$l,"⇃","\\downharpoonleft",!0),Ol(Il,Pl,$l,"⊶","\\origof",!0),Ol(Il,Pl,$l,"⊷","\\imageof",!0),Ol(Il,Dl,$l,"⊸","\\multimap",!0),Ol(Il,Dl,$l,"↭","\\leftrightsquigarrow",!0),Ol(Il,Dl,$l,"⇉","\\rightrightarrows",!0),Ol(Il,Dl,$l,"⇄","\\rightleftarrows",!0),Ol(Il,Dl,$l,"↠","\\twoheadrightarrow",!0),Ol(Il,Dl,$l,"↣","\\rightarrowtail",!0),Ol(Il,Dl,$l,"↬","\\looparrowright",!0),Ol(Il,Dl,$l,"↷","\\curvearrowright",!0),Ol(Il,Dl,$l,"↻","\\circlearrowright",!0),Ol(Il,Dl,$l,"↱","\\Rsh",!0),Ol(Il,Dl,$l,"⇊","\\downdownarrows",!0),Ol(Il,Dl,$l,"↾","\\upharpoonright",!0),Ol(Il,Dl,$l,"⇂","\\downharpoonright",!0),
|
|
288
288
|
Ol(Il,Dl,$l,"⇝","\\rightsquigarrow",!0),Ol(Il,Dl,$l,"⇝","\\leadsto"),Ol(Il,Dl,$l,"⇛","\\Rrightarrow",!0),Ol(Il,Dl,$l,"↾","\\restriction"),Ol(Il,Pl,Gl,"‘","`"),Ol(Il,Pl,Gl,"$","\\$"),Ol(Rl,Pl,Gl,"$","\\$"),Ol(Rl,Pl,Gl,"$","\\textdollar"),Ol(Il,Pl,Gl,"%","\\%"),Ol(Rl,Pl,Gl,"%","\\%"),Ol(Il,Pl,Gl,"_","\\_"),Ol(Rl,Pl,Gl,"_","\\_"),Ol(Rl,Pl,Gl,"_","\\textunderscore"),Ol(Il,Pl,Gl,"∠","\\angle",!0),Ol(Il,Pl,Gl,"∞","\\infty",!0),Ol(Il,Pl,Gl,"′","\\prime"),Ol(Il,Pl,Gl,"△","\\triangle"),Ol(Il,Pl,Gl,"Γ","\\Gamma",!0),Ol(Il,Pl,Gl,"Δ","\\Delta",!0),Ol(Il,Pl,Gl,"Θ","\\Theta",!0),Ol(Il,Pl,Gl,"Λ","\\Lambda",!0),Ol(Il,Pl,Gl,"Ξ","\\Xi",!0),Ol(Il,Pl,Gl,"Π","\\Pi",!0),Ol(Il,Pl,Gl,"Σ","\\Sigma",!0),Ol(Il,Pl,Gl,"Υ","\\Upsilon",!0),Ol(Il,Pl,Gl,"Φ","\\Phi",!0),Ol(Il,Pl,Gl,"Ψ","\\Psi",!0),Ol(Il,Pl,Gl,"Ω","\\Omega",!0),Ol(Il,Pl,Gl,"A","Α"),Ol(Il,Pl,Gl,"B","Β"),Ol(Il,Pl,Gl,"E","Ε"),Ol(Il,Pl,Gl,"Z","Ζ"),Ol(Il,Pl,Gl,"H","Η"),Ol(Il,Pl,Gl,"I","Ι"),Ol(Il,Pl,Gl,"K","Κ"),Ol(Il,Pl,Gl,"M","Μ"),Ol(Il,Pl,Gl,"N","Ν"),Ol(Il,Pl,Gl,"O","Ο"),
|
|
289
289
|
Ol(Il,Pl,Gl,"P","Ρ"),Ol(Il,Pl,Gl,"T","Τ"),Ol(Il,Pl,Gl,"X","Χ"),Ol(Il,Pl,Gl,"¬","\\neg",!0),Ol(Il,Pl,Gl,"¬","\\lnot"),Ol(Il,Pl,Gl,"⊤","\\top"),Ol(Il,Pl,Gl,"⊥","\\bot"),Ol(Il,Pl,Gl,"∅","\\emptyset"),Ol(Il,Dl,Gl,"∅","\\varnothing"),Ol(Il,Pl,Hl,"α","\\alpha",!0),Ol(Il,Pl,Hl,"β","\\beta",!0),Ol(Il,Pl,Hl,"γ","\\gamma",!0),Ol(Il,Pl,Hl,"δ","\\delta",!0),Ol(Il,Pl,Hl,"ϵ","\\epsilon",!0),Ol(Il,Pl,Hl,"ζ","\\zeta",!0),Ol(Il,Pl,Hl,"η","\\eta",!0),Ol(Il,Pl,Hl,"θ","\\theta",!0),Ol(Il,Pl,Hl,"ι","\\iota",!0),Ol(Il,Pl,Hl,"κ","\\kappa",!0),Ol(Il,Pl,Hl,"λ","\\lambda",!0),Ol(Il,Pl,Hl,"μ","\\mu",!0),Ol(Il,Pl,Hl,"ν","\\nu",!0),Ol(Il,Pl,Hl,"ξ","\\xi",!0),Ol(Il,Pl,Hl,"ο","\\omicron",!0),Ol(Il,Pl,Hl,"π","\\pi",!0),Ol(Il,Pl,Hl,"ρ","\\rho",!0),Ol(Il,Pl,Hl,"σ","\\sigma",!0),Ol(Il,Pl,Hl,"τ","\\tau",!0),Ol(Il,Pl,Hl,"υ","\\upsilon",!0),Ol(Il,Pl,Hl,"ϕ","\\phi",!0),Ol(Il,Pl,Hl,"χ","\\chi",!0),Ol(Il,Pl,Hl,"ψ","\\psi",!0),Ol(Il,Pl,Hl,"ω","\\omega",!0),Ol(Il,Pl,Hl,"ε","\\varepsilon",!0),Ol(Il,Pl,Hl,"ϑ","\\vartheta",!0),
|
|
290
|
-
Ol(Il,Pl,Hl,"ϖ","\\varpi",!0),Ol(Il,Pl,Hl,"ϱ","\\varrho",!0),Ol(Il,Pl,Hl,"ς","\\varsigma",!0),Ol(Il,Pl,Hl,"φ","\\varphi",!0),Ol(Il,Pl,Fl,"∗","*",!0),Ol(Il,Pl,Fl,"+","+"),Ol(Il,Pl,Fl,"−","-",!0),Ol(Il,Pl,Fl,"⋅","\\cdot",!0),Ol(Il,Pl,Fl,"∘","\\circ"),Ol(Il,Pl,Fl,"÷","\\div",!0),Ol(Il,Pl,Fl,"±","\\pm",!0),Ol(Il,Pl,Fl,"×","\\times",!0),Ol(Il,Pl,Fl,"∩","\\cap",!0),Ol(Il,Pl,Fl,"∪","\\cup",!0),Ol(Il,Pl,Fl,"∖","\\setminus"),Ol(Il,Pl,Fl,"∧","\\land"),Ol(Il,Pl,Fl,"∨","\\lor"),Ol(Il,Pl,Fl,"∧","\\wedge",!0),Ol(Il,Pl,Fl,"∨","\\vee",!0),Ol(Il,Pl,Gl,"√","\\surd"),Ol(Il,Pl,
|
|
290
|
+
Ol(Il,Pl,Hl,"ϖ","\\varpi",!0),Ol(Il,Pl,Hl,"ϱ","\\varrho",!0),Ol(Il,Pl,Hl,"ς","\\varsigma",!0),Ol(Il,Pl,Hl,"φ","\\varphi",!0),Ol(Il,Pl,Fl,"∗","*",!0),Ol(Il,Pl,Fl,"+","+"),Ol(Il,Pl,Fl,"−","-",!0),Ol(Il,Pl,Fl,"⋅","\\cdot",!0),Ol(Il,Pl,Fl,"∘","\\circ"),Ol(Il,Pl,Fl,"÷","\\div",!0),Ol(Il,Pl,Fl,"±","\\pm",!0),Ol(Il,Pl,Fl,"×","\\times",!0),Ol(Il,Pl,Fl,"∩","\\cap",!0),Ol(Il,Pl,Fl,"∪","\\cup",!0),Ol(Il,Pl,Fl,"∖","\\setminus"),Ol(Il,Pl,Fl,"∧","\\land"),Ol(Il,Pl,Fl,"∨","\\lor"),Ol(Il,Pl,Fl,"∧","\\wedge",!0),Ol(Il,Pl,Fl,"∨","\\vee",!0),Ol(Il,Pl,Gl,"√","\\surd"),Ol(Il,Pl,Ul,"⟨","\\langle",!0),Ol(Il,Pl,Ul,"∣","\\lvert"),Ol(Il,Pl,Ul,"∥","\\lVert"),Ol(Il,Pl,jl,"?","?"),Ol(Il,Pl,jl,"!","!"),Ol(Il,Pl,jl,"⟩","\\rangle",!0),Ol(Il,Pl,jl,"∣","\\rvert"),Ol(Il,Pl,jl,"∥","\\rVert"),Ol(Il,Pl,$l,"=","="),Ol(Il,Pl,$l,":",":"),Ol(Il,Pl,$l,"≈","\\approx",!0),Ol(Il,Pl,$l,"≅","\\cong",!0),Ol(Il,Pl,$l,"≥","\\ge"),Ol(Il,Pl,$l,"≥","\\geq",!0),Ol(Il,Pl,$l,"←","\\gets"),Ol(Il,Pl,$l,">","\\gt",!0),Ol(Il,Pl,$l,"∈","\\in",!0),
|
|
291
291
|
Ol(Il,Pl,$l,"","\\@not"),Ol(Il,Pl,$l,"⊂","\\subset",!0),Ol(Il,Pl,$l,"⊃","\\supset",!0),Ol(Il,Pl,$l,"⊆","\\subseteq",!0),Ol(Il,Pl,$l,"⊇","\\supseteq",!0),Ol(Il,Dl,$l,"⊈","\\nsubseteq",!0),Ol(Il,Dl,$l,"⊉","\\nsupseteq",!0),Ol(Il,Pl,$l,"⊨","\\models"),Ol(Il,Pl,$l,"←","\\leftarrow",!0),Ol(Il,Pl,$l,"≤","\\le"),Ol(Il,Pl,$l,"≤","\\leq",!0),Ol(Il,Pl,$l,"<","\\lt",!0),Ol(Il,Pl,$l,"→","\\rightarrow",!0),Ol(Il,Pl,$l,"→","\\to"),Ol(Il,Dl,$l,"≱","\\ngeq",!0),Ol(Il,Dl,$l,"≰","\\nleq",!0),Ol(Il,Pl,"spacing"," ","\\ "),Ol(Il,Pl,"spacing"," ","\\space"),Ol(Il,Pl,"spacing"," ","\\nobreakspace"),Ol(Rl,Pl,"spacing"," ","\\ "),Ol(Rl,Pl,"spacing"," "," "),Ol(Rl,Pl,"spacing"," ","\\space"),Ol(Rl,Pl,"spacing"," ","\\nobreakspace"),Ol(Il,Pl,"spacing",null,"\\nobreak"),Ol(Il,Pl,"spacing",null,"\\allowbreak"),Ol(Il,Pl,"punct",",",","),Ol(Il,Pl,"punct",";",";"),Ol(Il,Dl,Fl,"⊼","\\barwedge",!0),Ol(Il,Dl,Fl,"⊻","\\veebar",!0),Ol(Il,Pl,Fl,"⊙","\\odot",!0),Ol(Il,Pl,Fl,"⊕","\\oplus",!0),Ol(Il,Pl,Fl,"⊗","\\otimes",!0),
|
|
292
|
-
Ol(Il,Pl,Gl,"∂","\\partial",!0),Ol(Il,Pl,Fl,"⊘","\\oslash",!0),Ol(Il,Dl,Fl,"⊚","\\circledcirc",!0),Ol(Il,Dl,Fl,"⊡","\\boxdot",!0),Ol(Il,Pl,Fl,"△","\\bigtriangleup"),Ol(Il,Pl,Fl,"▽","\\bigtriangledown"),Ol(Il,Pl,Fl,"†","\\dagger"),Ol(Il,Pl,Fl,"⋄","\\diamond"),Ol(Il,Pl,Fl,"⋆","\\star"),Ol(Il,Pl,Fl,"◃","\\triangleleft"),Ol(Il,Pl,Fl,"▹","\\triangleright"),Ol(Il,Pl,
|
|
293
|
-
Ol(Il,Pl,Gl,"∣","\\vert"),Ol(Rl,Pl,Gl,"|","\\textbar",!0),Ol(Il,Pl,Gl,"∥","\\|"),Ol(Il,Pl,Gl,"∥","\\Vert"),Ol(Rl,Pl,Gl,"∥","\\textbardbl"),Ol(Rl,Pl,Gl,"~","\\textasciitilde"),Ol(Rl,Pl,Gl,"\\","\\textbackslash"),Ol(Rl,Pl,Gl,"^","\\textasciicircum"),Ol(Il,Pl,$l,"↑","\\uparrow",!0),Ol(Il,Pl,$l,"⇑","\\Uparrow",!0),Ol(Il,Pl,$l,"↓","\\downarrow",!0),Ol(Il,Pl,$l,"⇓","\\Downarrow",!0),Ol(Il,Pl,$l,"↕","\\updownarrow",!0),Ol(Il,Pl,$l,"⇕","\\Updownarrow",!0),Ol(Il,Pl,
|
|
292
|
+
Ol(Il,Pl,Gl,"∂","\\partial",!0),Ol(Il,Pl,Fl,"⊘","\\oslash",!0),Ol(Il,Dl,Fl,"⊚","\\circledcirc",!0),Ol(Il,Dl,Fl,"⊡","\\boxdot",!0),Ol(Il,Pl,Fl,"△","\\bigtriangleup"),Ol(Il,Pl,Fl,"▽","\\bigtriangledown"),Ol(Il,Pl,Fl,"†","\\dagger"),Ol(Il,Pl,Fl,"⋄","\\diamond"),Ol(Il,Pl,Fl,"⋆","\\star"),Ol(Il,Pl,Fl,"◃","\\triangleleft"),Ol(Il,Pl,Fl,"▹","\\triangleright"),Ol(Il,Pl,Ul,"{","\\{"),Ol(Rl,Pl,Gl,"{","\\{"),Ol(Rl,Pl,Gl,"{","\\textbraceleft"),Ol(Il,Pl,jl,"}","\\}"),Ol(Rl,Pl,Gl,"}","\\}"),Ol(Rl,Pl,Gl,"}","\\textbraceright"),Ol(Il,Pl,Ul,"{","\\lbrace"),Ol(Il,Pl,jl,"}","\\rbrace"),Ol(Il,Pl,Ul,"[","\\lbrack",!0),Ol(Rl,Pl,Gl,"[","\\lbrack",!0),Ol(Il,Pl,jl,"]","\\rbrack",!0),Ol(Rl,Pl,Gl,"]","\\rbrack",!0),Ol(Il,Pl,Ul,"(","\\lparen",!0),Ol(Il,Pl,jl,")","\\rparen",!0),Ol(Rl,Pl,Gl,"<","\\textless",!0),Ol(Rl,Pl,Gl,">","\\textgreater",!0),Ol(Il,Pl,Ul,"⌊","\\lfloor",!0),Ol(Il,Pl,jl,"⌋","\\rfloor",!0),Ol(Il,Pl,Ul,"⌈","\\lceil",!0),Ol(Il,Pl,jl,"⌉","\\rceil",!0),Ol(Il,Pl,Gl,"\\","\\backslash"),Ol(Il,Pl,Gl,"∣","|"),
|
|
293
|
+
Ol(Il,Pl,Gl,"∣","\\vert"),Ol(Rl,Pl,Gl,"|","\\textbar",!0),Ol(Il,Pl,Gl,"∥","\\|"),Ol(Il,Pl,Gl,"∥","\\Vert"),Ol(Rl,Pl,Gl,"∥","\\textbardbl"),Ol(Rl,Pl,Gl,"~","\\textasciitilde"),Ol(Rl,Pl,Gl,"\\","\\textbackslash"),Ol(Rl,Pl,Gl,"^","\\textasciicircum"),Ol(Il,Pl,$l,"↑","\\uparrow",!0),Ol(Il,Pl,$l,"⇑","\\Uparrow",!0),Ol(Il,Pl,$l,"↓","\\downarrow",!0),Ol(Il,Pl,$l,"⇓","\\Downarrow",!0),Ol(Il,Pl,$l,"↕","\\updownarrow",!0),Ol(Il,Pl,$l,"⇕","\\Updownarrow",!0),Ol(Il,Pl,ql,"∐","\\coprod"),Ol(Il,Pl,ql,"⋁","\\bigvee"),Ol(Il,Pl,ql,"⋀","\\bigwedge"),Ol(Il,Pl,ql,"⨄","\\biguplus"),Ol(Il,Pl,ql,"⋂","\\bigcap"),Ol(Il,Pl,ql,"⋃","\\bigcup"),Ol(Il,Pl,ql,"∫","\\int"),Ol(Il,Pl,ql,"∫","\\intop"),Ol(Il,Pl,ql,"∬","\\iint"),Ol(Il,Pl,ql,"∭","\\iiint"),Ol(Il,Pl,ql,"∏","\\prod"),Ol(Il,Pl,ql,"∑","\\sum"),Ol(Il,Pl,ql,"⨂","\\bigotimes"),Ol(Il,Pl,ql,"⨁","\\bigoplus"),Ol(Il,Pl,ql,"⨀","\\bigodot"),Ol(Il,Pl,ql,"∮","\\oint"),Ol(Il,Pl,ql,"∯","\\oiint"),Ol(Il,Pl,ql,"∰","\\oiiint"),Ol(Il,Pl,ql,"⨆","\\bigsqcup"),Ol(Il,Pl,ql,"∫","\\smallint"),
|
|
294
294
|
Ol(Rl,Pl,"inner","…","\\textellipsis"),Ol(Il,Pl,"inner","…","\\mathellipsis"),Ol(Rl,Pl,"inner","…","\\ldots",!0),Ol(Il,Pl,"inner","…","\\ldots",!0),Ol(Il,Pl,"inner","⋯","\\@cdots",!0),Ol(Il,Pl,"inner","⋱","\\ddots",!0),Ol(Il,Pl,Gl,"⋮","\\varvdots"),Ol(Il,Pl,Bl,"ˊ","\\acute"),Ol(Il,Pl,Bl,"ˋ","\\grave"),Ol(Il,Pl,Bl,"¨","\\ddot"),Ol(Il,Pl,Bl,"~","\\tilde"),Ol(Il,Pl,Bl,"ˉ","\\bar"),Ol(Il,Pl,Bl,"˘","\\breve"),Ol(Il,Pl,Bl,"ˇ","\\check"),Ol(Il,Pl,Bl,"^","\\hat"),Ol(Il,Pl,Bl,"⃗","\\vec"),Ol(Il,Pl,Bl,"˙","\\dot"),Ol(Il,Pl,Bl,"˚","\\mathring"),Ol(Il,Pl,Hl,"","\\@imath"),Ol(Il,Pl,Hl,"","\\@jmath"),Ol(Il,Pl,Gl,"ı","ı"),Ol(Il,Pl,Gl,"ȷ","ȷ"),Ol(Rl,Pl,Gl,"ı","\\i",!0),Ol(Rl,Pl,Gl,"ȷ","\\j",!0),Ol(Rl,Pl,Gl,"ß","\\ss",!0),Ol(Rl,Pl,Gl,"æ","\\ae",!0),Ol(Rl,Pl,Gl,"œ","\\oe",!0),Ol(Rl,Pl,Gl,"ø","\\o",!0),Ol(Rl,Pl,Gl,"Æ","\\AE",!0),Ol(Rl,Pl,Gl,"Œ","\\OE",!0),Ol(Rl,Pl,Gl,"Ø","\\O",!0),Ol(Rl,Pl,Bl,"ˊ","\\'"),Ol(Rl,Pl,Bl,"ˋ","\\`"),Ol(Rl,Pl,Bl,"ˆ","\\^"),Ol(Rl,Pl,Bl,"˜","\\~"),Ol(Rl,Pl,Bl,"ˉ","\\="),Ol(Rl,Pl,Bl,"˘","\\u"),
|
|
295
295
|
Ol(Rl,Pl,Bl,"˙","\\."),Ol(Rl,Pl,Bl,"¸","\\c"),Ol(Rl,Pl,Bl,"˚","\\r"),Ol(Rl,Pl,Bl,"ˇ","\\v"),Ol(Rl,Pl,Bl,"¨",'\\"'),Ol(Rl,Pl,Bl,"˝","\\H"),Ol(Rl,Pl,Bl,"◯","\\textcircled");var Vl={"--":!0,"---":!0,"``":!0,"''":!0};Ol(Rl,Pl,Gl,"–","--",!0),Ol(Rl,Pl,Gl,"–","\\textendash"),Ol(Rl,Pl,Gl,"—","---",!0),Ol(Rl,Pl,Gl,"—","\\textemdash"),Ol(Rl,Pl,Gl,"‘","`",!0),Ol(Rl,Pl,Gl,"‘","\\textquoteleft"),Ol(Rl,Pl,Gl,"’","'",!0),Ol(Rl,Pl,Gl,"’","\\textquoteright"),Ol(Rl,Pl,Gl,"“","``",!0),Ol(Rl,Pl,Gl,"“","\\textquotedblleft"),Ol(Rl,Pl,Gl,"”","''",!0),Ol(Rl,Pl,Gl,"”","\\textquotedblright"),Ol(Il,Pl,Gl,"°","\\degree",!0),Ol(Rl,Pl,Gl,"°","\\degree"),Ol(Rl,Pl,Gl,"°","\\textdegree",!0),Ol(Il,Pl,Gl,"£","\\pounds"),Ol(Il,Pl,Gl,"£","\\mathsterling",!0),Ol(Rl,Pl,Gl,"£","\\pounds"),Ol(Rl,Pl,Gl,"£","\\textsterling",!0),Ol(Il,Dl,Gl,"✠","\\maltese"),Ol(Rl,Dl,Gl,"✠","\\maltese");for(var Wl=0;Wl<'0123456789/@."'.length;Wl++){var Yl='0123456789/@."'.charAt(Wl);Ol(Il,Pl,Gl,Yl,Yl)}for(var Kl=0;Kl<'0123456789!@*()-=+";:?/.,'.length;Kl++){
|
|
296
296
|
var Xl='0123456789!@*()-=+";:?/.,'.charAt(Kl);Ol(Rl,Pl,Gl,Xl,Xl)}for(var Zl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Jl=0;Jl<Zl.length;Jl++){var Ql=Zl.charAt(Jl);Ol(Il,Pl,Hl,Ql,Ql),Ol(Rl,Pl,Gl,Ql,Ql)}Ol(Il,Dl,Gl,"C","ℂ"),Ol(Rl,Dl,Gl,"C","ℂ"),Ol(Il,Dl,Gl,"H","ℍ"),Ol(Rl,Dl,Gl,"H","ℍ"),Ol(Il,Dl,Gl,"N","ℕ"),Ol(Rl,Dl,Gl,"N","ℕ"),Ol(Il,Dl,Gl,"P","ℙ"),Ol(Rl,Dl,Gl,"P","ℙ"),Ol(Il,Dl,Gl,"Q","ℚ"),Ol(Rl,Dl,Gl,"Q","ℚ"),Ol(Il,Dl,Gl,"R","ℝ"),Ol(Rl,Dl,Gl,"R","ℝ"),Ol(Il,Dl,Gl,"Z","ℤ"),Ol(Rl,Dl,Gl,"Z","ℤ"),Ol(Il,Pl,Hl,"h","ℎ"),Ol(Rl,Pl,Hl,"h","ℎ");for(var ec="",tc=0;tc<Zl.length;tc++){var nc=Zl.charAt(tc);Ol(Il,Pl,Hl,nc,ec=String.fromCharCode(55349,56320+tc)),Ol(Rl,Pl,Gl,nc,ec),Ol(Il,Pl,Hl,nc,ec=String.fromCharCode(55349,56372+tc)),Ol(Rl,Pl,Gl,nc,ec),Ol(Il,Pl,Hl,nc,ec=String.fromCharCode(55349,56424+tc)),Ol(Rl,Pl,Gl,nc,ec),Ol(Il,Pl,Hl,nc,ec=String.fromCharCode(55349,56580+tc)),Ol(Rl,Pl,Gl,nc,ec),Ol(Il,Pl,Hl,nc,ec=String.fromCharCode(55349,56736+tc)),Ol(Rl,Pl,Gl,nc,ec),
|
|
@@ -304,8 +304,8 @@ var f=m.elem,g=m.wrapperClasses||[],v=m.wrapperStyle||{},y=pc(g,[l,f],void 0,v);
|
|
|
304
304
|
if(120485===n||120486===n)return[sc[0][2],sc[0][r]];if(120486<n&&n<120782)return["",""];throw new Is("Unsupported character: "+e)}(o,r);return uc(o,l,r,t,i.concat(c))}if(s){var u,h;if("boldsymbol"===s){var d=function(e,t,n,r,o){return"textord"!==o&&cc(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(o,r,0,0,n);u=d.fontName,h=[d.fontClass]}else a?(u=vc[s].fontName,h=[s]):(u=gc(s,t.fontWeight,t.fontShape),h=[s,t.fontWeight,t.fontShape]);if(cc(o,u,r).metrics)return uc(o,u,r,t,i.concat(h));if(Vl.hasOwnProperty(o)&&"Typewriter"===u.substr(0,10)){for(var p=[],m=0;m<o.length;m++)p.push(uc(o[m],u,r,t,i.concat(h)));return fc(p)}}if("mathord"===n)return uc(o,"Math-Italic",r,t,i.concat(["mathnormal"]));if("textord"===n){var f=zl[r][o]&&zl[r][o].font;if("ams"===f){var g=gc("amsrm",t.fontWeight,t.fontShape);return uc(o,g,r,t,i.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==f&&f){var v=gc(f,t.fontWeight,t.fontShape)
|
|
305
305
|
;return uc(o,v,r,t,i.concat(v,t.fontWeight,t.fontShape))}var y=gc("textrm",t.fontWeight,t.fontShape);return uc(o,y,r,t,i.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+n+" in makeOrd")},makeGlue:(e,t)=>{var n=pc(["mspace"],[],t),r=fl(e,t);return n.style.marginRight=gl(r),n},staticSvg:function(e,t){var[n,r,o]=yc[e],i=new El(n),a=new Al([i],{width:gl(r),height:gl(o),style:"width:"+gl(r),viewBox:"0 0 "+1e3*r+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),s=mc(["overlay"],[a],t);return s.height=o,s.style.height=gl(o),s.style.width=gl(r),s},svgData:yc,tryCombineChars:e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Cl&&r instanceof Cl&&hc(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e}},bc={number:3,unit:"mu"},wc={number:4,unit:"mu"},xc={number:5,unit:"mu"},kc={mord:{mop:bc,mbin:wc,mrel:xc,minner:bc},mop:{mord:bc,mop:bc,mrel:xc,minner:bc},mbin:{mord:wc,mop:wc,mopen:wc,minner:wc},mrel:{
|
|
306
306
|
mord:xc,mop:xc,mopen:xc,minner:xc},mopen:{},mclose:{mop:bc,mbin:wc,mrel:xc,minner:bc},mpunct:{mord:bc,mop:bc,mrel:xc,mopen:bc,mclose:bc,mpunct:bc,minner:bc},minner:{mord:bc,mop:bc,mbin:wc,mrel:xc,mopen:bc,mpunct:bc,minner:bc}},Sc={mord:{mop:bc},mop:{mord:bc,mop:bc},mbin:{},mrel:{},mopen:{},mclose:{mop:bc},mpunct:{},minner:{mop:bc}},Cc={},Ac={},Ec={};function Tc(e){for(var{type:t,names:n,props:r,handler:o,htmlBuilder:i,mathmlBuilder:a}=e,s={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:o},l=0;l<n.length;++l)Cc[n[l]]=s;t&&(i&&(Ac[t]=i),a&&(Ec[t]=a))}function Nc(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Tc({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var Lc=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e
|
|
307
|
-
},Mc=function(e){return"ordgroup"===e.type?e.body:[e]},zc=_c.makeSpan,Oc=["leftmost","mbin","mopen","mrel","mop","mpunct"],Ic=["rightmost","mrel","mclose","mpunct"],Rc={display:Zs.DISPLAY,text:Zs.TEXT,script:Zs.SCRIPT,scriptscript:Zs.SCRIPTSCRIPT},Pc={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Dc=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var o=[],i=0;i<e.length;i++){var a=
|
|
308
|
-
var n=Hc(t),r=Hc(e),o=n&&r?e.hasClass("mtight")?Sc[n][r]:kc[n][r]:null;if(o)return _c.makeGlue(o,l)}),{node:u},h,d),o},Bc=function e(t,n,r,o,i){o&&t.push(o);for(var a=0;a<t.length;a++){var s=t[a],l=Fc(s);if(l)e(l.children,n,r,null,i);else{var c=!s.hasClass("mspace");if(c){var u=n(s,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),a++))}c?r.node=s:i&&s.hasClass("newline")&&(r.node=zc(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),a++})(a)}}o&&t.pop()},Fc=function(e){return e instanceof nl||e instanceof xl||e instanceof wl&&e.hasClass("enclosing")?e:null},jc=function e(t,n){var r=Fc(t);if(r){var o=r.children;if(o.length){if("right"===n)return e(o[o.length-1],"right");if("left"===n)return e(o[0],"left")}}return t},Hc=function(e,t){return e?(t&&(e=jc(e,t)),Pc[e.classes[0]]||null):null},
|
|
307
|
+
},Mc=function(e){return"ordgroup"===e.type?e.body:[e]},zc=_c.makeSpan,Oc=["leftmost","mbin","mopen","mrel","mop","mpunct"],Ic=["rightmost","mrel","mclose","mpunct"],Rc={display:Zs.DISPLAY,text:Zs.TEXT,script:Zs.SCRIPT,scriptscript:Zs.SCRIPTSCRIPT},Pc={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Dc=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var o=[],i=0;i<e.length;i++){var a=Uc(e[i],t);if(a instanceof nl){var s=a.children;o.push(...s)}else o.push(a)}if(_c.tryCombineChars(o),!n)return o;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(Rc[c.style]))}var u=zc([r[0]||"leftmost"],[],t),h=zc([r[1]||"rightmost"],[],t),d="root"===n;return Bc(o,((e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&Fs.contains(Ic,r)?t.classes[0]="mord":"mbin"===r&&Fs.contains(Oc,n)&&(e.classes[0]="mord")}),{node:u},h,d),Bc(o,((e,t)=>{
|
|
308
|
+
var n=Hc(t),r=Hc(e),o=n&&r?e.hasClass("mtight")?Sc[n][r]:kc[n][r]:null;if(o)return _c.makeGlue(o,l)}),{node:u},h,d),o},Bc=function e(t,n,r,o,i){o&&t.push(o);for(var a=0;a<t.length;a++){var s=t[a],l=Fc(s);if(l)e(l.children,n,r,null,i);else{var c=!s.hasClass("mspace");if(c){var u=n(s,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),a++))}c?r.node=s:i&&s.hasClass("newline")&&(r.node=zc(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),a++})(a)}}o&&t.pop()},Fc=function(e){return e instanceof nl||e instanceof xl||e instanceof wl&&e.hasClass("enclosing")?e:null},jc=function e(t,n){var r=Fc(t);if(r){var o=r.children;if(o.length){if("right"===n)return e(o[o.length-1],"right");if("left"===n)return e(o[0],"left")}}return t},Hc=function(e,t){return e?(t&&(e=jc(e,t)),Pc[e.classes[0]]||null):null},qc=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return zc(t.concat(n))},Uc=function(e,t,n){if(!e)return zc();if(Ac[e.type]){var r=Ac[e.type](e,t);if(n&&t.size!==n.size){
|
|
309
309
|
r=zc(t.sizingClasses(n),[r],t);var o=t.sizeMultiplier/n.sizeMultiplier;r.height*=o,r.depth*=o}return r}throw new Is("Got group of unknown type: '"+e.type+"'")};function $c(e,t){var n=zc(["base"],e,t),r=zc(["strut"]);return r.style.height=gl(n.height+n.depth),n.depth&&(r.style.verticalAlign=gl(-n.depth)),n.children.unshift(r),n}function Gc(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,o=Dc(e,t,"root");2===o.length&&o[1].hasClass("tag")&&(r=o.pop());for(var i,a=[],s=[],l=0;l<o.length;l++)if(s.push(o[l]),o[l].hasClass("mbin")||o[l].hasClass("mrel")||o[l].hasClass("allowbreak")){for(var c=!1;l<o.length-1&&o[l+1].hasClass("mspace")&&!o[l+1].hasClass("newline");)l++,s.push(o[l]),o[l].hasClass("nobreak")&&(c=!0);c||(a.push($c(s,t)),s=[])}else o[l].hasClass("newline")&&(s.pop(),s.length>0&&(a.push($c(s,t)),s=[]),a.push(o[l]));s.length>0&&a.push($c(s,t)),n?((i=$c(Dc(n,t,!0))).classes=["tag"],a.push(i)):r&&a.push(r);var u=zc(["katex-html"],a);if(u.setAttribute("aria-hidden","true"),i){
|
|
310
310
|
var h=i.children[0];h.style.height=gl(u.height+u.depth),u.depth&&(h.style.verticalAlign=gl(-u.depth))}return u}function Vc(e){return new nl(e)}class Wc{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=vl(this.classes));for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=Fs.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+Fs.escape(vl(this.classes))+'"'),e+=">"
|
|
311
311
|
;for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map((e=>e.toText())).join("")}}class Yc{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Fs.escape(this.toText())}toText(){return this.text}}var Kc={MathNode:Wc,TextNode:Yc,SpaceNode:class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":e>=-.05556&&e<=-.05555?" ":e>=-.1667&&e<=-.1666?" ":e>=-.2223&&e<=-.2222?" ":e>=-.2778&&e<=-.2777?" ":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",gl(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+gl(this.width)+'"/>'}toText(){
|
|
@@ -317,14 +317,14 @@ underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow
|
|
|
317
317
|
xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],
|
|
318
318
|
xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},su=function(e,t,n,r,o){var i,a=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(i=_c.makeSpan(["stretchy",t],[],o),"fbox"===t){var s=o.color&&o.getColor();s&&(i.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new Tl({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new Tl({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new Al(l,{width:"100%",height:gl(a)});i=_c.makeSvgSpan([],[c],o)}return i.height=a,i.style.height=gl(a),i},lu=function(e){var t=new Kc.MathNode("mo",[new Kc.TextNode(iu[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},cu=function(e,t){var{span:n,minWidth:r,height:o}=function(){var n=4e5,r=e.label.substr(1)
|
|
319
319
|
;if(Fs.contains(["widehat","widecheck","widetilde","utilde"],r)){var o,i,a,s="ordgroup"===(p=e.base).type?p.body.length:1;if(s>5)"widehat"===r||"widecheck"===r?(o=420,n=2364,a=.42,i=r+"4"):(o=312,n=2340,a=.34,i="tilde4");else{var l=[1,1,2,2,3,3][s];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],o=[0,239,300,360,420][l],a=[0,.24,.3,.3,.36,.42][l],i=r+l):(n=[0,600,1033,2339,2340][l],o=[0,260,286,306,312][l],a=[0,.26,.286,.3,.306,.34][l],i="tilde"+l)}var c=new El(i),u=new Al([c],{width:"100%",height:gl(a),viewBox:"0 0 "+n+" "+o,preserveAspectRatio:"none"});return{span:_c.makeSvgSpan([],[u],t),minWidth:0,height:a}}var h,d,p,m=[],f=au[r],[g,v,y]=f,_=y/1e3,b=g.length;if(1===b)h=["hide-tail"],d=[f[3]];else if(2===b)h=["halfarrow-left","halfarrow-right"],d=["xMinYMin","xMaxYMin"];else{if(3!==b)throw new Error("Correct katexImagesData or update code here to support\n "+b+" children.");h=["brace-left","brace-center","brace-right"],d=["xMinYMin","xMidYMin","xMaxYMin"]}
|
|
320
|
-
for(var w=0;w<b;w++){var x=new El(g[w]),k=new Al([x],{width:"400em",height:gl(_),viewBox:"0 0 "+n+" "+y,preserveAspectRatio:d[w]+" slice"}),S=_c.makeSvgSpan([h[w]],[k],t);if(1===b)return{span:S,minWidth:v,height:_};S.style.height=gl(_),m.push(S)}return{span:_c.makeSpan(["stretchy"],m,t),minWidth:v,height:_}}();return n.height=o,n.style.height=gl(o),r>0&&(n.style.minWidth=gl(r)),n};function uu(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function hu(e){var t=du(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function du(e){return e&&("atom"===e.type||Ml.hasOwnProperty(e.type))?e:null}var pu=(e,t)=>{var n,r,o;e&&"supsub"===e.type?(n=(r=uu(e.base,"accent")).base,e.base=n,o=function(e){if(e instanceof wl)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(
|
|
321
|
-
;if(r.isShifty&&Fs.isCharacterBox(n)){var s=Fs.getBaseElem(n);a=Nl(
|
|
320
|
+
for(var w=0;w<b;w++){var x=new El(g[w]),k=new Al([x],{width:"400em",height:gl(_),viewBox:"0 0 "+n+" "+y,preserveAspectRatio:d[w]+" slice"}),S=_c.makeSvgSpan([h[w]],[k],t);if(1===b)return{span:S,minWidth:v,height:_};S.style.height=gl(_),m.push(S)}return{span:_c.makeSpan(["stretchy"],m,t),minWidth:v,height:_}}();return n.height=o,n.style.height=gl(o),r>0&&(n.style.minWidth=gl(r)),n};function uu(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function hu(e){var t=du(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function du(e){return e&&("atom"===e.type||Ml.hasOwnProperty(e.type))?e:null}var pu=(e,t)=>{var n,r,o;e&&"supsub"===e.type?(n=(r=uu(e.base,"accent")).base,e.base=n,o=function(e){if(e instanceof wl)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(Uc(e,t)),e.base=r):n=(r=uu(e,"accent")).base;var i=Uc(n,t.havingCrampedStyle()),a=0
|
|
321
|
+
;if(r.isShifty&&Fs.isCharacterBox(n)){var s=Fs.getBaseElem(n);a=Nl(Uc(s,t.havingCrampedStyle())).skew}var l,c="\\c"===r.label,u=c?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight);if(r.isStretchy)l=cu(r,t),l=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+gl(2*a)+")",marginLeft:gl(2*a)}:void 0}]},t);else{var h,d;"\\vec"===r.label?(h=_c.staticSvg("vec",t),d=_c.svgData.vec[1]):((h=Nl(h=_c.makeOrd({mode:r.mode,text:r.label},t,"textord"))).italic=0,d=h.width,c&&(u+=h.depth)),l=_c.makeSpan(["accent-body"],[h]);var p="\\textcircled"===r.label;p&&(l.classes.push("accent-full"),u=i.height);var m=a;p||(m-=d/2),l.style.left=gl(m),"\\textcircled"===r.label&&(l.style.top=".2em"),l=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-u},{type:"elem",elem:l}]},t)}var f=_c.makeSpan(["mord","accent"],[l],t);return o?(o.children[0]=f,
|
|
322
322
|
o.height=Math.max(f.height,o.height),o.classes[0]="mord",o):f},mu=(e,t)=>{var n=e.isStretchy?lu(e.label):new Kc.MathNode("mo",[Xc(e.label,e.mode)]),r=new Kc.MathNode("mover",[tu(e.base,t),n]);return r.setAttribute("accent","true"),r},fu=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((e=>"\\"+e)).join("|"));Tc({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=Lc(t[0]),r=!fu.test(e.funcName),o=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:o,base:n}},htmlBuilder:pu,mathmlBuilder:mu}),Tc({type:"accent",
|
|
323
|
-
names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:pu,mathmlBuilder:mu}),Tc({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:o}},htmlBuilder:(e,t)=>{var n=
|
|
323
|
+
names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:pu,mathmlBuilder:mu}),Tc({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:o}},htmlBuilder:(e,t)=>{var n=Uc(e.base,t),r=cu(e,t),o="\\utilde"===e.label?.12:0,i=_c.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:n}]},t);return _c.makeSpan(["mord","accentunder"],[i],t)},
|
|
324
324
|
mathmlBuilder:(e,t)=>{var n=lu(e.label),r=new Kc.MathNode("munder",[tu(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var gu=e=>{var t=new Kc.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Tc({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:o}=e;return{type:"xArrow",mode:r.mode,label:o,body:t[0],below:n[0]}},htmlBuilder(e,t){
|
|
325
|
-
var n,r=t.style,o=t.havingStyle(r.sup()),i=_c.wrapFragment(
|
|
325
|
+
var n,r=t.style,o=t.havingStyle(r.sup()),i=_c.wrapFragment(Uc(e.body,o,t),t),a="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(a+"-arrow-pad"),e.below&&(o=t.havingStyle(r.sub()),(n=_c.wrapFragment(Uc(e.below,o,t),t)).classes.push(a+"-arrow-pad"));var s,l=cu(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,u=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(u-=i.depth),n){var h=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;s=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:l,shift:c},{type:"elem",elem:n,shift:h}]},t)}else s=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:l,shift:c}]},t);return s.children[0].children[0].children[1].classes.push("svg-align"),_c.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder(e,t){var n,r=lu(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var o=gu(tu(e.body,t));if(e.below){
|
|
326
326
|
var i=gu(tu(e.below,t));n=new Kc.MathNode("munderover",[r,i,o])}else n=new Kc.MathNode("mover",[r,o])}else if(e.below){var a=gu(tu(e.below,t));n=new Kc.MathNode("munder",[r,a])}else n=gu(),n=new Kc.MathNode("mover",[r,n]);return n}});var vu={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},yu=e=>"textord"===e.type&&"@"===e.text;function _u(e,t,n){var r=vu[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var o={type:"atom",text:r,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[o],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}
|
|
327
|
-
}}Tc({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=_c.wrapFragment(
|
|
327
|
+
}}Tc({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=_c.wrapFragment(Uc(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=gl(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Kc.MathNode("mrow",[tu(e.label,t)]);return(n=new Kc.MathNode("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new Kc.MathNode("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),Tc({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=_c.wrapFragment(Uc(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new Kc.MathNode("mrow",[tu(e.fragment,t)])}),Tc({
|
|
328
328
|
type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=uu(t[0],"ordgroup").body,o="",i=0;i<r.length;i++){o+=uu(r[i],"textord").text}var a,s=parseInt(o);if(isNaN(s))throw new Is("\\@char has non-numeric argument "+o);if(s<0||s>=1114111)throw new Is("\\@char with invalid code point "+o);return s<=65535?a=String.fromCharCode(s):(s-=65536,a=String.fromCharCode(55296+(s>>10),56320+(1023&s))),{type:"textord",mode:n.mode,text:a}}});var bu=(e,t)=>{var n=Dc(e.body,t.withColor(e.color),!1);return _c.makeFragment(n)},wu=(e,t)=>{var n=Qc(e.body,t.withColor(e.color)),r=new Kc.MathNode("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Tc({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=uu(t[0],"color-token").color,o=t[1];return{type:"color",mode:n.mode,color:r,body:Mc(o)}},htmlBuilder:bu,mathmlBuilder:wu}),Tc({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,
|
|
329
329
|
argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,o=uu(t[0],"color-token").color;n.gullet.macros.set("\\current@color",o);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:o,body:i}},htmlBuilder:bu,mathmlBuilder:wu}),Tc({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:1,argTypes:["size"],allowedInText:!0},handler(e,t,n){var{parser:r}=e,o=n[0],i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:o&&uu(o,"size").value}},htmlBuilder(e,t){var n=_c.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=gl(fl(e.size,t)))),n},mathmlBuilder(e,t){var n=new Kc.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",gl(fl(e.size,t)))),n}});var xu={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef",
|
|
330
330
|
"\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},ku=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Is("Expected a control sequence",e);return t},Su=(e,t,n,r)=>{var o=e.gullet.macros.get(n.text);null==o&&(n.noexpand=!0,o={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,o,r)};Tc({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(xu[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=xu[r.text]),uu(t.parseFunction(),"internal");throw new Is("Invalid token after macro prefix",r)}}),Tc({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),o=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new Is("Expected a control sequence",r)
|
|
@@ -339,23 +339,23 @@ return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c
|
|
|
339
339
|
return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize3":r=function(e,t){
|
|
340
340
|
return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,80);break;case"sqrtSize4":r=function(e,t){
|
|
341
341
|
return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,80);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,80,n)}return r}(e,r,n),a=new El(e,i),s=new Al([a],{width:"400em",height:gl(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"})
|
|
342
|
-
;return _c.makeSvgSpan(["hide-tail"],[s],o)},Pu=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Du=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],Bu=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Fu=[0,1.2,1.8,2.4,3],ju=[{type:"small",style:Zs.SCRIPTSCRIPT},{type:"small",style:Zs.SCRIPT},{type:"small",style:Zs.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Hu=[{type:"small",style:Zs.SCRIPTSCRIPT},{type:"small",style:Zs.SCRIPT},{type:"small",style:Zs.TEXT},{type:"stack"}],
|
|
343
|
-
type:"stack"}],
|
|
344
|
-
var n,r,o=t.havingBaseSizing(),i=$u("\\surd",e*o.sizeMultiplier,
|
|
342
|
+
;return _c.makeSvgSpan(["hide-tail"],[s],o)},Pu=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Du=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],Bu=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Fu=[0,1.2,1.8,2.4,3],ju=[{type:"small",style:Zs.SCRIPTSCRIPT},{type:"small",style:Zs.SCRIPT},{type:"small",style:Zs.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Hu=[{type:"small",style:Zs.SCRIPTSCRIPT},{type:"small",style:Zs.SCRIPT},{type:"small",style:Zs.TEXT},{type:"stack"}],qu=[{type:"small",style:Zs.SCRIPTSCRIPT},{type:"small",style:Zs.SCRIPT},{type:"small",style:Zs.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{
|
|
343
|
+
type:"stack"}],Uu=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},$u=function(e,t,n,r){for(var o=Math.min(2,3-r.style.size);o<n.length&&"stack"!==n[o].type;o++){var i=Cu(e,Uu(n[o]),"math"),a=i.height+i.depth;if("small"===n[o].type&&(a*=r.havingBaseStyle(n[o].style).sizeMultiplier),a>t)return n[o]}return n[n.length-1]},Gu=function(e,t,n,r,o,i){var a;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),a=Fs.contains(Bu,e)?ju:Fs.contains(Pu,e)?qu:Hu;var s=$u(e,t,a,r);return"small"===s.type?function(e,t,n,r,o,i){var a=_c.makeSymbol(e,"Main-Regular",o,r),s=Au(a,t,r,i);return n&&Eu(s,r,t),s}(e,s.style,n,r,o,i):"large"===s.type?Tu(e,s.size,n,r,o,i):Iu(e,t,n,r,o,i)},Vu={sqrtImage:function(e,t){
|
|
344
|
+
var n,r,o=t.havingBaseSizing(),i=$u("\\surd",e*o.sizeMultiplier,qu,o),a=o.sizeMultiplier,s=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,c=0,u=0;return"small"===i.type?(e<1?a=1:e<1.4&&(a=.7),c=(1+s)/a,(n=Ru("sqrtMain",l=(1+s+.08)/a,u=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",r=.833/a):"large"===i.type?(u=1080*Fu[i.size],c=(Fu[i.size]+s)/a,l=(Fu[i.size]+s+.08)/a,(n=Ru("sqrtSize"+i.size,l,u,s,t)).style.minWidth="1.02em",r=1/a):(l=e+s+.08,c=e+s,u=Math.floor(1e3*e+s)+80,(n=Ru("sqrtTall",l,u,s,t)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=gl(l),{span:n,advanceWidth:r,ruleWidth:(t.fontMetrics().sqrtRuleThickness+s)*a}},sizedDelim:function(e,t,n,r,o){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),Fs.contains(Pu,e)||Fs.contains(Bu,e))return Tu(e,t,!1,n,r,o);if(Fs.contains(Du,e))return Iu(e,Fu[t],!1,n,r,o);throw new Is("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:Fu,customSizedDelim:Gu,leftRightDelim:function(e,t,n,r,o,i){
|
|
345
345
|
var a=r.fontMetrics().axisHeight*r.sizeMultiplier,s=5/r.fontMetrics().ptPerEm,l=Math.max(t-a,n+a),c=Math.max(l/500*901,2*l-s);return Gu(e,c,!0,r,o,i)}},Wu={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}
|
|
346
346
|
},Yu=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Ku(e,t){var n=du(e);if(n&&Fs.contains(Yu,n.text))return n;throw new Is(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function Xu(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Tc({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Ku(t[0],e);return{type:"delimsizing",
|
|
347
347
|
mode:e.parser.mode,size:Wu[e.funcName].size,mclass:Wu[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?_c.makeSpan([e.mclass]):Vu.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(Xc(e.delim,e.mode));var n=new Kc.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=gl(Vu.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),Tc({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new Is("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Ku(t[0],e).text,color:n}}}),Tc({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ku(t[0],e),r=e.parser;++r.leftrightDepth;var o=r.parseExpression(!1)
|
|
348
|
-
;--r.leftrightDepth,r.expect("\\right",!1);var i=uu(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:o,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{Xu(e);for(var n,r,o=Dc(e.body,t,!0,["mopen","mclose"]),i=0,a=0,s=!1,l=0;l<o.length;l++)o[l].isMiddle?s=!0:(i=Math.max(o[l].height,i),a=Math.max(o[l].depth,a));if(i*=t.sizeMultiplier,a*=t.sizeMultiplier,n="."===e.left?
|
|
349
|
-
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return Zc(n)}}),Tc({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ku(t[0],e);if(!e.parser.leftrightDepth)throw new Is("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=
|
|
348
|
+
;--r.leftrightDepth,r.expect("\\right",!1);var i=uu(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:o,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{Xu(e);for(var n,r,o=Dc(e.body,t,!0,["mopen","mclose"]),i=0,a=0,s=!1,l=0;l<o.length;l++)o[l].isMiddle?s=!0:(i=Math.max(o[l].height,i),a=Math.max(o[l].depth,a));if(i*=t.sizeMultiplier,a*=t.sizeMultiplier,n="."===e.left?qc(t,["mopen"]):Vu.leftRightDelim(e.left,i,a,t,e.mode,["mopen"]),o.unshift(n),s)for(var c=1;c<o.length;c++){var u=o[c].isMiddle;u&&(o[c]=Vu.leftRightDelim(u.delim,i,a,u.options,e.mode,[]))}if("."===e.right)r=qc(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;r=Vu.leftRightDelim(e.right,i,a,h,e.mode,["mclose"])}return o.push(r),_c.makeSpan(["minner"],o,t)},mathmlBuilder:(e,t)=>{Xu(e);var n=Qc(e.body,t);if("."!==e.left){var r=new Kc.MathNode("mo",[Xc(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var o=new Kc.MathNode("mo",[Xc(e.right,e.mode)])
|
|
349
|
+
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return Zc(n)}}),Tc({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ku(t[0],e);if(!e.parser.leftrightDepth)throw new Is("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=qc(t,[]);else{n=Vu.sizedDelim(e.delim,1,t,e.mode,[]);var r={delim:e.delim,options:t};n.isMiddle=r}return n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?Xc("|","text"):Xc(e.delim,e.mode),r=new Kc.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Zu=(e,t)=>{var n,r,o=_c.wrapFragment(Uc(e.body,t),t),i=e.label.substr(1),a=t.sizeMultiplier,s=0,l=Fs.isCharacterBox(e.body);if("sout"===i)(n=_c.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/a,s=-.5*t.fontMetrics().xHeight;else if("phase"===i){var c=fl({
|
|
350
350
|
number:.6,unit:"pt"},t),u=fl({number:.35,unit:"ex"},t);a/=t.havingBaseSizing().sizeMultiplier;var h=o.height+o.depth+c+u;o.style.paddingLeft=gl(h/2+c);var d=Math.floor(1e3*h*a),p=function(e){return"M400000 "+e+" H0 L"+e/2+" 0 l65 45 L145 "+(e-80)+" H400000z"}(d),m=new Al([new El("phase",p)],{width:"400em",height:gl(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});(n=_c.makeSvgSpan(["hide-tail"],[m],t)).style.height=gl(h),s=o.depth+c+u}else{/cancel/.test(i)?l||o.classes.push("cancel-pad"):"angl"===i?o.classes.push("anglpad"):o.classes.push("boxpad");var f=0,g=0,v=0;/box/.test(i)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=f=t.fontMetrics().fboxsep+("colorbox"===i?0:v)):"angl"===i?(f=4*(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),g=Math.max(0,.25-o.depth)):g=f=l?.2:0,n=su(o,i,f,g,t),/fbox|boxed|fcolorbox/.test(i)?(n.style.borderStyle="solid",n.style.borderWidth=gl(v)):"angl"===i&&.049!==v&&(n.style.borderTopWidth=gl(v),n.style.borderRightWidth=gl(v)),
|
|
351
351
|
s=o.depth+g,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)r=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:s},{type:"elem",elem:o,shift:0}]},t);else{var y=/cancel|phase/.test(i)?["svg-align"]:[];r=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:n,shift:s,wrapperClasses:y}]},t)}return/cancel/.test(i)&&(r.height=o.height,r.depth=o.depth),/cancel/.test(i)&&!l?_c.makeSpan(["mord","cancel-lap"],[r],t):_c.makeSpan(["mord"],[r],t)},Ju=(e,t)=>{var n=0,r=new Kc.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[tu(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":
|
|
352
352
|
r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var o=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+o+"em solid "+String(e.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};Tc({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=uu(t[0],"color-token").color,a=t[1];return{type:"enclose",mode:r.mode,label:o,backgroundColor:i,body:a}},htmlBuilder:Zu,mathmlBuilder:Ju}),Tc({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,
|
|
353
353
|
argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=uu(t[0],"color-token").color,a=uu(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:r.mode,label:o,backgroundColor:a,borderColor:i,body:s}},htmlBuilder:Zu,mathmlBuilder:Ju}),Tc({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}}),Tc({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"enclose",mode:n.mode,label:r,body:o}},htmlBuilder:Zu,mathmlBuilder:Ju}),Tc({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var Qu={};function eh(e){for(var{type:t,names:n,props:r,handler:o,htmlBuilder:i,mathmlBuilder:a}=e,s={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,
|
|
354
354
|
handler:o},l=0;l<n.length;++l)Qu[n[l]]=s;i&&(Ac[t]=i),a&&(Ec[t]=a)}var th={};function nh(e,t){th[e]=t}function rh(e){var t=[];e.consumeSpaces();for(var n=e.fetch().text;"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var oh=e=>{if(!e.parser.settings.displayMode)throw new Is("{"+e.envName+"} can be used only in display mode.")};function ih(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function ah(e,t,n){var{hskipBeforeAndAfter:r,addJot:o,cols:i,arraystretch:a,colSeparationType:s,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:h,leqno:d}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!a){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)a=1;else if(!(a=parseFloat(p))||a<0)throw new Is("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],f=[m],g=[],v=[],y=null!=l?[]:void 0;function _(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){
|
|
355
355
|
y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new Os("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(_(),v.push(rh(e));;){var w=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),w={type:"ordgroup",mode:e.mode,body:w},n&&(w={type:"styling",mode:e.mode,style:n,body:[w]}),m.push(w);var x=e.fetch().text;if("&"===x){if(h&&m.length===h){if(c||s)throw new Is("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===x){b(),1===m.length&&"styling"===w.type&&0===w.body[0].body.length&&(f.length>1||!u)&&f.pop(),v.length<f.length+1&&v.push([]);break}if("\\\\"!==x)throw new Is("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var k=void 0;" "!==e.gullet.future().text&&(k=e.parseSizeGroup(!0)),g.push(k?k.value:null),b(),v.push(rh(e)),m=[],f.push(m),_()}}return e.gullet.endGroup(),
|
|
356
|
-
e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:o,arraystretch:a,body:f,cols:i,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:s,tags:y,leqno:d}}function sh(e){return"d"===e.substr(0,1)?"display":"text"}var lh=function(e,t){var n,r,o=e.body.length,i=e.hLinesBeforeRow,a=0,s=new Array(o),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),u=1/t.fontMetrics().ptPerEm,h=5*u;e.colSeparationType&&"small"===e.colSeparationType&&(h=t.havingStyle(Zs.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?fl({number:3,unit:"ex"},t):12*u,p=3*u,m=e.arraystretch*d,f=.7*m,g=.3*m,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(i[0]),n=0;n<e.body.length;++n){var _=e.body[n],b=f,w=g;a<_.length&&(a=_.length);var x=new Array(_.length);for(r=0;r<_.length;++r){var k=
|
|
356
|
+
e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:o,arraystretch:a,body:f,cols:i,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:s,tags:y,leqno:d}}function sh(e){return"d"===e.substr(0,1)?"display":"text"}var lh=function(e,t){var n,r,o=e.body.length,i=e.hLinesBeforeRow,a=0,s=new Array(o),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),u=1/t.fontMetrics().ptPerEm,h=5*u;e.colSeparationType&&"small"===e.colSeparationType&&(h=t.havingStyle(Zs.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?fl({number:3,unit:"ex"},t):12*u,p=3*u,m=e.arraystretch*d,f=.7*m,g=.3*m,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(i[0]),n=0;n<e.body.length;++n){var _=e.body[n],b=f,w=g;a<_.length&&(a=_.length);var x=new Array(_.length);for(r=0;r<_.length;++r){var k=Uc(_[r],t);w<k.depth&&(w=k.depth),b<k.height&&(b=k.height),x[r]=k}var S=e.rowGaps[n],C=0;S&&(C=fl(S,t))>0&&(w<(C+=g)&&(w=C),C=0),e.addJot&&(w+=p),x.height=b,
|
|
357
357
|
x.depth=w,v+=b,x.pos=v,v+=w+C,s[n]=x,y(i[n+1])}var A,E,T=v/2+t.fontMetrics().axisHeight,N=e.cols||[],L=[],M=[];if(e.tags&&e.tags.some((e=>e)))for(n=0;n<o;++n){var z=s[n],O=z.pos-T,I=e.tags[n],R=void 0;(R=!0===I?_c.makeSpan(["eqn-num"],[],t):!1===I?_c.makeSpan([],[],t):_c.makeSpan([],Dc(I,t,!0),t)).depth=z.depth,R.height=z.height,M.push({type:"elem",elem:R,shift:O})}for(r=0,E=0;r<a||E<N.length;++r,++E){for(var P=N[E]||{},D=!0;"separator"===P.type;){if(D||((A=_c.makeSpan(["arraycolsep"],[])).style.width=gl(t.fontMetrics().doubleRuleSep),L.push(A)),"|"!==P.separator&&":"!==P.separator)throw new Is("Invalid separator type: "+P.separator);var B="|"===P.separator?"solid":"dashed",F=_c.makeSpan(["vertical-separator"],[],t);F.style.height=gl(v),F.style.borderRightWidth=gl(c),F.style.borderRightStyle=B,F.style.margin="0 "+gl(-c/2);var j=v-T;j&&(F.style.verticalAlign=gl(-j)),L.push(F),P=N[++E]||{},D=!1}if(!(r>=a)){var H=void 0
|
|
358
|
-
;(r>0||e.hskipBeforeAndAfter)&&0!==(H=Fs.deflt(P.pregap,h))&&((A=_c.makeSpan(["arraycolsep"],[])).style.width=gl(H),L.push(A));var
|
|
358
|
+
;(r>0||e.hskipBeforeAndAfter)&&0!==(H=Fs.deflt(P.pregap,h))&&((A=_c.makeSpan(["arraycolsep"],[])).style.width=gl(H),L.push(A));var q=[];for(n=0;n<o;++n){var U=s[n],$=U[r];if($){var G=U.pos-T;$.depth=U.depth,$.height=U.height,q.push({type:"elem",elem:$,shift:G})}}q=_c.makeVList({positionType:"individualShift",children:q},t),q=_c.makeSpan(["col-align-"+(P.align||"c")],[q]),L.push(q),(r<a-1||e.hskipBeforeAndAfter)&&0!==(H=Fs.deflt(P.postgap,h))&&((A=_c.makeSpan(["arraycolsep"],[])).style.width=gl(H),L.push(A))}}if(s=_c.makeSpan(["mtable"],L),l.length>0){for(var V=_c.makeLineSpan("hline",t,c),W=_c.makeLineSpan("hdashline",t,c),Y=[{type:"elem",elem:s,shift:0}];l.length>0;){var K=l.pop(),X=K.pos-T;K.isDashed?Y.push({type:"elem",elem:W,shift:X}):Y.push({type:"elem",elem:V,shift:X})}s=_c.makeVList({positionType:"individualShift",children:Y},t)}if(0===M.length)return _c.makeSpan(["mord"],[s],t);var Z=_c.makeVList({positionType:"individualShift",children:M},t);return Z=_c.makeSpan(["tag"],[Z],t),_c.makeFragment([s,Z])
|
|
359
359
|
},ch={c:"center ",l:"left ",r:"right "},uh=function(e,t){for(var n=[],r=new Kc.MathNode("mtd",[],["mtr-glue"]),o=new Kc.MathNode("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var a=e.body[i],s=[],l=0;l<a.length;l++)s.push(new Kc.MathNode("mtd",[tu(a[l],t)]));e.tags&&e.tags[i]&&(s.unshift(r),s.push(r),e.leqno?s.unshift(o):s.push(o)),n.push(new Kc.MathNode("mtr",s))}var c=new Kc.MathNode("mtable",n),u=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",gl(u));var h="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(h+="top ",g=1),"separator"===p[p.length-1].type&&(h+="bottom ",v-=1);for(var y=g;y<v;y++)"align"===p[y].type?(d+=ch[p[y].align],f&&(m+="none "),f=!0):"separator"===p[y].type&&f&&(m+="|"===p[y].separator?"solid ":"dashed ",f=!1);c.setAttribute("columnalign",d.trim()),/[sd]/.test(m)&&c.setAttribute("columnlines",m.trim())}if("align"===e.colSeparationType){
|
|
360
360
|
for(var _=e.cols||[],b="",w=1;w<_.length;w++)b+=w%2?"0em ":"1em ";c.setAttribute("columnspacing",b.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var x="",k=e.hLinesBeforeRow;h+=k[0].length>0?"left ":"",h+=k[k.length-1].length>0?"right ":"";for(var S=1;S<k.length-1;S++)x+=0===k[S].length?"none ":k[S][0]?"dashed ":"solid ";return/[sd]/.test(x)&&c.setAttribute("rowlines",x.trim()),""!==h&&(c=new Kc.MathNode("menclose",[c])).setAttribute("notation",h.trim()),e.arraystretch&&e.arraystretch<1&&(c=new Kc.MathNode("mstyle",[c])).setAttribute("scriptlevel","1"),c},hh=function(e,t){-1===e.envName.indexOf("ed")&&oh(e);var n,r=[],o=e.envName.indexOf("at")>-1?"alignat":"align",i="split"===e.envName,a=ah(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:ih(e.envName),emptySingleRow:!0,
|
|
361
361
|
colSeparationType:o,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",u=0;u<t[0].body.length;u++){c+=uu(t[0].body[u],"textord").text}n=Number(c),s=2*n}var h=!s;a.body.forEach((function(e){for(var t=1;t<e.length;t+=2){var r=uu(e[t],"styling");uu(r.body[0],"ordgroup").body.unshift(l)}if(h)s<e.length&&(s=e.length);else{var o=e.length/2;if(n<o)throw new Is("Too many math in a row: expected "+n+", but got "+o,e[0])}}));for(var d=0;d<s;++d){var p="r",m=0;d%2==1?p="l":d>0&&h&&(m=1),r[d]={type:"align",align:p,pregap:m,postgap:0}}return a.colSeparationType=h?"align":"alignat",a};eh({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(du(t[0])?[t[0]]:uu(t[0],"ordgroup").body).map((function(e){var t=hu(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"}
|
|
@@ -366,43 +366,43 @@ type:"align",align:"l",pregap:0,postgap:0}]},sh(e.envName));return{type:"leftrig
|
|
|
366
366
|
}if(yu(l[f]))throw new Is("Missing a "+h+" character to complete a CD arrow.",l[f]);d[p].body.push(l[f])}if(m)throw new Is("Missing a "+h+" character to complete a CD arrow.",l[u])}}var g={type:"styling",body:[_u(h,d,e)],mode:"math",style:"display"};i.push(g),c={type:"styling",body:[],mode:"math",style:"display"}}else c.body.push(l[u]);s%2==0?i.push(c):i.shift(),i=[],a.push(i)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:a,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(a[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(a.length+1).fill([])}}(e.parser)),htmlBuilder:lh,mathmlBuilder:uh}),nh("\\nonumber","\\gdef\\@eqnsw{0}"),nh("\\notag","\\nonumber"),Tc({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Is(e.funcName+" valid only within array environment")}});var dh=Qu;Tc({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,
|
|
367
367
|
argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];if("ordgroup"!==o.type)throw new Is("Invalid environment name",o);for(var i="",a=0;a<o.body.length;++a)i+=uu(o.body[a],"textord").text;if("\\begin"===r){if(!dh.hasOwnProperty(i))throw new Is("No such environment: "+i,o);var s=dh[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",s),u={mode:n.mode,envName:i,parser:n},h=s.handler(u,l,c);n.expect("\\end",!1);var d=n.nextToken,p=uu(n.parseFunction(),"environment");if(p.name!==i)throw new Is("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",d);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:o}}});var ph=_c.makeSpan;function mh(e,t){var n=Dc(e.body,t,!0);return ph([e.mclass],n,t)}function fh(e,t){var n,r=Qc(e.body,t);return"minner"===e.mclass?n=new Kc.MathNode("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new Kc.MathNode("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new Kc.MathNode("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",
|
|
368
368
|
n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"===e.mclass||"mclose"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0em"):"minner"===e.mclass&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Tc({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.substr(5),body:Mc(o),isCharacterBox:Fs.isCharacterBox(o)}},htmlBuilder:mh,mathmlBuilder:fh});var gh=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};Tc({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:gh(t[0]),body:Mc(t[1]),isCharacterBox:Fs.isCharacterBox(t[1])}}}),Tc({type:"mclass",names:["\\stackrel","\\overset","\\underset"],
|
|
369
|
-
props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:o}=e,i=t[1],a=t[0];n="\\stackrel"!==o?gh(i):"mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==o,body:Mc(i)},l={type:"supsub",mode:a.mode,base:s,sup:"\\underset"===o?null:a,sub:"\\underset"===o?a:null};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:Fs.isCharacterBox(l)}},htmlBuilder:mh,mathmlBuilder:fh});var vh=(e,t)=>{var n=e.font,r=t.withFont(n);return
|
|
370
|
-
htmlBuilder:vh,mathmlBuilder:yh}),Tc({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],o=Fs.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:gh(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:o}}}),Tc({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:o}=e,{mode:i}=n,a=n.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:vh,mathmlBuilder:yh});var bh=(e,t)=>{var n=t;return"display"===e?n=n.id>=Zs.SCRIPT.id?n.text():Zs.DISPLAY:"text"===e&&n.size===Zs.DISPLAY.size?n=Zs.TEXT:"script"===e?n=Zs.SCRIPT:"scriptscript"===e&&(n=Zs.SCRIPTSCRIPT),n},wh=(e,t)=>{var n,r=bh(e.size,t.style),o=r.fracNum(),i=r.fracDen();n=t.havingStyle(o);var a=
|
|
371
|
-
;a.height=a.height<s?s:a.height,a.depth=a.depth<l?l:a.depth}n=t.havingStyle(i);var c,u,h,d,p,m,f,g,v,y,_=
|
|
372
|
-
return n=t.havingStyle(r),f.height*=n.sizeMultiplier/t.sizeMultiplier,f.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===Zs.DISPLAY.size?t.fontMetrics().delim1:r.size===Zs.SCRIPTSCRIPT.size?t.havingStyle(Zs.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?
|
|
369
|
+
props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:o}=e,i=t[1],a=t[0];n="\\stackrel"!==o?gh(i):"mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==o,body:Mc(i)},l={type:"supsub",mode:a.mode,base:s,sup:"\\underset"===o?null:a,sub:"\\underset"===o?a:null};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:Fs.isCharacterBox(l)}},htmlBuilder:mh,mathmlBuilder:fh});var vh=(e,t)=>{var n=e.font,r=t.withFont(n);return Uc(e.body,r)},yh=(e,t)=>{var n=e.font,r=t.withFont(n);return tu(e.body,r)},_h={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Tc({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=Lc(t[0]),i=r;return i in _h&&(i=_h[i]),{type:"font",mode:n.mode,font:i.slice(1),body:o}},
|
|
370
|
+
htmlBuilder:vh,mathmlBuilder:yh}),Tc({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],o=Fs.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:gh(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:o}}}),Tc({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:o}=e,{mode:i}=n,a=n.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:vh,mathmlBuilder:yh});var bh=(e,t)=>{var n=t;return"display"===e?n=n.id>=Zs.SCRIPT.id?n.text():Zs.DISPLAY:"text"===e&&n.size===Zs.DISPLAY.size?n=Zs.TEXT:"script"===e?n=Zs.SCRIPT:"scriptscript"===e&&(n=Zs.SCRIPTSCRIPT),n},wh=(e,t)=>{var n,r=bh(e.size,t.style),o=r.fracNum(),i=r.fracDen();n=t.havingStyle(o);var a=Uc(e.numer,n,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm
|
|
371
|
+
;a.height=a.height<s?s:a.height,a.depth=a.depth<l?l:a.depth}n=t.havingStyle(i);var c,u,h,d,p,m,f,g,v,y,_=Uc(e.denom,n,t);if(e.hasBarLine?(e.barSize?(u=fl(e.barSize,t),c=_c.makeLineSpan("frac-line",t,u)):c=_c.makeLineSpan("frac-line",t),u=c.height,h=c.height):(c=null,u=0,h=t.fontMetrics().defaultRuleThickness),r.size===Zs.DISPLAY.size||"display"===e.size?(d=t.fontMetrics().num1,p=u>0?3*h:7*h,m=t.fontMetrics().denom1):(u>0?(d=t.fontMetrics().num2,p=h):(d=t.fontMetrics().num3,p=3*h),m=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;d-a.depth-(b+.5*u)<p&&(d+=p-(d-a.depth-(b+.5*u))),b-.5*u-(_.height-m)<p&&(m+=p-(b-.5*u-(_.height-m)));var w=-(b-.5*u);f=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:_,shift:m},{type:"elem",elem:c,shift:w},{type:"elem",elem:a,shift:-d}]},t)}else{var x=d-a.depth-(_.height-m);x<p&&(d+=.5*(p-x),m+=.5*(p-x)),f=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:_,shift:m},{type:"elem",elem:a,shift:-d}]},t)}
|
|
372
|
+
return n=t.havingStyle(r),f.height*=n.sizeMultiplier/t.sizeMultiplier,f.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===Zs.DISPLAY.size?t.fontMetrics().delim1:r.size===Zs.SCRIPTSCRIPT.size?t.havingStyle(Zs.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?qc(t,["mopen"]):Vu.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),y=e.continued?_c.makeSpan([]):null==e.rightDelim?qc(t,["mclose"]):Vu.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),_c.makeSpan(["mord"].concat(n.sizingClasses(t)),[v,_c.makeSpan(["mfrac"],[f]),y],t)},xh=(e,t)=>{var n=new Kc.MathNode("mfrac",[tu(e.numer,t),tu(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=fl(e.barSize,t);n.setAttribute("linethickness",gl(r))}}else n.setAttribute("linethickness","0px");var o=bh(e.size,t.style);if(o.size!==t.style.size){n=new Kc.MathNode("mstyle",[n]);var i=o.size===Zs.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}
|
|
373
373
|
if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var s=new Kc.MathNode("mo",[new Kc.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),a.push(s)}if(a.push(n),null!=e.rightDelim){var l=new Kc.MathNode("mo",[new Kc.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}return Zc(a)}return n};Tc({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var n,{parser:r,funcName:o}=e,i=t[0],a=t[1],s=null,l=null,c="auto";switch(o){case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,s="(",l=")";break;case"\\\\bracefrac":n=!1,s="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,s="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(o){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text"}
|
|
374
374
|
return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:n,leftDelim:s,rightDelim:l,size:c,barSize:null}},htmlBuilder:wh,mathmlBuilder:xh}),Tc({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0],i=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:o,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Tc({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var t,{parser:n,funcName:r,token:o}=e;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:o}}});var kh=["display","text","script","scriptscript"],Sh=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};Tc({type:"genfrac",names:["\\genfrac"],
|
|
375
375
|
props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var n,{parser:r}=e,o=t[4],i=t[5],a=Lc(t[0]),s="atom"===a.type&&"open"===a.family?Sh(a.text):null,l=Lc(t[1]),c="atom"===l.type&&"close"===l.family?Sh(l.text):null,u=uu(t[2],"size"),h=null;n=!!u.isBlank||(h=u.value).number>0;var d="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var m=uu(p.body[0],"textord");d=kh[Number(m.text)]}}else p=uu(p,"textord"),d=kh[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:o,denom:i,continued:!1,hasBarLine:n,barSize:h,leftDelim:s,rightDelim:c,size:d}},htmlBuilder:wh,mathmlBuilder:xh}),Tc({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:o}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:uu(t[0],"size").value,token:o}}}),Tc({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{
|
|
376
|
-
var{parser:n,funcName:r}=e,o=t[0],i=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(uu(t[1],"infix").size),a=t[2],s=i.number>0;return{type:"genfrac",mode:n.mode,numer:o,denom:a,continued:!1,hasBarLine:s,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:wh,mathmlBuilder:xh});var Ch=(e,t)=>{var n,r,o=t.style;"supsub"===e.type?(n=e.sup?
|
|
376
|
+
var{parser:n,funcName:r}=e,o=t[0],i=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(uu(t[1],"infix").size),a=t[2],s=i.number>0;return{type:"genfrac",mode:n.mode,numer:o,denom:a,continued:!1,hasBarLine:s,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:wh,mathmlBuilder:xh});var Ch=(e,t)=>{var n,r,o=t.style;"supsub"===e.type?(n=e.sup?Uc(e.sup,t.havingStyle(o.sup()),t):Uc(e.sub,t.havingStyle(o.sub()),t),r=uu(e.base,"horizBrace")):r=uu(e,"horizBrace");var i,a=Uc(r.base,t.havingBaseStyle(Zs.DISPLAY)),s=cu(r,t);if(r.isOver?(i=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=_c.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},t)).children[0].children[0].children[0].classes.push("svg-align"),n){
|
|
377
377
|
var l=_c.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t);i=r.isOver?_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},t):_c.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return _c.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t)};Tc({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:t[0]}},htmlBuilder:Ch,mathmlBuilder:(e,t)=>{var n=lu(e.label);return new Kc.MathNode(e.isOver?"mover":"munder",[tu(e.base,t),n])}}),Tc({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],o=uu(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:n.mode,href:o,body:Mc(r)}:n.formatUnsupportedCmd("\\href")},
|
|
378
378
|
htmlBuilder:(e,t)=>{var n=Dc(e.body,t,!1);return _c.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=eu(e.body,t);return n instanceof Wc||(n=new Wc("mrow",[n])),n.setAttribute("href",e.href),n}}),Tc({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=uu(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var o=[],i=0;i<r.length;i++){var a=r[i];"~"===a&&(a="\\textasciitilde"),o.push({type:"textord",mode:"text",text:a})}var s={type:"text",mode:n.mode,font:"\\texttt",body:o};return{type:"href",mode:n.mode,href:r,body:Mc(s)}}}),Tc({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:Mc(t[0])}},htmlBuilder(e,t){var n=Dc(e.body,t,!1);return _c.makeFragment(n)},mathmlBuilder:(e,t)=>new Kc.MathNode("mrow",Qc(e.body,t))}),Tc({type:"html",
|
|
379
379
|
names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var n,{parser:r,funcName:o,token:i}=e,a=uu(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(o){case"\\htmlClass":l.class=a,n={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,n={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,n={command:"\\htmlStyle",style:a};break;case"\\htmlData":for(var c=a.split(","),u=0;u<c.length;u++){var h=c[u].split("=");if(2!==h.length)throw new Is("Error parsing key-value for \\htmlData");l["data-"+h[0].trim()]=h[1].trim()}n={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:Mc(s)}:r.formatUnsupportedCmd(o)},htmlBuilder:(e,t)=>{var n=Dc(e.body,t,!1),r=["enclosing"]
|
|
380
380
|
;e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var o=_c.makeSpan(r,n,t);for(var i in e.attributes)"class"!==i&&e.attributes.hasOwnProperty(i)&&o.setAttribute(i,e.attributes[i]);return o},mathmlBuilder:(e,t)=>eu(e.body,t)}),Tc({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Mc(t[0]),mathml:Mc(t[1])}},htmlBuilder:(e,t)=>{var n=Dc(e.html,t,!1);return _c.makeFragment(n)},mathmlBuilder:(e,t)=>eu(e.mathml,t)});var Ah=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new Is("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!ml(n))throw new Is("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Tc({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{
|
|
381
381
|
var{parser:r}=e,o={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},s="";if(n[0])for(var l=uu(n[0],"raw").string.split(","),c=0;c<l.length;c++){var u=l[c].split("=");if(2===u.length){var h=u[1].trim();switch(u[0].trim()){case"alt":s=h;break;case"width":o=Ah(h);break;case"height":i=Ah(h);break;case"totalheight":a=Ah(h);break;default:throw new Is("Invalid key: '"+u[0]+"' in \\includegraphics.")}}}var d=uu(t[0],"url").url;return""===s&&(s=(s=(s=d).replace(/^.*[\\/]/,"")).substring(0,s.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:s,width:o,height:i,totalheight:a,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=fl(e.height,t),r=0;e.totalheight.number>0&&(r=fl(e.totalheight,t)-n);var o=0;e.width.number>0&&(o=fl(e.width,t));var i={height:gl(n+r)};o>0&&(i.width=gl(o)),r>0&&(i.verticalAlign=gl(-r));var a=new kl(e.src,e.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(e,t)=>{
|
|
382
382
|
var n=new Kc.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var r=fl(e.height,t),o=0;if(e.totalheight.number>0&&(o=fl(e.totalheight,t)-r,n.setAttribute("valign",gl(-o))),n.setAttribute("height",gl(r+o)),e.width.number>0){var i=fl(e.width,t);n.setAttribute("width",gl(i))}return n.setAttribute("src",e.src),n}}),Tc({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,o=uu(t[0],"size");if(n.settings.strict){var i="m"===r[1],a="mu"===o.value.unit;i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+o.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:o.value}},htmlBuilder:(e,t)=>_c.makeGlue(e.dimension,t),mathmlBuilder(e,t){var n=fl(e.dimension,t)
|
|
383
|
-
;return new Kc.SpaceNode(n)}}),Tc({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:o}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=_c.makeSpan([],[
|
|
384
|
-
;r.switchMode("math");var i="\\("===n?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(o),{type:"styling",mode:r.mode,style:"text",body:a}}}),Tc({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Is("Mismatched "+e.funcName)}});var Eh=(e,t)=>{switch(t.style.size){case Zs.DISPLAY.size:return e.display;case Zs.TEXT.size:return e.text;case Zs.SCRIPT.size:return e.script;case Zs.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Tc({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Mc(t[0]),text:Mc(t[1]),script:Mc(t[2]),scriptscript:Mc(t[3])}},htmlBuilder:(e,t)=>{var n=Eh(e,t),r=Dc(n,t,!1);return _c.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=Eh(e,t);return eu(n,t)}});var Th=(e,t,n,r,o,i,a)=>{e=_c.makeSpan([],[e]);var s,l,c,u=n&&Fs.isCharacterBox(n);if(t){var h=
|
|
385
|
-
kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var d=
|
|
383
|
+
;return new Kc.SpaceNode(n)}}),Tc({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:o}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=_c.makeSpan([],[Uc(e.body,t)]),n=_c.makeSpan(["inner"],[n],t)):n=_c.makeSpan(["inner"],[Uc(e.body,t)]);var r=_c.makeSpan(["fix"],[]),o=_c.makeSpan([e.alignment],[n,r],t),i=_c.makeSpan(["strut"]);return i.style.height=gl(o.height+o.depth),o.depth&&(i.style.verticalAlign=gl(-o.depth)),o.children.unshift(i),o=_c.makeSpan(["thinbox"],[o],t),_c.makeSpan(["mord","vbox"],[o],t)},mathmlBuilder:(e,t)=>{var n=new Kc.MathNode("mpadded",[tu(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),Tc({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,o=r.mode
|
|
384
|
+
;r.switchMode("math");var i="\\("===n?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(o),{type:"styling",mode:r.mode,style:"text",body:a}}}),Tc({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Is("Mismatched "+e.funcName)}});var Eh=(e,t)=>{switch(t.style.size){case Zs.DISPLAY.size:return e.display;case Zs.TEXT.size:return e.text;case Zs.SCRIPT.size:return e.script;case Zs.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Tc({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Mc(t[0]),text:Mc(t[1]),script:Mc(t[2]),scriptscript:Mc(t[3])}},htmlBuilder:(e,t)=>{var n=Eh(e,t),r=Dc(n,t,!1);return _c.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=Eh(e,t);return eu(n,t)}});var Th=(e,t,n,r,o,i,a)=>{e=_c.makeSpan([],[e]);var s,l,c,u=n&&Fs.isCharacterBox(n);if(t){var h=Uc(t,r.havingStyle(o.sup()),r);l={elem:h,
|
|
385
|
+
kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var d=Uc(n,r.havingStyle(o.sub()),r);s={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}if(l&&s){var p=r.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+a;c=_c.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:gl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:gl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(s){var m=e.height-a;c=_c.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:gl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e}]},r)}else{if(!l)return e;var f=e.depth+a;c=_c.makeVList({positionType:"bottom",positionData:f,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{
|
|
386
386
|
type:"elem",elem:l.elem,marginLeft:gl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}var g=[c];if(s&&0!==i&&!u){var v=_c.makeSpan(["mspace"],[],r);v.style.marginRight=gl(i),g.unshift(v)}return _c.makeSpan(["mop","op-limits"],g,r)},Nh=["\\smallint"],Lh=(e,t)=>{var n,r,o,i=!1;"supsub"===e.type?(n=e.sup,r=e.sub,o=uu(e.base,"op"),i=!0):o=uu(e,"op");var a,s=t.style,l=!1;if(s.size===Zs.DISPLAY.size&&o.symbol&&!Fs.contains(Nh,o.name)&&(l=!0),o.symbol){var c=l?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==o.name&&"\\oiiint"!==o.name||(u=o.name.substr(1),o.name="oiint"===u?"\\iint":"\\iiint"),a=_c.makeSymbol(o.name,c,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var h=a.italic,d=_c.staticSvg(u+"Size"+(l?"2":"1"),t);a=_c.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:d,shift:l?.08:0}]},t),o.name="\\"+u,a.classes.unshift("mop"),a.italic=h}}else if(o.body){var p=Dc(o.body,t,!0)
|
|
387
387
|
;1===p.length&&p[0]instanceof Cl?(a=p[0]).classes[0]="mop":a=_c.makeSpan(["mop"],p,t)}else{for(var m=[],f=1;f<o.name.length;f++)m.push(_c.mathsym(o.name[f],o.mode,t));a=_c.makeSpan(["mop"],m,t)}var g=0,v=0;return(a instanceof Cl||"\\oiint"===o.name||"\\oiiint"===o.name)&&!o.suppressBaseShift&&(g=(a.height-a.depth)/2-t.fontMetrics().axisHeight,v=a.italic),i?Th(a,n,r,t,s,v,g):(g&&(a.style.position="relative",a.style.top=gl(g)),a)},Mh=(e,t)=>{var n;if(e.symbol)n=new Wc("mo",[Xc(e.name,e.mode)]),Fs.contains(Nh,e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Wc("mo",Qc(e.body,t));else{n=new Wc("mi",[new Yc(e.name.slice(1))]);var r=new Wc("mo",[Xc("","text")]);n=e.parentIsSupSub?new Wc("mrow",[n,r]):Vc([n,r])}return n},zh={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Tc({type:"op",
|
|
388
388
|
names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=r;return 1===o.length&&(o=zh[o]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:Lh,mathmlBuilder:Mh}),Tc({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Mc(r)}},htmlBuilder:Lh,mathmlBuilder:Mh});var Oh={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Tc({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],
|
|
389
389
|
props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Lh,mathmlBuilder:Mh}),Tc({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Lh,mathmlBuilder:Mh}),Tc({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e,r=n;return 1===r.length&&(r=Oh[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Lh,mathmlBuilder:Mh});var Ih=(e,t)=>{var n,r,o,i,a=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,o=uu(e.base,"operatorname"),a=!0):o=uu(e,"operatorname"),o.body.length>0){for(var s=o.body.map((e=>{var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=Dc(s,t.withFont("mathrm"),!0),c=0;c<l.length;c++){
|
|
390
390
|
var u=l[c];u instanceof Cl&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=_c.makeSpan(["mop"],l,t)}else i=_c.makeSpan(["mop"],[],t);return a?Th(i,n,r,t,t.style,0,0):i};function Rh(e,t,n){for(var r=Dc(e,t,!1),o=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var a=r[i].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[a+1]==="reset-size"+t.size&&(r[i].classes[a+1]="reset-size"+n.size),r[i].height*=o,r[i].depth*=o}return _c.makeFragment(r)}Tc({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"operatorname",mode:n.mode,body:Mc(o),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:Ih,mathmlBuilder:(e,t)=>{for(var n=Qc(e.body,t.withFont("mathrm")),r=!0,o=0;o<n.length;o++){var i=n[o];if(i instanceof Kc.SpaceNode);else if(i instanceof Kc.MathNode)switch(i.type){case"mi":case"mn":case"ms":
|
|
391
|
-
case"mspace":case"mtext":break;case"mo":var a=i.children[0];1===i.children.length&&a instanceof Kc.TextNode?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var s=n.map((e=>e.toText())).join("");n=[new Kc.TextNode(s)]}var l=new Kc.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new Kc.MathNode("mo",[Xc("","text")]);return e.parentIsSupSub?new Kc.MathNode("mrow",[l,c]):Kc.newDocumentFragment([l,c])}}),nh("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Nc({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?_c.makeFragment(Dc(e.body,t,!1)):_c.makeSpan(["mord"],Dc(e.body,t,!0),t),mathmlBuilder:(e,t)=>eu(e.body,t,!0)}),Tc({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=
|
|
392
|
-
children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]},t);return _c.makeSpan(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Kc.MathNode("mo",[new Kc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Kc.MathNode("mover",[tu(e.body,t),n]);return r.setAttribute("accent","true"),r}}),Tc({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:Mc(r)}},htmlBuilder:(e,t)=>{var n=Dc(e.body,t.withPhantom(),!1);return _c.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Qc(e.body,t);return new Kc.MathNode("mphantom",n)}}),Tc({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=_c.makeSpan([],[
|
|
393
|
-
;return n=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),_c.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=Qc(Mc(e.body),t),r=new Kc.MathNode("mphantom",n),o=new Kc.MathNode("mpadded",[r]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),Tc({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=_c.makeSpan(["inner"],[
|
|
391
|
+
case"mspace":case"mtext":break;case"mo":var a=i.children[0];1===i.children.length&&a instanceof Kc.TextNode?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var s=n.map((e=>e.toText())).join("");n=[new Kc.TextNode(s)]}var l=new Kc.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new Kc.MathNode("mo",[Xc("","text")]);return e.parentIsSupSub?new Kc.MathNode("mrow",[l,c]):Kc.newDocumentFragment([l,c])}}),nh("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Nc({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?_c.makeFragment(Dc(e.body,t,!1)):_c.makeSpan(["mord"],Dc(e.body,t,!0),t),mathmlBuilder:(e,t)=>eu(e.body,t,!0)}),Tc({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=Uc(e.body,t.havingCrampedStyle()),r=_c.makeLineSpan("overline-line",t),o=t.fontMetrics().defaultRuleThickness,i=_c.makeVList({positionType:"firstBaseline",
|
|
392
|
+
children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]},t);return _c.makeSpan(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Kc.MathNode("mo",[new Kc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Kc.MathNode("mover",[tu(e.body,t),n]);return r.setAttribute("accent","true"),r}}),Tc({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:Mc(r)}},htmlBuilder:(e,t)=>{var n=Dc(e.body,t.withPhantom(),!1);return _c.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Qc(e.body,t);return new Kc.MathNode("mphantom",n)}}),Tc({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=_c.makeSpan([],[Uc(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0
|
|
393
|
+
;return n=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),_c.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=Qc(Mc(e.body),t),r=new Kc.MathNode("mphantom",n),o=new Kc.MathNode("mpadded",[r]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),Tc({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=_c.makeSpan(["inner"],[Uc(e.body,t.withPhantom())]),r=_c.makeSpan(["fix"],[]);return _c.makeSpan(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Qc(Mc(e.body),t),r=new Kc.MathNode("mphantom",n),o=new Kc.MathNode("mpadded",[r]);return o.setAttribute("width","0px"),o}}),Tc({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=uu(t[0],"size").value,o=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:o}},htmlBuilder(e,t){var n=Uc(e.body,t),r=fl(e.dy,t)
|
|
394
394
|
;return _c.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new Kc.MathNode("mpadded",[tu(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),Tc({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),Tc({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,o=n[0],i=uu(t[0],"size"),a=uu(t[1],"size");return{type:"rule",mode:r.mode,shift:o&&uu(o,"size").value,width:i.value,height:a.value}},htmlBuilder(e,t){var n=_c.makeSpan(["mord","rule"],[],t),r=fl(e.width,t),o=fl(e.height,t),i=e.shift?fl(e.shift,t):0;return n.style.borderRightWidth=gl(r),n.style.borderTopWidth=gl(o),n.style.bottom=gl(i),n.width=r,n.height=o+i,n.depth=-i,n.maxFontSize=1.125*o*t.sizeMultiplier,n},mathmlBuilder(e,t){
|
|
395
395
|
var n=fl(e.width,t),r=fl(e.height,t),o=e.shift?fl(e.shift,t):0,i=t.color&&t.getColor()||"black",a=new Kc.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",gl(n)),a.setAttribute("height",gl(r));var s=new Kc.MathNode("mpadded",[a]);return o>=0?s.setAttribute("height",gl(o)):(s.setAttribute("height",gl(o)),s.setAttribute("depth",gl(-o))),s.setAttribute("voffset",gl(o)),s}});var Ph=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];Tc({type:"sizing",names:Ph,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:o}=e,i=o.parseExpression(!1,n);return{type:"sizing",mode:o.mode,size:Ph.indexOf(r)+1,body:i}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return Rh(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Qc(e.body,n),o=new Kc.MathNode("mstyle",r);return o.setAttribute("mathsize",gl(n.sizeMultiplier)),o}}),Tc({type:"smash",names:["\\smash"],props:{
|
|
396
|
-
numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,o=!1,i=!1,a=n[0]&&uu(n[0],"ordgroup");if(a)for(var s="",l=0;l<a.body.length;++l){if("t"===(s=a.body[l].text))o=!0;else{if("b"!==s){o=!1,i=!1;break}i=!0}}else o=!0,i=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:o,smashDepth:i}},htmlBuilder:(e,t)=>{var n=_c.makeSpan([],[
|
|
397
|
-
var{parser:r}=e,o=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:o}},htmlBuilder(e,t){var n=
|
|
396
|
+
numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,o=!1,i=!1,a=n[0]&&uu(n[0],"ordgroup");if(a)for(var s="",l=0;l<a.body.length;++l){if("t"===(s=a.body[l].text))o=!0;else{if("b"!==s){o=!1,i=!1;break}i=!0}}else o=!0,i=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:o,smashDepth:i}},htmlBuilder:(e,t)=>{var n=_c.makeSpan([],[Uc(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(e.smashDepth&&(n.depth=0,n.children))for(var o=0;o<n.children.length;o++)n.children[o].depth=0;var i=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t);return _c.makeSpan(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var n=new Kc.MathNode("mpadded",[tu(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),Tc({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){
|
|
397
|
+
var{parser:r}=e,o=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:o}},htmlBuilder(e,t){var n=Uc(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=_c.wrapFragment(n,t);var r=t.fontMetrics().defaultRuleThickness,o=r;t.style.id<Zs.TEXT.id&&(o=t.fontMetrics().xHeight);var i=r+o/4,a=n.height+n.depth+i+r,{span:s,ruleWidth:l,advanceWidth:c}=Vu.sqrtImage(a,t),u=s.height-l;u>n.height+n.depth+i&&(i=(i+u-n.height-n.depth)/2);var h=s.height-n.height-i-l;n.style.paddingLeft=gl(c);var d=_c.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:s},{type:"kern",size:l}]},t);if(e.index){var p=t.havingStyle(Zs.SCRIPTSCRIPT),m=Uc(e.index,p,t),f=.6*(d.height-d.depth),g=_c.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:m}]},t),v=_c.makeSpan(["root"],[g]);return _c.makeSpan(["mord","sqrt"],[v,d],t)}return _c.makeSpan(["mord","sqrt"],[d],t)},mathmlBuilder(e,t){
|
|
398
398
|
var{body:n,index:r}=e;return r?new Kc.MathNode("mroot",[tu(n,t),tu(r,t)]):new Kc.MathNode("msqrt",[tu(n,t)])}});var Dh={display:Zs.DISPLAY,text:Zs.TEXT,script:Zs.SCRIPT,scriptscript:Zs.SCRIPTSCRIPT};Tc({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:o}=e,i=o.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:o.mode,style:a,body:i}},htmlBuilder(e,t){var n=Dh[e.style],r=t.havingStyle(n).withFont("");return Rh(e.body,r,t)},mathmlBuilder(e,t){var n=Dh[e.style],r=t.havingStyle(n),o=Qc(e.body,r),i=new Kc.MathNode("mstyle",o),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});Nc({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base
|
|
399
|
-
;return n?"op"===n.type?n.limits&&(t.style.size===Zs.DISPLAY.size||n.alwaysHandleSupSub)?Lh:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===Zs.DISPLAY.size||n.limits)?Ih:null:"accent"===n.type?Fs.isCharacterBox(n.base)?pu:null:"horizBrace"===n.type&&!e.sub===n.isOver?Ch:null:null}(e,t);if(n)return n(e,t);var r,o,i,{base:a,sup:s,sub:l}=e,c=
|
|
399
|
+
;return n?"op"===n.type?n.limits&&(t.style.size===Zs.DISPLAY.size||n.alwaysHandleSupSub)?Lh:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===Zs.DISPLAY.size||n.limits)?Ih:null:"accent"===n.type?Fs.isCharacterBox(n.base)?pu:null:"horizBrace"===n.type&&!e.sub===n.isOver?Ch:null:null}(e,t);if(n)return n(e,t);var r,o,i,{base:a,sup:s,sub:l}=e,c=Uc(a,t),u=t.fontMetrics(),h=0,d=0,p=a&&Fs.isCharacterBox(a);if(s){var m=t.havingStyle(t.style.sup());r=Uc(s,m,t),p||(h=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(l){var f=t.havingStyle(t.style.sub());o=Uc(l,f,t),p||(d=c.depth+f.fontMetrics().subDrop*f.sizeMultiplier/t.sizeMultiplier)}i=t.style===Zs.DISPLAY?u.sup1:t.style.cramped?u.sup3:u.sup2;var g,v=t.sizeMultiplier,y=gl(.5/u.ptPerEm/v),_=null;if(o){var b=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof Cl||b)&&(_=gl(-c.italic))}if(r&&o){h=Math.max(h,i,r.depth+.25*u.xHeight),d=Math.max(d,u.sub2)
|
|
400
400
|
;var w=4*u.defaultRuleThickness;if(h-r.depth-(o.height-d)<w){d=w-(h-r.depth)+o.height;var x=.8*u.xHeight-(h-r.depth);x>0&&(h+=x,d-=x)}var k=[{type:"elem",elem:o,shift:d,marginRight:y,marginLeft:_},{type:"elem",elem:r,shift:-h,marginRight:y}];g=_c.makeVList({positionType:"individualShift",children:k},t)}else if(o){d=Math.max(d,u.sub1,o.height-.8*u.xHeight);var S=[{type:"elem",elem:o,marginLeft:_,marginRight:y}];g=_c.makeVList({positionType:"shift",positionData:d,children:S},t)}else{if(!r)throw new Error("supsub must have either sup or sub.");h=Math.max(h,i,r.depth+.25*u.xHeight),g=_c.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:r,marginRight:y}]},t)}var C=Hc(c,"right")||"mord";return _c.makeSpan([C],[c,_c.makeSpan(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var o,i=[tu(e.base,t)]
|
|
401
401
|
;if(e.sub&&i.push(tu(e.sub,t)),e.sup&&i.push(tu(e.sup,t)),r)o=n?"mover":"munder";else if(e.sub)if(e.sup){var a=e.base;o=a&&"op"===a.type&&a.limits&&t.style===Zs.DISPLAY||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(t.style===Zs.DISPLAY||a.limits)?"munderover":"msubsup"}else{var s=e.base;o=s&&"op"===s.type&&s.limits&&(t.style===Zs.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===Zs.DISPLAY)?"munder":"msub"}else{var l=e.base;o=l&&"op"===l.type&&l.limits&&(t.style===Zs.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===Zs.DISPLAY)?"mover":"msup"}return new Kc.MathNode(o,i)}}),Nc({type:"atom",htmlBuilder:(e,t)=>_c.mathsym(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new Kc.MathNode("mo",[Xc(e.text,e.mode)]);if("bin"===e.family){var r=Jc(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)
|
|
402
402
|
}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var Bh={mi:"italic",mn:"normal",mtext:"normal"};Nc({type:"mathord",htmlBuilder:(e,t)=>_c.makeOrd(e,t,"mathord"),mathmlBuilder(e,t){var n=new Kc.MathNode("mi",[Xc(e.text,e.mode,t)]),r=Jc(e,t)||"italic";return r!==Bh[n.type]&&n.setAttribute("mathvariant",r),n}}),Nc({type:"textord",htmlBuilder:(e,t)=>_c.makeOrd(e,t,"textord"),mathmlBuilder(e,t){var n,r=Xc(e.text,e.mode,t),o=Jc(e,t)||"normal";return n="text"===e.mode?new Kc.MathNode("mtext",[r]):/[0-9]/.test(e.text)?new Kc.MathNode("mn",[r]):"\\prime"===e.text?new Kc.MathNode("mo",[r]):new Kc.MathNode("mi",[r]),o!==Bh[n.type]&&n.setAttribute("mathvariant",o),n}});var Fh={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},jh={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Nc({type:"spacing",htmlBuilder(e,t){if(jh.hasOwnProperty(e.text)){var n=jh[e.text].className||""
|
|
403
|
-
;if("text"===e.mode){var r=_c.makeOrd(e,t,"textord");return r.classes.push(n),r}return _c.makeSpan(["mspace",n],[_c.mathsym(e.text,e.mode,t)],t)}if(Fh.hasOwnProperty(e.text))return _c.makeSpan(["mspace",Fh[e.text]],[],t);throw new Is('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!jh.hasOwnProperty(e.text)){if(Fh.hasOwnProperty(e.text))return new Kc.MathNode("mspace");throw new Is('Unknown type of space "'+e.text+'"')}return new Kc.MathNode("mtext",[new Kc.TextNode(" ")])}});var Hh=()=>{var e=new Kc.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Nc({type:"tag",mathmlBuilder(e,t){var n=new Kc.MathNode("mtable",[new Kc.MathNode("mtr",[Hh(),new Kc.MathNode("mtd",[eu(e.body,t)]),Hh(),new Kc.MathNode("mtd",[eu(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var
|
|
404
|
-
;return n?
|
|
405
|
-
},mathmlBuilder(e,t){var n=new Kc.MathNode("mo",[new Kc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Kc.MathNode("munder",[tu(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),Tc({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=
|
|
403
|
+
;if("text"===e.mode){var r=_c.makeOrd(e,t,"textord");return r.classes.push(n),r}return _c.makeSpan(["mspace",n],[_c.mathsym(e.text,e.mode,t)],t)}if(Fh.hasOwnProperty(e.text))return _c.makeSpan(["mspace",Fh[e.text]],[],t);throw new Is('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!jh.hasOwnProperty(e.text)){if(Fh.hasOwnProperty(e.text))return new Kc.MathNode("mspace");throw new Is('Unknown type of space "'+e.text+'"')}return new Kc.MathNode("mtext",[new Kc.TextNode(" ")])}});var Hh=()=>{var e=new Kc.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Nc({type:"tag",mathmlBuilder(e,t){var n=new Kc.MathNode("mtable",[new Kc.MathNode("mtr",[Hh(),new Kc.MathNode("mtd",[eu(e.body,t)]),Hh(),new Kc.MathNode("mtd",[eu(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var qh={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Uh={"\\textbf":"textbf","\\textmd":"textmd"},$h={"\\textit":"textit","\\textup":"textup"},Gh=(e,t)=>{var n=e.font
|
|
404
|
+
;return n?qh[n]?t.withTextFontFamily(qh[n]):Uh[n]?t.withTextFontWeight(Uh[n]):t.withTextFontShape($h[n]):t};Tc({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"text",mode:n.mode,body:Mc(o),font:r}},htmlBuilder(e,t){var n=Gh(e,t),r=Dc(e.body,n,!0);return _c.makeSpan(["mord","text"],r,n)},mathmlBuilder(e,t){var n=Gh(e,t);return eu(e.body,n)}}),Tc({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Uc(e.body,t),r=_c.makeLineSpan("underline-line",t),o=t.fontMetrics().defaultRuleThickness,i=_c.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:o},{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n}]},t);return _c.makeSpan(["mord","underline"],[i],t)
|
|
405
|
+
},mathmlBuilder(e,t){var n=new Kc.MathNode("mo",[new Kc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Kc.MathNode("munder",[tu(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),Tc({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Uc(e.body,t),r=t.fontMetrics().axisHeight,o=.5*(n.height-r-(n.depth+r));return _c.makeVList({positionType:"shift",positionData:o,children:[{type:"elem",elem:n}]},t)},mathmlBuilder:(e,t)=>new Kc.MathNode("mpadded",[tu(e.body,t)],["vcenter"])}),Tc({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Is("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=Vh(e),r=[],o=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var a=n[i];"~"===a&&(a="\\textasciitilde"),r.push(_c.makeSymbol(a,"Typewriter-Regular",e.mode,o,["mord","texttt"]))}
|
|
406
406
|
return _c.makeSpan(["mord","text"].concat(o.sizingClasses(t)),_c.tryCombineChars(r),o)},mathmlBuilder(e,t){var n=new Kc.TextNode(Vh(e)),r=new Kc.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var Vh=e=>e.body.replace(/ /g,e.star?"␣":" "),Wh=Cc,Yh=new RegExp("[̀-ͯ]+$");class Kh{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp("([ \r\n\t]+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-][̀-ͯ]*|[\ud800-\udbff][\udc00-\udfff][̀-ͯ]*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|(\\\\[a-zA-Z@]+)[ \r\n\t]*|\\\\[^\ud800-\udfff])","g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Os("EOF",new zs(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new Is("Unexpected character: '"+e[t]+"'",new Os(e[t],new zs(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ")
|
|
407
407
|
;if(14===this.catcodes[r]){var o=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===o?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=o+1,this.lex()}return new Os(r,new zs(this,t,this.tokenRegex.lastIndex))}}class Xh{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new Is("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){
|
|
408
408
|
return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var o=this.undefStack[this.undefStack.length-1];o&&!o.hasOwnProperty(e)&&(o[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t}}var Zh=th;nh("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),nh("\\expandafter",(function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),nh("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),nh("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),nh("\\@ifnextchar",(function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),
|
|
@@ -441,7 +441,7 @@ color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"=
|
|
|
441
441
|
;var o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:n.loc,body:o};return t&&this.switchMode(r),i}parseGroup(e,t){var n,r=this.fetch(),o=r.text;if("{"===o||"\\begingroup"===o){this.consume();var i="{"===o?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,i),s=this.fetch();this.expect(i),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:zs.range(r,s),body:a,semisimple:"\\begingroup"===o||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===o[0]&&!rd.hasOwnProperty(o)){if(this.settings.throwOnError)throw new Is("Undefined control sequence: "+o,r);n=this.formatUnsupportedCmd(o),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n],o=r.text;"-"===o&&"-"===e[n+1].text&&(n+1<t&&"-"===e[n+2].text?(e.splice(n,3,{type:"textord",mode:"text",loc:zs.range(r,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:zs.range(r,e[n+1]),text:"--"}),
|
|
442
442
|
t-=1)),"'"!==o&&"`"!==o||e[n+1].text!==o||(e.splice(n,2,{type:"textord",mode:"text",loc:zs.range(r,e[n+1]),text:o+o}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new Is("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}ad.hasOwnProperty(t[0])&&!zl[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=ad[t[0]]+t.substr(1));var o,i=Yh.exec(t);if(i&&("i"===(t=t.substring(0,i.index))?t="ı":"j"===t&&(t="ȷ")),zl[this.mode][t]){this.settings.strict&&"math"===this.mode&&"ÐÞþ".indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e)
|
|
443
443
|
;var a,s=zl[this.mode][t].group,l=zs.range(e);if(Ll.hasOwnProperty(s)){var c=s;a={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else a={type:s,mode:this.mode,loc:l,text:t};o=a}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(el(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),o={type:"textord",mode:"text",loc:zs.range(e),text:t}}if(this.consume(),i)for(var u=0;u<i[0].length;u++){var h=i[0][u];if(!id[h])throw new Is("Unknown accent ' "+h+"'",e);var d=id[h][this.mode]||id[h].text;if(!d)throw new Is("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:zs.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}}sd.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var ld=function(e,t){
|
|
444
|
-
if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new sd(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new Is("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new Os("\\df@tag")])}]}return r};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."));var cd=function(e,t,n){if(n.throwOnError||!(e instanceof Is))throw e;var r=_c.makeSpan(["katex-error"],[new Cl(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},ud=function(e,t){var n=new
|
|
444
|
+
if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new sd(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new Is("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new Os("\\df@tag")])}]}return r};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."));var cd=function(e,t,n){if(n.throwOnError||!(e instanceof Is))throw e;var r=_c.makeSpan(["katex-error"],[new Cl(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},ud=function(e,t){var n=new qs(t);try{return function(e,t,n){var r,o=ru(n);if("mathml"===n.output)return nu(e,t,o,n.displayMode,!0)
|
|
445
445
|
;if("html"===n.output){var i=Gc(e,o);r=_c.makeSpan(["katex"],[i])}else{var a=nu(e,t,o,n.displayMode,!1),s=Gc(e,o);r=_c.makeSpan(["katex"],[a,s])}return ou(r,n)}(ld(e,n),e,n)}catch(t){return cd(t,e,n)}},hd=function(e,t){return ud(e,t).toMarkup()},dd={exports:{}};!function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,
|
|
446
446
|
describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",
|
|
447
447
|
type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,
|
|
@@ -515,7 +515,7 @@ o=n.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":o=n.subPa
|
|
|
515
515
|
;for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t);r+="**"}return r})),n.subParser("makeMarkdown.table",(function(e,t){var r,o,i="",a=[[],[]],s=e.querySelectorAll("thead>tr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;r<s.length;++r){var c=n.subParser("makeMarkdown.tableCell")(s[r],t),u="---";if(s[r].hasAttribute("style"))switch(s[r].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":u=":---";break;case"text-align:right;":u="---:";break;case"text-align:center;":u=":---:"}a[0][r]=c.trim(),a[1][r]=u}for(r=0;r<l.length;++r){var h=a.push([])-1,d=l[r].getElementsByTagName("td");for(o=0;o<s.length;++o){var p=" ";void 0!==d[o]&&(p=n.subParser("makeMarkdown.tableCell")(d[o],t)),a[h].push(p)}}var m=3;for(r=0;r<a.length;++r)for(o=0;o<a[r].length;++o){var f=a[r][o].length;f>m&&(m=f)}for(r=0;r<a.length;++r){
|
|
516
516
|
for(o=0;o<a[r].length;++o)1===r?":"===a[r][o].slice(-1)?a[r][o]=n.helper.padEnd(a[r][o].slice(-1),m-1,"-")+":":a[r][o]=n.helper.padEnd(a[r][o],m,"-"):a[r][o]=n.helper.padEnd(a[r][o],m);i+="| "+a[r].join(" | ")+" |\n"}return i.trim()})),n.subParser("makeMarkdown.tableCell",(function(e,t){var r="";if(!e.hasChildNodes())return"";for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t,!0);return r.trim()})),n.subParser("makeMarkdown.txt",(function(e){var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),t=(t=(t=(t=(t=(t=(t=(t=(t=n.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}));e.exports?e.exports=n:this.showdown=n}).call(X)}(dd);var pd=dd.exports;const md=Ns(window);function fd(){return[{
|
|
517
517
|
type:"output",filter:function(e){return e.replace(/<a href=/g,'<a target="_blank" href=')}}]}let gd;function vd(e){return"{math:"+e.toString()+"}"}function yd(e){const t=function(e){const t=[];let n=0,r=e;for(;;){const e=r.indexOf("$$",n),o=r.indexOf("\\(",n);if(-1===e&&-1===o)break;let i,a;if(-1!==e&&(-1===o||e<o)?(i=e,a=r.indexOf("$$",i+2)):(i=o,a=r.indexOf("\\)",i+2)),-1===a)break;a+=2;const s=t.length+1,l=vd(s);let c;t.push({id:s,expression:r.slice(i+2,a-2),inline:-1!==o}),c=-1!==o?l:"\n\n"+l+"\n\n",r=r.slice(0,i)+c+r.slice(a),n=i+c.length}return{mathBlocks:t,content:r}}(e),n=md.sanitize(function(e){return gd||(gd=new pd.Converter({extensions:[fd],simplifiedAutoLink:!0,literalMidWordUnderscores:!0,strikethrough:!0})),gd.makeHtml(e)}(t.content)),r=function(e,t){return t.reduce(((e,t)=>{let n;try{n=t.inline?hd(t.expression):hd(t.expression,{displayMode:!0})}catch(e){n=Ms(t.expression)}return e.replace(vd(t.id),n)}),e)}(n,t.mathBlocks);return r}function _d({markdown:e="",textClass:t={},textStyle:n={}}){
|
|
518
|
-
const r=no((()=>e?yd(e):""),[e]),o=to();Qr((()=>{!function(e,{className:t}={}){const n=Array.from(e.getElementsByTagName("a"));for(let e of n){const n=Ia(e);n&&(t?n.className=t:n.style.width="350px")}}(o.current,{className:"MarkdownView__embed"})}),[e]);return po("div",{className:
|
|
518
|
+
const r=no((()=>e?yd(e):""),[e]),o=to();Qr((()=>{!function(e,{className:t}={}){const n=Array.from(e.getElementsByTagName("a"));for(let e of n){const n=Ia(e);n&&(t?n.className=t:n.style.width="350px")}}(o.current,{className:"MarkdownView__embed"})}),[e]);return po("div",{className:qr("MarkdownView",t),dir:"auto",lang:"",ref:o,dangerouslySetInnerHTML:{__html:r},style:n})}function bd({annotation:e,tags:t}){const n=ii(),r=n.defaultAuthority(),o=no((()=>!Qo(e.user,r)),[e,r]),i=e=>n.getLink("search.tag",{tag:e});return po("ul",{className:"TagList","aria-label":"Annotation tags",children:t.map((e=>po("li",{className:"TagList__item",children:[o&&po("a",{className:"TagList__link",href:i(e),lang:"",target:"_blank",rel:"noopener noreferrer","aria-label":`Tag: ${e}`,title:`View annotations with tag: ${e}`,children:e}),!o&&po("span",{className:"TagList__text","aria-label":`Tag: ${e}`,lang:"",children:e})]},e)))})}md.addHook("afterSanitizeAttributes",(e=>{"target"in e&&e.setAttribute("target","_blank")}))
|
|
519
519
|
;var wd=ri((function({annotation:e,settings:t}){var n,r;const[o,i]=Zr(!0),[a,s]=Zr(!1),l=ii().getDraft(e),c=o?"More":"Less",u=null!==(n=null==l?void 0:l.tags)&&void 0!==n?n:e.tags,h=null!==(r=null==l?void 0:l.text)&&void 0!==r?r:e.text,d=h.length>0,p=u.length>0,m=ti(["annotationFontFamily"],t);return po("div",{className:"hyp-u-vertical-spacing--2",children:[d&&po(Ta,{collapse:o,collapsedHeight:400,inlineControls:!1,onCollapsibleChanged:s,onToggleCollapsed:i,overflowThreshold:20,children:po(_d,{textStyle:m,markdown:h,textClass:{AnnotationBody__text:!0,"p-redacted-content":Ti(e)}})}),a&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{expanded:!o,onClick:()=>i(!o),title:`Toggle visibility of full annotation text: Show ${c}`,children:c})}),p&&po(bd,{annotation:e,tags:u})]})}),["settings"]);const xd=0,kd=1;function Sd(e,t,n,r){let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,
|
|
520
520
|
i+=r.length-n):i<=t||(o<=t&&i>=t+n?i+=r.length-n:o<t&&i<t+n?o=t:o<t+n&&i>t+n?i+=r.length-n:t<o&&t+n>i&&(o=t,i=t+n)),{text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Cd(e,t=xd){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===kd&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Sd(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://insert-your-link-here.com";return r=Sd(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Ad(e,t,n,r){void 0===n&&(n=t);const o=e.text.slice(e.selectionStart-t.length,e.selectionStart),i=e.text.slice(e.selectionEnd,e.selectionEnd+t.length);let a=e;return e.selectionStart===e.selectionEnd&&r&&(a=Sd(e,e.selectionStart,0,r),a.selectionStart=a.selectionEnd-r.length),
|
|
521
521
|
o===t&&i===n?(a=Sd(a,a.selectionStart-t.length,t.length,""),a=Sd(a,a.selectionEnd,n.length,"")):(a=Sd(a,a.selectionStart,0,t),a=Sd(a,a.selectionEnd,0,n)),a}function Ed(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Td(e,t,n,r){let o=function(e,t){const n=e.lastIndexOf("\n",t);return n<0?0:n+1}(e.text,t),i=Ed(e.text,t);for(;i<=Ed(e.text,n);){const t=i===e.text.length,a=i-o,s=Ed((e=r(e,o,i)).text,o)-o;if(n+=s-a,t)break;o=o+s+1,i=Ed(e.text,o)}return e}function Nd(e,t){const n=e.selectionStart,r=e.selectionEnd;let o=!0;return Td(e,n,r,((e,n)=>(e.text.slice(n,n+t.length)!==t&&(o=!1),e))),Td(e,n,r,o?(e,n)=>Sd(e,n,t.length,""):(e,n)=>e.text.slice(n,n+t.length)===t?e:Sd(e,n,0,t))}const Ld={bold:"b",italic:"i",link:"l",quote:"q",image:"g",numlist:"o",list:"u"};function Md({buttonRef:e,disabled:t=!1,iconName:n="",label:r,onClick:o,shortcutKey:i,tabIndex:a,title:s=""}){const l=no((()=>((e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0)()?"Cmd":"Ctrl"),[]);let c=s;i&&(c+=` (${l}-${i.toUpperCase()})`)
|
|
@@ -523,13 +523,13 @@ o===t&&i===n?(a=Sd(a,a.selectionStart-t.length,t.length,""),a=Sd(a,a.selectionEn
|
|
|
523
523
|
iconName:"format-italic",onClick:()=>t("italic"),shortcutKey:Ld.italic,buttonRef:g[o],tabIndex:v(o),title:"Italic"}),po(Md,{disabled:e,iconName:"format-quote",onClick:()=>t("quote"),shortcutKey:Ld.quote,buttonRef:g[i],tabIndex:v(i),title:"Quote"}),po(Md,{disabled:e,iconName:"link",onClick:()=>t("link"),shortcutKey:Ld.link,buttonRef:g[a],tabIndex:v(a),title:"Insert link"}),po(Md,{disabled:e,iconName:"image",onClick:()=>t("image"),shortcutKey:Ld.image,buttonRef:g[s],tabIndex:v(s),title:"Insert image"}),po(Md,{disabled:e,iconName:"format-functions",onClick:()=>t("math"),buttonRef:g[l],tabIndex:v(l),title:"Insert math (LaTeX is supported)"}),po(Md,{disabled:e,iconName:"format-list-numbered",onClick:()=>t("numlist"),shortcutKey:Ld.numlist,buttonRef:g[c],tabIndex:v(c),title:"Numbered list"}),po(Md,{disabled:e,iconName:"format-list-unordered",onClick:()=>t("list"),shortcutKey:Ld.list,buttonRef:g[u],tabIndex:v(u),title:"Bulleted list"}),po("span",{className:"hyp-u-stretch"}),po("div",{
|
|
524
524
|
className:"hyp-u-layout-row--center",children:po(zo,{href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",classes:"text-tiny IconOnlyLink",linkRef:g[h],tabIndex:v(h),title:"Formatting help","aria-label":"Formatting help",children:po(Mo,{name:"help"})})}),po(Md,{label:e?"Write":"Preview",onClick:n,buttonRef:g[d],tabIndex:v(d)})]})}function Od({label:e="",onEditText:t=(()=>{}),text:n="",textStyle:r={}}){const[o,i]=Zr(!1),a=to(null);Qr((()=>{var e;o||(null===(e=a.current)||void 0===e||e.focus())}),[o]);const s=e=>{a.current&&(!function(e,t){const n=e=>{const n=e({text:t.value,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd});t.value=n.text,t.selectionStart=n.selectionStart,t.selectionEnd=n.selectionEnd,t.focus()},r=e=>{const t=e.text.slice(0,e.selectionStart);return 0===t.length||"\n"===t.slice(-1)||"$$"===t.slice(-2)?Ad(e,"$$","$$","Insert LaTeX"):Ad(e,"\\(","\\)","Insert LaTeX")};switch(e){case"bold":n((e=>Ad(e,"**","**","Bold")));break;case"italic":
|
|
525
525
|
n((e=>Ad(e,"*","*","Italic")));break;case"quote":n((e=>Nd(e,"> ")));break;case"link":n((e=>Cd(e)));break;case"image":n((e=>Cd(e,kd)));break;case"math":n(r);break;case"numlist":n((e=>Nd(e,"1. ")));break;case"list":n((e=>Nd(e,"* ")));break;default:throw new Error(`Unknown toolbar command "${e}"`)}}(e,a.current),t({text:a.current.value}))};return po("div",{className:"leading-none",children:[po(zd,{onCommand:s,isPreviewing:o,onTogglePreview:()=>i(!o)}),o?po(_d,{markdown:n,textClass:{"hyp-u-border":!0,"hyp-u-bg-color--grey-1":!0,"hyp-u-padding":!0},textStyle:r}):po("textarea",{"aria-label":e,className:"MarkdownEditor__input",dir:"auto",ref:a,onClick:e=>e.stopPropagation(),onKeyDown:e=>{if(e.ctrlKey||e.metaKey)for(let[t,n]of Object.entries(Ld))n===Oo(e.key)&&(e.stopPropagation(),e.preventDefault(),s(t))},onInput:e=>{t({text:e.target.value})},value:n,style:r})]})}const Id=e=>e;function Rd({activeItem:e=-1,id:t,itemPrefixId:n,list:r,listFormatter:o=Id,onSelectItem:i,open:a=!1}){const s=no((()=>r.map(((t,r)=>{
|
|
526
|
-
const a=n?{id:`${n}${r}`}:{};return po("li",{role:"option","aria-selected":(e===r).toString(),className:
|
|
526
|
+
const a=n?{id:`${n}${r}`}:{};return po("li",{role:"option","aria-selected":(e===r).toString(),className:qr({"is-selected":e===r},"AutocompleteList__li"),onClick:()=>{i(t)},...a,children:o(t,r)},`AutocompleteList-${r}`)}))),[e,n,r,o,i]),l=t?{id:t}:{},c=0===r.length||!a;return po("div",{className:qr({"is-hidden":c},"AutocompleteList"),children:po("ul",{className:"AutocompleteList__items",tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s})})}let Pd=0;var Dd=ri((function({onAddTag:e,onRemoveTag:t,onTagInput:n,tagList:r,tags:o}){const i=to(),[a,s]=Zr([]),[l,c]=Zr(-1),[u,h]=Zr(!1),[d]=Zr((()=>(++Pd,`TagEditor-${Pd}`))),p=to();Ro(p,u,(()=>{h(!1)}));const m=()=>i.current.value.trim(),f=()=>m()&&m().length>0,g=()=>{i.current.value="",null==n||n("")},v=t=>{e(t)&&(h(!1),c(-1),g(),i.current.focus())},y=e=>{let t=l+e;t<-1?t=a.length-1:t>=a.length&&(t=-1),c(t)},_=l>=0?`${d}-AutocompleteList-item-${l}`:"";return po("div",{className:"TagEditor",children:[po("ul",{className:"TagEditor__tags",
|
|
527
527
|
"aria-label":"Suggested tags for annotation",children:r.map((e=>po("li",{className:"TagEditor__item","aria-label":`Tag: ${e}`,children:[po("span",{lang:"",className:"TagEditor__edit",children:e}),po("button",{onClick:()=>{t(e)},"aria-label":`Remove Tag: ${e}`,title:`Remove Tag: ${e}`,className:"TagEditor__delete",children:po(Mo,{name:"cancel"})})]},`${e}`)))}),po("span",{id:d,className:"TagEditor__combobox-wrapper",ref:p,role:"combobox","aria-expanded":u.toString(),"aria-owns":`${d}-AutocompleteList`,"aria-haspopup":"listbox",children:[po("input",{onInput:()=>{null==n||n(m()),(()=>{if(f()){const e=o.filter(m());s(((e,t)=>{const n=[];return e.forEach((e=>{t.indexOf(e)<0&&n.push(e)})),n.sort()})(e,r)),h(e.length>0)}else h(!1);c(-1)})()},onKeyDown:e=>{switch(Oo(e.key)){case"ArrowUp":y(-1),e.preventDefault();break;case"ArrowDown":y(1),e.preventDefault();break;case"Escape":g(),e.preventDefault();break;case"Enter":case",":v(-1===l?m():a[l]),e.preventDefault();break;case"Tab":if(!f())break
|
|
528
528
|
;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&h(!0)},ref:i,placeholder:"Add new tags",className:"TagEditor__input",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":_,"aria-controls":`${d}-AutocompleteList`,dir:"auto"}),po(Rd,{id:`${d}-AutocompleteList`,list:a,listFormatter:e=>{const t=m().toLowerCase(),n=e.toLowerCase().indexOf(t);if(-1===n)return po("span",{children:e});const r=e.slice(0,n),o=e.slice(n,n+t.length),i=e.slice(n+t.length);return po("span",{children:[po("strong",{children:r}),o,po("strong",{children:i})]})},open:u,onSelectItem:e=>{e&&v(e)},itemPrefixId:`${d}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);function Bd(){return po("div",{className:"hyp-u-padding--top hyp-u-border--top text-sm leading-none",children:po(zo,{classes:"hyp-u-layout-row--align-center p-link--muted",href:"http://creativecommons.org/publicdomain/zero/1.0/",target:"_blank",
|
|
529
529
|
title:"View more information about the Creative Commons Public Domain dedication",children:[po(Mo,{name:"cc-std",classes:"text-tiny"}),po(Mo,{name:"cc-zero",classes:"hyp-u-margin--left--1 text-tiny"}),po("div",{className:"hyp-u-margin--left--2",children:"Annotations can be freely reused by anyone for any purpose."})]})})}function Fd(e){return null!==e.offsetParent}function jd({className:e,closeMenu:t,children:n,visible:r}){const o=to();Qr((()=>{let e=null;return r&&(e=setTimeout((()=>{const e=o.current.querySelector('[role^="menuitem"]');e&&e.focus()}))),()=>{clearTimeout(e)}}),[r]);return po("div",{role:"menu",className:e,ref:o,onKeyDown:e=>{const n=Array.from(o.current.querySelectorAll('[role^="menuitem"]')).filter(Fd);let r=n.findIndex((e=>e.contains(document.activeElement))),i=!1;switch(Oo(e.key)){case"ArrowLeft":case"Escape":t&&(t(e),i=!0);break;case"ArrowUp":r-=1,r<0&&(r=n.length-1),i=!0;break;case"ArrowDown":r+=1,r===n.length&&(r=0),i=!0;break;case"Home":r=0,i=!0;break;case"End":r=n.length-1,i=!0}
|
|
530
|
-
i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}function Hd({className:e}){return po("svg",{className:
|
|
531
|
-
"aria-label":u,title:u,children:po("span",{className:"Menu__toggle-wrapper",children:[a,c&&po("span",{className:
|
|
532
|
-
function Vd({href:e,icon:t,iconAlt:n,isDisabled:r,isExpanded:o,isSelected:i,isSubmenuItem:a,isSubmenuVisible:s,label:l,onClick:c,onToggleSubmenu:u,submenu:h}){const d=t&&-1!==t.indexOf("/"),p=t||a,f=t&&a,g=to();let v=null,y=null;t&&"blank"!==t&&(y=d?po("img",{className:"MenuItem__icon",alt:n,src:t}):po(fo,{name:t,className:"MenuItem__icon"}));const _=a?null:y,b=a?y:null;let w;const x="boolean"==typeof s,k="boolean"==typeof i;Qr((()=>()=>{clearTimeout(v)}),[]);const S=e=>{switch(Oo(e.key)){case"ArrowRight":u&&(e.stopPropagation(),e.preventDefault(),u(e));break;case"Enter":case" ":c&&c(e)}};return w=e?po("a",{ref:g,className:
|
|
530
|
+
i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}function Hd({className:e}){return po("svg",{className:qr("Menu__arrow",e),width:15,height:8,children:po("path",{d:"M0 8 L7 0 L15 8",stroke:"currentColor",strokeWidth:"2"})})}let qd=!1;const Ud=()=>{};function $d({align:e="left",arrowClass:t="",children:n,containerPositioned:r=!0,contentClass:o,defaultOpen:i=!1,label:a,open:s,onOpenChanged:l,menuIndicator:c=!0,title:u}){let[h,d]=Zr(i);"boolean"==typeof s&&(h=s,d=l||Ud);const p=to(h);Qr((()=>{"function"==typeof l&&p.current!==h&&(p.current=h,l(h))}),[h,l]);const f=e=>{if("mousedown"===e.type)qd=!0;else if("click"===e.type&&qd)return qd=!1,e.stopPropagation(),void e.preventDefault();d(!h)},g=ro((()=>d(!1)),[d]),v=to();Ro(v,h,g);const y=e=>e.stopPropagation();return po("div",{className:"Menu",ref:v,style:{position:r?"relative":"static"},onClick:y,onMouseDown:y,children:[po("button",{"aria-expanded":h?"true":"false","aria-haspopup":!0,className:"Menu__toggle",onMouseDown:f,onClick:f,
|
|
531
|
+
"aria-label":u,title:u,children:po("span",{className:"Menu__toggle-wrapper",children:[a,c&&po("span",{className:qr("Menu__toggle-arrow",h&&"is-open"),children:po(fo,{name:"expand-menu",className:"Menu__toggle-icon"})})]})}),h&&po(m,{children:[po(Hd,{className:t}),po("div",{className:qr("Menu__content",`Menu__content--align-${e}`,o),role:"menu",tabIndex:-1,onClick:g,onKeyDown:e=>{const t=Oo(e.key);"Enter"!==t&&" "!==t||setTimeout((()=>{g()}))},children:po(jd,{visible:!0,children:n})})]})]})}function Gd({children:e,visible:t}){const n=to(),[r,o]=Zr(t?"auto":0),[i,a]=Zr(t);Qr((()=>{if(t===(0!==r))return;const e=n.current;t?(e.style.display="",a(!0),o(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),o(0))}),[r,t]);return po("div",{ontransitionend:ro((()=>{t?o("auto"):a(!1)}),[o,t]),ref:n,style:{display:i?"":"none",height:r,overflow:"auto"===r?"visible":"hidden",transition:"height 0.15s ease-in"},children:e})}
|
|
532
|
+
function Vd({href:e,icon:t,iconAlt:n,isDisabled:r,isExpanded:o,isSelected:i,isSubmenuItem:a,isSubmenuVisible:s,label:l,onClick:c,onToggleSubmenu:u,submenu:h}){const d=t&&-1!==t.indexOf("/"),p=t||a,f=t&&a,g=to();let v=null,y=null;t&&"blank"!==t&&(y=d?po("img",{className:"MenuItem__icon",alt:n,src:t}):po(fo,{name:t,className:"MenuItem__icon"}));const _=a?null:y,b=a?y:null;let w;const x="boolean"==typeof s,k="boolean"==typeof i;Qr((()=>()=>{clearTimeout(v)}),[]);const S=e=>{switch(Oo(e.key)){case"ArrowRight":u&&(e.stopPropagation(),e.preventDefault(),u(e));break;case"Enter":case" ":c&&c(e)}};return w=e?po("a",{ref:g,className:qr("MenuItem",{"is-submenu":a,"is-disabled":r}),href:e,target:"_blank",tabIndex:-1,rel:"noopener noreferrer",role:"menuitem",onKeyDown:S,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b})]}):po("div",{ref:g,className:qr("MenuItem",{"is-submenu":a,
|
|
533
533
|
"is-disabled":r,"is-expanded":o,"is-selected":i}),tabIndex:-1,onKeyDown:S,onClick:c,role:k?"menuitemradio":"menuitem","aria-checked":k?i:void 0,"aria-haspopup":x,"aria-expanded":x?s:void 0,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b}),x&&po("div",{role:"none",icon:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle",onClick:u,title:`Show actions for ${l}`,children:po(fo,{name:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle-icon"})})]}),po(m,{children:[w,x&&po(Gd,{visible:s,children:po(jd,{closeMenu:e=>{u&&u(e),v=setTimeout((()=>{g.current.focus()}))},visible:s,className:"MenuItem__submenu",children:h})})]})}var Wd=ri((function({annotation:e,isDisabled:t,onSave:n,settings:r}){const o=ii(),i=o.getDraft(e),a=o.getGroup(e.group);if(!a)return null;const s=i?i.isPrivate:!ya(e.permissions),l=s?"Only Me":a.name,c=t=>{o.createDraft(e,{...i,
|
|
534
534
|
isPrivate:"private"===t}),ki(e)||o.setDefault("annotationPrivacy",t)},u=ti(["ctaTextColor","ctaBackgroundColor"],r),h=po("div",{className:"annotation-publish-button__menu-label",style:u,children:po(Mo,{name:"expand-menu"})});return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--4",children:[po("div",{className:"annotation-publish-button",children:[po(bo,{classes:"PublishControlButton","data-testid":"publish-control-button",style:u,onClick:n,disabled:t,size:"large",variant:"primary",children:["Post to ",l]}),po("div",{className:"annotation-publish-button__menu-wrapper",style:u,children:po($d,{arrowClass:"annotation-publish-button__menu-arrow",containerPositioned:!1,contentClass:"annotation-publish-button__menu-content",label:h,menuIndicator:!1,title:"Change annotation sharing setting",align:"left",children:[po(Vd,{icon:"open"===a.type?"public":"groups",label:a.name,isSelected:!s,onClick:()=>c("shared")}),po(Vd,{icon:"lock",label:"Only Me",isSelected:s,onClick:()=>c("private")})]})})]
|
|
535
535
|
}),po("div",{children:po(bo,{icon:"cancel",onClick:()=>{o.removeDraft(e),Si(e)&&o.removeAnnotations([e])},size:"large",children:"Cancel"})})]})}),["settings"]);var Yd=ri((function({annotation:e,annotationsService:t,settings:n,tags:r,toastMessenger:o}){const[i,a]=Zr(null),s=ii(),l=s.getDraft(e),c=s.getGroup(e.group);if(!l)return null;const u=!l.isPrivate&&c&&"private"!==c.type,h=l.tags,d=l.text,p=!d&&!h.length,m=({tags:e})=>{s.createDraft(l.annotation,{...l,tags:e})},f=e=>{if(!e||h.indexOf(e)>=0)return!1;const t=[...h,e];return r.store(t),m({tags:t}),!0},g=async()=>{i&&f(i);try{await t.save(e)}catch(e){o.error("Saving annotation failed")}};return po("div",{className:"hyp-u-vertical-spacing AnnotationEditor",onKeyDown:e=>{const t=Oo(e.key);p||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),g())},children:[po(Od,{textStyle:ti(["annotationFontFamily"],n),label:"Annotation body",text:d,onEditText:({text:e})=>{s.createDraft(l.annotation,{...l,text:e})}}),po(Dd,{onAddTag:f,
|
|
@@ -538,119 +538,119 @@ classes:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--mu
|
|
|
538
538
|
;return`${n} hr${n>1?"s":""} ago`},nextUpdate:36e5},{test:(e,t)=>e.getFullYear()===t.getFullYear(),formatter:function(e,t,n){return ep(e,{month:"short",day:"numeric"},n)},nextUpdate:null}],np={test:()=>!0,formatter:function(e,t,n){return ep(e,{day:"numeric",month:"short",year:"numeric"},n)},nextUpdate:null};function rp(e,t){for(let n of tp)if(n.test(e,t))return n;return np}function op(e){return!isNaN(e.valueOf())}function ip(e,t){let n;const r=new Date(e),o=()=>{const e=function(e,t){if(!e||!op(e)||!op(t))return null;let n=rp(e,t).nextUpdate;return null===n?null:(n=Math.max(n,5e3),n=Math.min(n,20736e5),n)}(r,new Date);if(null===e)return;n=setTimeout((()=>{t(),o()}),e+500)};return o(),()=>clearTimeout(n)}function ap(e,t,n){return e?rp(e,t).formatter(e,t,n):""}function sp(e,t){return ep(e,{year:"numeric",month:"short",day:"2-digit",weekday:"long",hour:"2-digit",minute:"2-digit"},t)}function lp({annotationCreated:e,annotationUpdated:t,annotationUrl:n,withEditedTimestamp:r}){
|
|
539
539
|
const[o,i]=Zr((()=>new Date)),a=no((()=>new Date(e)),[e]),s=no((()=>r&&new Date(t)),[t,r]),l=no((()=>({absolute:sp(a),relative:ap(a,o)})),[a,o]),c=no((()=>s?{absolute:sp(s),relative:ap(s,o)}:{}),[s,o]);Qr((()=>ip(s?t:e,(()=>i(new Date)))),[e,t,a,s,o]);const u=c&&c.relative!==l.relative?`edited ${c.relative}`:"edited";return po("div",{children:[r&&po("span",{className:"text-color-text-light text-sm italic","data-testid":"timestamp-edited",title:c.absolute,children:["(",u,")"," "]}),n?po(zo,{classes:"p-link--muted p-link--hover-muted",target:"_blank",title:l.absolute,href:n,children:l.relative}):po("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:l.absolute,children:l.relative})]})}function cp({authorLink:e,displayName:t}){const n=po("h3",{className:"text-color-text font-bold",children:t});return e?po(zo,{href:e,target:"_blank",children:n}):po("div",{children:n})}var up=ri((function({annotation:e,isEditing:t,replyCount:n,threadIsCollapsed:r,settings:o}){var i
|
|
540
540
|
;const a=ii(),s=a.defaultAuthority(),l=a.isFeatureEnabled("client_display_names"),c=Qo(e.user,s),u=Kd(e,c,l),h=(()=>{var t;return c?null!==(t=o.usernameUrl&&`${o.usernameUrl}${Jo(e.user)}`)&&void 0!==t?t:void 0:a.getLink("user",{user:e.user})})(),d=ki(e)&&r,p=_a(e.permissions),m=(null===(i=e.links)||void 0===i?void 0:i.html)||"",f=!t&&e.created,g=no((()=>function(e){if(!e.updated||!e.created||e.updated===e.created)return!1;const t=new Date(e.created).getTime(),n=new Date(e.updated).getTime();return!isNaN(t)&&!isNaN(n)&&n-t>2e3}(e)&&!d),[e,d]),v=`${n} ${n>1?"replies":"reply"}`,y=n>0&&d,_=!ki(e),b=function(e){return{domain:wi(e),titleText:xi(e),titleLink:bi(e)}}(e),w=m&&b.titleLink?b.titleLink:"",x="sidebar"!==a.route()&&b.titleText;return po("header",{children:[po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[p&&!t&&po(Mo,{classes:"text-tiny",name:"lock",title:"This annotation is visible only to you"}),po(cp,{authorLink:h,displayName:u}),y&&po(wo,{
|
|
541
|
-
onClick:()=>a.setExpanded(e.id,!0),title:"Expand replies",children:v}),f&&po("div",{className:"hyp-u-layout-row--justify-right hyp-u-stretch",children:po(lp,{annotationCreated:e.created,annotationUpdated:e.updated,annotationUrl:m,withEditedTimestamp:g})})]}),_&&po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[po(Zd,{annotation:e}),!t&&Ni(e)&&po(Mo,{name:"highlight",title:"This is a highlight. Click 'edit' to add a note or tag.",classes:"text-tiny text-color-text-light"}),x&&po(Xd,{domain:b.domain,link:w,title:b.titleText})]})]})}),["settings"]);var hp=ri((function({annotation:e,isFocused:t,settings:n={}}){return po("div",{className:
|
|
542
|
-
;function dp({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return po(wo,{onClick:e,title:r,children:r})}var pp=ri((function({annotation:e,hasAppliedFilter:t,isReply:n,onToggleReplies:r,replyCount:o,threadIsCollapsed:i,annotationsService:a}){const s=n&&i,l=ii(),c=e&&!!Ii(e),u=e&&l.isAnnotationFocused(e.$tag),h=e&&l.isSavingAnnotation(e),d=e&&!!l.getDraft(e)&&!h,p=l.profile().userid,f=!h&&!d,g=!n&&!t&&o>0;return po("article",{className:
|
|
543
|
-
className:"hyp-u-layout-row--justify-right hyp-u-stretch","data-testid":"saving-message",children:"Saving..."}),e&&f&&po(So,{classes:"hyp-u-stretch",children:po(Ca,{annotation:e,onReply:()=>a.reply(e,p)})})]})})]})}),["annotationsService"]);var mp=ri((function({annotation:e,api:t,toastMessenger:n}){const r=ii(),o=function(e){return e.moderation?e.moderation.flagCount:null}(e);return null!==o&&(o>0||e.hidden)?po("div",{className:
|
|
544
|
-
}).then((()=>{r.unhideAnnotation(o)})).catch((()=>{n.error("Failed to unhide annotation")}))}:()=>{const o=e.id;t.annotation.hide({id:o}).then((()=>{r.hideAnnotation(o)})).catch((()=>{n.error("Failed to hide annotation")}))},title:e.hidden?"Make this annotation visible to everyone":"Hide this annotationn from non-moderators",variant:"dark",children:e.hidden?"Unhide":"Hide"})})]}):null}),["api","toastMessenger"]);function fp({annotation:e,...t}){const n=ii(),r=e&&n.isSavingAnnotation(e),o=e&&!!n.getDraft(e)&&!r;return e?po("div",{className:"Thread__top-annotation-header",children:po(up,{annotation:e,isEditing:o,...t})}):null}var gp=ri((function e({thread:t,threadsService:n}){const r=!t.collapsed,o=
|
|
545
|
-
annotation:t.annotation}),po(pp,{annotation:t.annotation,hasAppliedFilter:u,isReply:!!t.parent,onToggleReplies:h,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})]})),[u,h,t.annotation,t.parent,t.replyCount,t.collapsed,t.visible]);return po("section",{className:
|
|
546
|
-
threadsService:n})},t.id)))})]})]})}),["threadsService"]);var vp=ri((function({frameSync:e,thread:t}){const n=ii(),r=t.annotation&&t.annotation.$tag,o=r&&n.isAnnotationFocused(r),i=no((()=>ua((t=>{const n=t?[t]:[];e.focusAnnotations(n)}),10)),[e]),a=ro((t=>{e.scrollToAnnotation(t)}),[e]),s=no((()=>po(gp,{thread:t})),[t]);return po("div",{onClick:e=>{var t;(t=e.target).closest("button")||t.closest("a")||a(r)},onMouseEnter:()=>i(r),onMouseLeave:()=>i(null),className:
|
|
541
|
+
onClick:()=>a.setExpanded(e.id,!0),title:"Expand replies",children:v}),f&&po("div",{className:"hyp-u-layout-row--justify-right hyp-u-stretch",children:po(lp,{annotationCreated:e.created,annotationUpdated:e.updated,annotationUrl:m,withEditedTimestamp:g})})]}),_&&po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[po(Zd,{annotation:e}),!t&&Ni(e)&&po(Mo,{name:"highlight",title:"This is a highlight. Click 'edit' to add a note or tag.",classes:"text-tiny text-color-text-light"}),x&&po(Xd,{domain:b.domain,link:w,title:b.titleText})]})]})}),["settings"]);var hp=ri((function({annotation:e,isFocused:t,settings:n={}}){return po("div",{className:qr({"is-orphan":Li(e)}),children:po(Ta,{collapsedHeight:35,inlineControls:!0,overflowThreshold:20,children:po("blockquote",{className:qr("p-quoted-text",{"is-focused":t,"p-redacted-content":Li(e)}),dir:"auto",lang:"",style:ti(["selectionFontFamily"],n),children:Ii(e)})})})}),["settings"])
|
|
542
|
+
;function dp({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return po(wo,{onClick:e,title:r,children:r})}var pp=ri((function({annotation:e,hasAppliedFilter:t,isReply:n,onToggleReplies:r,replyCount:o,threadIsCollapsed:i,annotationsService:a}){const s=n&&i,l=ii(),c=e&&!!Ii(e),u=e&&l.isAnnotationFocused(e.$tag),h=e&&l.isSavingAnnotation(e),d=e&&!!l.getDraft(e)&&!h,p=l.profile().userid,f=!h&&!d,g=!n&&!t&&o>0;return po("article",{className:qr("hyp-u-vertical-spacing",{"is-collapsed":i,"is-focused":u}),children:[e&&po(m,{children:[po(up,{annotation:e,isEditing:d,replyCount:o,threadIsCollapsed:i}),c&&po(hp,{annotation:e,isFocused:u}),!s&&!d&&po(wd,{annotation:e}),d&&po(Yd,{annotation:e})]}),!e&&!s&&po("div",{children:po("em",{children:"Message not available."})}),!s&&po("footer",{children:po("div",{className:"hyp-u-layout-row",children:[g&&po(dp,{onToggleReplies:r,replyCount:o,threadIsCollapsed:i}),h&&po("div",{
|
|
543
|
+
className:"hyp-u-layout-row--justify-right hyp-u-stretch","data-testid":"saving-message",children:"Saving..."}),e&&f&&po(So,{classes:"hyp-u-stretch",children:po(Ca,{annotation:e,onReply:()=>a.reply(e,p)})})]})})]})}),["annotationsService"]);var mp=ri((function({annotation:e,api:t,toastMessenger:n}){const r=ii(),o=function(e){return e.moderation?e.moderation.flagCount:null}(e);return null!==o&&(o>0||e.hidden)?po("div",{className:qr("flex gap-x-3 bg-grey-1 text-color-text font-semibold","mb-2 ",{"-mt-3 -ml-3 -mr-3":!ki(e),"-mr-3":ki(e)}),children:[po("div",{className:qr("p-3 text-white",{"bg-red-error":!e.hidden,"bg-grey-6":e.hidden}),children:po(Mo,{name:e.hidden?"hide":"flag"})}),po("div",{className:"self-center grow",children:[!e.hidden&&po("span",{children:["Flagged for review by ",o," ",1===o?"user":"users"]}),e.hidden&&po("span",{children:"Hidden from users"})]}),po("div",{className:"self-center pr-2",children:po(bo,{classes:"py-1 bg-slate-1",onClick:e.hidden?()=>{const o=e.id;t.annotation.unhide({id:o
|
|
544
|
+
}).then((()=>{r.unhideAnnotation(o)})).catch((()=>{n.error("Failed to unhide annotation")}))}:()=>{const o=e.id;t.annotation.hide({id:o}).then((()=>{r.hideAnnotation(o)})).catch((()=>{n.error("Failed to hide annotation")}))},title:e.hidden?"Make this annotation visible to everyone":"Hide this annotationn from non-moderators",variant:"dark",children:e.hidden?"Unhide":"Hide"})})]}):null}),["api","toastMessenger"]);function fp({annotation:e,...t}){const n=ii(),r=e&&n.isSavingAnnotation(e),o=e&&!!n.getDraft(e)&&!r;return e?po("div",{className:"Thread__top-annotation-header",children:po(up,{annotation:e,isEditing:o,...t})}):null}var gp=ri((function e({thread:t,threadsService:n}){const r=!t.collapsed,o=qi(t)>0,i=!!t.parent,a=t.collapsed?"collapsed":"expand-menu",s=t.collapsed?"Expand replies":"Collapse replies",l=t.children.filter((e=>Ui(e)>0)),c=ii(),u=c.hasAppliedFilter(),h=ro((()=>c.setExpanded(t.id,!!t.collapsed)),[c,t.id,t.collapsed]),d=no((()=>t.visible&&po(m,{children:[t.annotation&&po(mp,{
|
|
545
|
+
annotation:t.annotation}),po(pp,{annotation:t.annotation,hasAppliedFilter:u,isReply:!!t.parent,onToggleReplies:h,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})]})),[u,h,t.annotation,t.parent,t.replyCount,t.collapsed,t.visible]);return po("section",{className:qr("Thread",{"Thread--reply":t.depth>0,"is-collapsed":t.collapsed}),children:[i&&po("div",{className:"Thread__collapse",children:po("div",{className:"Thread__collapse-button-container",children:po(_o,{classes:"NonResponsiveIconButton",expanded:!t.collapsed,icon:a,title:s,onClick:h,size:"medium",variant:"light"})})}),po("div",{className:"Thread__content",children:[d,o&&po(m,{children:[!t.parent&&po(fp,{annotation:t.annotation,replyCount:t.replyCount,threadIsCollapsed:t.collapsed}),po("div",{className:"Thread__hidden-toggle-button-container",children:po(bo,{onClick:()=>n.forceVisible(t),children:["Show ",qi(t)," more in conversation"]})})]}),r&&po("ul",{className:"Thread__children",children:l.map((t=>po("li",{children:po(e,{thread:t,
|
|
546
|
+
threadsService:n})},t.id)))})]})]})}),["threadsService"]);var vp=ri((function({frameSync:e,thread:t}){const n=ii(),r=t.annotation&&t.annotation.$tag,o=r&&n.isAnnotationFocused(r),i=no((()=>ua((t=>{const n=t?[t]:[];e.focusAnnotations(n)}),10)),[e]),a=ro((t=>{e.scrollToAnnotation(t)}),[e]),s=no((()=>po(gp,{thread:t})),[t]);return po("div",{onClick:e=>{var t;(t=e.target).closest("button")||t.closest("a")||a(r)},onMouseEnter:()=>i(r),onMouseLeave:()=>i(null),className:qr("ThreadCard p-3",{"is-focused":o}),children:s},t.id)}),["frameSync"]);function yp(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function _p(e){return Math.max(e-e%50,0)}function bp({threads:e}){const[t,n]=Zr(0),[r,o]=Zr(0);eo((()=>{const e=new ha,t=yp();n(t.clientHeight),o(_p(t.scrollTop));const r=ua((()=>{n(t.clientHeight),o(_p(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}}),[])
|
|
547
547
|
;const[i,a]=Zr({}),[s,l]=Zr(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:h,visibleThreads:d}=no((()=>function(e,t,n,r,o=da){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,h=0;return e.forEach((e=>{const o=t[e.id]||i;c+o<n-a?u+=o:c<n+r+s?l.push(e):h+=o,c+=o})),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:h}}(c,i,r,t)),[c,i,r,t]),p=ii(),m=(()=>{const e=p.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();return Qr((()=>{m&&(p.setForcedVisible(m,!0),l(m))}),[p,m]),Qr((()=>{if(!s)return;const e=c.findIndex((e=>e.id===s));if(-1===e)return;l(null);const t=c.slice(0,e).reduce(((e,t)=>e+(e=>i[e.id]||da.defaultHeight)(t)),0);yp().scrollTop=t}),[s,c,i]),Qr((()=>{a((e=>{const t={};for(let{id:n}of d){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=pa(r);o!==e[n]&&(t[n]=o)}return 0===Object.keys(t).length?e:{...e,...t}}))}),[d]),po("div",{children:[po("div",{style:{height:h}
|
|
548
548
|
}),d.map((e=>po("div",{className:"ThreadList__card",id:e.id,children:po(vp,{thread:e})},e.id))),po("div",{style:{height:u}})]})}function wp({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=ii(),o=r.isLoggedIn();return po("div",{className:"mb-4",children:po(Ho,{icon:"restricted",title:"annotation"===e?"Annotation unavailable":"Group unavailable",children:[po("p",{children:o?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":"The current URL links to an annotation, but that annotation\n cannot be found, or you do not have permission to view it.":`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),po("div",{className:"hyp-u-layout-row--justify-right hyp-u-horizontal-spacing",children:[n&&po(bo,{variant:o?"primary":void 0,onClick:()=>r.clearSelection(),children:"Show all annotations"}),!o&&po(bo,{variant:"primary",onClick:t,
|
|
549
|
-
children:"Log in"})]})]})})}var xp=ri((function({loadAnnotationsService:e,onLogin:t}){const n=ii(),r=n.routeParams().id,o=Ki(),i=n.profile().userid,[a,s]=Zr(!1);return Qr((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),po(m,{children:[a&&po(wp,{errorType:"annotation",onLoginRequest:t}),po(bp,{threads:o.children})]})}),["loadAnnotationsService"]);function kp({actionButton:e,additionalCount:t=0,entitySingular:n="annotation",entityPlural:r="annotations",filterQuery:o,focusDisplayName:i,resultCount:a}){return po("div",{className:"FilterStatus",children:ii().isLoading()?po("div",{className:"hyp-u-layout-row--center",children:po(
|
|
550
|
-
children:[a>0?a:"No"," ",1===a?n:r]}),o&&po("span",{children:[" ","for"," ",po("span",{className:"filter-facet--pre",children:`'${o}'`})]}),i&&po("span",{children:[" ","by ",po("span",{className:"filter-facet",children:i})]}),t>0&&po("span",{className:"filter-facet--muted",children:[" ","(and ",t," more)"]})]}),po("div",{children:e})]})})}function Sp({filterState:e,rootThread:t}){const n=ii(),r=n.directLinkedAnnotationId(),o=n.annotationCount(),i=(t.children||[]).filter((e=>e.annotation&&e.visible)).length-e.selectedCount,a=!e.focusConfigured&&!r?`Show all (${o})`:"Show all",s=po(bo,{title:a,variant:"primary",onClick:()=>n.clearSelection(),icon:"cancel",children:a});return po(kp,{resultCount:e.selectedCount,additionalCount:i,actionButton:s})}function Cp({filterState:e,rootThread:t}){const n=ii(),r=
|
|
551
|
-
entitySingular:"result",entityPlural:"results",filterQuery:e.filterQuery,focusDisplayName:e.focusDisplayName,resultCount:r})}function Ap({filterState:e,rootThread:t}){const n=ii(),r=
|
|
549
|
+
children:"Log in"})]})]})})}var xp=ri((function({loadAnnotationsService:e,onLogin:t}){const n=ii(),r=n.routeParams().id,o=Ki(),i=n.profile().userid,[a,s]=Zr(!1);return Qr((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),po(m,{children:[a&&po(wp,{errorType:"annotation",onLoginRequest:t}),po(bp,{threads:o.children})]})}),["loadAnnotationsService"]);function kp({actionButton:e,additionalCount:t=0,entitySingular:n="annotation",entityPlural:r="annotations",filterQuery:o,focusDisplayName:i,resultCount:a}){return po("div",{className:"FilterStatus",children:ii().isLoading()?po("div",{className:"hyp-u-layout-row--center",children:po(Uo,{})}):po("div",{className:"hyp-u-layout-row--align-center",children:[po("div",{className:"FilterStatus__text",children:[a>0&&po("span",{children:"Showing "}),po("span",{className:"filter-facet",
|
|
550
|
+
children:[a>0?a:"No"," ",1===a?n:r]}),o&&po("span",{children:[" ","for"," ",po("span",{className:"filter-facet--pre",children:`'${o}'`})]}),i&&po("span",{children:[" ","by ",po("span",{className:"filter-facet",children:i})]}),t>0&&po("span",{className:"filter-facet--muted",children:[" ","(and ",t," more)"]})]}),po("div",{children:e})]})})}function Sp({filterState:e,rootThread:t}){const n=ii(),r=n.directLinkedAnnotationId(),o=n.annotationCount(),i=(t.children||[]).filter((e=>e.annotation&&e.visible)).length-e.selectedCount,a=!e.focusConfigured&&!r?`Show all (${o})`:"Show all",s=po(bo,{title:a,variant:"primary",onClick:()=>n.clearSelection(),icon:"cancel",children:a});return po(kp,{resultCount:e.selectedCount,additionalCount:i,actionButton:s})}function Cp({filterState:e,rootThread:t}){const n=ii(),r=Ui(t)-e.forcedVisibleCount,o=po(bo,{icon:"cancel",variant:"primary",title:"Clear search",onClick:()=>n.clearSelection(),children:"Clear search"});return po(kp,{actionButton:o,additionalCount:e.forcedVisibleCount,
|
|
551
|
+
entitySingular:"result",entityPlural:"results",filterQuery:e.filterQuery,focusDisplayName:e.focusDisplayName,resultCount:r})}function Ap({filterState:e,rootThread:t}){const n=ii(),r=Ui(t)-e.forcedVisibleCount,o={};e.forcedVisibleCount>0?(o.onClick=()=>n.clearSelection(),o.title="Reset filters"):(o.onClick=()=>n.toggleFocusMode(),o.title=e.focusActive?"Show all":`Show only ${e.focusDisplayName}`);const i=e.focusActive?e.focusDisplayName:"",a=po(bo,{variant:"primary",...o,children:o.title});return po(kp,{resultCount:r,actionButton:a,additionalCount:e.forcedVisibleCount,filterQuery:e.filterQuery,focusDisplayName:i})}function Ep(){const e=Ki(),t=ii(),n=t.focusState(),r=t.forcedVisibleThreads().length,o=t.filterQuery(),i=t.selectedAnnotations().length,a=no((()=>({filterQuery:o,focusActive:n.active,focusConfigured:n.configured,focusDisplayName:n.displayName,forcedVisibleCount:r,selectedCount:i})),[n,r,o,i]);return a.selectedCount>0?po(Sp,{filterState:a,rootThread:e}):a.filterQuery?po(Cp,{filterState:a,rootThread:e
|
|
552
552
|
}):a.focusConfigured?po(Ap,{filterState:a,rootThread:e}):null}function Tp({onLogin:e}){const t=ii();return po("div",{className:"LoggedOutMessage",children:[po("span",{children:["This is a public annotation created with Hypothesis. ",po("br",{}),"To reply or make your own annotations on this document,"," ",po("a",{className:"LoggedOutMessage__link",href:t.getLink("signup"),target:"_blank",rel:"noopener noreferrer",children:"create a free account"})," ","or"," ",po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:e,variant:"dark",children:"log in"}),"."]}),po("div",{className:"LoggedOutMessage__logo",children:po("a",{href:"https://hypothes.is","aria-label":"Hypothesis homepage",title:"Hypothesis homepage",children:po(Mo,{name:"logo",classes:"w-16 h-16 hyp-u-color--grey-7"})})})]})}function Np(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function Lp(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){
|
|
553
553
|
var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),h=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=h,g=d;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect();var v=u.left-(n.left-t.scrollLeft),y=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=y+l*g-t.clientHeight*g,r-=p,o-=m,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return Np(e,r.x,r.y),
|
|
554
554
|
e._scrollSettings=null,t.end("complete");var a=1-t.ease(i);if(Np(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&Lp(t.scrollAncestor),void Lp(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(Lp.bind(null,e))}}function Mp(e){return e.self===e}function zp(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Op(){return!0}function Ip(e){if(e.assignedSlot)return Ip(e.assignedSlot);if(e.parentElement)return"BODY"===e.parentElement.tagName?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 Rp=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||{}
|
|
555
555
|
;var r=Ip(e),o=1,i=t.validTarget||Op,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,zp):zp(r))&&(o++,s.push(r)),!(r=Ip(r))){l("complete");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),n.debug&&console.log("Scrolling ended with type",e,"for",t),o(e),i&&(t.removeEventListener("touchstart",i,c),t.removeEventListener("wheel",i,c))}s&&s.end("canceled");var h=n.maxSynchronousAlignments;return null==h&&(h=3),t._scrollSettings={startTime:l,endIterations:0,target:e,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||Mp,maxSynchronousAlignments:h,end:u,scrollAncestor:r},"cancellable"in n&&!n.cancellable||(i=u.bind(null,"canceled"),
|
|
556
556
|
t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Lp(t),i}(e,r,t,s[o+1],l)),null)}function l(e){--o||n&&n(e)}};function Pp({children:e,icon:t="",panelName:n,title:r,onActiveChanged:o}){const i=ii(),a=i.isSidebarPanelOpen(n),s=to(null),l=to(a);Qr((()=>{l.current!==a&&(l.current=a,a&&Rp(s.current),"function"==typeof o&&o(a))}),[a,o]);const c=ro((()=>{i.toggleSidebarPanel(n,!1)}),[i,n]);return po(Gd,{visible:a,children:po("div",{ref:s,className:"mb-4",children:po(Ho,{title:r,icon:t,onClose:c,children:e})})})}function Dp({onLogin:e,onSignUp:t}){return ii().isLoggedIn()?null:po(Pp,{icon:"restricted",title:"Login needed",panelName:"loginPrompt",children:[po("p",{children:"Please log in to create annotations or highlights."}),po(So,{children:[po(bo,{title:"Sign up",onClick:t,children:"Sign up"}),po(bo,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})}function Bp({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i}){const a=()=>{r||i()
|
|
557
|
-
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:
|
|
557
|
+
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:qr("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var Fp=ri((function({annotationsService:e,isLoading:t,settings:n}){const r=ii(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return po("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[po(Bp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),po(Bp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
|
|
558
558
|
children:"Page Notes"}),s>0&&po(Bp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",po("br",{}),"Create one by selecting some text and clicking the"," ",po(Mo,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var jp=ri((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
559
559
|
const i=Ki(),a=ii(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?ji(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=to(s);Qr((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Qr((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return Qr((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),po("div",{children:[po("h2",{className:"sr-only",children:"Annotations"}),w&&po(Ep,{}),po(Dp,{onLogin:t,onSignUp:n}),y&&po(wp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&po(wp,{
|
|
560
|
-
errorType:"group",onLoginRequest:t}),x&&po(Fp,{isLoading:c}),po(bp,{threads:i.children}),k&&po(Tp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Hp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(bp,{threads:Ki().children})}),["api","toastMessenger"]);class
|
|
561
|
-
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function
|
|
560
|
+
errorType:"group",onLoginRequest:t}),x&&po(Fp,{isLoading:c}),po(bp,{threads:i.children}),k&&po(Tp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Hp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(bp,{threads:Ki().children})}),["api","toastMessenger"]);class qp{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.982.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
561
|
+
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function Up(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function $p({commandName:e,iconName:t}){return po("span",{className:"whitespace-nowrap",children:[po(Mo,{name:t,classes:qr("mx-1 -mt-1","text-color-text-light inline")}),po("em",{children:e})]})}var Gp=ri((function({settings:e}){const t=!Up(e);return po("ol",{className:"list-decimal pl-10 space-y-2",children:[po("li",{children:["To create an annotation, select text and then select the"," ",po($p,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),po("li",{
|
|
562
562
|
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po($p,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&po("li",{children:["To annotate in a private group, select the group from the groups dropdown. Don't see your group? Ask the group creator to send a"," ",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),po("li",{children:["To reply to an annotation, select the"," ",po($p,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var Vp=ri((function({toastMessenger:e,versionData:t}){return po("div",{className:"hyp-u-vertical-spacing",children:[po("dl",{className:"VersionInfo",children:[po("dt",{className:"VersionInfo__key",children:"Version"}),po("dd",{
|
|
563
563
|
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{ba(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Wp({children:e,onClick:t}){return po(wo,{
|
|
564
|
-
classes:"leading-none text-brand",onClick:t,children:[e,po(Mo,{classes:"ml-1",name:"arrow-right"})]})}function Yp({linkText:e,url:t}){return po("div",{className:"flex-1 border-r last-of-type:border-r-0",children:po(zo,{href:t,classes:"flex items-center justify-center space-x-2 text-color-text-light text-lg font-medium",target:"_blank",children:[po("span",{children:e})," ",po(Mo,{name:"external",classes:"w-3 h-3"})]})})}var Kp=ri((function({auth:e,session:t}){const n=ii(),r=n.frames(),o=n.mainFrame(),i=!!n.profile().preferences.show_sidebar_tutorial,[a,s]=Zr("tutorial"),l=no((()=>{const t=e||{status:"logged-out"},n=[...r].sort(((e,t)=>e===o?-1:t===o?1:0));return new
|
|
564
|
+
classes:"leading-none text-brand",onClick:t,children:[e,po(Mo,{classes:"ml-1",name:"arrow-right"})]})}function Yp({linkText:e,url:t}){return po("div",{className:"flex-1 border-r last-of-type:border-r-0",children:po(zo,{href:t,classes:"flex items-center justify-center space-x-2 text-color-text-light text-lg font-medium",target:"_blank",children:[po("span",{children:e})," ",po(Mo,{name:"external",classes:"w-3 h-3"})]})})}var Kp=ri((function({auth:e,session:t}){const n=ii(),r=n.frames(),o=n.mainFrame(),i=!!n.profile().preferences.show_sidebar_tutorial,[a,s]=Zr("tutorial"),l=no((()=>{const t=e||{status:"logged-out"},n=[...r].sort(((e,t)=>e===o?-1:t===o?1:0));return new qp(t,n)}),[e,r,o]),c=`https://web.hypothes.is/get-help/?sys_info=${l.asEncodedURLString()}`,u=(e,t)=>{e.preventDefault(),s(t)};return po(Pp,{title:"Help",panelName:"help",onActiveChanged:ro((e=>{!e&&i&&t.dismissSidebarTutorial()}),[t,i]),children:po("div",{className:"space-y-4",children:[po("div",{className:"flex items-center",children:[po("h3",{
|
|
565
565
|
className:"grow text-lg font-medium","data-testid":"subpanel-title",children:{tutorial:"Getting started",versionInfo:"About this version"}[a]}),"versionInfo"===a&&po(Wp,{onClick:e=>u(e,"tutorial"),children:"Getting started"}),"tutorial"===a&&po(Wp,{onClick:e=>u(e,"versionInfo"),children:"About this version"})]}),po("div",{className:"border-y py-4",children:["tutorial"===a&&po(Gp,{}),"versionInfo"===a&&po(Vp,{versionData:l})]}),po("div",{className:"flex items-center",children:[po(Yp,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),po(Yp,{linkText:"New support ticket",url:c})]})]})})}),["session"]),Xp={exports:{}};function Zp(){}Zp.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},
|
|
566
566
|
off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,a=r.length;i<a;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},Xp.exports=Zp;var Jp=Xp.exports.TinyEmitter=Zp;class Qp extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function em(e){return 0===e?50:200}class tm extends Jp{constructor(e,{getPageSize:t=em,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._results=[],this._resultCount=null}async _getPage(e,t,n=0){const r=this._getPageSize(n),o={limit:r,sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(o.search_after=t);try{const t=await this._searchFn(o);if(this._canceled)return;if(null===this._resultCount&&(this._resultCount=t.total,this.emit("resultCount",this._resultCount)),
|
|
567
567
|
this._maxResults&&t.total>this._maxResults)return this.emit("error",new Qp(this._maxResults)),void this.emit("end");const i=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",i):this._results=this._results.concat(i);const a=i.length===r,s=i.length>0?i[i.length-1][this._sortBy]:null;a&&s?this._getPage(e,s,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._results=[],this._resultCount=null,this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function nm({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=null!=o?o:e,l=po("span",{className:"FilterSelect__menu-label",children:[t&&po(Mo,{name:t,classes:"text-xl hyp-u-margin--right--3"}),s.display]});return po($d,{label:l,title:i,contentClass:"FilterSelect__menu",children:a.map((e=>po(Vd,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function rm(){
|
|
568
|
-
const e=ii(),t=e.getFilter("user"),n=function(){const e=ii(),t=e.allAnnotations(),n=e.defaultAuthority(),r=e.isFeatureEnabled("client_display_names"),o=e.getFocusFilters(),i=Jo(e.profile().userid);return no((()=>{const e={};if(t.forEach((t=>{const o=Jo(t.user);e[o]=Kd(t,Qo(t.user,n),r)})),o.user){const t=Jo(o.user.value)||o.user.value;e[t]=o.user.display}const a=Object.keys(e).map((t=>({display:t===i?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>i===e.value?-1:i===t.value?1:e.display.localeCompare(t.display))),a}),[t,i,n,r,o.user])}();return po(nm,{defaultOption:{value:"",display:"Everybody"},icon:"profile",onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function om({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const o=Ki(),i=n?r:
|
|
568
|
+
const e=ii(),t=e.getFilter("user"),n=function(){const e=ii(),t=e.allAnnotations(),n=e.defaultAuthority(),r=e.isFeatureEnabled("client_display_names"),o=e.getFocusFilters(),i=Jo(e.profile().userid);return no((()=>{const e={};if(t.forEach((t=>{const o=Jo(t.user);e[o]=Kd(t,Qo(t.user,n),r)})),o.user){const t=Jo(o.user.value)||o.user.value;e[t]=o.user.display}const a=Object.keys(e).map((t=>({display:t===i?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>i===e.value?-1:i===t.value?1:e.display.localeCompare(t.display))),a}),[t,i,n,r,o.user])}();return po(nm,{defaultOption:{value:"",display:"Everybody"},icon:"profile",onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function om({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const o=Ki(),i=n?r:Ui(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return po("div",{className:"hyp-u-layout-row NotebookResultCount",children:[n&&po(Uo,{size:"small"}),!n&&po("h2",{children:[!a&&po("strong",{
|
|
569
569
|
children:"No results"}),a&&t&&po("strong",{children:[l," ",1===l?"result":"results"]}),a&&!t&&po("strong",{children:[c," ",1===c?"thread":"threads"]})]}),s&&po("h3",{children:["(and ",e," more)"]}),!t&&a&&po("h3",{children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function im({currentPage:e,onChangePage:t,totalPages:n}){const r=e<n,o=e>1,i=function(e,t,n=5){if(t<=1)return[];const r=new Set([1,e,t]);let o=1;for(;r.size<Math.min(t,n);)e+o<=t&&r.add(e+o),e-o>=1&&r.add(e-o),++o;const i=[];return[...r].sort(((e,t)=>e-t)).forEach(((e,t,n)=>{t>0&&e-n[t-1]>1&&i.push(null),i.push(e)})),i}(e,n),a=(e,n)=>{t(e),null==n||n.blur()};return po("div",{className:"PaginationNavigation",children:[po("div",{className:"PaginationNavigation__relative PaginationNavigation__prev",children:o&&po(bo,{classes:"PaginationPageButton",icon:"arrow-left",title:"Go to previous page",onClick:t=>a(e-1,t.target),variant:"dark",children:"prev"})}),po("ul",{className:"PaginationNavigation__pages",children:i.map(((t,n)=>po("li",{
|
|
570
|
-
children:null===t?po("div",{className:"PaginationNavigation__gap",children:"..."}):po(bo,{classes:"PaginationPageButton",title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),variant:"dark",children:t.toString()},`page-${n}`)},n)))}),po("div",{className:"PaginationNavigation__relative PaginationNavigation__next",children:r&&po(bo,{classes:"PaginationPageButton",icon:"arrow-right",iconPosition:"right",title:"Go to next page",onClick:t=>a(e+1,t.target),variant:"dark",children:"next"})})]})}function am({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=no((()=>{const t=r.filter((e=>
|
|
570
|
+
children:null===t?po("div",{className:"PaginationNavigation__gap",children:"..."}):po(bo,{classes:"PaginationPageButton",title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),variant:"dark",children:t.toString()},`page-${n}`)},n)))}),po("div",{className:"PaginationNavigation__relative PaginationNavigation__next",children:r&&po(bo,{classes:"PaginationPageButton",icon:"arrow-right",iconPosition:"right",title:"Go to next page",onClick:t=>a(e+1,t.target),variant:"dark",children:"next"})})]})}function am({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=no((()=>{const t=r.filter((e=>Ui(e)>0)),n=(e-1)*o,i=n+o,a=Math.ceil(t.length/o);return{paginatedThreads:t.slice(n,i),totalPages:a}}),[r,e,o]);return po(m,{children:[po(bp,{threads:i}),!t&&po(im,{currentPage:e,onChangePage:n,totalPages:a})]})}var sm=ri((function({loadAnnotationsService:e,streamer:t}){var n
|
|
571
571
|
;const r=ii(),o=r.getFilterValues(),i=r.focusedGroup(),a=r.forcedVisibleThreads().length,s=r.hasAppliedFilter(),l=r.isLoading(),c=r.annotationResultCount(),u=r.pendingUpdateCount(),h=Ki(),d=null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"…",p=(null==i?void 0:i.id)||r.directLinkedGroupId(),m=to(1),[f,g]=Zr(1),[v,y]=Zr(!1),_=e=>{e instanceof Qp&&y(!0)},b=r.hasFetchedProfile();Qr((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),Qr((()=>{r.setSortKey("Newest"),p&&e.load({groupId:p,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:_,streamFilterBy:"group"})}),[e,p,r]);const w=e=>{g(e)};Qr((()=>{w(1)}),[o,i]);const x=to(null);eo((()=>{f!==m.current&&(Rp(x.current),m.current=f)}),[f]);const k=`Show ${u} new or updated ${u>1?"annotations":"annotation"}`;return po("div",{className:"NotebookView",children:[po("header",{className:"NotebookView__heading",ref:x,children:po("h1",{className:"NotebookView__group-name",children:d})}),po("div",{className:"NotebookView__filters",children:po(rm,{})}),po("div",{
|
|
572
572
|
className:"NotebookView__results hyp-u-layout-row--align-center text-lg font-medium",children:[u>0&&!s&&po(_o,{icon:"refresh",onClick:()=>t.applyPendingUpdates(),variant:"primary",title:k}),po(om,{forcedVisibleCount:a,isFiltered:s,isLoading:l,resultCount:c})]}),po("div",{className:"NotebookView__items",children:[v&&po("div",{className:"NotebookView__messages",children:po(Ho,{title:"Too many results to show",children:["This preview of the Notebook can show"," ",po("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."," ",po("a",{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})}),po(am,{currentPage:f,isLoading:l,onChangePage:w,threads:h.children})]})]})}),["loadAnnotationsService","streamer"])
|
|
573
|
-
;var lm=ri((function({toastMessenger:e}){const t=ii(),n=t.mainFrame(),r=t.focusedGroup(),o=`Share Annotations in ${r&&r.name||"..."}`,i=r&&n,a=i&&(s=n.uri,l=r.id,ma(s)?`https://hyp.is/go?url=${encodeURIComponent(s)}&group=${l}`:null);var s,l;return po(Pp,{title:o,panelName:"shareGroupAnnotations",children:[!i&&po("div",{className:"flex flex-row items-center justify-center",children:po(
|
|
574
|
-
title:"Copy share link",variant:"dark"})]})}),po("p",{"data-testid":"sharing-details",children:["private"===r.type?po("span",{children:["Annotations in the private group"," ",po("em",{children:r.name})," are only visible to group members."]}):po("span",{children:["Anyone using this link may view the annotations in the group"," ",po("em",{children:r.name}),"."]})," ",po("span",{children:["Private (",po(Mo,{name:"lock",classes:"inline -mt-0.5"})," ",po("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),po(xa,{shareURI:a})]}):po("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})})]})}),["toastMessenger"]);function cm({message:e,onDismiss:t}){const n=e.type.charAt(0).toUpperCase()+e.type.slice(1),r="notice"===e.type?"cancel":e.type;return po("li",{className:
|
|
573
|
+
;var lm=ri((function({toastMessenger:e}){const t=ii(),n=t.mainFrame(),r=t.focusedGroup(),o=`Share Annotations in ${r&&r.name||"..."}`,i=r&&n,a=i&&(s=n.uri,l=r.id,ma(s)?`https://hyp.is/go?url=${encodeURIComponent(s)}&group=${l}`:null);var s,l;return po(Pp,{title:o,panelName:"shareGroupAnnotations",children:[!i&&po("div",{className:"flex flex-row items-center justify-center",children:po(Uo,{})}),i&&po("div",{className:"text-color-text-light space-y-3",children:a?po(m,{children:[po("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?po("p",{children:"Use this link to share these annotations with other group members:"}):po("p",{children:"Use this link to share these annotations with anyone:"})}),po("div",{children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share these annotations",type:"text",value:a,readOnly:!0}),po(_o,{icon:"copy",onClick:()=>{try{ba(a),e.success("Copied share link to clipboard")}catch(t){e.error("Unable to copy link")}},
|
|
574
|
+
title:"Copy share link",variant:"dark"})]})}),po("p",{"data-testid":"sharing-details",children:["private"===r.type?po("span",{children:["Annotations in the private group"," ",po("em",{children:r.name})," are only visible to group members."]}):po("span",{children:["Anyone using this link may view the annotations in the group"," ",po("em",{children:r.name}),"."]})," ",po("span",{children:["Private (",po(Mo,{name:"lock",classes:"inline -mt-0.5"})," ",po("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),po(xa,{shareURI:a})]}):po("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})})]})}),["toastMessenger"]);function cm({message:e,onDismiss:t}){const n=e.type.charAt(0).toUpperCase()+e.type.slice(1),r="notice"===e.type?"cancel":e.type;return po("li",{className:qr("toast-message-container",{"is-dismissed":e.isDismissed}),onClick:()=>t(e.id),children:po("div",{className:qr("toast-message",`toast-message--${e.type}`),
|
|
575
575
|
children:[po("div",{className:"toast-message__type",children:po(Mo,{name:r,classes:"toast-message__icon"})}),po("div",{className:"toast-message__message",children:[po("strong",{children:[n,": "]}),e.message,e.moreInfoURL&&po("div",{className:"toast-message__link",children:po("a",{href:e.moreInfoURL,onClick:e=>e.stopPropagation(),target:"_new",children:"More info"})})]})]})})}var um=ri((function({toastMessenger:e}){return po("div",{children:po("ul",{"aria-live":"polite","aria-relevant":"additions",className:"ToastMessages",children:ii().getToastMessages().map((t=>po(cm,{message:t,onDismiss:t=>e.dismiss(t)},t.id)))})})}),["toastMessenger"]);function hm(e){return e.organization&&e.organization.name}function dm(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n="__default__"===(r=e.organization).id?"__default__":`${r.name.toLowerCase()}${r.id}`;var r;void 0===t[n]&&(t[n]=Object.assign({},e.organization),t[n].groups=[]),function(e,t){const n=Object.assign({},e),r=t.groups
|
|
576
576
|
;!r.length&&e.organization.logo&&(n.logo=e.organization.logo),r.push(n)}(e,t[n])})),t}function pm(e){const t=dm(e),n=[],r=[];return Object.keys(t).sort().forEach((e=>{"__default__"===e?n.push(...t[e].groups):r.push(...t[e].groups)})),n.length&&r.push(...n),r}function mm({heading:e,children:t}){return po(m,{children:[e&&po("h2",{className:"MenuSection__heading",children:e}),po("ul",{className:"MenuSection__content",children:x(t).map((e=>po("li",{children:e},e.key)))})]})}var fm=ri((function({isExpanded:e,group:t,groups:n,onExpand:r,toastMessenger:o}){const i=t.links.html,a=i||t.canLeave,s=t.scopes&&!t.scopes.enforced||t.isScopedToUri,l=ii(),c=l.focusedGroupId(),u=t.id===c,h=t=>{t.stopPropagation(),t.preventDefault(),r(!e)},d="private"===t.type?"Copy invite link":"Copy activity link";return po(Vd,{icon:t.logo||"blank",iconAlt:hm(t),isDisabled:!s,isExpanded:!!a&&e,isSelected:u,isSubmenuVisible:a?e:void 0,label:t.name,onClick:s?()=>{l.clearDirectLinkedGroupFetchFailed(),l.clearDirectLinkedIds(),n.focus(t.id)}:h,
|
|
577
577
|
onToggleSubmenu:h,submenu:po(m,{children:[po("ul",{children:[i&&po("li",{children:po(Vd,{href:i,icon:"external",isSubmenuItem:!0,label:"View group activity"})}),i&&po("li",{children:po(Vd,{onClick:()=>(e=>{try{ba(e),o.success(`Copied link for "${t.name}"`)}catch(e){o.error("Unable to copy link")}})(i),icon:"copy",isSubmenuItem:!0,label:d})}),t.canLeave&&po("li",{children:po(Vd,{icon:"leave",isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await Xo({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!s&&po("p",{className:"GroupListItem__footer",children:"This group is restricted to specific URLs."})]})})}),["groups","toastMessenger"]);function gm({expandedGroup:e,onExpandGroup:t,groups:n,heading:r}){return po(mm,{heading:r,children:n.map((n=>po(fm,{isExpanded:n===e,onExpand:e=>t(e?n:null),group:n},n.id)))})}var vm=ri((function({settings:e}){
|
|
578
|
-
const t=ii(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=no((()=>pm(o)),[o]),l=no((()=>pm(r)),[r]),c=no((()=>pm(n)),[n]),u=t.defaultAuthority(),h=a&&!Qo(a,u),d=t.getLink("groups.new"),[p,m]=Zr(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=hm(i)?hm(i):"";f=po("span",{className:"GroupList__menu-label",children:[t&&po("img",{className:"GroupList__menu-icon",src:t,alt:n}),i.name]})}else f=po("span",{children:"…"});return!!
|
|
579
|
-
}),h&&po(Vd,{icon:"add",href:d,label:"New private group"})]})}),["settings"]);function ym({alwaysExpanded:e,query:t,onSearch:n}){const r=ii().isLoading(),o=to(),[i,a]=Zr(t),[s,l]=Zr(t);return t!==i&&(l(t),a(t)),po("form",{action:"#",className:"SearchInput__form",name:"searchForm",onSubmit:e=>{e.preventDefault(),(o.current.value||i)&&n(o.current.value)},children:[po("input",{"aria-label":"Search",className:
|
|
578
|
+
const t=ii(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=no((()=>pm(o)),[o]),l=no((()=>pm(r)),[r]),c=no((()=>pm(n)),[n]),u=t.defaultAuthority(),h=a&&!Qo(a,u),d=t.getLink("groups.new"),[p,m]=Zr(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=hm(i)?hm(i):"";f=po("span",{className:"GroupList__menu-label",children:[t&&po("img",{className:"GroupList__menu-icon",src:t,alt:n}),i.name]})}else f=po("span",{children:"…"});return!!Up(e)&&n.length+r.length+o.length<2?f:po($d,{align:"left",contentClass:"GroupList__content",label:f,onOpenChanged:()=>m(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[c.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"Currently Viewing",groups:c}),l.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"Featured Groups",groups:l}),s.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"My Groups",groups:s
|
|
579
|
+
}),h&&po(Vd,{icon:"add",href:d,label:"New private group"})]})}),["settings"]);function ym({alwaysExpanded:e,query:t,onSearch:n}){const r=ii().isLoading(),o=to(),[i,a]=Zr(t),[s,l]=Zr(t);return t!==i&&(l(t),a(t)),po("form",{action:"#",className:"SearchInput__form",name:"searchForm",onSubmit:e=>{e.preventDefault(),(o.current.value||i)&&n(o.current.value)},children:[po("input",{"aria-label":"Search",className:qr("SearchInput__input",{"is-expanded":e||t}),dir:"auto",type:"text",name:"query",placeholder:r?"Loading…":"Search…",disabled:r,ref:o,value:s||"",onInput:e=>l(e.target.value)}),!r&&po("div",{className:"SearchInput__button-container",children:po(_o,{icon:"search",onClick:()=>o.current.focus(),size:"small",title:"Search annotations"})}),r&&po("div",{style:"margin:0.5em 0",children:po(Uo,{size:"small"})})]})}function _m(){const e=ii(),t=e.sortKey(),n=e.sortKeys().map((n=>po(Vd,{label:n,onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"sort",
|
|
580
580
|
classes:"TopBar__menu-icon"})});return po("div",{className:"SortMenu",children:po($d,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}var bm=ri((function({router:e}){return po(ym,{query:ii().routeParams().q,onSearch:t=>{e.navigate("stream",{q:t})},alwaysExpanded:!0})}),["router"]);var wm=ri((function({auth:e,frameSync:t,onLogout:n,settings:r}){const o=ii(),i=o.defaultAuthority(),a=Qo(e.userid,i),s=P(r),l=o.isFeatureEnabled("notebook_launch"),[c,u]=Zr(!1),h=e=>s&&!!s[e],d=!a||h("onProfileRequestProvided"),p=!a||h("onLogoutRequestProvided"),m=()=>{t.notifyHost("openNotebook",o.focusedGroupId())},f=()=>a&&t.notifyHost("profileRequested"),g=(()=>{const t={};return d&&(a||(t.href=o.getLink("user",{user:e.username})),t.onClick=f),t})(),v=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"profile",classes:"TopBar__menu-icon"})});return po("div",{className:"UserMenu",onKeyDown:e=>{"n"===e.key&&(m(),u(!1))},children:po($d,{label:v,title:e.displayName,align:"right",open:c,
|
|
581
|
-
onOpenChanged:u,children:[po(mm,{children:[po(Vd,{label:e.displayName,isDisabled:!d,...g}),!a&&po(Vd,{label:"Account settings",href:o.getLink("account.settings")}),l&&po(Vd,{label:"Open notebook",onClick:()=>m()})]}),p&&po(mm,{children:po(Vd,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var xm=ri((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!
|
|
581
|
+
onOpenChanged:u,children:[po(mm,{children:[po(Vd,{label:e.displayName,isDisabled:!d,...g}),!a&&po(Vd,{label:"Account settings",href:o.getLink("account.settings")}),l&&po(Vd,{label:"Open notebook",onClick:()=>m()})]}),p&&po(mm,{children:po(Vd,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var xm=ri((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!Up(a),c=ti(["accentColor"],a),u=ii(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations"),g=()=>{const e=P(a);e&&e.onHelpRequestProvided?t.notifyHost("helpRequested"):u.toggleSidebarPanel("help")},v=po(m,{children:["unknown"===e.status&&po("span",{className:"TopBar__login-links",children:"⋯"}),"logged-out"===e.status&&po("span",{className:"TopBar__login-links text-lg font-medium hyp-u-horizontal-spacing--2",children:[po(wo,{classes:"InlineLinkButton",onClick:i,style:c,variant:"primary",children:"Sign up"}),po("div",{
|
|
582
582
|
children:"/"}),po(wo,{classes:"InlineLinkButton",onClick:r,style:c,variant:"primary",children:"Log in"})]}),"logged-in"===e.status&&po(wm,{auth:e,onLogout:o})]});return po("div",{className:"TopBar",children:[!n&&po("div",{className:"TopBar__inner content",children:[po(bm,{}),po("div",{className:"hyp-u-stretch"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]}),n&&po("div",{className:"TopBar__inner content",children:[po(vm,{}),po("div",{className:"hyp-u-stretch"}),d>0&&po(_o,{icon:"refresh",onClick:()=>s.applyPendingUpdates(),size:"small",variant:"primary",title:`Show ${d} new/updated ${1===d?"annotation":"annotations"}`}),po(ym,{query:h||null,onSearch:u.setFilterQuery}),po(_m,{}),l&&po(_o,{icon:"share",expanded:f,onClick:()=>{u.toggleSidebarPanel("shareGroupAnnotations")},size:"small",title:"Share annotations on this page"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]})]})}),["frameSync","settings","streamer"])
|
|
583
583
|
;var km=ri((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=ii(),a=i.hasFetchedProfile(),s=i.profile(),l=i.route(),c=no((()=>a?function(e){const t=Zo(e.userid);if(t&&e.userid){let n=t.username;return e.user_info&&e.user_info.display_name&&(n=e.user_info.display_name),{status:"logged-in",displayName:n,userid:e.userid,username:t.username}}return{status:"logged-out"}}(s):{status:"unknown"}),[a,s]),u=no((()=>ti(["appBackgroundColor"],n)),[n]),h="clean"===n.theme,d="sidebar"===l;Qr((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=P(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,s,n)&&i.openSidebarPanel("help")}),[d,s,n,i]);const p=async()=>{if(P(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},m=()=>{P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return po("div",{
|
|
584
|
-
className:
|
|
585
|
-
;function Sm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Cm{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?fa(e.user):ga(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+
|
|
584
|
+
className:qr("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"HypothesisApp--notebook":"notebook"===l}),style:u,children:["notebook"!==l&&po(xm,{auth:c,onLogin:p,onSignUp:m,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),Xo({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),P(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),po("div",{className:"HypothesisApp__content",children:[po(um,{}),po(Kp,{auth:"logged-in"===c.status?c:{}}),po(lm,{}),l&&po("main",{children:["annotation"===l&&po(xp,{onLogin:p}),"notebook"===l&&po(sm,{}),"stream"===l&&po(Hp,{}),"sidebar"===l&&po(jp,{onLogin:p,onSignUp:m})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"])
|
|
585
|
+
;function Sm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Cm{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?fa(e.user):ga(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+U(8),l=Object.assign({created:t.toISOString(),group:r,permissions:va(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Ni(l)&&(l.permissions=fa(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Ni(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Ci(n)}),
|
|
586
586
|
Mi(n)?this._store.selectTab("note"):zi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ci(e)?ga(t,e.group):fa(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Si(e)?this._api.annotation.create({},n):this._api.annotation.update({id:e.id},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
|
|
587
587
|
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Cm.$inject=["api","store"];class Am extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),this.url=e,this.response=t,this.reason=n}}async function Em(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Am(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Am(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Am(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Tm(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function Nm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Lm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
|
|
588
|
-
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
588
|
+
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.982.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Tm(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await Em(m.toString(),{body:s?JSON.stringify(Nm(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});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={
|
|
589
589
|
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}}Lm.$inject=["apiRoutes","auth","store"];var Mm={};function zm(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 Om=zm;zm.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},zm.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},zm.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
|
|
590
590
|
;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},zm.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},zm.prototype.try=function(e){
|
|
591
591
|
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},zm.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},zm.prototype.start=zm.prototype.try,zm.prototype.errors=function(){return this._errors},zm.prototype.attempts=function(){return this._attempts},zm.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=Om;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})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
|
|
592
592
|
;return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort((function(e,t){return e-t})),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var a=r[i],s=t[a];t[a]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){r.apply(t,i)}))}.bind(t,s),t[a].options=n}}}(Mm);var Im=Mm;function Rm(e,t){return new Promise(((n,r)=>{const o=Im.operation(t);o.attempt((async()=>{try{const t=await e();o.retry(),n(t)}catch(e){o.retry(e)||r(e)}}))}))}function Pm(e){return Rm((()=>Em(e)))}class Dm{constructor(e){this._apiUrl=e.apiUrl,this._routeCache=null,this._linkCache=null}routes(){
|
|
593
|
-
return this._routeCache||(this._routeCache=Pm(this._apiUrl).then((e=>e.links))),this._routeCache}links(){return this._linkCache||(this._linkCache=this.routes().then((e=>Pm(e.links.url)))),this._linkCache}}Dm.$inject=["settings"];class Bm extends Error{constructor(e,t){super(e),this.cause=t}}class Fm{constructor(e){this.clientId=e.clientId,this.tokenEndpoint=e.tokenEndpoint,this.authorizationEndpoint=e.authorizationEndpoint,this.revokeEndpoint=e.revokeEndpoint}exchangeAuthCode(e){return this._getAccessToken({client_id:this.clientId,grant_type:"authorization_code",code:e})}exchangeGrantToken(e){return this._getAccessToken({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:e})}refreshToken(e){return this._getAccessToken({grant_type:"refresh_token",refresh_token:e})}async revokeToken(e){try{await this._formPost(this.revokeEndpoint,{token:e})}catch(e){throw new Bm("Failed to revoke access token",e)}}authorize(e,t){const n=
|
|
593
|
+
return this._routeCache||(this._routeCache=Pm(this._apiUrl).then((e=>e.links))),this._routeCache}links(){return this._linkCache||(this._linkCache=this.routes().then((e=>Pm(e.links.url)))),this._linkCache}}Dm.$inject=["settings"];class Bm extends Error{constructor(e,t){super(e),this.cause=t}}class Fm{constructor(e){this.clientId=e.clientId,this.tokenEndpoint=e.tokenEndpoint,this.authorizationEndpoint=e.authorizationEndpoint,this.revokeEndpoint=e.revokeEndpoint}exchangeAuthCode(e){return this._getAccessToken({client_id:this.clientId,grant_type:"authorization_code",code:e})}exchangeGrantToken(e){return this._getAccessToken({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:e})}refreshToken(e){return this._getAccessToken({grant_type:"refresh_token",refresh_token:e})}async revokeToken(e){try{await this._formPost(this.revokeEndpoint,{token:e})}catch(e){throw new Bm("Failed to revoke access token",e)}}authorize(e,t){const n=U(16),r=new Promise(((t,r)=>{e.addEventListener("message",(function o(i){
|
|
594
594
|
"object"==typeof i.data&&i.data.state===n&&("authorization_response"===i.data.type&&t(i.data),"authorization_canceled"===i.data.type&&r(new Error("Authorization window was closed")),e.removeEventListener("message",o))}))})),o=new URL(this.authorizationEndpoint);return o.searchParams.set("client_id",this.clientId),o.searchParams.set("origin",e.location.origin),o.searchParams.set("response_mode","web_message"),o.searchParams.set("response_type","code"),o.searchParams.set("state",n),t.location=o.toString(),r.then((e=>e.code))}async _formPost(e,t){const n=new URLSearchParams;for(let[e,r]of Object.entries(t))n.set(e,r);n.sort();return Em(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()})}async _getAccessToken(e){let t;try{t=await this._formPost(this.tokenEndpoint,e)}catch(e){throw new Bm("Failed to fetch access token",e)}return{accessToken:t.access_token,expiresAt:Date.now()+1e3*(t.expires_in-10),refreshToken:t.refresh_token}}static openAuthPopupWindow(e){
|
|
595
595
|
const t=`left=${e.screen.width/2-237.5},top=${e.screen.height/2-215},width=475,height=430`,n=e.open("about:blank","Log in to Hypothesis",t);if(!n)throw new Error("Failed to open login window");return n}}class jm extends Jp{constructor(e,t,n,r,o){let i,a,s;super();const l=(c="token",u=r.apiUrl,new URL(c,u).href);var c,u;function h(){let e=new URL(r.apiUrl).hostname;return e=e.replace(/\./g,"%2E"),`hypothesis.oauth.${e}.token`}function d(e){n.setObject(h(),e)}const p=async()=>{if(s)return s;const e=await t.links();return s=new Fm({clientId:r.oauthClientId,authorizationEndpoint:e["oauth.authorize"],revokeEndpoint:e["oauth.revoke"],tokenEndpoint:l}),s},m=()=>{var e;return null===(e=P(r))||void 0===e?void 0:e.grantToken},f=async()=>{if(!a){const e=m();void 0!==e?a=e?p().then((t=>t.exchangeGrantToken(e))).catch((e=>{var t;throw t="You must reload the page to annotate.",o.error(`Hypothesis login lost: ${t}`,{autoDismiss:!1}),e})):Promise.resolve(null):i?(a=(async e=>{const t=await p(),n=await t.exchangeAuthCode(e)
|
|
596
596
|
;return d(n),n})(i),i=null):a=Promise.resolve(function(){const e=n.getObject(h());return e&&"string"==typeof e.accessToken&&"string"==typeof e.refreshToken&&"number"==typeof e.expiresAt?{accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt}:null}())}const e=a,t=await a;if(!t)return null;if(e!==a)return f();if(Date.now()>t.expiresAt){const e=m();return a=(async(e,t)=>{const n=await p();let r;try{if(r=await n.refreshToken(e),Date.now()>r.expiresAt)throw new Error("Refreshed token expired in the past")}catch{return null}return t.persist&&d(r),r})(t.refreshToken,{persist:void 0===e}),f()}return t.accessToken};(()=>{e.addEventListener("storage",(({key:e})=>{e===h()&&(a=null,this.emit("oauthTokensChanged"))}))})(),this.login=async function(){const t=Fm.openAuthPopupWindow(e),n=await p(),r=await n.authorize(e,t);i=r,a=null},this.logout=async function(){const[e,t]=await Promise.all([a,p()]);e&&await t.revokeToken(e.accessToken),a=Promise.resolve(null),n.removeItem(h())},this.getAccessToken=f}}
|
|
597
|
-
jm.$inject=["$window","apiRoutes","localStorage","settings","toastMessenger"];class Hm{constructor(e,t){this._annotationsService=e,this._store=t,this._saving=new Set,this._failed=new Set}init(){const e=e=>!this._saving.has(e)&&!this._failed.has(e);this._store.subscribe((()=>{this._store.newHighlights().forEach((t=>{const n=t.$tag;e(n)&&(this._saving.add(n),Rm((()=>this._annotationsService.save(t))).catch((()=>{this._failed.add(n)})).finally((()=>{this._saving.delete(n)})))}))}))}isSaving(){return this._saving.size>0}}Hm.$inject=["annotationsService","store"];var
|
|
598
|
-
const r=Array.isArray(t),o=()=>r?t.map((e=>e())):t();let i=o();return e((()=>{const e=o();if(r?
|
|
599
|
-
!t)throw new Error("Invalid request of channel/port");return new Promise(((t,
|
|
600
|
-
|
|
601
|
-
const n=e.find((e=>e.uri===t.uri));return n||e.find((e=>null===e.id))}class
|
|
602
|
-
this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag))),this._inFrame.delete(e.$tag)})),n.length>0&&n.every((e=>e.isAnnotationFetchComplete))&&(0!==o&&o===e||(this._hostRPC.call("publicAnnotationCountChanged",o),e=o))}))}_connectGuest(e){const t=new
|
|
603
|
-
this._annotationsService.create(e)}));let r={};const o=ua((()=>{this._store.updateAnchorStatus(r),r={}}),10);t.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),r[e]=t?"orphan":"anchored",o()})),t.on("showAnnotations",(e=>{this._store.selectAnnotations(this._store.findIDsForTags(e)),this._store.selectTab("annotation")})),t.on("focusAnnotations",(e=>{this._store.focusAnnotations(e||[])})),t.on("toggleAnnotationSelection",(e=>{this._store.toggleSelectedAnnotations(this._store.findIDsForTags(e))})),t.on("openSidebar",(()=>{this._hostRPC.call("openSidebar")
|
|
604
|
-
|
|
605
|
-
;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e:null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,
|
|
606
|
-
_fetchGroup(e){return this._api.group.read({id:e,expand:
|
|
607
|
-
;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:
|
|
608
|
-
return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}}
|
|
609
|
-
});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 tm(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=>{
|
|
610
|
-
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),!ki(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}}
|
|
611
|
-
removeItem(e){this._storage.removeItem(e)}}
|
|
612
|
-
{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[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()}}
|
|
613
|
-
this._authority=null!==(i=null===(a=P(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=Rm((()=>{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:{
|
|
614
|
-
return this._lastLoad=null,this._lastLoadTime=null,this.load()}}
|
|
615
|
-
n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class
|
|
616
|
-
case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else K("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{
|
|
617
|
-
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
|
|
618
|
-
this._socket||await this._reconnect()}}
|
|
619
|
-
dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r=""}={}){if(this._store.hasToastMessage(e,t))return;const o=
|
|
620
|
-
;t%2?
|
|
621
|
-
;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(
|
|
622
|
-
if("object"!=typeof e||null===e)throw new Error(
|
|
623
|
-
;return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function
|
|
624
|
-
return e(o)}));return r=
|
|
625
|
-
console.log("Prev State:",e.getState()),console.log("Action:",r),n(r),console.log("Next State:",e.getState()),console.groupEnd()}}}const
|
|
626
|
-
;return{...e,hasFetchedAnnotations:!0,activeAnnotationFetches:e.activeAnnotationFetches-1}},SET_ANNOTATION_RESULT_COUNT:(e,t)=>({annotationResultCount:t.resultCount})},
|
|
627
|
-
isLoading:function(e){return e.activeApiRequests>0||!e.hasFetchedAnnotations},isFetchingAnnotations:function(e){return e.activeAnnotationFetches>0},isSavingAnnotation:function(e,t){return!!t.$tag&&e.activeAnnotationSaveRequests.includes(t.$tag)},annotationResultCount:function(e){return e.annotationResultCount}}});var
|
|
628
|
-
get:r,put:function(t,o){"NOT_FOUND"===r(t)&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(l,u);function d(){var t=h.get(arguments);if("NOT_FOUND"===t){if(t=e.apply(null,arguments),c){var n=h.getEntries(),r=n.find((function(e){return c(e.value,t)}));r&&(t=r.value)}h.put(arguments,t)}return t}return d.clearCache=function(){return h.clear()},d}function
|
|
629
|
-
"function"!=typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s,u=c.memoizeOptions,h=void 0===u?n:u,d=Array.isArray(h)?h:[h],p=
|
|
630
|
-
selectors:{route:function(e){return e.name},routeParams:function(e){return e.params}}});function
|
|
631
|
-
highlighted:t.highlighted}},REMOVE_ANNOTATIONS:function(e,t){return{annotations:[...t.remainingAnnotations]}},UNHIDE_ANNOTATION:function(e,t){return{annotations:e.annotations.map((e=>e.id!==t.id?e:Object.assign({},e,{hidden:!1})))}},UPDATE_ANCHOR_STATUS:function(e,t){return{annotations:e.annotations.map((e=>{if(!t.statusUpdates.hasOwnProperty(e.$tag))return e;const n=t.statusUpdates[e.$tag];return"timeout"===n?Object.assign({},e,{$anchorTimeout:!0}):Object.assign({},e,{$orphan:"orphan"===n})}))}},UPDATE_FLAG_STATUS:function(e,t){return{annotations:e.annotations.map((e=>{if(e.id&&e.id===t.id){
|
|
632
|
-
e.filter((e=>!(e.id&&e.id in n||e.$tag&&e.$tag in r)))}(n().annotations.annotations,e);t({type:
|
|
633
|
-
},highlightAnnotations:function(e){return{type:
|
|
634
|
-
newHighlights:
|
|
635
|
-
directLinkedAnnotationId:null,directLinkedGroupId:null,directLinkedGroupFetchFailed:!1}}},
|
|
636
|
-
},directLinkedGroupId:function(e){return e.directLinkedGroupId}}});class
|
|
637
|
-
draft:new
|
|
638
|
-
SET_FOCUS_MODE:function(e,t){var n;return{focusActive:null!==(n=t.active)&&void 0!==n?n:!e.focusActive}},CLEAR_SELECTION:function(){return{filters:{},focusActive:!1,query:null}}},
|
|
639
|
-
setFilterQuery:function(e){return{type:
|
|
640
|
-
}(t))),[])),(e=>e)),
|
|
641
|
-
profile:function(e){return e.profile}}}),
|
|
642
|
-
return e.groups.find((e=>e.id===t))}const
|
|
643
|
-
getInScopeGroups:
|
|
644
|
-
FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})},
|
|
645
|
-
pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:
|
|
646
|
-
return{forcedVisible:{},selected:{}}},SET_FILTER:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FILTER_QUERY:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FOCUS_MODE:function(){return{forcedVisible:{},selected:{}}},REMOVE_ANNOTATIONS:function(e,t){let n=e.selectedTab;"orphan"===n&&0===Uf(t.remainingAnnotations,Li)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{...
|
|
647
|
-
;return"note"!==e&&t.push("Location"),t})),
|
|
648
|
-
CLOSE_SIDEBAR_PANEL:function(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}},
|
|
649
|
-
|
|
650
|
-
get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){
|
|
651
|
-
factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const
|
|
652
|
-
"sidebar"===t.route()&&e.connect()}
|
|
653
|
-
document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),
|
|
654
|
-
|
|
655
|
-
console.error("Failed to start Hypothesis client: ",e),I(po(Sm,{error:e}),t)}(e,
|
|
597
|
+
jm.$inject=["$window","apiRoutes","localStorage","settings","toastMessenger"];class Hm{constructor(e,t){this._annotationsService=e,this._store=t,this._saving=new Set,this._failed=new Set}init(){const e=e=>!this._saving.has(e)&&!this._failed.has(e);this._store.subscribe((()=>{this._store.newHighlights().forEach((t=>{const n=t.$tag;e(n)&&(this._saving.add(n),Rm((()=>this._annotationsService.save(t))).catch((()=>{this._failed.add(n)})).finally((()=>{this._saving.delete(n)})))}))}))}isSaving(){return this._saving.size>0}}Hm.$inject=["annotationsService","store"];var qm=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var c=i[l];if(!s(c))return!1;var u=e[c],h=t[c];if(!1===(o=n?n.call(r,u,h,c):void 0)||void 0===o&&u!==h)return!1}return!0};function Um(e,t,n){
|
|
598
|
+
const r=Array.isArray(t),o=()=>r?t.map((e=>e())):t();let i=o();return e((()=>{const e=o();if(r?qm(e,i):e===i)return;const t=i;i=e,n(e,t)}))}class $m{constructor(e,t){this._frameSync=e,this._store=t}init(){const e=()=>this._store.profile().features;Um(this._store.subscribe,[e,()=>this._store.frames()],(()=>{this._frameSync.notifyHost("featureFlagsUpdated",e()||{})}))}}function Gm(e,t){return!!function(e){if(null===e||"object"!=typeof e)return!1;for(let t of["frame1","frame2","type","requestId"])if("string"!=typeof e[t])return!1;return!0}(e)&&JSON.stringify(e,Object.keys(t).sort())===JSON.stringify(t,Object.keys(t).sort())}$m.$inject=["frameSync","store"];class Vm{constructor({hostFrame:e,source:t}){this._hostFrame=e,this._source=t,this._listeners=new ha}destroy(){this._listeners.removeAll()}async discover(e){let t=!1;if(("guest"===this._source&&"host"===e||"guest"===this._source&&"sidebar"===e||"sidebar"===this._source&&"host"===e||"notebook"===this._source&&"sidebar"===e)&&(t=!0),
|
|
599
|
+
!t)throw new Error("Invalid request of channel/port");const n=U(6);return new Promise(((t,r)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:e,type:"request",requestId:n},"*")},i=setInterval(o,250),a=setTimeout((()=>{clearInterval(i),r(new Error(`Unable to establish ${this._source}-${e} communication channel`))}),2e4),s=this._listeners.add(window,"message",(r=>{const{data:o,ports:l}=r;Gm(o,{frame1:this._source,frame2:e,type:"offer",requestId:n})&&(clearInterval(i),clearTimeout(a),this._listeners.remove(s),t(l[0]))}));o()}))}}function Wm(e,t,n=[],r=-1){e.postMessage({protocol:"frame-rpc",version:"1.0.0",arguments:n,method:t,sequence:r})}class Ym{constructor({userAgent:e=navigator.userAgent,currentWindow:t=window}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new ha,this._listeners.add(t,"unload",(()=>{this._port&&(Wm(this._port,"close"),t!==t.parent&&function(e){const t=e.match(/\bAppleWebKit\/([0-9]+)\b/)
|
|
600
|
+
;return!!t&&!(parseInt(t[1])<=537)}(e)&&t.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],this._receivedCloseEvent=!1}on(e,t){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(e,t)}connect(e){this._port=e,this._listeners.add(e,"message",(e=>this._handle(e))),e.start(),Wm(e,"connect");for(let[e,t]of this._pendingCalls)this.call(e,...t);this._pendingCalls=[]}destroy(){this._port&&(Wm(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(e,...t){if(this._port||this._pendingCalls.push([e,t]),!this._port||this._destroyed)return;const n=this._sequence++,r=t[t.length-1];"function"==typeof r&&(this._callbacks.set(n,r),t=t.slice(0,-1)),Wm(this._port,e,t,n)}_parseMessage({data:e}){return e&&"object"==typeof e?"frame-rpc"!==e.protocol||"1.0.0"!==e.version?null:Array.isArray(e.arguments)?e:null:null}_handle(e){const t=this._parseMessage(e),n=this._port;if(t&&n)if("method"in t){
|
|
601
|
+
if("close"===t.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const e=this._methods.get(t.method);if(!e)return;const r=(...e)=>{const r={arguments:e,protocol:"frame-rpc",response:t.sequence,version:"1.0.0"};n.postMessage(r)};e(...t.arguments,r)}else if("response"in t){const e=this._callbacks.get(t.response);this._callbacks.delete(t.response),e&&e(...t.arguments)}}}function Km({$tag:e,target:t,uri:n}){return{$tag:e,target:t,uri:n}}function Xm(e,t){const n=e.find((e=>e.uri===t.uri));return n||e.find((e=>null===e.id))}class Zm{constructor(e,t,n){this._window=e,this._annotationsService=t,this._store=n,this._portFinder=new Vm({hostFrame:this._window.parent,source:"sidebar"}),this._listeners=new ha,this._hostRPC=new Ym,this._guestRPC=new Map,this._nextGuestId=0,this._inFrame=new Set,this._highlightsVisible=!1,this._setupSyncToGuests(),this._setupHostEvents()}_setupSyncToGuests(){let e=0;Um(this._store.subscribe,[()=>this._store.allAnnotations(),()=>this._store.frames()],(([t,n],[r])=>{
|
|
602
|
+
let o=0;const i=new Set,a=[];t.forEach((e=>{ki(e)||(Ci(e)&&++o,i.add(e.$tag),this._inFrame.has(e.$tag)||a.push(e))}));const s=r.filter((e=>!i.has(e.$tag)));if(a.length>0){const e=new Map;for(let t of a){var l;const r=Xm(n,t);if(!r)continue;const o=null!==(l=e.get(r.id))&&void 0!==l?l:[];o.push(t),e.set(r.id,o)}for(let[t,n]of e){const e=this._guestRPC.get(t);e&&e.call("loadAnnotations",n.map(Km))}a.forEach((e=>{this._inFrame.add(e.$tag)}))}s.forEach((e=>{this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag))),this._inFrame.delete(e.$tag)})),n.length>0&&n.every((e=>e.isAnnotationFetchComplete))&&(0!==o&&o===e||(this._hostRPC.call("publicAnnotationCountChanged",o),e=o))}))}_connectGuest(e){const t=new Ym;++this._nextGuestId;let n=`temp-${this._nextGuestId}`;this._guestRPC.set(n,t),t.on("documentInfoChanged",(e=>{this._guestRPC.delete(n),n=e.frameIdentifier,this._guestRPC.set(n,t),this._store.connectFrame({id:e.frameIdentifier,metadata:e.metadata,uri:e.uri})})),t.on("close",(()=>{
|
|
603
|
+
const e=this._store.frames().find((e=>e.id===n));e&&this._store.destroyFrame(e),t.destroy(),this._guestRPC.delete(n)})),t.on("createAnnotation",(e=>{if(!this._store.isLoggedIn())return this._hostRPC.call("openSidebar"),this._store.openSidebarPanel("loginPrompt"),void this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag)));this._inFrame.add(e.$tag),e.$highlight||this._hostRPC.call("openSidebar"),this._hostRPC.call("showHighlights"),this._annotationsService.create(e)}));let r={};const o=ua((()=>{this._store.updateAnchorStatus(r),r={}}),10);t.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),r[e]=t?"orphan":"anchored",o()})),t.on("showAnnotations",(e=>{this._store.selectAnnotations(this._store.findIDsForTags(e)),this._store.selectTab("annotation")})),t.on("focusAnnotations",(e=>{this._store.focusAnnotations(e||[])})),t.on("toggleAnnotationSelection",(e=>{this._store.toggleSelectedAnnotations(this._store.findIDsForTags(e))})),t.on("openSidebar",(()=>{this._hostRPC.call("openSidebar")
|
|
604
|
+
})),t.on("closeSidebar",(()=>{this._hostRPC.call("closeSidebar")})),t.connect(e),t.call("setHighlightsVisible",this._highlightsVisible)}_setupHostEvents(){this._hostRPC.on("sidebarOpened",(()=>{this._store.setSidebarOpened(!0)})),this._hostRPC.on("setHighlightsVisible",(e=>{this._highlightsVisible=e,this._guestRPC.forEach((t=>t.call("setHighlightsVisible",e)))}))}async connect(){const e=await this._portFinder.discover("host");this._hostRPC.connect(e),this._listeners.add(e,"message",(e=>{const{data:t,ports:n}=e;Gm(t,{frame1:"guest",frame2:"sidebar",type:"offer"})&&this._connectGuest(n[0])}))}notifyHost(e,...t){this._hostRPC.call(e,...t)}focusAnnotations(e){this._store.focusAnnotations(e),this._guestRPC.forEach((t=>t.call("focusAnnotations",e)))}scrollToAnnotation(e){this._guestRPC.forEach((t=>t.call("scrollToAnnotation",e)))}destroy(){this._portFinder.destroy(),this._listeners.removeAll()}}function Jm(e){return Object.keys(e).reduce(((e,t)=>(e[t]=t,e)),{})}Zm.$inject=["$window","annotationsService","store"]
|
|
605
|
+
;const Qm={id:"__default__",name:"__DEFAULT__",logo:"data:image/svg+xml;utf8,"+encodeURIComponent(Yo)};const ef=["organization","scopes"];class tf{constructor(e,t,n,r,o,i){this._store=e,this._api=t,this._auth=n,this._settings=o,this._toastMessenger=i,this._serviceConfig=P(o),this._reloadSetUp=!1}_mainURI(){var e,t;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e:null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,Um(this._store.subscribe,(()=>this._mainURI()),(()=>{this.load()})),Um(this._store.subscribe,[()=>this._store.hasFetchedProfile(),()=>this._store.profile().userid],((e,[t])=>{t&&this.load()})))}
|
|
606
|
+
_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=Qm)}))}(e);const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:ef})}async _loadGroupsForUserAndDocument(){var e;const t=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let n=null;"sidebar"===this._store.route()&&(n=await t()),this._setupAutoReload();const r=this._store.directLinkedAnnotationId();let o=null;r&&(o=this._api.annotation.get({id:r}).catch((()=>null)));const i=this._store.directLinkedGroupId();let a=null;i&&(a=this._fetchGroup(i).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),
|
|
607
|
+
null))));const s={expand:ef},l=null===(e=this._serviceConfig)||void 0===e?void 0:e.authority;l&&(s.authority=l),n&&(s.document_uri=n);const[c,u,h,d,p]=await Promise.all([this._api.profile.groups.read({expand:ef}),this._api.groups.list(s),this._auth.getAccessToken(),o,a]);p&&!u.some((e=>e.id===p.id))&&u.push(p);let m=null;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:ef});let n;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}},o=await Promise.all(e.map((e=>t.find((t=>t.id===e||t.groupid===e))||r(e)))),i=o.filter((e=>null!==e)),a=this._store.directLinkedGroupId();return this._addGroupsToStore(i,a),
|
|
608
|
+
n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){var e;if(null!==(e=this._serviceConfig)&&void 0!==e&&e.groups){let e=[];try{e=await this._serviceConfig.groups}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}}tf.$inject=["store","api","auth","session","settings","toastMessenger"];class nf{constructor(e,t,n,r){this._api=e,this._store=t,this._streamer=n,this._streamFilter=r,this._searchClient=null}
|
|
609
|
+
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 tm(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=>{
|
|
610
|
+
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}),ki(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),!ki(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}}nf.$inject=["api","store","streamer","streamFilter"];class rf{constructor(){this._store={}}getItem(e){return e in this._store?this._store[e]:null}setItem(e,t){this._store[e]=t}removeItem(e){delete this._store[e]}}class of{constructor(e){
|
|
611
|
+
let 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 rf}}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)}}of.$inject=["$window"];const af={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class sf{constructor(e,t){this._storage=e,this._store=t}init(){Object.keys(af).forEach((e=>{const t=this._storage.getItem(af[e]);this._store.setDefault(e,t)})),Um(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(let n in e)t[n]!==e[n]&&n in af&&this._storage.setItem(af[n],e[n])}))}}sf.$inject=["localStorage","store"];class lf{constructor(e,t){this._window=e,this._store=t,this._didRegisterPopstateListener=!1}currentRoute(){
|
|
612
|
+
const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(let[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"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"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[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()}}
|
|
613
|
+
lf.$inject=["$window","store"];class cf{constructor(e,t){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}`)}}}cf.$inject=["apiRoutes","store"];class uf{constructor(e,t,n,r,o){var i,a;this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=P(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=Rm((()=>{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:{
|
|
614
|
+
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?Cr({id:e.userid}):Cr(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()}}uf.$inject=["store","api","auth","settings","toastMessenger"];class hf{constructor(){this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}}}addClause(e,t,n,r=!1){return this._filter.clauses.push({field:e,operator:t,value:n,case_sensitive:r}),this}getFilter(){return this._filter}resetFilter(){return this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}},this}}class df extends Jp{constructor(e){super();const t=[];let n;const r=()=>{for(;t.length>0;){const e=JSON.stringify(t.shift())
|
|
615
|
+
;n.send(e)}};this.close=()=>{n.close(1e3)},this.send=e=>{t.push(e),this.isConnected()&&r()},this.isConnected=()=>n.readyState===WebSocket.OPEN,(()=>{n=new WebSocket(e),n.onopen=e=>{r(),this.emit("open",e)},n.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")},n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class pf{constructor(e,t,n,r,o){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=U(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()}
|
|
616
|
+
_handleSocketError(e,t){K("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&K("Check that your H service is configured to allow WebSocket connections from "+window.location.origin)}_handleSocketMessage(e){const t=JSON.parse(e.data);if(t)if("annotation-notification"===t.type){const e=t.payload;switch(t.options.action){case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else K("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{
|
|
617
|
+
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 df(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",{
|
|
618
|
+
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,Um(this._store.subscribe,(()=>this._store.profile().userid),(()=>{this._reconnect()}))),this._socket||await this._reconnect()}}pf.$inject=["store","apiRoutes","auth","groups","session"];class mf{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject("hypothesis.user.tags.list")||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Z(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject("hypothesis.user.tags.map")||{};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("hypothesis.user.tags.map",t)
|
|
619
|
+
;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("hypothesis.user.tags.list",n)}}mf.$inject=["localStorage"];class ff{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}ff.$inject=["store"];class gf{constructor(e){this._store=e}dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r=""}={}){if(this._store.hasToastMessage(e,t))return;const o=U(10),i={type:e,id:o,message:t,moreInfoURL:r};this._store.addToastMessage({isDismissed:!1,...i}),n&&setTimeout((()=>{this.dismiss(o)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}function vf(e,t,n){return t in e?Object.defineProperty(e,t,{
|
|
620
|
+
value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yf(Object(n),!0).forEach((function(t){vf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bf(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}gf.$inject=["store"];var wf="function"==typeof Symbol&&Symbol.observable||"@@observable",xf=function(){return Math.random().toString(36).substring(7).split("").join(".")},kf={INIT:"@@redux/INIT"+xf(),
|
|
621
|
+
REPLACE:"@@redux/REPLACE"+xf(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+xf()}};function Sf(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Cf(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(bf(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(bf(1));return n(Cf)(e,t)}if("function"!=typeof e)throw new Error(bf(2));var o=e,i=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(bf(3));return i}function h(e){if("function"!=typeof e)throw new Error(bf(4));if(l)throw new Error(bf(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(bf(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),a=null}}}function d(e){if(!Sf(e))throw new Error(bf(7));if(void 0===e.type)throw new Error(bf(8))
|
|
622
|
+
;if(l)throw new Error(bf(9));try{l=!0,i=o(i,e)}finally{l=!1}for(var t=a=s,n=0;n<t.length;n++){(0,t[n])()}return e}function p(e){if("function"!=typeof e)throw new Error(bf(10));o=e,d({type:kf.REPLACE})}function m(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(bf(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[wf]=function(){return this},e}return d({type:kf.INIT}),(r={dispatch:d,subscribe:h,getState:u,replaceReducer:p})[wf]=m,r}function Af(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:kf.INIT}))throw new Error(bf(12));if(void 0===n(void 0,{type:kf.PROBE_UNKNOWN_ACTION()}))throw new Error(bf(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},s=0;s<a.length;s++){var l=a[s],c=n[l],u=e[l],h=c(u,t);if(void 0===h)throw t&&t.type,
|
|
623
|
+
new Error(bf(14));o[l]=h,r=r||h!==u}return(r=r||a.length!==Object.keys(e).length)?o:e}}function Ef(e,t){return function(){return t(e.apply(this,arguments))}}function Tf(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Nf(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var Lf=Nf();Lf.withExtraArgument=Nf;var Mf=Lf;function zf(e,t=[],n=[]){const r={},o={},i={};e.forEach((e=>{e.namespace?(r[e.namespace]=e.initialState(...t),o[e.namespace]=function(e){return(t={},n)=>{const r=e[n.type];if(!r)return t;const o=r(t,n);return Array.isArray(o)?o:{...t,...o}}}(e.reducers),i[e.namespace]={selectors:e.selectors,rootSelectors:e.rootSelectors||{}}):console.warn("Store module does not specify a namespace",e)}));const a=function(){
|
|
624
|
+
for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(bf(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return r=Tf.apply(void 0,i)(n.dispatch),_f(_f({},n),{},{dispatch:r})}}}(...[Mf],...n);const s=Cf(Af(o),r,a),l=Object.assign({},...e.map((e=>e.actionCreators))),c=function(e,t){if("function"==typeof e)return Ef(e,t);if("object"!=typeof e||null===e)throw new Error(bf(16));var n={};for(var r in e){var o=e[r];"function"==typeof o&&(n[r]=Ef(o,t))}return n}(l,s.dispatch),u=function(e,t){const n={};return Object.keys(e).forEach((r=>{const{selectors:o,rootSelectors:i={}}=e[r];Object.keys(o).forEach((e=>{if(n[e])throw new Error(`Duplicate selector "${e}"`);n[e]=(...n)=>o[e](t()[r],...n)})),Object.keys(i).forEach((e=>{if(n[e])throw new Error(`Duplicate selector "${e}"`);n[e]=(...n)=>i[e](t(),...n)}))})),n}(i,s.getState)
|
|
625
|
+
;return Object.assign(s,c,u),s}function Of(e,t){if(!(e instanceof Function)){const t=e;e=()=>t}return{initialState:e,...t}}function If(e){let t=0;return function(n){return function(r){if(!window.debug)return void n(r);++t;const o=r.type+" ("+t.toString()+")";console.group(o),console.log("Prev State:",e.getState()),console.log("Action:",r),n(r),console.log("Next State:",e.getState()),console.groupEnd()}}}const Rf={API_REQUEST_STARTED:e=>({...e,activeApiRequests:e.activeApiRequests+1}),API_REQUEST_FINISHED(e){if(0===e.activeApiRequests)throw new Error("API_REQUEST_FINISHED action when no requests were active");return{...e,activeApiRequests:e.activeApiRequests-1}},ANNOTATION_SAVE_STARTED(e,t){let n=[];t.annotation.$tag&&!e.activeAnnotationSaveRequests.includes(t.annotation.$tag)&&n.push(t.annotation.$tag);const r=e.activeAnnotationSaveRequests.concat(n);return{...e,activeAnnotationSaveRequests:r}},ANNOTATION_SAVE_FINISHED(e,t){const n=e.activeAnnotationSaveRequests.filter((e=>e!==t.annotation.$tag));return{...e,
|
|
626
|
+
activeAnnotationSaveRequests:n}},ANNOTATION_FETCH_STARTED:e=>({...e,activeAnnotationFetches:e.activeAnnotationFetches+1}),ANNOTATION_FETCH_FINISHED(e){if(0===e.activeAnnotationFetches)throw new Error("ANNOTATION_FETCH_FINISHED action when no annotation fetches were active");return{...e,hasFetchedAnnotations:!0,activeAnnotationFetches:e.activeAnnotationFetches-1}},SET_ANNOTATION_RESULT_COUNT:(e,t)=>({annotationResultCount:t.resultCount})},Pf=Jm(Rf);const Df=Of({activeAnnotationSaveRequests:[],activeApiRequests:0,activeAnnotationFetches:0,hasFetchedAnnotations:!1,annotationResultCount:null},{reducers:Rf,namespace:"activity",actionCreators:{annotationFetchStarted:function(){return{type:Pf.ANNOTATION_FETCH_STARTED}},annotationFetchFinished:function(){return{type:Pf.ANNOTATION_FETCH_FINISHED}},annotationSaveStarted:function(e){return{type:Pf.ANNOTATION_SAVE_STARTED,annotation:e}},annotationSaveFinished:function(e){return{type:Pf.ANNOTATION_SAVE_FINISHED,annotation:e}},apiRequestStarted:function(){return{
|
|
627
|
+
type:Pf.API_REQUEST_STARTED}},apiRequestFinished:function(){return{type:Pf.API_REQUEST_FINISHED}},setAnnotationResultCount:function(e){return{type:Pf.SET_ANNOTATION_RESULT_COUNT,resultCount:e}}},selectors:{hasFetchedAnnotations:function(e){return e.hasFetchedAnnotations},isLoading:function(e){return e.activeApiRequests>0||!e.hasFetchedAnnotations},isFetchingAnnotations:function(e){return e.activeAnnotationFetches>0},isSavingAnnotation:function(e,t){return!!t.$tag&&e.activeAnnotationSaveRequests.includes(t.$tag)},annotationResultCount:function(e){return e.annotationResultCount}}});var Bf=function(e,t){return e===t};function Ff(e,t){var n,r,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,a=void 0===i?Bf:i,s=o.maxSize,l=void 0===s?1:s,c=o.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(a),h=1===l?(n=u,{get:function(e){return r&&n(r.key,e)?r.value:"NOT_FOUND"},
|
|
628
|
+
put:function(e,t){r={key:e,value:t}},getEntries:function(){return r?[r]:[]},clear:function(){r=void 0}}):function(e,t){var n=[];function r(e){var r=n.findIndex((function(n){return t(e,n.key)}));if(r>-1){var o=n[r];return r>0&&(n.splice(r,1),n.unshift(o)),o.value}return"NOT_FOUND"}return{get:r,put:function(t,o){"NOT_FOUND"===r(t)&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(l,u);function d(){var t=h.get(arguments);if("NOT_FOUND"===t){if(t=e.apply(null,arguments),c){var n=h.getEntries(),r=n.find((function(e){return c(e.value,t)}));r&&(t=r.value)}h.put(arguments,t)}return t}return d.clearCache=function(){return h.clear()},d}function jf(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ")
|
|
629
|
+
;throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}function Hf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,a=0,s={memoizeOptions:void 0},l=r.pop();if("object"==typeof l&&(s=l,l=r.pop()),"function"!=typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s,u=c.memoizeOptions,h=void 0===u?n:u,d=Array.isArray(h)?h:[h],p=jf(r),m=e.apply(void 0,[function(){return a++,l.apply(null,arguments)}].concat(d)),f=e((function(){for(var e=[],t=p.length,n=0;n<t;n++)e.push(p[n].apply(null,arguments));return i=m.apply(null,e)}));return Object.assign(f,{resultFunc:l,memoizedResultFunc:m,dependencies:p,lastResult:function(){return i},recomputations:function(){return a},resetRecomputations:function(){return a=0}}),f};return o}var qf=Hf(Ff)
|
|
630
|
+
;function Uf(e,t){return e.reduce(((e,n)=>t(n)?e+1:e),0)}function $f(e){const t={};return e.forEach((e=>t[e]=!0)),t}function Gf(e){return Object.keys(e).filter((t=>!0===e[t]))}const Vf={CHANGE_ROUTE:(e,{name:t,params:n})=>({name:t,params:n})},Wf=Jm(Vf);const Yf=Of({name:null,params:{}},{namespace:"route",reducers:Vf,actionCreators:{changeRoute:function(e,t={}){return{type:Wf.CHANGE_ROUTE,name:e,params:t}}},selectors:{route:function(e){return e.name},routeParams:function(e){return e.params}}});function Kf(e,t){return e.find((e=>e.id===t))}function Xf(e,t){return e.find((e=>e.$tag===t))}const Zf={ADD_ANNOTATIONS:function(e,t){const n={},r={},o=[],i=[],a=[];let s=e.nextTag;return t.annotations.forEach((t=>{let i;t.id&&(i=Kf(e.annotations,t.id)),!i&&t.$tag&&(i=Xf(e.annotations,t.$tag)),i?(a.push(Object.assign({},i,t)),t.id&&(n[t.id]=!0),i.$tag&&(r[i.$tag]=!0)):(o.push(function(e,t){let n=e.$orphan;return e.id||(n=!1),Object.assign({},e,{$anchorTimeout:!1,$tag:e.$tag||t,$orphan:n})}(t,"t"+s)),++s)})),
|
|
631
|
+
e.annotations.forEach((e=>{n[e.id]||r[e.$tag]||i.push(e)})),{annotations:o.concat(a).concat(i),nextTag:s}},CLEAR_ANNOTATIONS:function(){return{annotations:[],focused:{},highlighted:{}}},FOCUS_ANNOTATIONS:function(e,t){return{focused:$f(t.focusedTags)}},HIDE_ANNOTATION:function(e,t){return{annotations:e.annotations.map((e=>e.id!==t.id?e:{...e,hidden:!0}))}},HIGHLIGHT_ANNOTATIONS:function(e,t){return{highlighted:t.highlighted}},REMOVE_ANNOTATIONS:function(e,t){return{annotations:[...t.remainingAnnotations]}},UNHIDE_ANNOTATION:function(e,t){return{annotations:e.annotations.map((e=>e.id!==t.id?e:Object.assign({},e,{hidden:!1})))}},UPDATE_ANCHOR_STATUS:function(e,t){return{annotations:e.annotations.map((e=>{if(!t.statusUpdates.hasOwnProperty(e.$tag))return e;const n=t.statusUpdates[e.$tag];return"timeout"===n?Object.assign({},e,{$anchorTimeout:!0}):Object.assign({},e,{$orphan:"orphan"===n})}))}},UPDATE_FLAG_STATUS:function(e,t){return{annotations:e.annotations.map((e=>{if(e.id&&e.id===t.id){
|
|
632
|
+
if(e.flagged===t.isFlagged)return e;const n=Object.assign({},e,{flagged:t.isFlagged});if(n.moderation){const r=t.isFlagged?1:-1;n.moderation=Object.assign({},e.moderation,{flagCount:e.moderation.flagCount+r})}return n}return e}))}}},Jf=Jm(Zf);function Qf(e){return(t,n)=>{const r=function(e,t){const n={},r={};return t.forEach((e=>{e.id&&(n[e.id]=!0),e.$tag&&(r[e.$tag]=!0)})),e.filter((e=>!(e.id&&e.id in n||e.$tag&&e.$tag in r)))}(n().annotations.annotations,e);t({type:Jf.REMOVE_ANNOTATIONS,annotationsToRemove:e,remainingAnnotations:r})}}function eg(e){return{type:Jf.UPDATE_ANCHOR_STATUS,statusUpdates:e}}const tg=Of({annotations:[],focused:{},highlighted:{},nextTag:1},{namespace:"annotations",reducers:Zf,actionCreators:{addAnnotations:function(e){return function(t,n){const r=e.filter((e=>!Kf(n().annotations.annotations,e.id)));if(t({type:Jf.ADD_ANNOTATIONS,annotations:e,currentAnnotationCount:n().annotations.annotations.length}),"sidebar"!==Yf.selectors.route(n().route))return
|
|
633
|
+
;const o=r.filter(Ei).map((e=>e.id));o.length>0&&setTimeout((()=>{const e=n().annotations.annotations,r=o.map((t=>Kf(e,t))).filter((e=>e&&Ei(e))).reduce(((e,t)=>(e[t.$tag]="timeout",e)),{});t(eg(r))}),500)}},clearAnnotations:function(){return{type:Jf.CLEAR_ANNOTATIONS}},focusAnnotations:function(e){return{type:Jf.FOCUS_ANNOTATIONS,focusedTags:e}},hideAnnotation:function(e){return{type:Jf.HIDE_ANNOTATION,id:e}},highlightAnnotations:function(e){return{type:Jf.HIGHLIGHT_ANNOTATIONS,highlighted:$f(e)}},removeAnnotations:Qf,unhideAnnotation:function(e){return{type:Jf.UNHIDE_ANNOTATION,id:e}},updateAnchorStatus:eg,updateFlagStatus:function(e,t){return{type:Jf.UPDATE_FLAG_STATUS,id:e,isFlagged:t}}},selectors:{allAnnotations:function(e){return e.annotations},annotationCount:qf((e=>e.annotations),(e=>Uf(e,zi))),annotationExists:function(e,t){return e.annotations.some((e=>e.id===t))},findAnnotationByID:function(e,t){return Kf(e.annotations,t)},findIDsForTags:function(e,t){const n=[];return t.forEach((t=>{
|
|
634
|
+
const r=Xf(e.annotations,t);r&&r.id&&n.push(r.id)})),n},focusedAnnotations:qf((e=>e.focused),(e=>Gf(e))),highlightedAnnotations:qf((e=>e.highlighted),(e=>Gf(e))),isAnnotationFocused:function(e,t){return!0===e.focused[t]},isWaitingToAnchorAnnotations:qf((e=>e.annotations),(e=>e.some(Ei))),newAnnotations:qf((e=>e.annotations),(e=>e.filter((e=>Si(e)&&!Ni(e))))),newHighlights:qf((e=>e.annotations),(e=>e.filter((e=>Si(e)&&Ni(e))))),noteCount:qf((e=>e.annotations),(e=>Uf(e,Mi))),orphanCount:qf((e=>e.annotations),(e=>Uf(e,Li))),savedAnnotations:function(e){return e.annotations.filter((e=>!Si(e)))}}}),ng={SET_DEFAULT:function(e,t){return{[t.defaultKey]:t.value}}},rg=Jm(ng);const og=Of({annotationPrivacy:null,focusedGroup:null},{namespace:"defaults",reducers:ng,actionCreators:{setDefault:function(e,t){return{type:rg.SET_DEFAULT,defaultKey:e,value:t}}},selectors:{getDefault:function(e,t){return e[t]},getDefaults:function(e){return e}}});const ig={UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED:(e,t)=>({
|
|
635
|
+
directLinkedGroupFetchFailed:t.directLinkedGroupFetchFailed}),UPDATE_DIRECT_LINKED_GROUP_ID:(e,t)=>({directLinkedGroupId:t.directLinkedGroupId}),UPDATE_DIRECT_LINKED_ANNOTATION_ID:(e,t)=>({directLinkedAnnotationId:t.directLinkedAnnotationId}),CLEAR_DIRECT_LINKED_IDS:()=>({directLinkedAnnotationId:null,directLinkedGroupId:null}),CLEAR_SELECTION:function(){return{directLinkedAnnotationId:null,directLinkedGroupId:null,directLinkedGroupFetchFailed:!1}}},ag=Jm(ig);const sg=Of((function(e){return{directLinkedGroupId:e.group||null,directLinkedAnnotationId:e.annotations||null,directLinkedGroupFetchFailed:!1}}),{namespace:"directLinked",reducers:ig,actionCreators:{setDirectLinkedGroupFetchFailed:function(){return{type:ag.UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED,directLinkedGroupFetchFailed:!0}},setDirectLinkedGroupId:function(e){return{type:ag.UPDATE_DIRECT_LINKED_GROUP_ID,directLinkedGroupId:e}},setDirectLinkedAnnotationId:function(e){return{type:ag.UPDATE_DIRECT_LINKED_ANNOTATION_ID,directLinkedAnnotationId:e}},
|
|
636
|
+
clearDirectLinkedGroupFetchFailed:function(){return{type:ag.UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED,directLinkedGroupFetchFailed:!1}},clearDirectLinkedIds:function(){return{type:ag.CLEAR_DIRECT_LINKED_IDS}}},selectors:{directLinkedAnnotationId:function(e){return e.directLinkedAnnotationId},directLinkedGroupFetchFailed:function(e){return e.directLinkedGroupFetchFailed},directLinkedGroupId:function(e){return e.directLinkedGroupId}}});class lg{constructor(e,t){this.annotation={id:e.id,$tag:e.$tag},this.isPrivate=t.isPrivate,this.tags=t.tags,this.text=t.text}match(e){return this.annotation.$tag&&e.$tag===this.annotation.$tag||this.annotation.id&&e.id===this.annotation.id}isEmpty(){return!this.text&&0===this.tags.length}}const cg={DISCARD_ALL_DRAFTS:function(){return[]},REMOVE_DRAFT:function(e,t){return e.filter((e=>!e.match(t.annotation)))},UPDATE_DRAFT:function(e,t){const n=e.filter((e=>!e.match(t.draft.annotation)));return n.push(t.draft),n}},ug=Jm(cg);function hg(e){return{type:ug.REMOVE_DRAFT,annotation:e}}
|
|
637
|
+
function dg(e,t){const n=e;for(let e=0;e<n.length;e++){const r=n[e];if(r.match(t))return r}return null}function pg(e,t){const n=dg(e,t);return n?n.isEmpty()?null:n:null}const mg=qf((e=>e),(e=>e.filter((e=>!e.annotation.id)).map((e=>e.annotation)))),fg=Of([],{namespace:"drafts",reducers:cg,actionCreators:{createDraft:function(e,t){return{type:ug.UPDATE_DRAFT,draft:new lg(e,t)}},deleteNewAndEmptyDrafts:function(){return(e,t)=>{const n=t().drafts.filter((e=>Si(e.annotation)&&!pg(t().drafts,e.annotation))).map((t=>(e(hg(t.annotation)),t.annotation)));e(Qf(n))}},discardAllDrafts:function(){return{type:ug.DISCARD_ALL_DRAFTS}},removeDraft:hg},selectors:{countDrafts:function(e){return e.length},getDraft:dg,getDraftIfNotEmpty:pg,unsavedAnnotations:mg}});function gg(e){var t,n;return!!(null!==(t=e.user)&&void 0!==t&&t.username||null!==(n=e.user)&&void 0!==n&&n.userid)}function vg(e){if(!gg(e))return{};const t=e.user.username||e.user.userid||"";return{user:{value:t,display:e.user.displayName||t}}}const yg={
|
|
638
|
+
CHANGE_FOCUS_MODE_USER:function(e,t){return{focusActive:gg({user:t.user}),focusFilters:vg({user:t.user})}},SET_FILTER:function(e,t){var n;const r={...e.filters,[t.filterName]:t.filterOption};return""===(null===(n=t.filterOption)||void 0===n?void 0:n.value)&&delete r[t.filterName],{filters:r}},SET_FILTER_QUERY:function(e,t){return{query:t.query}},SET_FOCUS_MODE:function(e,t){var n;return{focusActive:null!==(n=t.active)&&void 0!==n?n:!e.focusActive}},CLEAR_SELECTION:function(){return{filters:{},focusActive:!1,query:null}}},_g=Jm(yg);const bg=qf((e=>e.focusActive),(e=>e.focusFilters),((e,t)=>{var n;return{active:e,configured:!(null==t||!t.user),displayName:(null==t||null===(n=t.user)||void 0===n?void 0:n.display)||""}})),wg=qf((e=>e.filters),(e=>e.focusActive),(e=>e.focusFilters),((e,t,n)=>t?{...n,...e}:{...e}));const xg=qf((e=>wg(e)),(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].value)),t}));const kg=Of((function(e){const t=e.focus||{};return{filters:{},focusActive:gg(t),focusFilters:vg(t),
|
|
639
|
+
query:e.query||null}}),{namespace:"filters",reducers:yg,actionCreators:{changeFocusModeUser:function(e){return{type:_g.CHANGE_FOCUS_MODE_USER,user:e}},setFilter:function(e,t){return(n,r)=>{var o;null!==(o=r().filters.focusFilters)&&void 0!==o&&o[e]&&n({type:_g.SET_FOCUS_MODE,active:!1}),n({type:_g.SET_FILTER,filterName:e,filterOption:t})}},setFilterQuery:function(e){return{type:_g.SET_FILTER_QUERY,query:e}},toggleFocusMode:function(e){return{type:_g.SET_FOCUS_MODE,active:e}}},selectors:{filterQuery:function(e){return e.query},focusState:bg,getFilter:function(e,t){return wg(e)[t]},getFilters:wg,getFilterValues:xg,getFocusFilters:function(e){return e.focusFilters},hasAppliedFilter:function(e){return!(!e.query&&!Object.keys(wg(e)).length)}}}),Sg={CONNECT_FRAME:function(e,t){return[...e,t.frame]},DESTROY_FRAME:function(e,t){return e.filter((e=>e!==t.frame))},UPDATE_FRAME_ANNOTATION_FETCH_STATUS:function(e,t){return e.map((e=>e.uri&&e.uri===t.uri?Object.assign({},e,{
|
|
640
|
+
isAnnotationFetchComplete:t.isAnnotationFetchComplete}):e))}},Cg=Jm(Sg);const Ag=qf((e=>e),(e=>e.find((e=>!e.id))||null));const Eg=Hf(Ff,qm)((e=>e.reduce(((e,t)=>e.concat(function(e){let t=[e.uri];return e.metadata&&e.metadata.documentFingerprint&&(t=e.metadata.link.map((e=>e.href))),e.metadata&&e.metadata.link&&e.metadata.link.forEach((e=>{e.href.startsWith("doi:")&&t.push(e.href)})),t}(t))),[])),(e=>e)),Tg=Of([],{namespace:"frames",reducers:Sg,actionCreators:{connectFrame:function(e){return{type:Cg.CONNECT_FRAME,frame:e}},destroyFrame:function(e){return{type:Cg.DESTROY_FRAME,frame:e}},updateFrameAnnotationFetchStatus:function(e,t){return{type:Cg.UPDATE_FRAME_ANNOTATION_FETCH_STATUS,isAnnotationFetchComplete:t,uri:e}}},selectors:{frames:function(e){return e},mainFrame:Ag,searchUris:Eg}}),Ng={features:{},preferences:{},userid:null};const Lg={UPDATE_PROFILE:function(e,t){return{profile:{...t.profile}}}},Mg=Jm(Lg);const zg=Of((function(e){var t;return{
|
|
641
|
+
defaultAuthority:null!==(t=null==e?void 0:e.authDomain)&&void 0!==t?t:"",profile:Ng}}),{namespace:"session",reducers:Lg,actionCreators:{updateProfile:function(e){return{type:Mg.UPDATE_PROFILE,profile:e}}},selectors:{defaultAuthority:function(e){return e.defaultAuthority},hasFetchedProfile:function(e){return e.profile!==Ng},isFeatureEnabled:function(e,t){return!!e.profile.features[t]},isLoggedIn:function(e){return null!==e.profile.userid},profile:function(e){return e.profile}}}),Og={FILTER_GROUPS(e,t){var n;if(null===(n=t.filteredGroupIds)||void 0===n||!n.length)return{filteredGroupIds:null};const r=e.groups.filter((e=>t.filteredGroupIds.includes(e.id)));if(!r.length)return{filteredGroupIds:null};let o=e.focusedGroupId;return o&&t.filteredGroupIds.includes(o)||(o=r[0].id),{filteredGroupIds:t.filteredGroupIds,focusedGroupId:o}},FOCUS_GROUP(e,t){const n=e.groups.find((e=>e.id===t.id));return n?{focusedGroupId:t.id}:(console.error(`Attempted to focus group ${t.id} which is not loaded`),{})},LOAD_GROUPS(e,t){
|
|
642
|
+
const n=t.groups;let r=e.focusedGroupId;return null!==e.focusedGroupId&&n.find((t=>t.id===e.focusedGroupId))||(r=n.length>0?n[0].id:null),{focusedGroupId:r,groups:t.groups}},CLEAR_GROUPS:()=>({filteredGroupIds:null,focusedGroupId:null,groups:[]})},Ig=Jm(Og);function Rg(e){return e.filteredGroupIds?e.groups.filter((t=>{var n;return null===(n=e.filteredGroupIds)||void 0===n?void 0:n.includes(t.id)})):e.groups}function Pg(e,t){return e.groups.find((e=>e.id===t))}const Dg=qf((e=>Rg(e)),(e=>e.filter((e=>!e.isMember&&e.isScopedToUri)))),Bg=qf((e=>Rg(e)),(e=>e.filter((e=>e.isScopedToUri)))),Fg=qf((e=>Rg(e.groups)),(e=>zg.selectors.isLoggedIn(e.session)),((e,t)=>t?e.filter((e=>e.isMember)):[])),jg=qf((e=>Rg(e.groups)),(e=>Fg(e)),(e=>Dg(e.groups)),((e,t,n)=>e.filter((e=>!t.includes(e)&&!n.includes(e))))),Hg=Of({filteredGroupIds:null,groups:[],focusedGroupId:null},{namespace:"groups",reducers:Og,actionCreators:{filterGroups:function(e){return{type:Ig.FILTER_GROUPS,filteredGroupIds:e}},focusGroup:function(e){return{
|
|
643
|
+
type:Ig.FOCUS_GROUP,id:e}},loadGroups:function(e){return{type:Ig.LOAD_GROUPS,groups:e}},clearGroups:function(){return{type:Ig.CLEAR_GROUPS}}},selectors:{allGroups:function(e){return e.groups},filteredGroups:Rg,filteredGroupIds:function(e){return e.filteredGroupIds},focusedGroup:function(e){return e.focusedGroupId?Pg(e,e.focusedGroupId):null},focusedGroupId:function(e){return e.focusedGroupId},getFeaturedGroups:Dg,getGroup:Pg,getInScopeGroups:Bg},rootSelectors:{getCurrentlyViewingGroups:jg,getMyGroups:Fg}}),qg={UPDATE_LINKS:(e,t)=>({...t.links})},Ug=Jm(qg);const $g=Of(null,{namespace:"links",reducers:qg,actionCreators:{updateLinks:function(e){return{type:Ug.UPDATE_LINKS,links:e}}},selectors:{getLink:function(e,t,n={}){if(!e)return"";const r=e[t];if(!r)throw new Error(`Unknown link "${t}"`);const{url:o,unusedParams:i}=Tm(r,n),a=Object.keys(i);if(a.length>0)throw new Error(`Unused parameters: ${a.join(", ")}`);return o}}}),Gg={RECEIVE_REAL_TIME_UPDATES:(e,t)=>({pendingUpdates:{...t.pendingUpdates},
|
|
644
|
+
pendingDeletions:{...t.pendingDeletions}}),CLEAR_PENDING_UPDATES:()=>({pendingUpdates:{},pendingDeletions:{}}),ADD_ANNOTATIONS(e,{annotations:t}){const n={...e.pendingUpdates};return t.forEach((e=>delete n[e.id])),{pendingUpdates:n}},REMOVE_ANNOTATIONS(e,{annotationsToRemove:t}){const n={...e.pendingUpdates},r={...e.pendingDeletions};return t.forEach((e=>{delete n[e.id],delete r[e.id]})),{pendingUpdates:n,pendingDeletions:r}},FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})},Vg=Jm(Gg);const Wg=qf((e=>[e.pendingUpdates,e.pendingDeletions]),(([e,t])=>Object.keys(e).length+Object.keys(t).length));const Yg=Of({pendingUpdates:{},pendingDeletions:{}},{namespace:"realTimeUpdates",reducers:Gg,actionCreators:{receiveRealTimeUpdates:function({updatedAnnotations:e=[],deletedAnnotations:t=[]}){return(n,r)=>{const o={...r().realTimeUpdates.pendingUpdates},i={...r().realTimeUpdates.pendingDeletions};e.forEach((e=>{const t=r().groups,n=r().route
|
|
645
|
+
;e.group!==Hg.selectors.focusedGroupId(t)&&"sidebar"===Yf.selectors.route(n)||(o[e.id]=e)})),t.forEach((e=>{const t=e.id;delete o[t];const n=r().annotations;tg.selectors.annotationExists(n,t)&&(i[t]=!0)})),n({type:Vg.RECEIVE_REAL_TIME_UPDATES,pendingUpdates:o,pendingDeletions:i})}},clearPendingUpdates:function(){return{type:Vg.CLEAR_PENDING_UPDATES}}},selectors:{hasPendingDeletion:function(e,t){return e.pendingDeletions.hasOwnProperty(t)},pendingDeletions:function(e){return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:Wg}}),Kg={annotation:"Location",note:"Oldest",orphan:"Location"};function Xg(e){const t={};return e.annotations&&!e.query&&(t[e.annotations]=!0),t}const Zg=(e,t)=>t===e?{}:{selectedTab:e,sortKey:Kg[e]},Jg={CLEAR_SELECTION:function(){return{forcedVisible:{},selected:{}}},SELECT_ANNOTATIONS:function(e,t){return{selected:t.selection}},SELECT_TAB:function(e,t){return Zg(t.tab,e.selectedTab)},SET_EXPANDED:function(e,t){const n={...e.expanded}
|
|
646
|
+
;return n[t.id]=t.expanded,{expanded:n}},SET_FORCED_VISIBLE:function(e,t){return{forcedVisible:{...e.forcedVisible,[t.id]:t.visible}}},SET_SORT_KEY:function(e,t){return{sortKey:t.key}},TOGGLE_SELECTED_ANNOTATIONS:function(e,t){const n={...e.selected};return t.toggleIds.forEach((e=>{n[e]=!n[e]})),{selected:n}},ADD_ANNOTATIONS(e,t){const n=t.annotations.filter((e=>!ki(e))),r=Uf(t.annotations,Mi)===n.length;return 0===t.currentAnnotationCount&&r?Zg("note",e.selectedTab):{}},CHANGE_FOCUS_MODE_USER:function(){return{forcedVisible:{},selected:{}}},SET_FILTER:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FILTER_QUERY:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FOCUS_MODE:function(){return{forcedVisible:{},selected:{}}},REMOVE_ANNOTATIONS:function(e,t){let n=e.selectedTab;"orphan"===n&&0===Uf(t.remainingAnnotations,Li)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{...Zg(n,e.selectedTab),expanded:r({
|
|
647
|
+
...e.expanded}),forcedVisible:r({...e.forcedVisible}),selected:r({...e.selected})}}},Qg=Jm(Jg);function ev(e){return e.expanded}const tv=qf((e=>e.forcedVisible),(e=>Gf(e))),nv=qf((e=>e.selected),(e=>Gf(e).length>0)),rv=qf((e=>e.selected),(e=>Gf(e)));function ov(e){return e.selectedTab}const iv=qf((e=>e),(e=>({expanded:ev(e),forcedVisible:tv(e),selected:rv(e),sortKey:av(e),selectedTab:ov(e)})));function av(e){return e.sortKey}const sv=qf((e=>e.selectedTab),(e=>{const t=["Newest","Oldest"];return"note"!==e&&t.push("Location"),t})),lv=Of((function(e){return{selected:Xg(e),expanded:Xg(e)||{},forcedVisible:{},selectedTab:"annotation",sortKey:Kg.annotation}}),{namespace:"selection",reducers:Jg,actionCreators:{clearSelection:function(){return{type:Qg.CLEAR_SELECTION}},selectAnnotations:function(e){return t=>{t({type:Qg.CLEAR_SELECTION}),t({type:Qg.SELECT_ANNOTATIONS,selection:$f(e)})}},selectTab:function(e){return{type:Qg.SELECT_TAB,tab:e}},setExpanded:function(e,t){return{type:Qg.SET_EXPANDED,id:e,expanded:t}},
|
|
648
|
+
setForcedVisible:function(e,t){return{type:Qg.SET_FORCED_VISIBLE,id:e,visible:t}},setSortKey:function(e){return{type:Qg.SET_SORT_KEY,key:e}},toggleSelectedAnnotations:function(e){return{type:Qg.TOGGLE_SELECTED_ANNOTATIONS,toggleIds:e}}},selectors:{expandedMap:ev,forcedVisibleThreads:tv,hasSelectedAnnotations:nv,selectedAnnotations:rv,selectedTab:ov,selectionState:iv,sortKey:av,sortKeys:sv}}),cv={OPEN_SIDEBAR_PANEL:function(e,t){return{activePanelName:t.panelName}},CLOSE_SIDEBAR_PANEL:function(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}},uv=Jm(cv);const hv=Of({activePanelName:null},{namespace:"sidebarPanels",reducers:cv,actionCreators:{openSidebarPanel:function(e){return{type:uv.OPEN_SIDEBAR_PANEL,panelName:e}},closeSidebarPanel:function(e){return{type:uv.CLOSE_SIDEBAR_PANEL,
|
|
649
|
+
panelName:e}},toggleSidebarPanel:function(e,t){return{type:uv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),dv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},pv=Jm(dv);const mv=Of({messages:[]},{namespace:"toastMessages",reducers:dv,actionCreators:{addToastMessage:function(e){return{type:pv.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:pv.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:pv.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),fv={
|
|
650
|
+
SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},gv=Jm(fv);const vv=Of({sidebarHasOpened:!1},{namespace:"viewer",reducers:fv,actionCreators:{setSidebarOpened:function(e){return{type:gv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function yv(e){return zf([Df,tg,og,sg,fg,kg,Tg,$g,Hg,Yg,Yf,lv,zg,hv,mv,vv],[e],[If])}yv.$inject=["settings"];class _v{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){
|
|
651
|
+
const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const bv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),wv=function(e){const{version:t,origin:n}=R(e.location.href)
|
|
652
|
+
;return"1.982.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.982.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 xv(e,t){e.setClientId(t.clientId)}function kv(e,t,n){e.load(),t.load(),n.sync()}function Sv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Cv(e,t){"sidebar"===t.route()&&e.connect()}bv.sentry&&wv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.982.0",beforeSend:(e,t)=>{if(Sr>=5)return K("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Sr;try{
|
|
653
|
+
const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{Yt("host_config",R(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),kr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(bv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),xv.$inject=["api","streamer"],kv.$inject=["groups","session","router"],Sv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],Cv.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&mo.clear()
|
|
654
|
+
;for(let[t,n]of Object.entries(e))mo.set(t,n)}(Ko);const Av=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",te)}(),async function(e,t=window){const n=H(window),r=n.requestConfigFromFrame;if(!r)return V(e,n);if("string"==typeof r)return await G(e,t);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(bv).then((e=>{!function(e,t){const n=new _v
|
|
655
|
+
;n.register("annotationsService",Cm).register("api",Lm).register("apiRoutes",Dm).register("auth",jm).register("autosaveService",Hm).register("features",$m).register("frameSync",Zm).register("groups",tf).register("loadAnnotationsService",nf).register("localStorage",of).register("persistedDefaults",sf).register("router",lf).register("serviceURL",cf).register("session",uf).register("streamer",pf).register("streamFilter",hf).register("tags",mf).register("threadsService",ff).register("toastMessenger",gf).register("store",{factory:yv}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Sv),n.run(xv),n.run(kv),n.run(ee),n.run(Cv),I(po(ni.Provider,{value:n,children:po(km,{})}),t)}(e,Av)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(po(Sm,{error:e}),t)}(e,Av)));
|
|
656
656
|
//# sourceMappingURL=sidebar.bundle.js.map
|