@pretextbook/web-editor 0.0.18 → 0.0.19

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/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- (function(kt,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],z):(kt=typeof globalThis<"u"?globalThis:kt||self,z(kt.PretextWebEditor={},kt.React,kt.ReactDOM))})(this,(function(kt,z,ji){"use strict";function S1(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const k1=S1(z);var Ui={exports:{}},ei={};var N0;function M1(){if(N0)return ei;N0=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:r,type:n,key:o,ref:i!==void 0?i:null,props:s}}return ei.Fragment=e,ei.jsx=t,ei.jsxs=t,ei}var ti={};var D0;function T1(){return D0||(D0=1,process.env.NODE_ENV!=="production"&&(function(){function r(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===te?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case v:return"Fragment";case T:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case A:return"SuspenseList";case q:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case y:return"Portal";case P:return w.displayName||"Context";case D:return(w._context.displayName||"Context")+".Consumer";case N:var I=w.render;return w=w.displayName,w||(w=I.displayName||I.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case $:return I=w.displayName||null,I!==null?I:r(w.type)||"Memo";case F:I=w._payload,w=w._init;try{return r(w(I))}catch{}}return null}function e(w){return""+w}function t(w){try{e(w);var I=!1}catch{I=!0}if(I){I=console;var L=I.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return L.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),e(w)}}function n(w){if(w===v)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===F)return"<...>";try{var I=r(w);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function i(){var w=Y.A;return w===null?null:w.getOwner()}function s(){return Error("react-stack-top-frame")}function o(w){if(he.call(w,"key")){var I=Object.getOwnPropertyDescriptor(w,"key").get;if(I&&I.isReactWarning)return!1}return w.key!==void 0}function a(w,I){function L(){ne||(ne=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}L.isReactWarning=!0,Object.defineProperty(w,"key",{get:L,configurable:!0})}function l(){var w=r(this.type);return ve[w]||(ve[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function c(w,I,L,B,K,re){var j=L.ref;return w={$$typeof:m,type:w,key:I,props:L,_owner:B},(j!==void 0?j:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:l}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function u(w,I,L,B,K,re){var j=I.children;if(j!==void 0)if(B)if(Q(j)){for(B=0;B<j.length;B++)d(j[B]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(j);if(he.call(I,"key")){j=r(w);var ie=Object.keys(I).filter(function(Ce){return Ce!=="key"});B=0<ie.length?"{key: someKey, "+ie.join(": ..., ")+": ...}":"{key: someKey}",C[j+B]||(ie=0<ie.length?"{"+ie.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(kt,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],z):(kt=typeof globalThis<"u"?globalThis:kt||self,z(kt.PretextWebEditor={},kt.React,kt.ReactDOM))})(this,(function(kt,z,ji){"use strict";function S1(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const k1=S1(z);var Ui={exports:{}},ei={};var D0;function M1(){if(D0)return ei;D0=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:r,type:n,key:o,ref:i!==void 0?i:null,props:s}}return ei.Fragment=e,ei.jsx=t,ei.jsxs=t,ei}var ti={};var z0;function T1(){return z0||(z0=1,process.env.NODE_ENV!=="production"&&(function(){function r(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===te?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case v:return"Fragment";case T:return"Profiler";case x:return"StrictMode";case N:return"Suspense";case O:return"SuspenseList";case q:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case y:return"Portal";case P:return w.displayName||"Context";case D:return(w._context.displayName||"Context")+".Consumer";case E:var I=w.render;return w=w.displayName,w||(w=I.displayName||I.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case $:return I=w.displayName||null,I!==null?I:r(w.type)||"Memo";case F:I=w._payload,w=w._init;try{return r(w(I))}catch{}}return null}function e(w){return""+w}function t(w){try{e(w);var I=!1}catch{I=!0}if(I){I=console;var L=I.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return L.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),e(w)}}function n(w){if(w===v)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===F)return"<...>";try{var I=r(w);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function i(){var w=Y.A;return w===null?null:w.getOwner()}function s(){return Error("react-stack-top-frame")}function o(w){if(he.call(w,"key")){var I=Object.getOwnPropertyDescriptor(w,"key").get;if(I&&I.isReactWarning)return!1}return w.key!==void 0}function a(w,I){function L(){ne||(ne=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}L.isReactWarning=!0,Object.defineProperty(w,"key",{get:L,configurable:!0})}function l(){var w=r(this.type);return ve[w]||(ve[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function c(w,I,L,B,K,re){var j=L.ref;return w={$$typeof:m,type:w,key:I,props:L,_owner:B},(j!==void 0?j:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:l}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function u(w,I,L,B,K,re){var j=I.children;if(j!==void 0)if(B)if(Q(j)){for(B=0;B<j.length;B++)d(j[B]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(j);if(he.call(I,"key")){j=r(w);var ie=Object.keys(I).filter(function(Ce){return Ce!=="key"});B=0<ie.length?"{key: someKey, "+ie.join(": ..., ")+": ...}":"{key: someKey}",C[j+B]||(ie=0<ie.length?"{"+ie.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,B,j,ie,j),C[j+B]=!0)}if(j=null,L!==void 0&&(t(L),j=""+L),o(I)&&(t(I.key),j=""+I.key),"key"in I){L={};for(var me in I)me!=="key"&&(L[me]=I[me])}else L=I;return j&&a(L,typeof w=="function"?w.displayName||w.name||"Unknown":w),c(w,j,L,i(),K,re)}function d(w){h(w)?w._store&&(w._store.validated=1):typeof w=="object"&&w!==null&&w.$$typeof===F&&(w._payload.status==="fulfilled"?h(w._payload.value)&&w._payload.value._store&&(w._payload.value._store.validated=1):w._store&&(w._store.validated=1))}function h(w){return typeof w=="object"&&w!==null&&w.$$typeof===m}var f=z,m=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),P=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),Y=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=Object.prototype.hasOwnProperty,Q=Array.isArray,W=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(w){return w()}};var ne,ve={},ge=f.react_stack_bottom_frame.bind(f,s)(),Ae=W(n(s)),C={};ti.Fragment=v,ti.jsx=function(w,I,L){var B=1e4>Y.recentlyCreatedOwnerStacks++;return u(w,I,L,!1,B?Error("react-stack-top-frame"):ge,B?W(n(w)):Ae)},ti.jsxs=function(w,I,L){var B=1e4>Y.recentlyCreatedOwnerStacks++;return u(w,I,L,!0,B?Error("react-stack-top-frame"):ge,B?W(n(w)):Ae)}})()),ti}var z0;function C1(){return z0||(z0=1,process.env.NODE_ENV==="production"?Ui.exports=M1():Ui.exports=T1()),Ui.exports}var J=C1();const Wi=z.createContext(null);Wi.displayName="PanelGroupContext";const Re={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Io=10,Yr=z.useLayoutEffect,I0=k1.useId,E1=typeof I0=="function"?I0:()=>null;let A1=0;function Ro(r=null){const e=E1(),t=z.useRef(r||e||null);return t.current===null&&(t.current=""+A1++),r??t.current}function R0({children:r,className:e="",collapsedSize:t,collapsible:n,defaultSize:i,forwardedRef:s,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:f,tagName:m="div",...y}){const v=z.useContext(Wi);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:T,getPanelSize:D,getPanelStyle:P,groupId:N,isPanelCollapsed:O,reevaluatePanelConstraints:A,registerPanel:$,resizePanel:F,unregisterPanel:q}=v,te=Ro(o),Y=z.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:t,collapsible:n,defaultSize:i,maxSize:a,minSize:l},id:te,idIsFromProps:o!==void 0,order:h});z.useRef({didLogMissingDefaultSizeWarning:!1}),Yr(()=>{const{callbacks:Q,constraints:W}=Y.current,ne={...W};Y.current.id=te,Y.current.idIsFromProps=o!==void 0,Y.current.order=h,Q.onCollapse=c,Q.onExpand=u,Q.onResize=d,W.collapsedSize=t,W.collapsible=n,W.defaultSize=i,W.maxSize=a,W.minSize=l,(ne.collapsedSize!==W.collapsedSize||ne.collapsible!==W.collapsible||ne.maxSize!==W.maxSize||ne.minSize!==W.minSize)&&A(Y.current,ne)}),Yr(()=>{const Q=Y.current;return $(Q),()=>{q(Q)}},[h,te,$,q]),z.useImperativeHandle(s,()=>({collapse:()=>{x(Y.current)},expand:Q=>{T(Y.current,Q)},getId(){return te},getSize(){return D(Y.current)},isCollapsed(){return O(Y.current)},isExpanded(){return!O(Y.current)},resize:Q=>{F(Y.current,Q)}}),[x,T,D,O,te,F]);const he=P(Y.current,i);return z.createElement(m,{...y,children:r,className:e,id:te,style:{...he,...f},[Re.groupId]:N,[Re.panel]:"",[Re.panelCollapsible]:n||void 0,[Re.panelId]:te,[Re.panelSize]:parseFloat(""+he.flexGrow).toFixed(1)})}const Po=z.forwardRef((r,e)=>z.createElement(R0,{...r,forwardedRef:e}));R0.displayName="Panel",Po.displayName="forwardRef(Panel)";let Lo=null,Gi=-1,Sr=null;function O1(r,e){if(e){const t=(e&q0)!==0,n=(e&_0)!==0,i=(e&j0)!==0,s=(e&U0)!==0;if(t)return i?"se-resize":s?"ne-resize":"e-resize";if(n)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(r){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function N1(){Sr!==null&&(document.head.removeChild(Sr),Lo=null,Sr=null,Gi=-1)}function Bo(r,e){var t,n;const i=O1(r,e);if(Lo!==i){if(Lo=i,Sr===null&&(Sr=document.createElement("style"),document.head.appendChild(Sr)),Gi>=0){var s;(s=Sr.sheet)===null||s===void 0||s.removeRule(Gi)}Gi=(t=(n=Sr.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${i} !important;}`))!==null&&t!==void 0?t:-1}}function P0(r){return r.type==="keydown"}function L0(r){return r.type.startsWith("pointer")}function B0(r){return r.type.startsWith("mouse")}function Ki(r){if(L0(r)){if(r.isPrimary)return{x:r.clientX,y:r.clientY}}else if(B0(r))return{x:r.clientX,y:r.clientY};return{x:1/0,y:1/0}}function D1(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function z1(r,e,t){return r.x<e.x+e.width&&r.x+r.width>e.x&&r.y<e.y+e.height&&r.y+r.height>e.y}function I1(r,e){if(r===e)throw new Error("Cannot compare node with itself");const t={a:H0(r),b:H0(e)};let n;for(;t.a.at(-1)===t.b.at(-1);)r=t.a.pop(),e=t.b.pop(),n=r;pe(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:$0(F0(t.a)),b:$0(F0(t.b))};if(i.a===i.b){const s=n.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const R1=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function P1(r){var e;const t=getComputedStyle((e=V0(r))!==null&&e!==void 0?e:r).display;return t==="flex"||t==="inline-flex"}function L1(r){const e=getComputedStyle(r);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||P1(r))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||R1.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function F0(r){let e=r.length;for(;e--;){const t=r[e];if(pe(t,"Missing node"),L1(t))return t}return null}function $0(r){return r&&Number(getComputedStyle(r).zIndex)||0}function H0(r){const e=[];for(;r;)e.push(r),r=V0(r);return e}function V0(r){const{parentNode:e}=r;return e&&e instanceof ShadowRoot?e.host:e}const q0=1,_0=2,j0=4,U0=8,B1=D1()==="coarse";let Rt=[],kn=!1,Zr=new Map,Ji=new Map;const ri=new Set;function F1(r,e,t,n,i){var s;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:n,setResizeHandlerState:i},l=(s=Zr.get(o))!==null&&s!==void 0?s:0;return Zr.set(o,l+1),ri.add(a),Xi(),function(){var u;Ji.delete(r),ri.delete(a);const d=(u=Zr.get(o))!==null&&u!==void 0?u:1;if(Zr.set(o,d-1),Xi(),d===1&&Zr.delete(o),Rt.includes(a)){const h=Rt.indexOf(a);h>=0&&Rt.splice(h,1),qo(),i("up",!0,null)}}}function $1(r){const{target:e}=r,{x:t,y:n}=Ki(r);kn=!0,Ho({target:e,x:t,y:n}),Xi(),Rt.length>0&&(Yi("down",r),r.preventDefault(),W0(e)||r.stopImmediatePropagation())}function Fo(r){const{x:e,y:t}=Ki(r);if(kn&&r.buttons===0&&(kn=!1,Yi("up",r)),!kn){const{target:n}=r;Ho({target:n,x:e,y:t})}Yi("move",r),qo(),Rt.length>0&&r.preventDefault()}function $o(r){const{target:e}=r,{x:t,y:n}=Ki(r);Ji.clear(),kn=!1,Rt.length>0&&(r.preventDefault(),W0(e)||r.stopImmediatePropagation()),Yi("up",r),Ho({target:e,x:t,y:n}),qo(),Xi()}function W0(r){let e=r;for(;e;){if(e.hasAttribute(Re.resizeHandle))return!0;e=e.parentElement}return!1}function Ho({target:r,x:e,y:t}){Rt.splice(0);let n=null;(r instanceof HTMLElement||r instanceof SVGElement)&&(n=r),ri.forEach(i=>{const{element:s,hitAreaMargins:o}=i,a=s.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=B1?o.coarse:o.fine;if(e>=c-h&&e<=u+h&&t>=d-h&&t<=l+h){if(n!==null&&document.contains(n)&&s!==n&&!s.contains(n)&&!n.contains(s)&&I1(n,s)>0){let m=n,y=!1;for(;m&&!m.contains(s);){if(z1(m.getBoundingClientRect(),a)){y=!0;break}m=m.parentElement}if(y)return}Rt.push(i)}})}function Vo(r,e){Ji.set(r,e)}function qo(){let r=!1,e=!1;Rt.forEach(n=>{const{direction:i}=n;i==="horizontal"?r=!0:e=!0});let t=0;Ji.forEach(n=>{t|=n}),r&&e?Bo("intersection",t):r?Bo("horizontal",t):e?Bo("vertical",t):N1()}let _o=new AbortController;function Xi(){_o.abort(),_o=new AbortController;const r={capture:!0,signal:_o.signal};ri.size&&(kn?(Rt.length>0&&Zr.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",$o,r),n.addEventListener("pointerleave",Fo,r),n.addEventListener("pointermove",Fo,r))}),window.addEventListener("pointerup",$o,r),window.addEventListener("pointercancel",$o,r)):Zr.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",$1,r),n.addEventListener("pointermove",Fo,r))}))}function Yi(r,e){ri.forEach(t=>{const{setResizeHandlerState:n}=t,i=Rt.includes(t);n(r,i,e)})}function H1(){const[r,e]=z.useState(0);return z.useCallback(()=>e(t=>t+1),[])}function pe(r,e){if(!r)throw console.error(e),Error(e)}function Qr(r,e,t=Io){return r.toFixed(t)===e.toFixed(t)?0:r>e?1:-1}function tr(r,e,t=Io){return Qr(r,e,t)===0}function mt(r,e,t){return Qr(r,e,t)===0}function V1(r,e,t){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++){const i=r[n],s=e[n];if(!mt(i,s,t))return!1}return!0}function Mn({panelConstraints:r,panelIndex:e,size:t}){const n=r[e];pe(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:i=0,collapsible:s,maxSize:o=100,minSize:a=0}=n;if(Qr(t,a)<0)if(s){const l=(i+a)/2;Qr(t,l)<0?t=i:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(Io)),t}function ni({delta:r,initialLayout:e,panelConstraints:t,pivotIndices:n,prevLayout:i,trigger:s}){if(mt(r,0))return e;const o=[...e],[a,l]=n;pe(a!=null,"Invalid first pivot index"),pe(l!=null,"Invalid second pivot index");let c=0;if(s==="keyboard"){{const d=r<0?l:a,h=t[d];pe(h,`Panel constraints not found for index ${d}`);const{collapsedSize:f=0,collapsible:m,minSize:y=0}=h;if(m){const v=e[d];if(pe(v!=null,`Previous layout not found for panel index ${d}`),mt(v,f)){const x=y-v;Qr(x,Math.abs(r))>0&&(r=r<0?0-x:x)}}}{const d=r<0?a:l,h=t[d];pe(h,`No panel constraints found for index ${d}`);const{collapsedSize:f=0,collapsible:m,minSize:y=0}=h;if(m){const v=e[d];if(pe(v!=null,`Previous layout not found for panel index ${d}`),mt(v,y)){const x=v-f;Qr(x,Math.abs(r))>0&&(r=r<0?0-x:x)}}}}{const d=r<0?1:-1;let h=r<0?l:a,f=0;for(;;){const y=e[h];pe(y!=null,`Previous layout not found for panel index ${h}`);const x=Mn({panelConstraints:t,panelIndex:h,size:100})-y;if(f+=x,h+=d,h<0||h>=t.length)break}const m=Math.min(Math.abs(r),Math.abs(f));r=r<0?0-m:m}{let h=r<0?a:l;for(;h>=0&&h<t.length;){const f=Math.abs(r)-Math.abs(c),m=e[h];pe(m!=null,`Previous layout not found for panel index ${h}`);const y=m-f,v=Mn({panelConstraints:t,panelIndex:h,size:y});if(!mt(m,v)&&(c+=m-v,o[h]=v,c.toPrecision(3).localeCompare(Math.abs(r).toPrecision(3),void 0,{numeric:!0})>=0))break;r<0?h--:h++}}if(V1(i,o))return i;{const d=r<0?l:a,h=e[d];pe(h!=null,`Previous layout not found for panel index ${d}`);const f=h+c,m=Mn({panelConstraints:t,panelIndex:d,size:f});if(o[d]=m,!mt(m,f)){let y=f-m,x=r<0?l:a;for(;x>=0&&x<t.length;){const T=o[x];pe(T!=null,`Previous layout not found for panel index ${x}`);const D=T+y,P=Mn({panelConstraints:t,panelIndex:x,size:D});if(mt(T,P)||(y-=P-T,o[x]=P),mt(y,0))break;r>0?x--:x++}}}const u=o.reduce((d,h)=>h+d,0);return mt(u,100)?o:i}function q1({layout:r,panelsArray:e,pivotIndices:t}){let n=0,i=100,s=0,o=0;const a=t[0];pe(a!=null,"No pivot index found"),e.forEach((d,h)=>{const{constraints:f}=d,{maxSize:m=100,minSize:y=0}=f;h===a?(n=y,i=m):(s+=y,o+=m)});const l=Math.min(i,100-s),c=Math.max(n,100-o),u=r[a];return{valueMax:l,valueMin:c,valueNow:u}}function ii(r,e=document){return Array.from(e.querySelectorAll(`[${Re.resizeHandleId}][data-panel-group-id="${r}"]`))}function G0(r,e,t=document){const i=ii(r,t).findIndex(s=>s.getAttribute(Re.resizeHandleId)===e);return i??null}function K0(r,e,t){const n=G0(r,e,t);return n!=null?[n,n+1]:[-1,-1]}function J0(r,e=document){var t;if(e instanceof HTMLElement&&(e==null||(t=e.dataset)===null||t===void 0?void 0:t.panelGroupId)==r)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${r}"]`);return n||null}function Zi(r,e=document){const t=e.querySelector(`[${Re.resizeHandleId}="${r}"]`);return t||null}function _1(r,e,t,n=document){var i,s,o,a;const l=Zi(e,n),c=ii(r,n),u=l?c.indexOf(l):-1,d=(i=(s=t[u])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null,h=(o=(a=t[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[d,h]}function j1({committedValuesRef:r,eagerValuesRef:e,groupId:t,layout:n,panelDataArray:i,panelGroupElement:s,setLayout:o}){z.useRef({didWarnAboutMissingResizeHandle:!1}),Yr(()=>{if(!s)return;const a=ii(t,s);for(let l=0;l<i.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=q1({layout:n,panelsArray:i,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const f=i[l];pe(f,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",f.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[t,n,i,s]),z.useEffect(()=>{if(!s)return;const a=e.current;pe(a,"Eager values not found");const{panelDataArray:l}=a,c=J0(t,s);pe(c!=null,`No group found for id "${t}"`);const u=ii(t,s);pe(u,`No resize handles found for group id "${t}"`);const d=u.map(h=>{const f=h.getAttribute(Re.resizeHandleId);pe(f,"Resize handle element has no handle id attribute");const[m,y]=_1(t,f,l,s);if(m==null||y==null)return()=>{};const v=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const T=l.findIndex(D=>D.id===m);if(T>=0){const D=l[T];pe(D,`No panel data found for index ${T}`);const P=n[T],{collapsedSize:N=0,collapsible:O,minSize:A=0}=D.constraints;if(P!=null&&O){const $=ni({delta:mt(P,N)?A-N:N-P,initialLayout:n,panelConstraints:l.map(F=>F.constraints),pivotIndices:K0(t,f,s),prevLayout:n,trigger:"keyboard"});n!==$&&o($)}}break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}});return()=>{d.forEach(h=>h())}},[s,r,e,t,n,i,o])}function X0(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Y0(r,e){const t=r==="horizontal",{x:n,y:i}=Ki(e);return t?n:i}function U1(r,e,t,n,i){const s=t==="horizontal",o=Zi(e,i);pe(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(Re.groupId);pe(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=n;const c=Y0(t,r),u=J0(a,i);pe(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=s?d.width:d.height;return(c-l)/h*100}function W1(r,e,t,n,i,s){if(P0(r)){const o=t==="horizontal";let a=0;r.shiftKey?a=100:i!=null?a=i:a=10;let l=0;switch(r.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return n==null?0:U1(r,e,t,n,s)}function G1({panelDataArray:r}){const e=Array(r.length),t=r.map(s=>s.constraints);let n=0,i=100;for(let s=0;s<r.length;s++){const o=t[s];pe(o,`Panel constraints not found for index ${s}`);const{defaultSize:a}=o;a!=null&&(n++,e[s]=a,i-=a)}for(let s=0;s<r.length;s++){const o=t[s];pe(o,`Panel constraints not found for index ${s}`);const{defaultSize:a}=o;if(a!=null)continue;const l=r.length-n,c=i/l;n++,e[s]=c,i-=c}return e}function Tn(r,e,t){e.forEach((n,i)=>{const s=r[i];pe(s,`Panel data not found for index ${i}`);const{callbacks:o,constraints:a,id:l}=s,{collapsedSize:c=0,collapsible:u}=a,d=t[l];if(d==null||n!==d){t[l]=n;const{onCollapse:h,onExpand:f,onResize:m}=o;m&&m(n,d),u&&(h||f)&&(f&&(d==null||tr(d,c))&&!tr(n,c)&&f(),h&&(d==null||!tr(d,c))&&tr(n,c)&&h())}})}function Qi(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t])return!1;return!0}function K1({defaultSize:r,dragState:e,layout:t,panelData:n,panelIndex:i,precision:s=3}){const o=t[i];let a;return o==null?a=r!=null?r.toPrecision(s):"1":n.length===1?a="1":a=o.toPrecision(s),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function J1(r,e=10){let t=null;return(...i)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{r(...i)},e)}}function Z0(r){try{if(typeof localStorage<"u")r.getItem=e=>localStorage.getItem(e),r.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),r.getItem=()=>null,r.setItem=()=>{}}}function Q0(r){return`react-resizable-panels:${r}`}function ec(r){return r.map(e=>{const{constraints:t,id:n,idIsFromProps:i,order:s}=e;return i?n:s?`${s}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function tc(r,e){try{const t=Q0(r),n=e.getItem(t);if(n){const i=JSON.parse(n);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function X1(r,e,t){var n,i;const s=(n=tc(r,t))!==null&&n!==void 0?n:{},o=ec(e);return(i=s[o])!==null&&i!==void 0?i:null}function Y1(r,e,t,n,i){var s;const o=Q0(r),a=ec(e),l=(s=tc(r,i))!==null&&s!==void 0?s:{};l[a]={expandToSizes:Object.fromEntries(t.entries()),layout:n};try{i.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function rc({layout:r,panelConstraints:e}){const t=[...r],n=t.reduce((s,o)=>s+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(s=>`${s}%`).join(", ")}`);if(!mt(n,100)&&t.length>0)for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=100/n*o;t[s]=a}let i=0;for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=Mn({panelConstraints:e,panelIndex:s,size:o});o!=a&&(i+=o-a,t[s]=a)}if(!mt(i,0))for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=o+i,l=Mn({panelConstraints:e,panelIndex:s,size:a});if(o!==l&&(i-=l-o,t[s]=l,mt(i,0)))break}return t}const Z1=100,si={getItem:r=>(Z0(si),si.getItem(r)),setItem:(r,e)=>{Z0(si),si.setItem(r,e)}},nc={};function ic({autoSaveId:r=null,children:e,className:t="",direction:n,forwardedRef:i,id:s=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=si,style:c,tagName:u="div",...d}){const h=Ro(s),f=z.useRef(null),[m,y]=z.useState(null),[v,x]=z.useState([]),T=H1(),D=z.useRef({}),P=z.useRef(new Map),N=z.useRef(0),O=z.useRef({autoSaveId:r,direction:n,dragState:m,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),A=z.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});z.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),z.useImperativeHandle(i,()=>({getId:()=>O.current.id,getLayout:()=>{const{layout:L}=A.current;return L},setLayout:L=>{const{onLayout:B}=O.current,{layout:K,panelDataArray:re}=A.current,j=rc({layout:L,panelConstraints:re.map(ie=>ie.constraints)});X0(K,j)||(x(j),A.current.layout=j,B&&B(j),Tn(re,j,D.current))}}),[]),Yr(()=>{O.current.autoSaveId=r,O.current.direction=n,O.current.dragState=m,O.current.id=h,O.current.onLayout=o,O.current.storage=l}),j1({committedValuesRef:O,eagerValuesRef:A,groupId:h,layout:v,panelDataArray:A.current.panelDataArray,setLayout:x,panelGroupElement:f.current}),z.useEffect(()=>{const{panelDataArray:L}=A.current;if(r){if(v.length===0||v.length!==L.length)return;let B=nc[r];B==null&&(B=J1(Y1,Z1),nc[r]=B);const K=[...L],re=new Map(P.current);B(r,K,re,v,l)}},[r,v,l]),z.useEffect(()=>{});const $=z.useCallback(L=>{const{onLayout:B}=O.current,{layout:K,panelDataArray:re}=A.current;if(L.constraints.collapsible){const j=re.map(zt=>zt.constraints),{collapsedSize:ie=0,panelSize:me,pivotIndices:Ce}=en(re,L,K);if(pe(me!=null,`Panel size not found for panel "${L.id}"`),!tr(me,ie)){P.current.set(L.id,me);const It=Cn(re,L)===re.length-1?me-ie:ie-me,Ne=ni({delta:It,initialLayout:K,panelConstraints:j,pivotIndices:Ce,prevLayout:K,trigger:"imperative-api"});Qi(K,Ne)||(x(Ne),A.current.layout=Ne,B&&B(Ne),Tn(re,Ne,D.current))}}},[]),F=z.useCallback((L,B)=>{const{onLayout:K}=O.current,{layout:re,panelDataArray:j}=A.current;if(L.constraints.collapsible){const ie=j.map(ct=>ct.constraints),{collapsedSize:me=0,panelSize:Ce=0,minSize:zt=0,pivotIndices:It}=en(j,L,re),Ne=B??zt;if(tr(Ce,me)){const ct=P.current.get(L.id),Xr=ct!=null&&ct>=Ne?ct:Ne,wn=Cn(j,L)===j.length-1?Ce-Xr:Xr-Ce,je=ni({delta:wn,initialLayout:re,panelConstraints:ie,pivotIndices:It,prevLayout:re,trigger:"imperative-api"});Qi(re,je)||(x(je),A.current.layout=je,K&&K(je),Tn(j,je,D.current))}}},[]),q=z.useCallback(L=>{const{layout:B,panelDataArray:K}=A.current,{panelSize:re}=en(K,L,B);return pe(re!=null,`Panel size not found for panel "${L.id}"`),re},[]),te=z.useCallback((L,B)=>{const{panelDataArray:K}=A.current,re=Cn(K,L);return K1({defaultSize:B,dragState:m,layout:v,panelData:K,panelIndex:re})},[m,v]),Y=z.useCallback(L=>{const{layout:B,panelDataArray:K}=A.current,{collapsedSize:re=0,collapsible:j,panelSize:ie}=en(K,L,B);return pe(ie!=null,`Panel size not found for panel "${L.id}"`),j===!0&&tr(ie,re)},[]),he=z.useCallback(L=>{const{layout:B,panelDataArray:K}=A.current,{collapsedSize:re=0,collapsible:j,panelSize:ie}=en(K,L,B);return pe(ie!=null,`Panel size not found for panel "${L.id}"`),!j||Qr(ie,re)>0},[]),Q=z.useCallback(L=>{const{panelDataArray:B}=A.current;B.push(L),B.sort((K,re)=>{const j=K.order,ie=re.order;return j==null&&ie==null?0:j==null?-1:ie==null?1:j-ie}),A.current.panelDataArrayChanged=!0,T()},[T]);Yr(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:L,onLayout:B,storage:K}=O.current,{layout:re,panelDataArray:j}=A.current;let ie=null;if(L){const Ce=X1(L,j,K);Ce&&(P.current=new Map(Object.entries(Ce.expandToSizes)),ie=Ce.layout)}ie==null&&(ie=G1({panelDataArray:j}));const me=rc({layout:ie,panelConstraints:j.map(Ce=>Ce.constraints)});X0(re,me)||(x(me),A.current.layout=me,B&&B(me),Tn(j,me,D.current))}}),Yr(()=>{const L=A.current;return()=>{L.layout=[]}},[]);const W=z.useCallback(L=>{let B=!1;const K=f.current;return K&&window.getComputedStyle(K,null).getPropertyValue("direction")==="rtl"&&(B=!0),function(j){j.preventDefault();const ie=f.current;if(!ie)return()=>null;const{direction:me,dragState:Ce,id:zt,keyboardResizeBy:It,onLayout:Ne}=O.current,{layout:ct,panelDataArray:Xr}=A.current,{initialLayout:xn}=Ce??{},wn=K0(zt,L,ie);let je=W1(j,L,me,Ce,It,ie);const Sn=me==="horizontal";Sn&&B&&(je=-je);const nw=Xr.map(iw=>iw.constraints),_i=ni({delta:je,initialLayout:xn??ct,panelConstraints:nw,pivotIndices:wn,prevLayout:ct,trigger:P0(j)?"keyboard":"mouse-or-touch"}),h1=!Qi(ct,_i);(L0(j)||B0(j))&&N.current!=je&&(N.current=je,!h1&&je!==0?Sn?Vo(L,je<0?q0:_0):Vo(L,je<0?j0:U0):Vo(L,0)),h1&&(x(_i),A.current.layout=_i,Ne&&Ne(_i),Tn(Xr,_i,D.current))}},[]),ne=z.useCallback((L,B)=>{const{onLayout:K}=O.current,{layout:re,panelDataArray:j}=A.current,ie=j.map(ct=>ct.constraints),{panelSize:me,pivotIndices:Ce}=en(j,L,re);pe(me!=null,`Panel size not found for panel "${L.id}"`);const It=Cn(j,L)===j.length-1?me-B:B-me,Ne=ni({delta:It,initialLayout:re,panelConstraints:ie,pivotIndices:Ce,prevLayout:re,trigger:"imperative-api"});Qi(re,Ne)||(x(Ne),A.current.layout=Ne,K&&K(Ne),Tn(j,Ne,D.current))},[]),ve=z.useCallback((L,B)=>{const{layout:K,panelDataArray:re}=A.current,{collapsedSize:j=0,collapsible:ie}=B,{collapsedSize:me=0,collapsible:Ce,maxSize:zt=100,minSize:It=0}=L.constraints,{panelSize:Ne}=en(re,L,K);Ne!=null&&(ie&&Ce&&tr(Ne,j)?tr(j,me)||ne(L,me):Ne<It?ne(L,It):Ne>zt&&ne(L,zt))},[ne]),ge=z.useCallback((L,B)=>{const{direction:K}=O.current,{layout:re}=A.current;if(!f.current)return;const j=Zi(L,f.current);pe(j,`Drag handle element not found for id "${L}"`);const ie=Y0(K,B);y({dragHandleId:L,dragHandleRect:j.getBoundingClientRect(),initialCursorPosition:ie,initialLayout:re})},[]),Ae=z.useCallback(()=>{y(null)},[]),C=z.useCallback(L=>{const{panelDataArray:B}=A.current,K=Cn(B,L);K>=0&&(B.splice(K,1),delete D.current[L.id],A.current.panelDataArrayChanged=!0,T())},[T]),w=z.useMemo(()=>({collapsePanel:$,direction:n,dragState:m,expandPanel:F,getPanelSize:q,getPanelStyle:te,groupId:h,isPanelCollapsed:Y,isPanelExpanded:he,reevaluatePanelConstraints:ve,registerPanel:Q,registerResizeHandle:W,resizePanel:ne,startDragging:ge,stopDragging:Ae,unregisterPanel:C,panelGroupElement:f.current}),[$,m,n,F,q,te,h,Y,he,ve,Q,W,ne,ge,Ae,C]),I={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return z.createElement(Wi.Provider,{value:w},z.createElement(u,{...d,children:e,className:t,id:s,ref:f,style:{...I,...c},[Re.group]:"",[Re.groupDirection]:n,[Re.groupId]:h}))}const sc=z.forwardRef((r,e)=>z.createElement(ic,{...r,forwardedRef:e}));ic.displayName="PanelGroup",sc.displayName="forwardRef(PanelGroup)";function Cn(r,e){return r.findIndex(t=>t===e||t.id===e.id)}function en(r,e,t){const n=Cn(r,e),s=n===r.length-1?[n-1,n]:[n,n+1],o=t[n];return{...e.constraints,panelSize:o,pivotIndices:s}}function Q1({disabled:r,handleId:e,resizeHandler:t,panelGroupElement:n}){z.useEffect(()=>{if(r||t==null||n==null)return;const i=Zi(e,n);if(i==null)return;const s=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=i.getAttribute(Re.groupId);pe(a,`No group element found for id "${a}"`);const l=ii(a,n),c=G0(a,e,n);pe(c!==null,`No resize element found for id "${e}"`);const u=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return i.addEventListener("keydown",s),()=>{i.removeEventListener("keydown",s)}},[n,r,e,t])}function oc({children:r=null,className:e="",disabled:t=!1,hitAreaMargins:n,id:i,onBlur:s,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:h=0,tagName:f="div",...m}){var y,v;const x=z.useRef(null),T=z.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});z.useEffect(()=>{T.current.onClick=o,T.current.onDragging=a,T.current.onPointerDown=c,T.current.onPointerUp=u});const D=z.useContext(Wi);if(D===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:P,groupId:N,registerResizeHandle:O,startDragging:A,stopDragging:$,panelGroupElement:F}=D,q=Ro(i),[te,Y]=z.useState("inactive"),[he,Q]=z.useState(!1),[W,ne]=z.useState(null),ve=z.useRef({state:te});Yr(()=>{ve.current.state=te}),z.useEffect(()=>{if(t)ne(null);else{const w=O(q);ne(()=>w)}},[t,q,O]);const ge=(y=n?.coarse)!==null&&y!==void 0?y:15,Ae=(v=n?.fine)!==null&&v!==void 0?v:5;z.useEffect(()=>{if(t||W==null)return;const w=x.current;pe(w,"Element ref not attached");let I=!1;return F1(q,w,P,{coarse:ge,fine:Ae},(B,K,re)=>{if(!K){Y("inactive");return}switch(B){case"down":{Y("drag"),I=!1,pe(re,'Expected event to be defined for "down" action'),A(q,re);const{onDragging:j,onPointerDown:ie}=T.current;j?.(!0),ie?.();break}case"move":{const{state:j}=ve.current;I=!0,j!=="drag"&&Y("hover"),pe(re,'Expected event to be defined for "move" action'),W(re);break}case"up":{Y("hover"),$();const{onClick:j,onDragging:ie,onPointerUp:me}=T.current;ie?.(!1),me?.(),I||j?.();break}}})},[ge,P,t,Ae,O,q,W,A,$]),Q1({disabled:t,handleId:q,resizeHandler:W,panelGroupElement:F});const C={touchAction:"none",userSelect:"none"};return z.createElement(f,{...m,children:r,className:e,id:i,onBlur:()=>{Q(!1),s?.()},onFocus:()=>{Q(!0),l?.()},ref:x,role:"separator",style:{...C,...d},tabIndex:h,[Re.groupDirection]:P,[Re.groupId]:N,[Re.resizeHandle]:"",[Re.resizeHandleActive]:te==="drag"?"pointer":he?"keyboard":void 0,[Re.resizeHandleEnabled]:!t,[Re.resizeHandleId]:q,[Re.resizeHandleState]:te})}oc.displayName="PanelResizeHandle";function ac(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function e4(r){if(Array.isArray(r))return r}function t4(r,e,t){return(e=l4(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function r4(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function n4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function cc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lc(Object(t),!0).forEach(function(n){t4(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):lc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function i4(r,e){if(r==null)return{};var t,n,i=s4(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function s4(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function o4(r,e){return e4(r)||r4(r,e)||c4(r,e)||n4()}function a4(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function l4(r){var e=a4(r,"string");return typeof e=="symbol"?e:e+""}function c4(r,e){if(r){if(typeof r=="string")return ac(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ac(r,e):void 0}}function u4(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uc(Object(t),!0).forEach(function(n){u4(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function d4(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(n){return e.reduceRight(function(i,s){return s(i)},n)}}function oi(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function es(r){return{}.toString.call(r).includes("Object")}function h4(r){return!Object.keys(r).length}function ai(r){return typeof r=="function"}function f4(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function p4(r,e){return es(e)||kr("changeType"),Object.keys(e).some(function(t){return!f4(r,t)})&&kr("changeField"),e}function m4(r){ai(r)||kr("selectorType")}function g4(r){ai(r)||es(r)||kr("handlerType"),es(r)&&Object.values(r).some(function(e){return!ai(e)})&&kr("handlersType")}function y4(r){r||kr("initialIsRequired"),es(r)||kr("initialType"),h4(r)&&kr("initialContent")}function v4(r,e){throw new Error(r[e]||r.default)}var b4={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},kr=oi(v4)(b4),ts={changes:p4,selector:m4,handler:g4,initial:y4};function x4(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ts.initial(r),ts.handler(e);var t={current:r},n=oi(k4)(t,e),i=oi(S4)(t),s=oi(ts.changes)(r),o=oi(w4)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return ts.selector(c),c(t.current)}function l(c){d4(n,i,s,o)(c)}return[a,l]}function w4(r,e){return ai(e)?e(r.current):e}function S4(r,e){return r.current=dc(dc({},r.current),e),e}function k4(r,e,t){return ai(e)?e(r.current):Object.keys(t).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,r.current[n])}),t}var M4={create:x4},T4={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function C4(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function E4(r){return{}.toString.call(r).includes("Object")}function A4(r){return r||fc("configIsRequired"),E4(r)||fc("configType"),r.urls?(O4(),{paths:{vs:r.urls.monacoBase}}):r}function O4(){console.warn(hc.deprecation)}function N4(r,e){throw new Error(r[e]||r.default)}var hc={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
6
+ <%s key={someKey} {...props} />`,B,j,ie,j),C[j+B]=!0)}if(j=null,L!==void 0&&(t(L),j=""+L),o(I)&&(t(I.key),j=""+I.key),"key"in I){L={};for(var me in I)me!=="key"&&(L[me]=I[me])}else L=I;return j&&a(L,typeof w=="function"?w.displayName||w.name||"Unknown":w),c(w,j,L,i(),K,re)}function d(w){h(w)?w._store&&(w._store.validated=1):typeof w=="object"&&w!==null&&w.$$typeof===F&&(w._payload.status==="fulfilled"?h(w._payload.value)&&w._payload.value._store&&(w._payload.value._store.validated=1):w._store&&(w._store.validated=1))}function h(w){return typeof w=="object"&&w!==null&&w.$$typeof===m}var f=z,m=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),P=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),Y=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=Object.prototype.hasOwnProperty,Q=Array.isArray,W=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(w){return w()}};var ne,ve={},ge=f.react_stack_bottom_frame.bind(f,s)(),Ae=W(n(s)),C={};ti.Fragment=v,ti.jsx=function(w,I,L){var B=1e4>Y.recentlyCreatedOwnerStacks++;return u(w,I,L,!1,B?Error("react-stack-top-frame"):ge,B?W(n(w)):Ae)},ti.jsxs=function(w,I,L){var B=1e4>Y.recentlyCreatedOwnerStacks++;return u(w,I,L,!0,B?Error("react-stack-top-frame"):ge,B?W(n(w)):Ae)}})()),ti}var I0;function C1(){return I0||(I0=1,process.env.NODE_ENV==="production"?Ui.exports=M1():Ui.exports=T1()),Ui.exports}var J=C1();const Wi=z.createContext(null);Wi.displayName="PanelGroupContext";const Re={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Io=10,Yr=z.useLayoutEffect,R0=k1.useId,E1=typeof R0=="function"?R0:()=>null;let A1=0;function Ro(r=null){const e=E1(),t=z.useRef(r||e||null);return t.current===null&&(t.current=""+A1++),r??t.current}function P0({children:r,className:e="",collapsedSize:t,collapsible:n,defaultSize:i,forwardedRef:s,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:f,tagName:m="div",...y}){const v=z.useContext(Wi);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:T,getPanelSize:D,getPanelStyle:P,groupId:E,isPanelCollapsed:N,reevaluatePanelConstraints:O,registerPanel:$,resizePanel:F,unregisterPanel:q}=v,te=Ro(o),Y=z.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:t,collapsible:n,defaultSize:i,maxSize:a,minSize:l},id:te,idIsFromProps:o!==void 0,order:h});z.useRef({didLogMissingDefaultSizeWarning:!1}),Yr(()=>{const{callbacks:Q,constraints:W}=Y.current,ne={...W};Y.current.id=te,Y.current.idIsFromProps=o!==void 0,Y.current.order=h,Q.onCollapse=c,Q.onExpand=u,Q.onResize=d,W.collapsedSize=t,W.collapsible=n,W.defaultSize=i,W.maxSize=a,W.minSize=l,(ne.collapsedSize!==W.collapsedSize||ne.collapsible!==W.collapsible||ne.maxSize!==W.maxSize||ne.minSize!==W.minSize)&&O(Y.current,ne)}),Yr(()=>{const Q=Y.current;return $(Q),()=>{q(Q)}},[h,te,$,q]),z.useImperativeHandle(s,()=>({collapse:()=>{x(Y.current)},expand:Q=>{T(Y.current,Q)},getId(){return te},getSize(){return D(Y.current)},isCollapsed(){return N(Y.current)},isExpanded(){return!N(Y.current)},resize:Q=>{F(Y.current,Q)}}),[x,T,D,N,te,F]);const he=P(Y.current,i);return z.createElement(m,{...y,children:r,className:e,id:te,style:{...he,...f},[Re.groupId]:E,[Re.panel]:"",[Re.panelCollapsible]:n||void 0,[Re.panelId]:te,[Re.panelSize]:parseFloat(""+he.flexGrow).toFixed(1)})}const Po=z.forwardRef((r,e)=>z.createElement(P0,{...r,forwardedRef:e}));P0.displayName="Panel",Po.displayName="forwardRef(Panel)";let Lo=null,Gi=-1,Sr=null;function O1(r,e){if(e){const t=(e&_0)!==0,n=(e&j0)!==0,i=(e&U0)!==0,s=(e&W0)!==0;if(t)return i?"se-resize":s?"ne-resize":"e-resize";if(n)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(r){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function N1(){Sr!==null&&(document.head.removeChild(Sr),Lo=null,Sr=null,Gi=-1)}function Bo(r,e){var t,n;const i=O1(r,e);if(Lo!==i){if(Lo=i,Sr===null&&(Sr=document.createElement("style"),document.head.appendChild(Sr)),Gi>=0){var s;(s=Sr.sheet)===null||s===void 0||s.removeRule(Gi)}Gi=(t=(n=Sr.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${i} !important;}`))!==null&&t!==void 0?t:-1}}function L0(r){return r.type==="keydown"}function B0(r){return r.type.startsWith("pointer")}function F0(r){return r.type.startsWith("mouse")}function Ki(r){if(B0(r)){if(r.isPrimary)return{x:r.clientX,y:r.clientY}}else if(F0(r))return{x:r.clientX,y:r.clientY};return{x:1/0,y:1/0}}function D1(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function z1(r,e,t){return r.x<e.x+e.width&&r.x+r.width>e.x&&r.y<e.y+e.height&&r.y+r.height>e.y}function I1(r,e){if(r===e)throw new Error("Cannot compare node with itself");const t={a:V0(r),b:V0(e)};let n;for(;t.a.at(-1)===t.b.at(-1);)r=t.a.pop(),e=t.b.pop(),n=r;pe(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:H0($0(t.a)),b:H0($0(t.b))};if(i.a===i.b){const s=n.childNodes,o={a:t.a.at(-1),b:t.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const R1=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function P1(r){var e;const t=getComputedStyle((e=q0(r))!==null&&e!==void 0?e:r).display;return t==="flex"||t==="inline-flex"}function L1(r){const e=getComputedStyle(r);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||P1(r))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||R1.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function $0(r){let e=r.length;for(;e--;){const t=r[e];if(pe(t,"Missing node"),L1(t))return t}return null}function H0(r){return r&&Number(getComputedStyle(r).zIndex)||0}function V0(r){const e=[];for(;r;)e.push(r),r=q0(r);return e}function q0(r){const{parentNode:e}=r;return e&&e instanceof ShadowRoot?e.host:e}const _0=1,j0=2,U0=4,W0=8,B1=D1()==="coarse";let Rt=[],kn=!1,Zr=new Map,Ji=new Map;const ri=new Set;function F1(r,e,t,n,i){var s;const{ownerDocument:o}=e,a={direction:t,element:e,hitAreaMargins:n,setResizeHandlerState:i},l=(s=Zr.get(o))!==null&&s!==void 0?s:0;return Zr.set(o,l+1),ri.add(a),Xi(),function(){var u;Ji.delete(r),ri.delete(a);const d=(u=Zr.get(o))!==null&&u!==void 0?u:1;if(Zr.set(o,d-1),Xi(),d===1&&Zr.delete(o),Rt.includes(a)){const h=Rt.indexOf(a);h>=0&&Rt.splice(h,1),qo(),i("up",!0,null)}}}function $1(r){const{target:e}=r,{x:t,y:n}=Ki(r);kn=!0,Ho({target:e,x:t,y:n}),Xi(),Rt.length>0&&(Yi("down",r),r.preventDefault(),G0(e)||r.stopImmediatePropagation())}function Fo(r){const{x:e,y:t}=Ki(r);if(kn&&r.buttons===0&&(kn=!1,Yi("up",r)),!kn){const{target:n}=r;Ho({target:n,x:e,y:t})}Yi("move",r),qo(),Rt.length>0&&r.preventDefault()}function $o(r){const{target:e}=r,{x:t,y:n}=Ki(r);Ji.clear(),kn=!1,Rt.length>0&&(r.preventDefault(),G0(e)||r.stopImmediatePropagation()),Yi("up",r),Ho({target:e,x:t,y:n}),qo(),Xi()}function G0(r){let e=r;for(;e;){if(e.hasAttribute(Re.resizeHandle))return!0;e=e.parentElement}return!1}function Ho({target:r,x:e,y:t}){Rt.splice(0);let n=null;(r instanceof HTMLElement||r instanceof SVGElement)&&(n=r),ri.forEach(i=>{const{element:s,hitAreaMargins:o}=i,a=s.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=B1?o.coarse:o.fine;if(e>=c-h&&e<=u+h&&t>=d-h&&t<=l+h){if(n!==null&&document.contains(n)&&s!==n&&!s.contains(n)&&!n.contains(s)&&I1(n,s)>0){let m=n,y=!1;for(;m&&!m.contains(s);){if(z1(m.getBoundingClientRect(),a)){y=!0;break}m=m.parentElement}if(y)return}Rt.push(i)}})}function Vo(r,e){Ji.set(r,e)}function qo(){let r=!1,e=!1;Rt.forEach(n=>{const{direction:i}=n;i==="horizontal"?r=!0:e=!0});let t=0;Ji.forEach(n=>{t|=n}),r&&e?Bo("intersection",t):r?Bo("horizontal",t):e?Bo("vertical",t):N1()}let _o=new AbortController;function Xi(){_o.abort(),_o=new AbortController;const r={capture:!0,signal:_o.signal};ri.size&&(kn?(Rt.length>0&&Zr.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",$o,r),n.addEventListener("pointerleave",Fo,r),n.addEventListener("pointermove",Fo,r))}),window.addEventListener("pointerup",$o,r),window.addEventListener("pointercancel",$o,r)):Zr.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",$1,r),n.addEventListener("pointermove",Fo,r))}))}function Yi(r,e){ri.forEach(t=>{const{setResizeHandlerState:n}=t,i=Rt.includes(t);n(r,i,e)})}function H1(){const[r,e]=z.useState(0);return z.useCallback(()=>e(t=>t+1),[])}function pe(r,e){if(!r)throw console.error(e),Error(e)}function Qr(r,e,t=Io){return r.toFixed(t)===e.toFixed(t)?0:r>e?1:-1}function tr(r,e,t=Io){return Qr(r,e,t)===0}function mt(r,e,t){return Qr(r,e,t)===0}function V1(r,e,t){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++){const i=r[n],s=e[n];if(!mt(i,s,t))return!1}return!0}function Mn({panelConstraints:r,panelIndex:e,size:t}){const n=r[e];pe(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:i=0,collapsible:s,maxSize:o=100,minSize:a=0}=n;if(Qr(t,a)<0)if(s){const l=(i+a)/2;Qr(t,l)<0?t=i:t=a}else t=a;return t=Math.min(o,t),t=parseFloat(t.toFixed(Io)),t}function ni({delta:r,initialLayout:e,panelConstraints:t,pivotIndices:n,prevLayout:i,trigger:s}){if(mt(r,0))return e;const o=[...e],[a,l]=n;pe(a!=null,"Invalid first pivot index"),pe(l!=null,"Invalid second pivot index");let c=0;if(s==="keyboard"){{const d=r<0?l:a,h=t[d];pe(h,`Panel constraints not found for index ${d}`);const{collapsedSize:f=0,collapsible:m,minSize:y=0}=h;if(m){const v=e[d];if(pe(v!=null,`Previous layout not found for panel index ${d}`),mt(v,f)){const x=y-v;Qr(x,Math.abs(r))>0&&(r=r<0?0-x:x)}}}{const d=r<0?a:l,h=t[d];pe(h,`No panel constraints found for index ${d}`);const{collapsedSize:f=0,collapsible:m,minSize:y=0}=h;if(m){const v=e[d];if(pe(v!=null,`Previous layout not found for panel index ${d}`),mt(v,y)){const x=v-f;Qr(x,Math.abs(r))>0&&(r=r<0?0-x:x)}}}}{const d=r<0?1:-1;let h=r<0?l:a,f=0;for(;;){const y=e[h];pe(y!=null,`Previous layout not found for panel index ${h}`);const x=Mn({panelConstraints:t,panelIndex:h,size:100})-y;if(f+=x,h+=d,h<0||h>=t.length)break}const m=Math.min(Math.abs(r),Math.abs(f));r=r<0?0-m:m}{let h=r<0?a:l;for(;h>=0&&h<t.length;){const f=Math.abs(r)-Math.abs(c),m=e[h];pe(m!=null,`Previous layout not found for panel index ${h}`);const y=m-f,v=Mn({panelConstraints:t,panelIndex:h,size:y});if(!mt(m,v)&&(c+=m-v,o[h]=v,c.toPrecision(3).localeCompare(Math.abs(r).toPrecision(3),void 0,{numeric:!0})>=0))break;r<0?h--:h++}}if(V1(i,o))return i;{const d=r<0?l:a,h=e[d];pe(h!=null,`Previous layout not found for panel index ${d}`);const f=h+c,m=Mn({panelConstraints:t,panelIndex:d,size:f});if(o[d]=m,!mt(m,f)){let y=f-m,x=r<0?l:a;for(;x>=0&&x<t.length;){const T=o[x];pe(T!=null,`Previous layout not found for panel index ${x}`);const D=T+y,P=Mn({panelConstraints:t,panelIndex:x,size:D});if(mt(T,P)||(y-=P-T,o[x]=P),mt(y,0))break;r>0?x--:x++}}}const u=o.reduce((d,h)=>h+d,0);return mt(u,100)?o:i}function q1({layout:r,panelsArray:e,pivotIndices:t}){let n=0,i=100,s=0,o=0;const a=t[0];pe(a!=null,"No pivot index found"),e.forEach((d,h)=>{const{constraints:f}=d,{maxSize:m=100,minSize:y=0}=f;h===a?(n=y,i=m):(s+=y,o+=m)});const l=Math.min(i,100-s),c=Math.max(n,100-o),u=r[a];return{valueMax:l,valueMin:c,valueNow:u}}function ii(r,e=document){return Array.from(e.querySelectorAll(`[${Re.resizeHandleId}][data-panel-group-id="${r}"]`))}function K0(r,e,t=document){const i=ii(r,t).findIndex(s=>s.getAttribute(Re.resizeHandleId)===e);return i??null}function J0(r,e,t){const n=K0(r,e,t);return n!=null?[n,n+1]:[-1,-1]}function X0(r,e=document){var t;if(e instanceof HTMLElement&&(e==null||(t=e.dataset)===null||t===void 0?void 0:t.panelGroupId)==r)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${r}"]`);return n||null}function Zi(r,e=document){const t=e.querySelector(`[${Re.resizeHandleId}="${r}"]`);return t||null}function _1(r,e,t,n=document){var i,s,o,a;const l=Zi(e,n),c=ii(r,n),u=l?c.indexOf(l):-1,d=(i=(s=t[u])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null,h=(o=(a=t[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[d,h]}function j1({committedValuesRef:r,eagerValuesRef:e,groupId:t,layout:n,panelDataArray:i,panelGroupElement:s,setLayout:o}){z.useRef({didWarnAboutMissingResizeHandle:!1}),Yr(()=>{if(!s)return;const a=ii(t,s);for(let l=0;l<i.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=q1({layout:n,panelsArray:i,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const f=i[l];pe(f,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",f.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[t,n,i,s]),z.useEffect(()=>{if(!s)return;const a=e.current;pe(a,"Eager values not found");const{panelDataArray:l}=a,c=X0(t,s);pe(c!=null,`No group found for id "${t}"`);const u=ii(t,s);pe(u,`No resize handles found for group id "${t}"`);const d=u.map(h=>{const f=h.getAttribute(Re.resizeHandleId);pe(f,"Resize handle element has no handle id attribute");const[m,y]=_1(t,f,l,s);if(m==null||y==null)return()=>{};const v=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const T=l.findIndex(D=>D.id===m);if(T>=0){const D=l[T];pe(D,`No panel data found for index ${T}`);const P=n[T],{collapsedSize:E=0,collapsible:N,minSize:O=0}=D.constraints;if(P!=null&&N){const $=ni({delta:mt(P,E)?O-E:E-P,initialLayout:n,panelConstraints:l.map(F=>F.constraints),pivotIndices:J0(t,f,s),prevLayout:n,trigger:"keyboard"});n!==$&&o($)}}break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}});return()=>{d.forEach(h=>h())}},[s,r,e,t,n,i,o])}function Y0(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Z0(r,e){const t=r==="horizontal",{x:n,y:i}=Ki(e);return t?n:i}function U1(r,e,t,n,i){const s=t==="horizontal",o=Zi(e,i);pe(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(Re.groupId);pe(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=n;const c=Z0(t,r),u=X0(a,i);pe(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=s?d.width:d.height;return(c-l)/h*100}function W1(r,e,t,n,i,s){if(L0(r)){const o=t==="horizontal";let a=0;r.shiftKey?a=100:i!=null?a=i:a=10;let l=0;switch(r.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return n==null?0:U1(r,e,t,n,s)}function G1({panelDataArray:r}){const e=Array(r.length),t=r.map(s=>s.constraints);let n=0,i=100;for(let s=0;s<r.length;s++){const o=t[s];pe(o,`Panel constraints not found for index ${s}`);const{defaultSize:a}=o;a!=null&&(n++,e[s]=a,i-=a)}for(let s=0;s<r.length;s++){const o=t[s];pe(o,`Panel constraints not found for index ${s}`);const{defaultSize:a}=o;if(a!=null)continue;const l=r.length-n,c=i/l;n++,e[s]=c,i-=c}return e}function Tn(r,e,t){e.forEach((n,i)=>{const s=r[i];pe(s,`Panel data not found for index ${i}`);const{callbacks:o,constraints:a,id:l}=s,{collapsedSize:c=0,collapsible:u}=a,d=t[l];if(d==null||n!==d){t[l]=n;const{onCollapse:h,onExpand:f,onResize:m}=o;m&&m(n,d),u&&(h||f)&&(f&&(d==null||tr(d,c))&&!tr(n,c)&&f(),h&&(d==null||!tr(d,c))&&tr(n,c)&&h())}})}function Qi(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t])return!1;return!0}function K1({defaultSize:r,dragState:e,layout:t,panelData:n,panelIndex:i,precision:s=3}){const o=t[i];let a;return o==null?a=r!=null?r.toPrecision(s):"1":n.length===1?a="1":a=o.toPrecision(s),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function J1(r,e=10){let t=null;return(...i)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{r(...i)},e)}}function Q0(r){try{if(typeof localStorage<"u")r.getItem=e=>localStorage.getItem(e),r.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),r.getItem=()=>null,r.setItem=()=>{}}}function ec(r){return`react-resizable-panels:${r}`}function tc(r){return r.map(e=>{const{constraints:t,id:n,idIsFromProps:i,order:s}=e;return i?n:s?`${s}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(",")}function rc(r,e){try{const t=ec(r),n=e.getItem(t);if(n){const i=JSON.parse(n);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function X1(r,e,t){var n,i;const s=(n=rc(r,t))!==null&&n!==void 0?n:{},o=tc(e);return(i=s[o])!==null&&i!==void 0?i:null}function Y1(r,e,t,n,i){var s;const o=ec(r),a=tc(e),l=(s=rc(r,i))!==null&&s!==void 0?s:{};l[a]={expandToSizes:Object.fromEntries(t.entries()),layout:n};try{i.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function nc({layout:r,panelConstraints:e}){const t=[...r],n=t.reduce((s,o)=>s+o,0);if(t.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${t.map(s=>`${s}%`).join(", ")}`);if(!mt(n,100)&&t.length>0)for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=100/n*o;t[s]=a}let i=0;for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=Mn({panelConstraints:e,panelIndex:s,size:o});o!=a&&(i+=o-a,t[s]=a)}if(!mt(i,0))for(let s=0;s<e.length;s++){const o=t[s];pe(o!=null,`No layout data found for index ${s}`);const a=o+i,l=Mn({panelConstraints:e,panelIndex:s,size:a});if(o!==l&&(i-=l-o,t[s]=l,mt(i,0)))break}return t}const Z1=100,si={getItem:r=>(Q0(si),si.getItem(r)),setItem:(r,e)=>{Q0(si),si.setItem(r,e)}},ic={};function sc({autoSaveId:r=null,children:e,className:t="",direction:n,forwardedRef:i,id:s=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=si,style:c,tagName:u="div",...d}){const h=Ro(s),f=z.useRef(null),[m,y]=z.useState(null),[v,x]=z.useState([]),T=H1(),D=z.useRef({}),P=z.useRef(new Map),E=z.useRef(0),N=z.useRef({autoSaveId:r,direction:n,dragState:m,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),O=z.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});z.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),z.useImperativeHandle(i,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:L}=O.current;return L},setLayout:L=>{const{onLayout:B}=N.current,{layout:K,panelDataArray:re}=O.current,j=nc({layout:L,panelConstraints:re.map(ie=>ie.constraints)});Y0(K,j)||(x(j),O.current.layout=j,B&&B(j),Tn(re,j,D.current))}}),[]),Yr(()=>{N.current.autoSaveId=r,N.current.direction=n,N.current.dragState=m,N.current.id=h,N.current.onLayout=o,N.current.storage=l}),j1({committedValuesRef:N,eagerValuesRef:O,groupId:h,layout:v,panelDataArray:O.current.panelDataArray,setLayout:x,panelGroupElement:f.current}),z.useEffect(()=>{const{panelDataArray:L}=O.current;if(r){if(v.length===0||v.length!==L.length)return;let B=ic[r];B==null&&(B=J1(Y1,Z1),ic[r]=B);const K=[...L],re=new Map(P.current);B(r,K,re,v,l)}},[r,v,l]),z.useEffect(()=>{});const $=z.useCallback(L=>{const{onLayout:B}=N.current,{layout:K,panelDataArray:re}=O.current;if(L.constraints.collapsible){const j=re.map(zt=>zt.constraints),{collapsedSize:ie=0,panelSize:me,pivotIndices:Ce}=en(re,L,K);if(pe(me!=null,`Panel size not found for panel "${L.id}"`),!tr(me,ie)){P.current.set(L.id,me);const It=Cn(re,L)===re.length-1?me-ie:ie-me,Ne=ni({delta:It,initialLayout:K,panelConstraints:j,pivotIndices:Ce,prevLayout:K,trigger:"imperative-api"});Qi(K,Ne)||(x(Ne),O.current.layout=Ne,B&&B(Ne),Tn(re,Ne,D.current))}}},[]),F=z.useCallback((L,B)=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:j}=O.current;if(L.constraints.collapsible){const ie=j.map(ct=>ct.constraints),{collapsedSize:me=0,panelSize:Ce=0,minSize:zt=0,pivotIndices:It}=en(j,L,re),Ne=B??zt;if(tr(Ce,me)){const ct=P.current.get(L.id),Xr=ct!=null&&ct>=Ne?ct:Ne,wn=Cn(j,L)===j.length-1?Ce-Xr:Xr-Ce,je=ni({delta:wn,initialLayout:re,panelConstraints:ie,pivotIndices:It,prevLayout:re,trigger:"imperative-api"});Qi(re,je)||(x(je),O.current.layout=je,K&&K(je),Tn(j,je,D.current))}}},[]),q=z.useCallback(L=>{const{layout:B,panelDataArray:K}=O.current,{panelSize:re}=en(K,L,B);return pe(re!=null,`Panel size not found for panel "${L.id}"`),re},[]),te=z.useCallback((L,B)=>{const{panelDataArray:K}=O.current,re=Cn(K,L);return K1({defaultSize:B,dragState:m,layout:v,panelData:K,panelIndex:re})},[m,v]),Y=z.useCallback(L=>{const{layout:B,panelDataArray:K}=O.current,{collapsedSize:re=0,collapsible:j,panelSize:ie}=en(K,L,B);return pe(ie!=null,`Panel size not found for panel "${L.id}"`),j===!0&&tr(ie,re)},[]),he=z.useCallback(L=>{const{layout:B,panelDataArray:K}=O.current,{collapsedSize:re=0,collapsible:j,panelSize:ie}=en(K,L,B);return pe(ie!=null,`Panel size not found for panel "${L.id}"`),!j||Qr(ie,re)>0},[]),Q=z.useCallback(L=>{const{panelDataArray:B}=O.current;B.push(L),B.sort((K,re)=>{const j=K.order,ie=re.order;return j==null&&ie==null?0:j==null?-1:ie==null?1:j-ie}),O.current.panelDataArrayChanged=!0,T()},[T]);Yr(()=>{if(O.current.panelDataArrayChanged){O.current.panelDataArrayChanged=!1;const{autoSaveId:L,onLayout:B,storage:K}=N.current,{layout:re,panelDataArray:j}=O.current;let ie=null;if(L){const Ce=X1(L,j,K);Ce&&(P.current=new Map(Object.entries(Ce.expandToSizes)),ie=Ce.layout)}ie==null&&(ie=G1({panelDataArray:j}));const me=nc({layout:ie,panelConstraints:j.map(Ce=>Ce.constraints)});Y0(re,me)||(x(me),O.current.layout=me,B&&B(me),Tn(j,me,D.current))}}),Yr(()=>{const L=O.current;return()=>{L.layout=[]}},[]);const W=z.useCallback(L=>{let B=!1;const K=f.current;return K&&window.getComputedStyle(K,null).getPropertyValue("direction")==="rtl"&&(B=!0),function(j){j.preventDefault();const ie=f.current;if(!ie)return()=>null;const{direction:me,dragState:Ce,id:zt,keyboardResizeBy:It,onLayout:Ne}=N.current,{layout:ct,panelDataArray:Xr}=O.current,{initialLayout:xn}=Ce??{},wn=J0(zt,L,ie);let je=W1(j,L,me,Ce,It,ie);const Sn=me==="horizontal";Sn&&B&&(je=-je);const nw=Xr.map(iw=>iw.constraints),_i=ni({delta:je,initialLayout:xn??ct,panelConstraints:nw,pivotIndices:wn,prevLayout:ct,trigger:L0(j)?"keyboard":"mouse-or-touch"}),h1=!Qi(ct,_i);(B0(j)||F0(j))&&E.current!=je&&(E.current=je,!h1&&je!==0?Sn?Vo(L,je<0?_0:j0):Vo(L,je<0?U0:W0):Vo(L,0)),h1&&(x(_i),O.current.layout=_i,Ne&&Ne(_i),Tn(Xr,_i,D.current))}},[]),ne=z.useCallback((L,B)=>{const{onLayout:K}=N.current,{layout:re,panelDataArray:j}=O.current,ie=j.map(ct=>ct.constraints),{panelSize:me,pivotIndices:Ce}=en(j,L,re);pe(me!=null,`Panel size not found for panel "${L.id}"`);const It=Cn(j,L)===j.length-1?me-B:B-me,Ne=ni({delta:It,initialLayout:re,panelConstraints:ie,pivotIndices:Ce,prevLayout:re,trigger:"imperative-api"});Qi(re,Ne)||(x(Ne),O.current.layout=Ne,K&&K(Ne),Tn(j,Ne,D.current))},[]),ve=z.useCallback((L,B)=>{const{layout:K,panelDataArray:re}=O.current,{collapsedSize:j=0,collapsible:ie}=B,{collapsedSize:me=0,collapsible:Ce,maxSize:zt=100,minSize:It=0}=L.constraints,{panelSize:Ne}=en(re,L,K);Ne!=null&&(ie&&Ce&&tr(Ne,j)?tr(j,me)||ne(L,me):Ne<It?ne(L,It):Ne>zt&&ne(L,zt))},[ne]),ge=z.useCallback((L,B)=>{const{direction:K}=N.current,{layout:re}=O.current;if(!f.current)return;const j=Zi(L,f.current);pe(j,`Drag handle element not found for id "${L}"`);const ie=Z0(K,B);y({dragHandleId:L,dragHandleRect:j.getBoundingClientRect(),initialCursorPosition:ie,initialLayout:re})},[]),Ae=z.useCallback(()=>{y(null)},[]),C=z.useCallback(L=>{const{panelDataArray:B}=O.current,K=Cn(B,L);K>=0&&(B.splice(K,1),delete D.current[L.id],O.current.panelDataArrayChanged=!0,T())},[T]),w=z.useMemo(()=>({collapsePanel:$,direction:n,dragState:m,expandPanel:F,getPanelSize:q,getPanelStyle:te,groupId:h,isPanelCollapsed:Y,isPanelExpanded:he,reevaluatePanelConstraints:ve,registerPanel:Q,registerResizeHandle:W,resizePanel:ne,startDragging:ge,stopDragging:Ae,unregisterPanel:C,panelGroupElement:f.current}),[$,m,n,F,q,te,h,Y,he,ve,Q,W,ne,ge,Ae,C]),I={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return z.createElement(Wi.Provider,{value:w},z.createElement(u,{...d,children:e,className:t,id:s,ref:f,style:{...I,...c},[Re.group]:"",[Re.groupDirection]:n,[Re.groupId]:h}))}const oc=z.forwardRef((r,e)=>z.createElement(sc,{...r,forwardedRef:e}));sc.displayName="PanelGroup",oc.displayName="forwardRef(PanelGroup)";function Cn(r,e){return r.findIndex(t=>t===e||t.id===e.id)}function en(r,e,t){const n=Cn(r,e),s=n===r.length-1?[n-1,n]:[n,n+1],o=t[n];return{...e.constraints,panelSize:o,pivotIndices:s}}function Q1({disabled:r,handleId:e,resizeHandler:t,panelGroupElement:n}){z.useEffect(()=>{if(r||t==null||n==null)return;const i=Zi(e,n);if(i==null)return;const s=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),t(o);break}case"F6":{o.preventDefault();const a=i.getAttribute(Re.groupId);pe(a,`No group element found for id "${a}"`);const l=ii(a,n),c=K0(a,e,n);pe(c!==null,`No resize element found for id "${e}"`);const u=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return i.addEventListener("keydown",s),()=>{i.removeEventListener("keydown",s)}},[n,r,e,t])}function ac({children:r=null,className:e="",disabled:t=!1,hitAreaMargins:n,id:i,onBlur:s,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:h=0,tagName:f="div",...m}){var y,v;const x=z.useRef(null),T=z.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});z.useEffect(()=>{T.current.onClick=o,T.current.onDragging=a,T.current.onPointerDown=c,T.current.onPointerUp=u});const D=z.useContext(Wi);if(D===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:P,groupId:E,registerResizeHandle:N,startDragging:O,stopDragging:$,panelGroupElement:F}=D,q=Ro(i),[te,Y]=z.useState("inactive"),[he,Q]=z.useState(!1),[W,ne]=z.useState(null),ve=z.useRef({state:te});Yr(()=>{ve.current.state=te}),z.useEffect(()=>{if(t)ne(null);else{const w=N(q);ne(()=>w)}},[t,q,N]);const ge=(y=n?.coarse)!==null&&y!==void 0?y:15,Ae=(v=n?.fine)!==null&&v!==void 0?v:5;z.useEffect(()=>{if(t||W==null)return;const w=x.current;pe(w,"Element ref not attached");let I=!1;return F1(q,w,P,{coarse:ge,fine:Ae},(B,K,re)=>{if(!K){Y("inactive");return}switch(B){case"down":{Y("drag"),I=!1,pe(re,'Expected event to be defined for "down" action'),O(q,re);const{onDragging:j,onPointerDown:ie}=T.current;j?.(!0),ie?.();break}case"move":{const{state:j}=ve.current;I=!0,j!=="drag"&&Y("hover"),pe(re,'Expected event to be defined for "move" action'),W(re);break}case"up":{Y("hover"),$();const{onClick:j,onDragging:ie,onPointerUp:me}=T.current;ie?.(!1),me?.(),I||j?.();break}}})},[ge,P,t,Ae,N,q,W,O,$]),Q1({disabled:t,handleId:q,resizeHandler:W,panelGroupElement:F});const C={touchAction:"none",userSelect:"none"};return z.createElement(f,{...m,children:r,className:e,id:i,onBlur:()=>{Q(!1),s?.()},onFocus:()=>{Q(!0),l?.()},ref:x,role:"separator",style:{...C,...d},tabIndex:h,[Re.groupDirection]:P,[Re.groupId]:E,[Re.resizeHandle]:"",[Re.resizeHandleActive]:te==="drag"?"pointer":he?"keyboard":void 0,[Re.resizeHandleEnabled]:!t,[Re.resizeHandleId]:q,[Re.resizeHandleState]:te})}ac.displayName="PanelResizeHandle";function lc(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function e4(r){if(Array.isArray(r))return r}function t4(r,e,t){return(e=l4(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function r4(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function n4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function uc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cc(Object(t),!0).forEach(function(n){t4(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function i4(r,e){if(r==null)return{};var t,n,i=s4(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function s4(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function o4(r,e){return e4(r)||r4(r,e)||c4(r,e)||n4()}function a4(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function l4(r){var e=a4(r,"string");return typeof e=="symbol"?e:e+""}function c4(r,e){if(r){if(typeof r=="string")return lc(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?lc(r,e):void 0}}function u4(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dc(Object(t),!0).forEach(function(n){u4(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function d4(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(n){return e.reduceRight(function(i,s){return s(i)},n)}}function oi(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function es(r){return{}.toString.call(r).includes("Object")}function h4(r){return!Object.keys(r).length}function ai(r){return typeof r=="function"}function f4(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function p4(r,e){return es(e)||kr("changeType"),Object.keys(e).some(function(t){return!f4(r,t)})&&kr("changeField"),e}function m4(r){ai(r)||kr("selectorType")}function g4(r){ai(r)||es(r)||kr("handlerType"),es(r)&&Object.values(r).some(function(e){return!ai(e)})&&kr("handlersType")}function y4(r){r||kr("initialIsRequired"),es(r)||kr("initialType"),h4(r)&&kr("initialContent")}function v4(r,e){throw new Error(r[e]||r.default)}var b4={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},kr=oi(v4)(b4),ts={changes:p4,selector:m4,handler:g4,initial:y4};function x4(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ts.initial(r),ts.handler(e);var t={current:r},n=oi(k4)(t,e),i=oi(S4)(t),s=oi(ts.changes)(r),o=oi(w4)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return ts.selector(c),c(t.current)}function l(c){d4(n,i,s,o)(c)}return[a,l]}function w4(r,e){return ai(e)?e(r.current):e}function S4(r,e){return r.current=hc(hc({},r.current),e),e}function k4(r,e,t){return ai(e)?e(r.current):Object.keys(t).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,r.current[n])}),t}var M4={create:x4},T4={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function C4(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function E4(r){return{}.toString.call(r).includes("Object")}function A4(r){return r||pc("configIsRequired"),E4(r)||pc("configType"),r.urls?(O4(),{paths:{vs:r.urls.monacoBase}}):r}function O4(){console.warn(fc.deprecation)}function N4(r,e){throw new Error(r[e]||r.default)}var fc={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
8
8
  You are using deprecated way of configuration.
9
9
 
10
10
  Instead of using
@@ -13,19 +13,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
13
13
  monaco.config({ paths: { vs: '...' } })
14
14
 
15
15
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
16
- `},fc=C4(N4)(hc),D4={config:A4},z4=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(s,o){return o(s)},i)}};function pc(r,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&r[t]&&Object.assign(e[t],pc(r[t],e[t]))}),cc(cc({},r),e)}var I4={type:"cancelation",msg:"operation is manually canceled"};function jo(r){var e=!1,t=new Promise(function(n,i){r.then(function(s){return e?i(I4):n(s)}),r.catch(i)});return t.cancel=function(){return e=!0},t}var R4=["monaco"],P4=M4.create({config:T4,isInitialized:!1,resolve:null,reject:null,monaco:null}),mc=o4(P4,2),li=mc[0],rs=mc[1];function L4(r){var e=D4.config(r),t=e.monaco,n=i4(e,R4);rs(function(i){return{config:pc(i.config,n),monaco:t}})}function B4(){var r=li(function(e){var t=e.monaco,n=e.isInitialized,i=e.resolve;return{monaco:t,isInitialized:n,resolve:i}});if(!r.isInitialized){if(rs({isInitialized:!0}),r.monaco)return r.resolve(r.monaco),jo(Uo);if(window.monaco&&window.monaco.editor)return gc(window.monaco),r.resolve(window.monaco),jo(Uo);z4(F4,H4)(V4)}return jo(Uo)}function F4(r){return document.body.appendChild(r)}function $4(r){var e=document.createElement("script");return r&&(e.src=r),e}function H4(r){var e=li(function(n){var i=n.config,s=n.reject;return{config:i,reject:s}}),t=$4("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return r()},t.onerror=e.reject,t}function V4(){var r=li(function(t){var n=t.config,i=t.resolve,s=t.reject;return{config:n,resolve:i,reject:s}}),e=window.require;e.config(r.config),e(["vs/editor/editor.main"],function(t){var n=t.m||t;gc(n),r.resolve(n)},function(t){r.reject(t)})}function gc(r){li().monaco||rs({monaco:r})}function q4(){return li(function(r){var e=r.monaco;return e})}var Uo=new Promise(function(r,e){return rs({resolve:r,reject:e})}),yc={config:L4,init:B4,__getMonacoInstance:q4},_4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Wo=_4,j4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},U4=j4;function W4({children:r}){return z.createElement("div",{style:U4.container},r)}var G4=W4,K4=G4;function J4({width:r,height:e,isEditorReady:t,loading:n,_ref:i,className:s,wrapperProps:o}){return z.createElement("section",{style:{...Wo.wrapper,width:r,height:e},...o},!t&&z.createElement(K4,null,n),z.createElement("div",{ref:i,style:{...Wo.fullWidth,...!t&&Wo.hide},className:s}))}var X4=J4,vc=z.memo(X4);function Y4(r){z.useEffect(r,[])}var bc=Y4;function Z4(r,e,t=!0){let n=z.useRef(!0);z.useEffect(n.current||!t?()=>{n.current=!1}:r,e)}var gt=Z4;function ci(){}function En(r,e,t,n){return Q4(r,n)||eg(r,e,t,n)}function Q4(r,e){return r.editor.getModel(xc(r,e))}function eg(r,e,t,n){return r.editor.createModel(e,t,n?xc(r,n):void 0)}function xc(r,e){return r.Uri.parse(e)}function tg({original:r,modified:e,language:t,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:h="100%",width:f="100%",className:m,wrapperProps:y={},beforeMount:v=ci,onMount:x=ci}){let[T,D]=z.useState(!1),[P,N]=z.useState(!0),O=z.useRef(null),A=z.useRef(null),$=z.useRef(null),F=z.useRef(x),q=z.useRef(v),te=z.useRef(!1);bc(()=>{let W=yc.init();return W.then(ne=>(A.current=ne)&&N(!1)).catch(ne=>ne?.type!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>O.current?Q():W.cancel()}),gt(()=>{if(O.current&&A.current){let W=O.current.getOriginalEditor(),ne=En(A.current,r||"",n||t||"text",s||"");ne!==W.getModel()&&W.setModel(ne)}},[s],T),gt(()=>{if(O.current&&A.current){let W=O.current.getModifiedEditor(),ne=En(A.current,e||"",i||t||"text",o||"");ne!==W.getModel()&&W.setModel(ne)}},[o],T),gt(()=>{let W=O.current.getModifiedEditor();W.getOption(A.current.editor.EditorOption.readOnly)?W.setValue(e||""):e!==W.getValue()&&(W.executeEdits("",[{range:W.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),W.pushUndoStop())},[e],T),gt(()=>{O.current?.getModel()?.original.setValue(r||"")},[r],T),gt(()=>{let{original:W,modified:ne}=O.current.getModel();A.current.editor.setModelLanguage(W,n||t||"text"),A.current.editor.setModelLanguage(ne,i||t||"text")},[t,n,i],T),gt(()=>{A.current?.editor.setTheme(c)},[c],T),gt(()=>{O.current?.updateOptions(d)},[d],T);let Y=z.useCallback(()=>{if(!A.current)return;q.current(A.current);let W=En(A.current,r||"",n||t||"text",s||""),ne=En(A.current,e||"",i||t||"text",o||"");O.current?.setModel({original:W,modified:ne})},[t,e,i,r,n,s,o]),he=z.useCallback(()=>{!te.current&&$.current&&(O.current=A.current.editor.createDiffEditor($.current,{automaticLayout:!0,...d}),Y(),A.current?.editor.setTheme(c),D(!0),te.current=!0)},[d,c,Y]);z.useEffect(()=>{T&&F.current(O.current,A.current)},[T]),z.useEffect(()=>{!P&&!T&&he()},[P,T,he]);function Q(){let W=O.current?.getModel();a||W?.original?.dispose(),l||W?.modified?.dispose(),O.current?.dispose()}return z.createElement(vc,{width:f,height:h,isEditorReady:T,loading:u,_ref:$,className:m,wrapperProps:y})}var rg=tg;z.memo(rg);function ng(r){let e=z.useRef();return z.useEffect(()=>{e.current=r},[r]),e.current}var ig=ng,ns=new Map;function sg({defaultValue:r,defaultLanguage:e,defaultPath:t,value:n,language:i,path:s,theme:o="light",line:a,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:h=!1,width:f="100%",height:m="100%",className:y,wrapperProps:v={},beforeMount:x=ci,onMount:T=ci,onChange:D,onValidate:P=ci}){let[N,O]=z.useState(!1),[A,$]=z.useState(!0),F=z.useRef(null),q=z.useRef(null),te=z.useRef(null),Y=z.useRef(T),he=z.useRef(x),Q=z.useRef(),W=z.useRef(n),ne=ig(s),ve=z.useRef(!1),ge=z.useRef(!1);bc(()=>{let w=yc.init();return w.then(I=>(F.current=I)&&$(!1)).catch(I=>I?.type!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>q.current?C():w.cancel()}),gt(()=>{let w=En(F.current,r||n||"",e||i||"",s||t||"");w!==q.current?.getModel()&&(d&&ns.set(ne,q.current?.saveViewState()),q.current?.setModel(w),d&&q.current?.restoreViewState(ns.get(s)))},[s],N),gt(()=>{q.current?.updateOptions(c)},[c],N),gt(()=>{!q.current||n===void 0||(q.current.getOption(F.current.editor.EditorOption.readOnly)?q.current.setValue(n):n!==q.current.getValue()&&(ge.current=!0,q.current.executeEdits("",[{range:q.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),q.current.pushUndoStop(),ge.current=!1))},[n],N),gt(()=>{let w=q.current?.getModel();w&&i&&F.current?.editor.setModelLanguage(w,i)},[i],N),gt(()=>{a!==void 0&&q.current?.revealLine(a)},[a],N),gt(()=>{F.current?.editor.setTheme(o)},[o],N);let Ae=z.useCallback(()=>{if(!(!te.current||!F.current)&&!ve.current){he.current(F.current);let w=s||t,I=En(F.current,n||r||"",e||i||"",w||"");q.current=F.current?.editor.create(te.current,{model:I,automaticLayout:!0,...c},u),d&&q.current.restoreViewState(ns.get(w)),F.current.editor.setTheme(o),a!==void 0&&q.current.revealLine(a),O(!0),ve.current=!0}},[r,e,t,n,i,s,c,u,d,o,a]);z.useEffect(()=>{N&&Y.current(q.current,F.current)},[N]),z.useEffect(()=>{!A&&!N&&Ae()},[A,N,Ae]),W.current=n,z.useEffect(()=>{N&&D&&(Q.current?.dispose(),Q.current=q.current?.onDidChangeModelContent(w=>{ge.current||D(q.current.getValue(),w)}))},[N,D]),z.useEffect(()=>{if(N){let w=F.current.editor.onDidChangeMarkers(I=>{let L=q.current.getModel()?.uri;if(L&&I.find(B=>B.path===L.path)){let B=F.current.editor.getModelMarkers({resource:L});P?.(B)}});return()=>{w?.dispose()}}return()=>{}},[N,P]);function C(){Q.current?.dispose(),h?d&&ns.set(s,q.current.saveViewState()):q.current.getModel()?.dispose(),q.current.dispose()}return z.createElement(vc,{width:f,height:m,isEditorReady:N,loading:l,_ref:te,className:y,wrapperProps:v})}var og=sg,ag=z.memo(og);const lg={automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},wc=({content:r,onChange:e})=>{const t=z.useRef(null),n=z.useRef(null),i=z.useRef(null),[,s]=z.useState(!1),[,o]=z.useState(!1);z.useEffect(()=>()=>{n.current?.dispose?.(),i.current&&clearTimeout(i.current)},[]),z.useEffect(()=>{const u=t.current;if(!u)return;const d=u.getModel();if(d&&d.getValue()!==r){const h=u.getPosition(),f=u.getSelections();d.setValue(r),h&&u.setPosition(h),f&&u.setSelections(f)}},[r]);const a=u=>{t.current=u;const d=u.getModel();d&&d.getValue()!==r&&d.setValue(r),n.current?.dispose?.(),n.current=u.onDidChangeModelContent(()=>{l()}),l()},l=()=>{const u=t.current?.getModel?.();if(u&&typeof u.canUndo=="function"&&typeof u.canRedo=="function")try{s(u.canUndo()),o(u.canRedo());return}catch{}const d=!!t.current;s(d),o(d)},c=u=>{e(u)};return J.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:J.jsx("div",{style:{flex:1},children:J.jsx(ag,{options:lg,height:"100%",language:"xml",defaultValue:r,onMount:a,onChange:u=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{c(u||"")},500)}})})})};function Je(r){this.content=r}Je.prototype={constructor:Je,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Je(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Je(t)},addToStart:function(r,e){return new Je([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Je(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Je(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Je.from(r),r.size?new Je(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Je.from(r),r.size?new Je(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Je.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},Je.from=function(r){if(r instanceof Je)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Je(e)};function Sc(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Sc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function kc(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||a.content.size){let c=kc(o.content,a.content,t-1,n-1);if(c)return c}t-=l,n-=l}}class H{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),n,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new H(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new H(n,i)}cutByIndex(e,t){return e==t?H.empty:e==0&&t==this.content.length?this:new H(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new H(i,s)}addToStart(e){return new H([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new H(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Sc(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return kc(this,e,t,n)}findIndex(e){if(e==0)return is(0,e);if(e==this.size)return is(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?is(t+1,s):is(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return H.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new H(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return H.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new H(t||e,n)}static from(e){if(!e)return H.empty;if(e instanceof H)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new H([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}H.empty=new H([],0);const Go={index:0,offset:0};function is(r,e){return Go.index=r,Go.offset=e,Go}function ss(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!ss(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!ss(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Me=class E0{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ss(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return E0.none;if(e instanceof E0)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Me.none=[];class as extends Error{}class X{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Tc(this.content,e+this.openStart,t);return n&&new X(n,this.openStart,this.openEnd)}removeBetween(e,t){return new X(Mc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return X.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new X(H.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new X(e,n,i)}}X.empty=new X(H.empty,0,0);function Mc(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Mc(s.content,e-i-1,t-i-1)))}function Tc(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Tc(o.content,e-s-1,t,o);return a&&r.replaceChild(i,o.copy(a))}function cg(r,e,t){if(t.openStart>r.depth)throw new as("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new as("Inconsistent open depths");return Cc(r,e,t,0)}function Cc(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Cc(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return rn(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=ug(t,r);return rn(s,Ac(r,o,a,e,n))}else return rn(s,ls(r,e,n))}function Ec(r,e){if(!e.type.compatibleContent(r.type))throw new as("Cannot join "+e.type.name+" onto "+r.type.name)}function Ko(r,e,t){let n=r.node(t);return Ec(n,e.node(t)),n}function tn(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ui(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(tn(r.nodeAfter,n),s++));for(let a=s;a<o;a++)tn(i.child(a),n);e&&e.depth==t&&e.textOffset&&tn(e.nodeBefore,n)}function rn(r,e){return r.type.checkContent(e),r.copy(e)}function Ac(r,e,t,n,i){let s=r.depth>i&&Ko(r,e,i+1),o=n.depth>i&&Ko(t,n,i+1),a=[];return ui(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(Ec(s,o),tn(rn(s,Ac(r,e,t,n,i+1)),a)):(s&&tn(rn(s,ls(r,e,i+1)),a),ui(e,t,i,a),o&&tn(rn(o,ls(t,n,i+1)),a)),ui(n,null,i,a),new H(a)}function ls(r,e,t){let n=[];if(ui(null,r,t,n),r.depth>t){let i=Ko(r,e,t+1);tn(rn(i,ls(r,e,t+1)),n)}return ui(e,null,t,n),new H(n)}function ug(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(H.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class di{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Me.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new cs(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(n.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new di(t,n,s)}static resolveCached(e,t){let n=Oc.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Oc.set(e,n=new dg);let i=n.elts[n.i]=di.resolve(e,t);return n.i=(n.i+1)%hg,i}}class dg{constructor(){this.elts=[],this.i=0}}const hg=12,Oc=new WeakMap;class cs{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fg=Object.create(null);let Mr=class A0{constructor(e,t,n,i=Me.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||H.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ss(this.attrs,t||e.defaultAttrs||fg)&&Me.sameSet(this.marks,n||Me.none)}copy(e=null){return e==this.content?this:new A0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new A0(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return X.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new X(c,i.depth-o,s.depth-o)}replace(e,t,n){return cg(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return di.resolveCached(this,e)}resolveNoCache(e){return di.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Nc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=H.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Me.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Me.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=H.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Mr.prototype.text=void 0;let pg=class O0 extends Mr{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new O0(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new O0(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Nc(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class nn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new mg(e,t);if(n.next==null)return nn.empty;let i=Dc(n);n.next&&n.err("Unexpected trailing text");let s=Sg(wg(i));return kg(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return H.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
17
- `)}}nn.empty=new nn(!0);class mg{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Dc(r){let e=[];do e.push(gg(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gg(r){let e=[];do e.push(yg(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yg(r){let e=xg(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=vg(r,e);else break;return e}function zc(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function vg(r,e){let t=zc(r),n=t;return r.eat(",")&&(r.next!="}"?n=zc(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function bg(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function xg(r){if(r.eat("(")){let e=Dc(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=bg(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function wg(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();n(l,u),i(s(o.expr,l),u),l=u}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ic(r,e){return e-r}function Rc(r,e){let t=[];return n(e),t.sort(Ic);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function Sg(r){let e=Object.create(null);return t(Rc(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Rc(r,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[n.join(",")]=new nn(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Ic);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function kg(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pc(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Lc(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Bc(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function Fc(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Tg(r,n,e[n]);return t}let $c=class f1{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Fc(e,n.attrs),this.defaultAttrs=Pc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==nn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Lc(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Mr(this,this.computeAttrs(e),H.from(t),Me.setFrom(n))}createChecked(e=null,t,n){return t=H.from(t),this.checkContent(t),new Mr(this,this.computeAttrs(e),t,Me.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=H.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(H.empty,!0);return s?new Mr(this,e,t.append(s),Me.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Bc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Me.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new f1(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Mg(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Tg{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Mg(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class us{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=Fc(e,i.attrs),this.excluded=null;let s=Pc(this.attrs);this.instance=s?new Me(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Me(this,Lc(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new us(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Bc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Hc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Je.from(e.nodes),t.marks=Je.from(e.marks||{}),this.nodes=$c.compile(this.spec.nodes,this),this.marks=us.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=nn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Vc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Vc(this,o.split(" "))}this.nodeFromJSON=i=>Mr.fromJSON(this,i),this.markFromJSON=i=>Me.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof $c){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new pg(n,n.defaultAttrs,e,Me.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Vc(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Cg(r){return r.tag!=null}function Eg(r){return r.style!=null}class Tr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Cg(i))this.tags.push(i);else if(Eg(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new Uc(this,t,!1);return n.addAll(e,Me.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Uc(this,t,!0);return n.addAll(e,Me.none,t.from,t.to),X.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ng(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Wc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Wc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Tr(e,Tr.schemaRules(e)))}}const qc={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ag={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},_c={ol:!0,ul:!0},hi=1,Jo=2,fi=4;function jc(r,e,t){return e!=null?(e?hi:0)|(e==="full"?Jo:0):r&&r.whitespace=="pre"?hi|Jo:t&~fi}class ds{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Me.none,this.match=s||(o&fi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(H.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&hi)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=H.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(H.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Uc{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=jc(null,t.preserveWhitespace,0)|(n?fi:0);i?s=new ds(i.type,i.attrs,Me.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new ds(null,null,Me.none,!0,null,o):s=new ds(e.schema.topNodeType,null,Me.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Jo?"full":this.localPreserveWS||(i.options&hi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
18
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;_c.hasOwnProperty(o)&&this.parser.normalizeLists&&Og(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Ag.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(qc.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
19
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(n)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Me.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Gc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=jc(e,s,o.options);o.options&fi&&o.content.length==0&&(a|=fi);let l=Me.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):Gc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ds(e,t,l,i,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=hi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function Og(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&_c.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Ng(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Wc(r){let e={};for(let t in r)e[t]=r[t];return e}function Gc(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class sn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Xo(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=hs(Xo(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&hs(Xo(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return hs(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Kc(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Kc(e.marks)}}function Kc(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Xo(r){return r.document||window.document}const Jc=new WeakMap;function Dg(r){let e=Jc.get(r);return e===void 0&&Jc.set(r,e=zg(r)),e}function zg(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function hs(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Dg(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:m}=hs(r,h,t,n);if(l.appendChild(f),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Xc=65535,Yc=Math.pow(2,16);function Ig(r,e){return r+e*Yc}function Zc(r){return r&Xc}function Rg(r){return(r-(r&Xc))/Yc}const Qc=1,eu=2,fs=4,tu=8;class Yo{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&tu)>0}get deletedBefore(){return(this.delInfo&(Qc|fs))>0}get deletedAfter(){return(this.delInfo&(eu|fs))>0}get deletedAcross(){return(this.delInfo&fs)>0}}class yt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yt.empty)return yt.empty}recover(e){let t=0,n=Zc(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Rg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:u);if(n)return f;let m=e==(t<0?l:d)?null:Ig(a/3,e-l),y=e==l?eu:e==d?Qc:fs;return(t<0?e!=l:e!=d)&&(y|=tu),new Yo(f,y,m)}i+=u-c}return n?e+i:new Yo(e+i,0,null)}touches(e,t){let n=0,i=Zc(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+n];e(a,a+c,l,l+u),s+=u-c}}invert(){return new yt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yt.empty:new yt(e<0?[0,-e,0]:[0,0,e])}}yt.empty=new yt([]);class pi{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new pi(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new pi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new Yo(e,i,null)}}const Zo=Object.create(null);class Ze{getMap(){return yt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Zo[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Zo)throw new RangeError("Duplicate use of step JSON ID "+e);return Zo[e]=t,t.prototype.jsonID=e,t}}class He{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new He(e,null)}static fail(e){return new He(null,e)}static fromReplace(e,t,n,i){try{return He.ok(e.replace(t,n,i))}catch(s){if(s instanceof as)return He.fail(s.message);throw s}}}function Qo(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Qo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return H.fromArray(n)}class Cr extends Ze{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new X(Qo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return He.fromReplace(e,this.from,this.to,s)}invert(){return new Pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Cr(t.pos,n.pos,this.mark)}merge(e){return e instanceof Cr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Cr(t.from,t.to,e.markFromJSON(t.mark))}}Ze.jsonID("addMark",Cr);class Pt extends Ze{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new X(Qo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return He.fromReplace(e,this.from,this.to,n)}invert(){return new Cr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Pt(t.pos,n.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Pt(t.from,t.to,e.markFromJSON(t.mark))}}Ze.jsonID("removeMark",Pt);class Er extends Ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Er(this.pos,t.marks[i]);return new Er(this.pos,this.mark)}}return new on(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}Ze.jsonID("addNodeMark",Er);class on extends Ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new on(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new on(t.pos,e.markFromJSON(t.mark))}}Ze.jsonID("removeNodeMark",on);class Ue extends Ze{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&ea(e,this.from,this.to)?He.fail("Structure replace would overwrite content"):He.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ue(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Ue(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ue)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?X.empty:new X(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ue(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?X.empty:new X(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ue(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ue(t.from,t.to,X.fromJSON(e,t.slice),!!t.structure)}}Ze.jsonID("replace",Ue);class We extends Ze{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(ea(e,this.from,this.gapFrom)||ea(e,this.gapTo,this.to)))return He.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return He.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?He.fromReplace(e,this.from,this.to,n):He.fail("Content does not fit in gap")}getMap(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new We(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new We(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new We(t.from,t.to,t.gapFrom,t.gapTo,X.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ze.jsonID("replaceAround",We);function ea(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Pg(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!n.isInSet(d)&&u.type.allowsMarkType(n.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),m=n.addToSet(d);for(let y=0;y<d.length;y++)d[y].isInSet(m)||(o&&o.to==h&&o.mark.eq(d[y])?o.to=f:i.push(o=new Pt(h,f,d[y])));a&&a.to==h?a.to=f:s.push(a=new Cr(h,f,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function Lg(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof us){let c=o.marks,u;for(;u=n.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let m=i[f];m.step==s-1&&d.eq(i[f].style)&&(h=m)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>r.step(new Pt(o.from,o.to,o.style)))}function ta(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=n.matchType(c.type);if(!d)o.push(new Ue(a,u,X.empty));else{n=d;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||r.step(new Pt(a,u,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,m;for(;h=f.exec(c.text);)m||(m=new X(H.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Ue(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!n.validEnd){let l=n.fillBefore(H.empty,!0);r.replace(a,a,new X(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function Bg(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function An(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),a=r.$from.index(n)+i,l=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!Bg(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Fg(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,c=a,u=H.empty,d=0;for(let m=s,y=!1;m>t;m--)y||n.index(m)>0?(y=!0,u=H.from(n.node(m).copy(u)),d++):l--;let h=H.empty,f=0;for(let m=s,y=!1;m>t;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=H.from(i.node(m).copy(h)),f++):c++;r.step(new We(l,c,o,a,new X(u.append(h),d,f),u.size-d,!0))}function ra(r,e,t=null,n=r){let i=$g(r,e),s=i&&Hg(n,e);return s?i.map(ru).concat({type:e,attrs:t}).concat(s.map(ru)):null}function ru(r){return{type:r,attrs:null}}function $g(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function Hg(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function Vg(r,e,t){let n=H.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=H.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new We(i,s,i,s,new X(n,0,0),t.length,!0))}function qg(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&_g(r.doc,r.mapping.slice(s).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let f=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);f&&!m?c=!1:!f&&m&&(c=!0)}c===!1&&iu(r,o,a,s),ta(r,r.mapping.slice(s).map(a,1),n,void 0,c===null);let u=r.mapping.slice(s),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return r.step(new We(d,h,d+1,h-1,new X(H.from(n.create(l,null,o.marks)),0,0),1,!0)),c===!0&&nu(r,o,a,s),!1}})}function nu(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function iu(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
20
- `))}})}function _g(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function jg(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new We(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new X(H.from(o),0,0),1,!0))}function rr(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),m=n&&n[u+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let y=n&&n[u]||d;if(!d.canReplace(h+1,d.childCount)||!y.type.validContent(f))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Ug(r,e,t=1,n){let i=r.doc.resolve(e),s=H.empty,o=H.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=H.from(i.node(a).copy(s));let u=n&&n[c];o=H.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}r.step(new Ue(e,e,new X(s.append(o),t,t),!0))}function Ar(r,e){let t=r.resolve(e),n=t.index();return su(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function Wg(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function su(r,e){return!!(r&&e&&!r.isLeaf&&Wg(r,e))}function ps(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&su(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function Gg(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?n=!1:!u&&d&&(n=!0)}let a=r.steps.length;if(n===!1){let u=r.doc.resolve(e+t);iu(r,u.node(),u.before(),a)}o.inlineContent&&ta(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),c=l.map(e-t);if(r.step(new Ue(c,l.map(e+t,-1),X.empty,!0)),n===!0){let u=r.doc.resolve(c);nu(r,u.node(),u.before(),r.steps.length)}return r}function Kg(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function ou(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),c=n.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function ms(r,e,t=e,n=X.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return au(i,s,n)?new Ue(e,t,n):new Jg(i,s,n).fit()}function au(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class Jg{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=H.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=H.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new X(s,o,a);return e>-1?new We(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Ue(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=na(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(H.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=na(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new X(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=na(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new X(mi(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new X(mi(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(i){for(let y=0;y<i.childCount;y++)u.push(i.child(y));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),v=d.matchType(y.type);if(!v)break;c++,(c>1||l==0||y.content.size)&&(d=v,u.push(lu(y.mark(h.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=gi(this.placed,t,H.from(u)),this.frontier[t].match=d,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,v=a;y<f;y++){let x=v.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),v=x.content}this.unplaced=m?e==0?X.empty:new X(mi(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new X(mi(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ia(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ia(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ia(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gi(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=gi(this.placed,this.depth,H.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(H.empty,!0);t.childCount&&(this.placed=gi(this.placed,this.frontier.length,t))}}function mi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(mi(r.firstChild.content,e-1,t)))}function gi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(gi(r.lastChild.content,e-1,t)))}function na(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function lu(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,lu(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(H.empty,!0)))),r.copy(n)}function ia(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!Xg(t,s.content,o)?a:null}function Xg(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Yg(r){return r.spec.defining||r.spec.definingForContent}function Zg(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(au(i,s,n))return r.step(new Ue(e,t,n));let o=uu(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=n.openStart;for(let h=n.content,f=0;;f++){let m=h.firstChild;if(c.push(m),f==n.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let f=c[h],m=Yg(f.type);if(m&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(m||!f.type.isTextblock)break}for(let h=n.openStart;h>=0;h--){let f=(h+u+1)%(n.openStart+1),m=c[f];if(m)for(let y=0;y<o.length;y++){let v=o[(y+l)%o.length],x=!0;v<0&&(x=!1,v=-v);let T=i.node(v-1),D=i.index(v-1);if(T.canReplaceWith(D,D,m.type,m.marks))return r.replace(i.before(v),x?s.after(v):t,new X(cu(n.content,0,n.openStart,f),f,n.openEnd))}}let d=r.steps.length;for(let h=o.length-1;h>=0&&(r.replace(e,t,n),!(r.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function cu(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(cu(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(H.empty,!0))}return r}function Qg(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=Kg(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new X(H.from(n),0,0))}function e2(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=uu(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function uu(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class On extends Ze{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(i),0,t.isLeaf?0:1))}getMap(){return yt.empty}invert(e){return new On(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new On(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new On(t.pos,t.attr,t.value)}}Ze.jsonID("attr",On);class yi extends Ze{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return He.ok(n)}getMap(){return yt.empty}invert(e){return new yi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yi(t.attr,t.value)}}Ze.jsonID("docAttr",yi);let Nn=class extends Error{};Nn=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},Nn.prototype=Object.create(Error.prototype),Nn.prototype.constructor=Nn,Nn.prototype.name="TransformError";class du{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new pi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Nn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=X.empty){let i=ms(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new X(H.from(n),0,0))}delete(e,t){return this.replace(e,t,X.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Zg(this,e,t,n),this}replaceRangeWith(e,t,n){return Qg(this,e,t,n),this}deleteRange(e,t){return e2(this,e,t),this}lift(e,t){return Fg(this,e,t),this}join(e,t=1){return Gg(this,e,t),this}wrap(e,t){return Vg(this,e,t),this}setBlockType(e,t=e,n,i=null){return qg(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return jg(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new On(e,t,n)),this}setDocAttribute(e,t){return this.step(new yi(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Me)t.isInSet(n.marks)&&this.step(new on(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new on(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return Ug(this,e,t,n),this}addMark(e,t,n){return Pg(this,e,t,n),this}removeMark(e,t,n){return Lg(this,e,t,n),this}clearIncompatible(e,t,n){return ta(this,e,t,n),this}}const sa=Object.create(null);class ce{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new hu(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=X.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?X.empty:t),a==0&&mu(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),mu(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new de(e):Dn(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Dn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):Dn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new vt(e.node(0))}static atStart(e){return Dn(e,e,0,0,1)||new vt(e)}static atEnd(e){return Dn(e,e,e.content.size,e.childCount,-1)||new vt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=sa[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sa)throw new RangeError("Duplicate use of selection JSON ID "+e);return sa[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}ce.prototype.visible=!0;class hu{constructor(e,t){this.$from=e,this.$to=t}}let fu=!1;function pu(r){!fu&&!r.parent.inlineContent&&(fu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class de extends ce{constructor(e,t=e){pu(e),pu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return ce.near(n);let i=e.resolve(t.map(this.anchor));return new de(i.parent.inlineContent?i:n,n)}replace(e,t=X.empty){if(super.replace(e,t),t==X.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=ce.findFrom(t,n,!0)||ce.findFrom(t,-n,!0);if(s)t=s.$head;else return ce.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(ce.findFrom(e,-n,!0)||ce.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new de(e,t)}}ce.jsonID("text",de);class gs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gs(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class se extends ce{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?ce.near(s):new se(s)}content(){return new X(H.from(this.node),0,0)}eq(e){return e instanceof se&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new oa(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new se(e.resolve(t.anchor))}static create(e,t){return new se(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}se.prototype.visible=!1,ce.jsonID("node",se);class oa{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new gs(n,n):new oa(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&se.isSelectable(n)?new se(t):ce.near(t)}}class vt extends ce{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=X.empty){if(t==X.empty){e.delete(0,e.doc.content.size);let n=ce.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vt(e)}map(e){return new vt(e)}eq(e){return e instanceof vt}getBookmark(){return t2}}ce.jsonID("all",vt);const t2={map(){return this},resolve(r){return new vt(r)}};function Dn(r,e,t,n,i,s=!1){if(e.inlineContent)return de.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&se.isSelectable(a))return se.create(r,t-(i<0?a.nodeSize:0))}else{let l=Dn(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function mu(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof Ue||i instanceof We))return;let s=r.mapping.maps[n],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),r.setSelection(ce.near(r.doc.resolve(o),t))}const gu=1,ys=2,yu=4;class r2 extends du{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|gu)&~ys,this.storedMarks=null,this}get selectionSet(){return(this.updated&gu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ys,this}ensureMarks(e){return Me.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ys)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ys,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Me.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ce.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=yu,this}get scrolledIntoView(){return(this.updated&yu)>0}}function vu(r,e){return!e||!r?r:r.bind(e)}class vi{constructor(e,t,n){this.name=e,this.init=vu(t.init,n),this.apply=vu(t.apply,n)}}const n2=[new vi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new vi("selection",{init(r,e){return r.selection||ce.atStart(e.doc)},apply(r){return r.selection}}),new vi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new vi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class aa{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=n2.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new vi(n.key,n.spec.state,n))})}}class zn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,n);if(u&&n.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(u),n=n.applyInner(u),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new zn(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new r2(this)}static create(e){let t=new aa(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new zn(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new aa(this.schema,e.plugins),n=t.fields,i=new zn(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new aa(e.schema,e.plugins),s=new zn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Mr.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=ce.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function bu(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=bu(i,e,{})),t[n]=i}return t}class Pe{constructor(e){this.spec=e,this.props={},e.props&&bu(e.props,this,this.props),this.key=e.key?e.key.key:xu("plugin")}getState(e){return e[this.key]}}const la=Object.create(null);function xu(r){return r in la?r+"$"+ ++la[r]:(la[r]=0,r+"$")}class Fe{constructor(e="key"){this.key=xu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ca=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function wu(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Su=(r,e,t)=>{let n=wu(r,t);if(!n)return!1;let i=ua(n);if(!i){let o=n.blockRange(),a=o&&An(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Du(r,i,e,-1))return!0;if(n.parent.content.size==0&&(In(s,"end")||se.isSelectable(s)))for(let o=n.depth;;o--){let a=ms(r.doc,n.before(o),n.after(o),X.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(In(s,"end")?ce.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):se.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},i2=(r,e,t)=>{let n=wu(r,t);if(!n)return!1;let i=ua(n);return i?ku(r,i,e):!1},s2=(r,e,t)=>{let n=Tu(r,t);if(!n)return!1;let i=da(n);return i?ku(r,i,e):!1};function ku(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=ms(r.doc,s,l,X.empty);if(!c||c.from!=s||c instanceof Ue&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(de.create(u.doc,s)),t(u.scrollIntoView())}return!0}function In(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Mu=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=ua(n)}let o=s&&s.nodeBefore;return!o||!se.isSelectable(o)?!1:(e&&e(r.tr.setSelection(se.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ua(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Tu(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Cu=(r,e,t)=>{let n=Tu(r,t);if(!n)return!1;let i=da(n);if(!i)return!1;let s=i.nodeAfter;if(Du(r,i,e,1))return!0;if(n.parent.content.size==0&&(In(s,"start")||se.isSelectable(s))){let o=ms(r.doc,n.before(),n.after(),X.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(In(s,"start")?ce.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):se.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Eu=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=da(n)}let o=s&&s.nodeAfter;return!o||!se.isSelectable(o)?!1:(e&&e(r.tr.setSelection(se.create(r.doc,s.pos)).scrollIntoView()),!0)};function da(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const o2=(r,e)=>{let t=r.selection,n=t instanceof se,i;if(n){if(t.node.isTextblock||!Ar(r.doc,t.from))return!1;i=t.from}else if(i=ps(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(se.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},a2=(r,e)=>{let t=r.selection,n;if(t instanceof se){if(t.node.isTextblock||!Ar(r.doc,t.to))return!1;n=t.to}else if(n=ps(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},l2=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&An(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},Au=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
21
- `).scrollIntoView()),!0)};function ha(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const c2=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=ha(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ce.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Ou=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof vt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=ha(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(de.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Nu=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(rr(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&An(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function u2(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof se&&e.selection.node.isBlock)return!n.parentOffset||!rr(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=n.depth;;f--)if(n.node(f).isBlock){l=n.end(f)==n.pos+(n.depth-f),c=n.start(f)==n.pos-(n.depth-f),a=ha(n.node(f-1).contentMatchAt(n.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof de||e.selection instanceof vt)&&u.deleteSelection();let d=u.mapping.map(n.pos),h=rr(u.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=rr(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!l&&c&&n.node(o).type!=a){let f=u.mapping.map(n.before(o)),m=u.doc.resolve(f);a&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(o)),a)}return t&&t(u.scrollIntoView()),!0}}const d2=u2(),h2=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(se.create(r.doc,i))),!0)};function f2(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ar(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function Du(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&f2(r,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,m=H.empty;for(let x=o.length-1;x>=0;x--)m=H.from(o[x].create(null,m));m=H.from(i.copy(m));let y=r.tr.step(new We(e.pos-1,f,e.pos,f,new X(m,1,0),o.length,!0)),v=y.doc.resolve(f+2*o.length);v.nodeAfter&&v.nodeAfter.type==i.type&&Ar(y.doc,v.pos)&&y.join(v.pos),t(y.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:ce.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&An(d);if(h!=null&&h>=e.depth)return t&&t(r.tr.lift(d,h).scrollIntoView()),!0;if(c&&In(s,"start",!0)&&In(i,"end")){let f=i,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let y=s,v=1;for(;!y.isTextblock;y=y.firstChild)v++;if(f.canReplace(f.childCount,f.childCount,y.content)){if(t){let x=H.empty;for(let D=m.length-1;D>=0;D--)x=H.from(m[D].copy(x));let T=r.tr.step(new We(e.pos-m.length,e.pos+s.nodeSize,e.pos+v,e.pos+s.nodeSize-v,new X(x,m.length,0),0,!0));t(T.scrollIntoView())}return!0}}return!1}function zu(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const p2=zu(-1),m2=zu(1);function g2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&ra(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Iu(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function fa(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}fa(ca,Su,Mu),fa(ca,Cu,Eu),fa(Au,Ou,Nu,d2),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function y2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return v2(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function v2(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new cs(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new cs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ra(s,t,n,e);return a?(r&&b2(r,e,a,i,t),!0):!1}function b2(r,e,t,n,i){let s=H.empty;for(let u=t.length-1;u>=0;u--)s=H.from(t[u].type.create(t[u].attrs,s));r.step(new We(e.start-(n?2:0),e.end,e.start,e.end,new X(s,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==i&&(o=u+1);let a=t.length-o,l=e.start+t.length-(n?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&rr(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return r}function x2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?w2(e,t,r,s):S2(e,t,s):!0:!1}}function w2(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new We(s-1,o,s,o,new X(H.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new cs(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=An(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ar(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function S2(r,e,t){let n=r.tr,i=t.parent;for(let f=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)f-=i.child(m).nodeSize,n.delete(f-1,f+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?H.empty:H.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return n.step(new We(d-(a?1:0),h+(l?1:0),d+1,h-1,new X((a?H.empty:H.from(i.copy(H.empty))).append(l?H.empty:H.from(i.copy(H.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function k2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=H.from(c?r.create():null),d=new X(H.from(r.create(null,H.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new We(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const Xe=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Rn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let pa=null;const nr=function(r,e,t){let n=pa||(pa=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},M2=function(){pa=null},an=function(r,e,t,n){return t&&(Ru(r,e,t,n,-1)||Ru(r,e,t,n,1))},T2=/^(img|br|input|textarea|hr)$/i;function Ru(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Mt(r))){let o=r.parentNode;if(!o||o.nodeType!=1||bi(r)||T2.test(r.nodeName)||r.contentEditable=="false")return!1;e=Xe(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?Mt(r):0}else return!1}}function Mt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function C2(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Mt(r)}else if(r.parentNode&&!bi(r))e=Xe(r),r=r.parentNode;else return null}}function E2(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!bi(r))e=Xe(r)+1,r=r.parentNode;else return null}}function A2(r,e,t){for(let n=e==0,i=e==Mt(r);n||i;){if(r==t)return!0;let s=Xe(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Mt(r)}}function bi(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const vs=function(r){return r.focusNode&&an(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function ln(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function O2(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function N2(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Mt(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Mt(n.startContainer),n.startOffset)}}}const Vt=typeof navigator<"u"?navigator:null,Pu=typeof document<"u"?document:null,Or=Vt&&Vt.userAgent||"",ma=/Edge\/(\d+)/.exec(Or),Lu=/MSIE \d/.exec(Or),ga=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Or),ut=!!(Lu||ga||ma),Nr=Lu?document.documentMode:ga?+ga[1]:ma?+ma[1]:0,Tt=!ut&&/gecko\/(\d+)/i.test(Or);Tt&&+(/Firefox\/(\d+)/.exec(Or)||[0,0])[1];const ya=!ut&&/Chrome\/(\d+)/.exec(Or),Ge=!!ya,Bu=ya?+ya[1]:0,Qe=!ut&&!!Vt&&/Apple Computer/.test(Vt.vendor),Pn=Qe&&(/Mobile\/\w+/.test(Or)||!!Vt&&Vt.maxTouchPoints>2),Ct=Pn||(Vt?/Mac/.test(Vt.platform):!1),Fu=Vt?/Win/.test(Vt.platform):!1,ir=/Android \d/.test(Or),xi=!!Pu&&"webkitFontSmoothing"in Pu.documentElement.style,D2=xi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z2(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function sr(r,e){return typeof r=="number"?r:r[e]}function I2(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function $u(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;){if(o.nodeType!=1){o=Rn(o);continue}let a=o,l=a==s.body,c=l?z2(s):I2(a),u=0,d=0;if(e.top<c.top+sr(n,"top")?d=-(c.top-e.top+sr(i,"top")):e.bottom>c.bottom-sr(n,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+sr(i,"top")-c.top:e.bottom-c.bottom+sr(i,"bottom")),e.left<c.left+sr(n,"left")?u=-(c.left-e.left+sr(i,"left")):e.right>c.right-sr(n,"right")&&(u=e.right-c.right+sr(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let y=a.scrollLeft-f,v=a.scrollTop-m;e={left:e.left-y,top:e.top-v,right:e.right-y,bottom:e.bottom-v}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Rn(o)}}function R2(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=r.root.elementFromPoint(s,o);if(!a||a==r.dom||!r.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){n=a,i=l.top;break}}return{refDOM:n,refTop:i,stack:Hu(r.dom)}}function Hu(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Rn(n));return e}function P2({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;Vu(t,n==0?0:n-e)}function Vu(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let Ln=null;function L2(r){if(r.setActive)return r.setActive();if(Ln)return r.focus(Ln);let e=Hu(r);r.focus(Ln==null?{get preventScroll(){return Ln={preventScroll:!0},!0}}:void 0),Ln||(Ln=!1,Vu(e,0))}function qu(r,e){let t,n=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=r.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=nr(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let m=h[f];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<n){t=u,n=y,i=y&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(s=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=c,n=0),t&&t.nodeType==3?B2(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:qu(t,i)}function B2(r,e){let t=r.nodeValue.length,n=document.createRange(),i;for(let s=0;s<t;s++){n.setEnd(r,s+1),n.setStart(r,s);let o=Dr(n,1);if(o.top!=o.bottom&&va(e,o)){i={node:r,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:r,offset:0}}function va(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function F2(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function $2(r,e,t){let{node:n,offset:i}=qu(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function H2(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let a=r.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>n.left||l.top>n.top?i=a.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function _u(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(va(e,c))return _u(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function V2(r,e){let t=r.dom.ownerDocument,n,i=0,s=N2(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),a;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=r.dom.getBoundingClientRect();if(!va(e,c)||(o=_u(r.dom,e,c),!o))return null}if(Qe)for(let c=o;n&&c;c=Rn(c))c.draggable&&(n=void 0);if(o=F2(o,e),n){if(Tt&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let u=n.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;xi&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=H2(r,n,i,e))}a==null&&(a=$2(r,o,e));let l=r.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function ju(r){return r.top<r.bottom||r.left<r.right}function Dr(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(ju(n))return n}return Array.prototype.find.call(t,ju)||r.getBoundingClientRect()}const q2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Uu(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=xi||Tt;if(n.nodeType==3)if(o&&(q2.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=Dr(nr(n,i,i),t);if(Tt&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=Dr(nr(n,i-1,i-1),-1);if(c.top==l.top){let u=Dr(nr(n,i,i+1),-1);if(u.top!=l.top)return wi(u,u.left<c.left)}}return l}else{let l=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==n.nodeValue.length?(l--,u=1):t<0?l--:c++,wi(Dr(nr(n,l,c),u),u<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Mt(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!1)}if(s==null&&i<Mt(n)){let l=n.childNodes[i];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!0)}return ba(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Mt(n))){let l=n.childNodes[i-1],c=l.nodeType==3?nr(l,Mt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return wi(Dr(c,1),!1)}if(s==null&&i<Mt(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?nr(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return wi(Dr(c,-1),!0)}return wi(Dr(n.nodeType==3?nr(n):n,-t),t>=0)}function wi(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function ba(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function Wu(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function _2(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Wu(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=r.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Uu(r,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=nr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const j2=/[\u0590-\u08ac]/;function U2(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,a=r.domSelection();return a?!j2.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Wu(r,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=r.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:m,focusOffset:y}=r.domSelectionRange(),v=m&&!f.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),v}):n.pos==n.start()||n.pos==n.end()}let Gu=null,Ku=null,Ju=!1;function W2(r,e,t){return Gu==e&&Ku==t?Ju:(Gu=e,Ku=t,Ju=t=="up"||t=="down"?_2(r,e,t):U2(r,e,t))}const Et=0,Xu=1,cn=2,qt=3;class Si{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Et,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let i=this.children[t];if(i==e)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.size;if(a>e||o instanceof Qu){i=e-s;break}s=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof Yu&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Xe(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Xe(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=n,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Xe(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,m=0;f<this.children.length;f++){let y=this.children[f],v=m+y.size;if(s>m&&o<v)return y.setSelection(e-m-y.border,t-m-y.border,n,i);m=v}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),u=n.domSelectionRange(),d=!1;if((Tt||Qe)&&e==t){let{node:f,offset:m}=a;if(f.nodeType==3){if(d=!!(m&&f.nodeValue[m-1]==`
22
- `),d&&m==f.nodeValue.length)for(let y=f,v;y;y=y.parentNode){if(v=y.nextSibling){v.nodeName=="BR"&&(a=l={node:v.parentNode,offset:Xe(v)+1});break}let x=y.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let y=f.childNodes[m-1];d=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(Tt&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Qe)&&an(a.node,a.offset,u.anchorNode,u.anchorOffset)&&an(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(d&&Tt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let m=a;a=l,l=m}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,i=0;i<this.children.length;i++){let s=this.children[i],o=n+s.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let a=n+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==n||t==o?cn:Xu,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=qt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?cn:qt}n=o}this.dirty=cn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?cn:Xu;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Yu extends Si{constructor(e,t,n,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Et&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class G2 extends Si{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class un extends Si{constructor(e,t,n,i,s){super(e,[],n,i),this.mark=t,this.spec=s}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=sn.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new un(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Et){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Et}}slice(e,t,n){let i=un.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=wa(s,t,o,n)),e>0&&(s=wa(s,0,e,n));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zr extends Si{constructor(e,t,n,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=a}static create(e,t,n,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=sn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=rd(u,n,t),c?l=new K2(e,t,n,i,u,d||null,h,c,s,o+1):t.isText?new bs(e,t,n,i,u,h,s):new zr(e,t,n,i,u,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>H.empty)}return e}matchesNode(e,t,n){return this.dirty==Et&&e.eq(this.node)&&xs(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new X2(this,o&&o.node,e);Q2(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Me.none:this.node.child(u).marks,n,e),l.placeWidget(c,e,i)},(c,u,d,h)=>{l.syncToMarks(c.marks,n,e);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==cn)&&(o&&this.protectLocalComposition(e,o),ed(this.contentDOM,this.children,e),Pn&&e5(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof de)||n<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=t5(this.node.content,o,n-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new G2(this,s,t,i);e.input.compositionNodes.push(o),this.children=wa(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==qt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Et}updateOuterDeco(e){if(xs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=td(this.dom,this.nodeDOM,xa(this.outerDeco,this.node,t),xa(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Zu(r,e,t,n,i){rd(n,e,r);let s=new zr(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bs extends zr{constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==qt||this.dirty!=Et&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Et||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Et,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new bs(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=qt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Qu extends Si{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Et&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class K2 extends zr{constructor(e,t,n,i,s,o,a,l,c,u){super(e,t,n,i,s,o,a,c,u),this.spec=l}update(e,t,n,i){if(this.dirty==qt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ed(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==r){for(;a!=n;)n=nd(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(a,n);if(o instanceof un){let l=n?n.previousSibling:r.lastChild;ed(o.contentDOM,o.children,t),n=l?l.nextSibling:r.firstChild}}for(;n;)n=nd(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const ki=function(r){r&&(this.nodeName=r)};ki.prototype=Object.create(null);const dn=[new ki];function xa(r,e,t){if(r.length==0)return dn;let n=t?dn[0]:new ki,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new ki(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(n=new ki(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return i}function td(r,e,t,n){if(t==dn&&n==dn)return e;let i=e;for(let s=0;s<n.length;s++){let o=n[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=r&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=dn[0]),i=l}J2(i,a||dn[0],o)}return i}function J2(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<n.length;s++)i.indexOf(n[s])==-1&&r.classList.remove(n[s]);for(let s=0;s<i.length;s++)n.indexOf(i[s])==-1&&r.classList.add(i[s]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function rd(r,e,t){return td(r,r,dn,xa(e,t,r.nodeType!=1))}function xs(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function nd(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class X2{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Y2(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Et,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=un.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,n,i,s){let o=this.top.children[i];return o.dirty==qt&&o.dom==o.contentDOM&&(o.dirty=cn),o.update(e,t,n,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof zr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=qt&&xs(t,l.outerDeco));if(!h&&l.update(e,t,n,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,n,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=cn,d.updateChildren(i,o+1),d.dirty=Et),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!xs(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=zr.create(this.top,t,n,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,n,i,s){let o=zr.create(this.top,e,t,n,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Yu(this.top,e,t,n);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof un;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof bs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Qe||Ge)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new Qu(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Y2(r,e){let t=e,n=t.children.length,i=r.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(n){let c=t.children[n-1];if(c instanceof un)t=c,n=c.children.length;else{a=c,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=r.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Z2(r,e){return r.type.side-e.type.side}function Q2(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let c=0;c<r.childCount;c++){let u=r.child(c);n(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let v=i[o++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(Z2);for(let v=0;v<d.length;v++)t(d[v],c,!!l)}else t(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<r.childCount)f=c,h=r.child(c++);else break;for(let v=0;v<a.length;v++)a[v].to<=s&&a.splice(v--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let v=m;o<i.length&&i[o].from<v&&(v=i[o].from);for(let x=0;x<a.length;x++)a[x].to<v&&(v=a[x].to);v<m&&(l=h.cut(v-s),h=h.cut(0,v-s),m=v,f=-1)}else for(;o<i.length&&i[o].to<m;)o++;let y=h.isInline&&!h.isLeaf?a.filter(v=>!v.inline):a.slice();n(h,y,e.forChild(s,h),f),s=m}}function e5(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function t5(r,e,t,n){for(let i=0,s=0;i<r.childCount&&s<=n;){let o=r.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<r.childCount;){let c=r.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let c=a<n?l.lastIndexOf(e,n-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function wa(r,e,t,n,i){let s=[];for(let o=0,a=0;o<r.length;o++){let l=r[o],c=a,u=a+=l.size;c>=t||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,n)),i&&(s.push(i),i=void 0),u>t&&s.push(l.slice(t-c,l.size,n)))}return s}function Sa(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,c;if(vs(t)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&se.isSelectable(d)&&i.parent&&!(d.isInline&&A2(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new se(o==h?a:n.resolve(h))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,h=o;for(let f=0;f<t.rangeCount;f++){let m=t.getRangeAt(f);d=Math.min(d,r.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,r.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=h==r.state.selection.anchor?[h,d]:[d,h],a=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=n.resolve(l);if(!c){let d=e=="pointer"||r.state.selection.head<a.pos&&!s?1:-1;c=Ma(r,u,a,d)}return c}function id(r){return r.editable?r.hasFocus():dd(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function or(r,e=!1){let t=r.state.selection;if(ld(r,t),!!id(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&Ge){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&an(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)n5(r);else{let{anchor:n,head:i}=t,s,o;sd&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=od(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=od(r,t.to))),r.docView.setSelection(n,i,r,e),sd&&(s&&ad(s),o&&ad(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&r5(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const sd=Qe||Ge&&Bu<63;function od(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(Qe&&i&&i.contentEditable=="false")return ka(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ka(i);if(s)return ka(s)}}function ka(r){return r.contentEditable="true",Qe&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function ad(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function r5(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!id(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function n5(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,Xe(t)+1):e.collapse(t,0),!n&&!r.state.selection.visible&&ut&&Nr<=11&&(t.disabled=!0,t.disabled=!1)}function ld(r,e){if(e instanceof se){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(cd(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else cd(r)}function cd(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function Ma(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||de.between(e,t,n)}function ud(r){return r.editable&&!r.hasFocus()?!1:dd(r)}function dd(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function i5(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return an(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ta(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ce.findFrom(s,e)}function Ir(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function hd(r,e,t){let n=r.state.selection;if(n instanceof de)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ir(r,new de(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Ta(r.state,e);return i&&i instanceof se?Ir(r,i):!1}else if(!(Ct&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(a))&&!o.contentDOM?se.isSelectable(s)?Ir(r,new se(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):xi?Ir(r,new de(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof se&&n.node.isInline)return Ir(r,new de(e>0?n.$to:n.$from));{let i=Ta(r.state,e);return i?Ir(r,i):!1}}}function ws(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Mi(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function Bn(r,e){return e<0?s5(r):o5(r)}function s5(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(Tt&&t.nodeType==1&&n<ws(t)&&Mi(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(Mi(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(fd(t))break;{let a=t.previousSibling;for(;a&&Mi(a,-1);)i=t.parentNode,s=Xe(a),a=a.previousSibling;if(a)t=a,n=ws(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Ca(r,t,n):i&&Ca(r,i,s)}function o5(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=ws(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(Mi(a,1))s=t,o=++n;else break}else{if(fd(t))break;{let a=t.nextSibling;for(;a&&Mi(a,1);)s=a.parentNode,o=Xe(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=ws(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Ca(r,s,o)}function fd(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function a5(r,e){for(;r&&e==r.childNodes.length&&!bi(r);)e=Xe(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function l5(r,e){for(;r&&!e&&!bi(r);)e=Xe(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Ca(r,e,t){if(e.nodeType!=3){let s,o;(o=a5(e,t))?(e=o,t=0):(s=l5(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(vs(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&or(r)},50)}function pd(r,e){let t=r.state.doc.resolve(e);if(!(Ge||Fu)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function md(r,e,t){let n=r.state.selection;if(n instanceof de&&!n.empty||t.indexOf("s")>-1||Ct&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Ta(r.state,e);if(o&&o instanceof se)return Ir(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof vt?ce.near(o,e):ce.findFrom(o,e);return a?Ir(r,a):!1}return!1}function gd(r,e){if(!(r.state.selection instanceof de))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function yd(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function c5(r){if(!Qe||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;yd(r,n,"true"),setTimeout(()=>yd(r,n,"false"),20)}return!1}function u5(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function d5(r,e){let t=e.keyCode,n=u5(e);if(t==8||Ct&&t==72&&n=="c")return gd(r,-1)||Bn(r,-1);if(t==46&&!e.shiftKey||Ct&&t==68&&n=="c")return gd(r,1)||Bn(r,1);if(t==13||t==27)return!0;if(t==37||Ct&&t==66&&n=="c"){let i=t==37?pd(r,r.state.selection.from)=="ltr"?-1:1:-1;return hd(r,i,n)||Bn(r,i)}else if(t==39||Ct&&t==70&&n=="c"){let i=t==39?pd(r,r.state.selection.from)=="ltr"?1:-1:1;return hd(r,i,n)||Bn(r,i)}else{if(t==38||Ct&&t==80&&n=="c")return md(r,-1,n)||Bn(r,-1);if(t==40||Ct&&t==78&&n=="c")return c5(r)||md(r,1,n)||Bn(r,1);if(n==(Ct?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ea(r,e){r.someProp("transformCopied",f=>{e=f(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let f=n.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),n=f.content}let o=r.someProp("clipboardSerializer")||sn.fromSchema(r.state.schema),a=Td(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=kd[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let m=a.createElement(u[f]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let h=r.someProp("clipboardTextSerializer",f=>f(e,r))||e.content.textBetween(0,e.content.size,`
23
-
24
- `);return{dom:l,text:h,slice:e}}function vd(r,e,t,n,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(n||s||!t);if(l){if(r.someProp("transformPastedText",h=>{e=h(e,s||n,r)}),s)return a=new X(H.from(r.state.schema.text(e.replace(/\r\n?/g,`
25
- `))),0,0),r.someProp("transformPasted",h=>{a=h(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",h=>h(e,i,n,r));if(d)a=d;else{let h=i.marks(),{schema:f}=r.state,m=sn.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let v=o.appendChild(document.createElement("p"));y&&v.appendChild(m.serializeNode(f.text(y,h)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=m5(t),xi&&g5(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Tr.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!h5.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=y5(Sd(a,+u[1],+u[2]),u[4]);else if(a=X.maxOpen(f5(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Sd(a,d,h)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const h5=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function f5(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&xd(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=wd(o[o.length-1],s.length));let u=bd(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return H.from(o)}return r}function bd(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,H.from(r));return r}function xd(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=xd(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(H.from(bd(t,r,i+1))))}}function wd(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,wd(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(H.empty,!0);return r.copy(t.append(n))}function Aa(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Aa(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(H.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Sd(r,e,t){return e<r.openStart&&(r=new X(Aa(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new X(Aa(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const kd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Md=null;function Td(){return Md||(Md=document.implementation.createHTMLDocument("title"))}let Oa=null;function p5(r){let e=window.trustedTypes;return e?(Oa||(Oa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Oa.createHTML(r)):r}function m5(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Td().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&kd[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=p5(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function g5(r){let e=r.querySelectorAll(Ge?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function y5(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=H.from(l.create(n[a+1],i)),s++,o++}return new X(i,s,o)}const tt={},rt={},v5={touchstart:!0,touchmove:!0};class b5{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function x5(r){for(let e in tt){let t=tt[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{S5(r,n)&&!Da(r,n)&&(r.editable||!(n.type in rt))&&t(r,n)},v5[e]?{passive:!0}:void 0)}Qe&&r.dom.addEventListener("input",()=>null),Na(r)}function Rr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function w5(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Na(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>Da(r,n))})}function Da(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function S5(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function k5(r,e){!Da(r,e)&&tt[e.type]&&(r.editable||!(e.type in rt))&&tt[e.type](r,e)}rt.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Ed(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(ir&&Ge&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),Pn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,ln(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||d5(r,t)?t.preventDefault():Rr(r,"key")},rt.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},rt.keypress=(r,e)=>{let t=e;if(Ed(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ct&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof de)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Ss(r){return{left:r.clientX,top:r.clientY}}function M5(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function za(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Fn(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function T5(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&se.isSelectable(n)?(Fn(r,new se(t)),!0):!1}function C5(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof se&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(se.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Fn(r,se.create(r.state.doc,i)),!0):!1}function E5(r,e,t,n,i){return za(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?C5(r,t):T5(r,t))}function A5(r,e,t,n){return za(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function O5(r,e,t,n){return za(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||N5(r,t,n)}function N5(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Fn(r,de.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Fn(r,de.create(n,a+1,a+1+o.content.size));else if(se.isSelectable(o))Fn(r,se.create(n,a));else continue;return!0}}function Ia(r){return ks(r)}const Cd=Ct?"metaKey":"ctrlKey";tt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Ia(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&M5(t,r.input.lastClick)&&!t[Cd]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(Ss(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new D5(r,o,t,!!n)):(s=="doubleClick"?A5:O5)(r,o.pos,o.inside,t)?t.preventDefault():Rr(r,"pointer"))};class D5{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Cd],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof se&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Tt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Rr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>or(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ss(e))),this.updateAllowDefault(e),this.allowDefault||!t?Rr(this.view,"pointer"):E5(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qe&&this.mightDrag&&!this.mightDrag.node.isAtom||Ge&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Fn(this.view,ce.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Rr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Rr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tt.touchstart=r=>{r.input.lastTouch=Date.now(),Ia(r),Rr(r,"pointer")},tt.touchmove=r=>{r.input.lastTouch=Date.now(),Rr(r,"pointer")},tt.contextmenu=r=>Ia(r);function Ed(r,e){return r.composing?!0:Qe&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const z5=ir?5e3:-1;rt.compositionstart=rt.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Ge&&Fu&&I5(r)))r.markCursor=r.state.storedMarks||t.marks(),ks(r,!0),r.markCursor=null;else if(ks(r,!e.selection.empty),Tt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Ad(r,z5)};function I5(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}rt.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Ad(r,20))};function Ad(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>ks(r),e))}function Od(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=P5());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function R5(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=C2(e.focusNode,e.focusOffset),n=E2(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function P5(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function ks(r,e=!1){if(!(ir&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Od(r),e||r.docView&&r.docView.dirty){let t=Sa(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function L5(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ti=ut&&Nr<15||Pn&&D2<604;tt.copy=rt.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Ti?null:t.clipboardData,o=n.content(),{dom:a,text:l}=Ea(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):L5(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function B5(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function F5(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Ci(r,n.value,null,i,e):Ci(r,n.textContent,n.innerHTML,i,e)},50)}function Ci(r,e,t,n,i){let s=vd(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||X.empty)))return!0;if(!s)return!1;let o=B5(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Nd(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}rt.paste=(r,e)=>{let t=e;if(r.composing&&!ir)return;let n=Ti?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Ci(r,Nd(n),n.getData("text/html"),i,t)?t.preventDefault():F5(r,t)};class Dd{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const $5=Ct?"altKey":"ctrlKey";function zd(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[$5]}tt.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Ss(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof se?i.to-1:i.to))){if(n&&n.mightDrag)o=se.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=se.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=Ea(r,a);(!t.dataTransfer.files.length||!Ge||Bu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ti?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ti||t.dataTransfer.setData("text/plain",c),r.dragging=new Dd(u,zd(r,t),o)},tt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},rt.dragover=rt.dragenter=(r,e)=>e.preventDefault(),rt.drop=(r,e)=>{try{H5(r,e,r.dragging)}finally{r.dragging=null}};function H5(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Ss(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",f=>{s=f(s,r,!1)}):s=vd(r,Nd(e.dataTransfer),Ti?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&zd(r,e));if(r.someProp("handleDrop",f=>f(r,e,s||X.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?ou(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&se.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new se(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,y,v,x)=>f=x),l.setSelection(Ma(r,h,l.doc.resolve(f)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}tt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&or(r)},20))},tt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},tt.beforeinput=(r,e)=>{if(Ge&&ir&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,ln(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in rt)tt[r]=rt[r];function Ei(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Ms{constructor(e,t){this.toDOM=e,this.spec=t||hn,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new nt(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ms&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ei(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pr{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new nt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Pr&&Ei(this.attrs,e.attrs)&&Ei(this.spec,e.spec)}static is(e){return e.type instanceof Pr}destroy(){}}class Ra{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new nt(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ra&&Ei(this.attrs,e.attrs)&&Ei(this.spec,e.spec)}destroy(){}}class nt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new nt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new nt(e,e,new Ms(t,n))}static inline(e,t,n,i){return new nt(e,t,new Pr(n,i))}static node(e,t,n,i){return new nt(e,t,new Ra(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pr}get widget(){return this.type instanceof Ms}}const $n=[],hn={};class De{constructor(e,t){this.local=e.length?e:$n,this.children=t.length?t:$n}static create(e,t){return t.length?Ts(t,e,0,hn):et}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==et||e.maps.length==0?this:this.mapInner(e,t,0,0,n||hn)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?V5(this.children,o||[],e,t,n,i,s):o?new De(o.sort(fn),$n):et}add(e,t){return t.length?this==et?De.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let c=l+n,u;if(u=Rd(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,Ts(u,a,c+1,hn)),s+=3}});let o=Id(s?Pd(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new De(o.length?this.local.concat(o).sort(fn):this.local,i||this.children)}remove(e){return e.length==0||this==et?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,a+1);c!=et?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new De(i,n):et}forChild(e,t){if(this==et)return this;if(t.isLeaf)return De.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Pr){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new De(i.sort(fn),$n);return n?new Lr([a,n]):a}return n||et}eq(e){if(this==e)return!0;if(!(e instanceof De)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Pa(this.localsInner(e))}localsInner(e){if(this==et)return $n;if(e.inlineContent||!this.local.some(Pr.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Pr||t.push(this.local[n]);return t}forEachSet(e){e(this)}}De.empty=new De([],[]),De.removeOverlap=Pa;const et=De.empty;class Lr{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,hn));return Lr.from(n)}forChild(e,t){if(t.isLeaf)return De.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=et&&(s instanceof Lr?n=n.concat(s.members):n.push(s))}return Lr.from(n)}eq(e){if(!(e instanceof Lr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Pa(n?t:t.sort(fn)):$n}static from(e){switch(e.length){case 0:return et;case 1:return e[0];default:return new Lr(e.every(t=>t instanceof De)?e:e.reduce((t,n)=>t.concat(n instanceof De?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function V5(r,e,t,n,i,s,o){let a=r.slice();for(let c=0,u=s;c<t.maps.length;c++){let d=0;t.maps[c].forEach((h,f,m,y)=>{let v=y-m-(f-h);for(let x=0;x<a.length;x+=3){let T=a[x+1];if(T<0||h>T+u-d)continue;let D=a[x]+u-d;f>=D?a[x+1]=h<=D?-2:-1:h>=u&&v&&(a[x]+=v,a[x+1]+=v)}d+=v}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(r[c]+s),d=u-i;if(d<0||d>=n.content.size){l=!0;continue}let h=t.map(r[c+1]+s,-1),f=h-i,{index:m,offset:y}=n.content.findIndex(d),v=n.maybeChild(m);if(v&&y==d&&y+v.nodeSize==f){let x=a[c+2].mapInner(t,v,u+1,r[c]+s+1,o);x!=et?(a[c]=d,a[c+1]=f,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=q5(a,r,e,t,i,s,o),u=Ts(c,n,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new De(e.sort(fn),a)}function Id(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new nt(i.from+e,i.to+e,i.type))}return t}function q5(r,e,t,n,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(n,i,c);d?t.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function Rd(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function Pd(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Ts(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=Rd(r,a,l+t);if(c){s=!0;let u=Ts(c,a,t+l+1,n);u!=et&&i.push(l,l+a.nodeSize,u)}});let o=Id(s?Pd(r):r,-t).sort(fn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new De(o,i):et}function fn(r,e){return r.from-e.from||r.to-e.to}function Pa(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Ld(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Ld(e,i,n.copy(s.from,n.to)));break}}}return e}function Ld(r,e,t){for(;e<r.length&&fn(t,r[e])>0;)e++;r.splice(e,0,t)}function La(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=et&&e.push(n)}),r.cursorWrapper&&e.push(De.create(r.state.doc,[r.cursorWrapper.deco])),Lr.from(e)}const _5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},j5=ut&&Nr<=11;class U5{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class W5{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new U5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);ut&&Nr<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),j5&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_5)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ud(this.view)){if(this.suppressingSelectionUpdates)return or(this.view);if(ut&&Nr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&an(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Rn(s))t.add(s);for(let s=e.anchorNode;s;s=Rn(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ud(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Tt&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||J5(e,d)!=f)&&h.remove()}}}else if((Ge||Qe)&&l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&vs(n)&&(c=Sa(e))&&c.eq(ce.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,or(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),G5(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||or(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ut&&Nr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Xe(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Xe(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Bd=new WeakMap,Fd=!1;function G5(r){if(!Bd.has(r)&&(Bd.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Tt,Fd)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Fd=!0}}function $d(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return an(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function K5(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return $d(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?$d(r,t):null}function J5(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function X5(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:a}=r.docView.parseRange(e,t),l=r.domSelectionRange(),c,u=l.anchorNode;if(u&&r.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],vs(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ge&&r.input.lastKeyCode===8)for(let v=s;v>i;v--){let x=n.childNodes[v-1],T=x.pmViewDesc;if(x.nodeName=="BR"&&!T){s=v;break}if(!T||T.size)break}let d=r.state.doc,h=r.someProp("domParser")||Tr.fromSchema(r.state.schema),f=d.resolve(o),m=null,y=h.parse(n,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Y5,context:f});if(c&&c[0].pos!=null){let v=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=v),m={anchor:v+o,head:x+o}}return{doc:y,sel:m,from:o,to:a}}function Y5(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(Qe&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||Qe&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Z5=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Q5(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let A=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,$=Sa(r,A);if($&&!r.state.selection.eq($)){if(Ge&&ir&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",q=>q(r,ln(13,"Enter"))))return;let F=r.state.tr.setSelection($);A=="pointer"?F.setMeta("pointer",!0):A=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),r.dispatch(F)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,c=X5(r,e,t),u=r.state.doc,d=u.slice(c.from,c.to),h,f;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(h=r.state.selection.to,f="end"):(h=r.state.selection.from,f="start"),r.input.lastKeyCode=null;let m=r3(d.content,c.doc.content,c.from,h,f);if(m&&r.input.domChangeCount++,(Pn&&r.input.lastIOSEnter>Date.now()-225||ir)&&i.some(A=>A.nodeType==1&&!Z5.test(A.nodeName))&&(!m||m.endA>=m.endB)&&r.someProp("handleKeyDown",A=>A(r,ln(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=Hd(r,r.state.doc,c.sel);if(A&&!A.eq(r.state.selection)){let $=r.state.tr.setSelection(A);s&&$.setMeta("composition",s),r.dispatch($)}}return}r.state.selection.from<r.state.selection.to&&m.start==m.endB&&r.state.selection instanceof de&&(m.start>r.state.selection.from&&m.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?m.start=r.state.selection.from:m.endA<r.state.selection.to&&m.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(m.endB+=r.state.selection.to-m.endA,m.endA=r.state.selection.to)),ut&&Nr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),v=c.doc.resolveNoCache(m.endB-c.from),x=u.resolve(m.start),T=y.sameParent(v)&&y.parent.inlineContent&&x.end()>=m.endA;if((Pn&&r.input.lastIOSEnter>Date.now()-225&&(!T||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!T&&y.pos<c.doc.content.size&&(!y.sameParent(v)||!y.parent.inlineContent)&&y.pos<v.pos&&!/\S/.test(c.doc.textBetween(y.pos,v.pos,"","")))&&r.someProp("handleKeyDown",A=>A(r,ln(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>m.start&&t3(u,m.start,m.endA,y,v)&&r.someProp("handleKeyDown",A=>A(r,ln(8,"Backspace")))){ir&&Ge&&r.domObserver.suppressSelectionUpdates();return}Ge&&m.endB==m.start&&(r.input.lastChromeDelete=Date.now()),ir&&!T&&y.start()!=v.start()&&v.parentOffset==0&&y.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,v=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(A){return A(r,ln(13,"Enter"))})},20));let D=m.start,P=m.endA,N=A=>{let $=A||r.state.tr.replace(D,P,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let F=Hd(r,$.doc,c.sel);F&&!(Ge&&r.composing&&F.empty&&(m.start!=m.endB||r.input.lastChromeDelete<Date.now()-100)&&(F.head==D||F.head==$.mapping.map(P)-1)||ut&&F.empty&&F.head==D)&&$.setSelection(F)}return s&&$.setMeta("composition",s),$.scrollIntoView()},O;if(T)if(y.pos==v.pos){ut&&Nr<=11&&y.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>or(r),20));let A=N(r.state.tr.delete(D,P)),$=u.resolve(m.start).marksAcross(u.resolve(m.endA));$&&A.ensureMarks($),r.dispatch(A)}else if(m.endA==m.endB&&(O=e3(y.parent.content.cut(y.parentOffset,v.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let A=N(r.state.tr);O.type=="add"?A.addMark(D,P,O.mark):A.removeMark(D,P,O.mark),r.dispatch(A)}else if(y.parent.child(y.index()).isText&&y.index()==v.index()-(v.textOffset?0:1)){let A=y.parent.textBetween(y.parentOffset,v.parentOffset),$=()=>N(r.state.tr.insertText(A,D,P));r.someProp("handleTextInput",F=>F(r,D,P,A,$))||r.dispatch($())}else r.dispatch(N());else r.dispatch(N())}function Hd(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ma(r,e.resolve(t.anchor),e.resolve(t.head))}function e3(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(H.from(c).eq(r))return{mark:a,type:o}}function t3(r,e,t,n,i){if(t-e<=i.pos-n.pos||Ba(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(Ba(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Ba(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Ba(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function r3(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&r.size<e.size){let l=n<=s&&n>=o?s-n:0;s-=l,s&&s<e.size&&Vd(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,s&&s<r.size&&Vd(r.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Vd(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class qd{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new b5,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Gd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ud(this),jd(this),this.nodeViews=Wd(this),this.docView=Zu(this.state.doc,_d(this),La(this),this.dom,this),this.domObserver=new W5(this,(n,i,s,o)=>Q5(this,n,i,s,o)),this.domObserver.start(),x5(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Na(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Gd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Od(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Wd(this);i3(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Na(this),this.editable=Ud(this),jd(this);let l=La(this),c=_d(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&R2(this);if(o){this.domObserver.stop();let f=d&&(ut||Ge)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&n3(i.selection,e.selection);if(d){let m=Ge?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=R5(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zu(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&i5(this))?or(this,f):(ld(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&P2(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof se){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&$u(this,t.getBoundingClientRect(),e)}else $u(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Dd(e.slice,e.move,i<0?void 0:se.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(ut){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&L2(this.dom),or(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return V2(this,e)}coordsAtPos(e,t=1){return Uu(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return W2(this,t||this.state,e)}pasteHTML(e,t){return Ci(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ci(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ea(this,e)}destroy(){this.docView&&(w5(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],La(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,M2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return k5(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qe&&this.root.nodeType===11&&O2(this.dom.ownerDocument)==this.dom&&K5(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}qd.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function _d(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[nt.node(0,r.state.doc.content.size,e)]}function jd(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:nt.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function Ud(r){return!r.someProp("editable",e=>e(r.state)===!1)}function n3(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function Wd(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function i3(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function Gd(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Cs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s3=typeof navigator<"u"&&/Mac/.test(navigator.platform),o3=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ye=0;Ye<10;Ye++)Br[48+Ye]=Br[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)Br[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)Br[Ye]=String.fromCharCode(Ye+32),Cs[Ye]=String.fromCharCode(Ye);for(var Fa in Br)Cs.hasOwnProperty(Fa)||(Cs[Fa]=Br[Fa]);function a3(r){var e=s3&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||o3&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Cs:Br)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const l3=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),c3=typeof navigator<"u"&&/Win/.test(navigator.platform);function u3(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))l3?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function d3(r){let e=Object.create(null);for(let t in r)e[u3(t)]=r[t];return e}function $a(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function h3(r){return new Pe({props:{handleKeyDown:Ha(r)}})}function Ha(r){let e=d3(r);return function(t,n){let i=a3(n),s,o=e[$a(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[$a(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(c3&&n.ctrlKey&&n.altKey)&&(s=Br[n.keyCode])&&s!=i){let a=e[$a(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var f3=Object.defineProperty,Va=(r,e)=>{for(var t in e)f3(r,t,{get:e[t],enumerable:!0})};function Es(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}var As=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:n}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(r).map(([o,a])=>[o,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o=[],a=!!r,l=r||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,h])=>[d,(...m)=>{const y=this.buildProps(l,e),v=h(...m)(y);return o.push(v),u}])),run:c};return u}createCan(r){const{rawCommands:e,state:t}=this,n=!1,i=r||t.tr,s=this.buildProps(i,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,n)}}buildProps(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o={tr:r,editor:n,view:s,state:Es({state:i,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},Kd={};Va(Kd,{blur:()=>p3,clearContent:()=>m3,clearNodes:()=>g3,command:()=>y3,createParagraphNear:()=>v3,cut:()=>b3,deleteCurrentNode:()=>x3,deleteNode:()=>w3,deleteRange:()=>S3,deleteSelection:()=>k3,enter:()=>M3,exitCode:()=>T3,extendMarkRange:()=>C3,first:()=>E3,focus:()=>A3,forEach:()=>O3,insertContent:()=>N3,insertContentAt:()=>I3,joinBackward:()=>L3,joinDown:()=>P3,joinForward:()=>B3,joinItemBackward:()=>F3,joinItemForward:()=>$3,joinTextblockBackward:()=>H3,joinTextblockForward:()=>V3,joinUp:()=>R3,keyboardShortcut:()=>_3,lift:()=>j3,liftEmptyBlock:()=>U3,liftListItem:()=>W3,newlineInCode:()=>G3,resetAttributes:()=>K3,scrollIntoView:()=>J3,selectAll:()=>X3,selectNodeBackward:()=>Y3,selectNodeForward:()=>Z3,selectParentNode:()=>Q3,selectTextblockEnd:()=>e6,selectTextblockStart:()=>t6,setContent:()=>r6,setMark:()=>M6,setMeta:()=>T6,setNode:()=>C6,setNodeSelection:()=>E6,setTextDirection:()=>A6,setTextSelection:()=>O6,sinkListItem:()=>N6,splitBlock:()=>D6,splitListItem:()=>z6,toggleList:()=>I6,toggleMark:()=>R6,toggleNode:()=>P6,toggleWrap:()=>L6,undoInputRule:()=>B6,unsetAllMarks:()=>F6,unsetMark:()=>$6,unsetTextDirection:()=>H6,updateAttributes:()=>V6,wrapIn:()=>q6,wrapInList:()=>_6});var p3=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),m3=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),g3=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const m=An(f);if(a.type.isTextblock){const{defaultType:y}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,y)}(m||m===0)&&e.lift(f,m)})}),!0},y3=r=>e=>r(e),v3=()=>({state:r,dispatch:e})=>Ou(r,e),b3=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new de(n.doc.resolve(Math.max(o-1,0)))),!0},x3=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1};function Ve(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var w3=r=>({tr:e,state:t,dispatch:n})=>{const i=Ve(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},S3=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},k3=()=>({state:r,dispatch:e})=>ca(r,e),M3=()=>({commands:r})=>r.keyboardShortcut("Enter"),T3=()=>({state:r,dispatch:e})=>c2(r,e);function qa(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function Os(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:qa(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function Jd(r,e,t={}){return r.find(n=>n.type===e&&Os(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function Xd(r,e,t={}){return!!Jd(r,e,t)}function _a(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((n=i.node.marks[0])==null?void 0:n.attrs),!Jd([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Xd([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&Xd([...r.parent.child(l).marks],e,t);)c+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function ar(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var C3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=ar(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=_a(l,s,e);if(d&&d.from<=c&&d.to>=u){const h=de.create(o,d.from,d.to);t.setSelection(h)}}return!0},E3=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function ja(r){return r instanceof de}function lr(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function Yd(r,e=null){if(!e)return null;const t=ce.atStart(r),n=ce.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?de.create(r,lr(0,i,s),lr(r.content.size,i,s)):de.create(r,lr(e,i,s),lr(e,i,s))}function Zd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ns(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var A3=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ns()||Zd())&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!ja(t.state.selection))return o(),!0;const a=Yd(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},O3=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),N3=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),Qd=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&Qd(n)}return r};function Ds(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Qd(t)}function Ai(r,e,t){if(r instanceof Mr||r instanceof H)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return H.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Ai("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Hc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Tr.fromSchema(l).parseSlice(Ds(r),t.parseOptions):Tr.fromSchema(l).parse(Ds(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Tr.fromSchema(e);return t.slice?s.parseSlice(Ds(r),t.parseOptions).content:s.parse(Ds(r),t.parseOptions)}return Ai("",e,t)}function D3(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof Ue||i instanceof We))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),r.setSelection(ce.near(r.doc.resolve(o),t))}var z3=r=>!("type"in r),I3=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=v=>{s.emit("contentError",{editor:s,error:v,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ai(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){l(v)}try{a=Ai(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(v){return l(v),!1}let{from:u,to:d}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},h=!0,f=!0;if((z3(a)?a:[a]).forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,f=f?v.isBlock:!1}),u===d&&f){const{parent:v}=n.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let y;if(h){if(Array.isArray(e))y=e.map(v=>v.text||"").join("");else if(e instanceof H){let v="";e.forEach(x=>{x.text&&(v+=x.text)}),y=v}else typeof e=="object"&&e&&e.text?y=e.text:y=e;n.insertText(y,u,d)}else{y=a;const v=n.doc.resolve(u),x=v.node(),T=v.parentOffset===0,D=x.isText||x.isTextblock,P=x.content.size>0;T&&D&&P&&(u=Math.max(0,u-1)),n.replaceWith(u,d,y)}t.updateSelection&&D3(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:y}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:y})}return!0},R3=()=>({state:r,dispatch:e})=>o2(r,e),P3=()=>({state:r,dispatch:e})=>a2(r,e),L3=()=>({state:r,dispatch:e})=>Su(r,e),B3=()=>({state:r,dispatch:e})=>Cu(r,e),F3=()=>({state:r,dispatch:e,tr:t})=>{try{const n=ps(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},$3=()=>({state:r,dispatch:e,tr:t})=>{try{const n=ps(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},H3=()=>({state:r,dispatch:e})=>i2(r,e),V3=()=>({state:r,dispatch:e})=>s2(r,e);function eh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function q3(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Ns()||eh()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var _3=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=q3(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(n.mapping);u&&i&&n.maybeStep(u)}),!0};function Fr(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?Ve(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(d,h)=>{if(d.isText)return;const f=Math.max(n,h),m=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:m})});const l=i-n,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Os(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}var j3=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return Fr(t,i,e)?l2(t,n):!1},U3=()=>({state:r,dispatch:e})=>Nu(r,e),W3=r=>({state:e,dispatch:t})=>{const n=Ve(r,e.schema);return x2(n)(e,t)},G3=()=>({state:r,dispatch:e})=>Au(r,e);function zs(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function th(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}var K3=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=Ve(r,n.schema)),a==="mark"&&(o=ar(r,n.schema));let l=!1;return t.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,th(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(l=!0,i&&t.addMark(d,d+u.nodeSize,o.create(th(h.attrs,e))))})})}),l},J3=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),X3=()=>({tr:r,dispatch:e})=>{if(e){const t=new vt(r.doc);r.setSelection(t)}return!0},Y3=()=>({state:r,dispatch:e})=>Mu(r,e),Z3=()=>({state:r,dispatch:e})=>Eu(r,e),Q3=()=>({state:r,dispatch:e})=>h2(r,e),e6=()=>({state:r,dispatch:e})=>m2(r,e),t6=()=>({state:r,dispatch:e})=>p2(r,e);function Ua(r,e,t={},n={}){return Ai(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var r6=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(n.preserveWhitespace!=="full"){const c=Ua(r,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},r,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function rh(r,e){const t=ar(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function n6(r,e){const t=new du(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function i6(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function s6(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function Is(r){return e=>s6(e.$from,r)}function oe(r,e,t){return r.config[e]===void 0&&r.parent?oe(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?oe(r.parent,e,t):null}):r.config[e]}function Wa(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},n=oe(e,"addExtensions",t);return n?[e,...Wa(n())]:e}).flat(10)}function Ga(r,e){const t=sn.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function nh(r){return typeof r=="function"}function ke(r,e=void 0,...t){return nh(r)?e?r.bind(e)(...t):r(...t):r}function o6(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Hn(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function ih(r){const e=[],{nodeExtensions:t,markExtensions:n}=Hn(r),i=[...t,...n],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=oe(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=oe(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function ye(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=n[i]?n[i].split(" "):[],c=a.filter(u=>!l.includes(u));n[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),a.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),n[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else n[i]=s}),n},{})}function Oi(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>ye(t,n),{})}function a6(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function sh(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):a6(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function oh(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&o6(t)?!1:t!=null))}function ah(r){var e,t;const n={};return!((e=r?.attribute)!=null&&e.isRequired)&&"default"in(r?.attribute||{})&&(n.default=r.attribute.default),((t=r?.attribute)==null?void 0:t.validate)!==void 0&&(n.validate=r.attribute.validate),[r.name,n]}function l6(r,e){var t;const n=ih(r),{nodeExtensions:i,markExtensions:s}=Hn(r),o=(t=i.find(c=>oe(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=n.filter(x=>x.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=r.reduce((x,T)=>{const D=oe(T,"extendNodeSchema",d);return{...x,...D?D(c):{}}},{}),f=oh({...h,content:ke(oe(c,"content",d)),marks:ke(oe(c,"marks",d)),group:ke(oe(c,"group",d)),inline:ke(oe(c,"inline",d)),atom:ke(oe(c,"atom",d)),selectable:ke(oe(c,"selectable",d)),draggable:ke(oe(c,"draggable",d)),code:ke(oe(c,"code",d)),whitespace:ke(oe(c,"whitespace",d)),linebreakReplacement:ke(oe(c,"linebreakReplacement",d)),defining:ke(oe(c,"defining",d)),isolating:ke(oe(c,"isolating",d)),attrs:Object.fromEntries(u.map(ah))}),m=ke(oe(c,"parseHTML",d));m&&(f.parseDOM=m.map(x=>sh(x,u)));const y=oe(c,"renderHTML",d);y&&(f.toDOM=x=>y({node:x,HTMLAttributes:Oi(x,u)}));const v=oe(c,"renderText",d);return v&&(f.toText=v),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const u=n.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=r.reduce((v,x)=>{const T=oe(x,"extendMarkSchema",d);return{...v,...T?T(c):{}}},{}),f=oh({...h,inclusive:ke(oe(c,"inclusive",d)),excludes:ke(oe(c,"excludes",d)),group:ke(oe(c,"group",d)),spanning:ke(oe(c,"spanning",d)),code:ke(oe(c,"code",d)),attrs:Object.fromEntries(u.map(ah))}),m=ke(oe(c,"parseHTML",d));m&&(f.parseDOM=m.map(v=>sh(v,u)));const y=oe(c,"renderHTML",d);return y&&(f.toDOM=v=>y({mark:v,HTMLAttributes:Oi(v,u)})),[c.name,f]}));return new Hc({topNode:o,nodes:a,marks:l})}function c6(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}function Ka(r){return r.sort((t,n)=>{const i=oe(t,"priority")||100,s=oe(n,"priority")||100;return i>s?-1:i<s?1:0})}function lh(r){const e=Ka(Wa(r)),t=c6(e.map(n=>n.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function ch(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
26
-
27
- `,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,c,u,d)=>{var h;l.isBlock&&c>n&&(a+=s);const f=o?.[l.type.name];if(f)return u&&(a+=f({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(n,c)-c,i-c))}),a}function uh(r,e){const t={from:0,to:r.content.size};return ch(r,t,e)}function Ja(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function u6(r,e){const t=Ve(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function d6(r,e){const t=zs(typeof e=="string"?e:e.name,r.schema);return t==="node"?u6(r,e):t==="mark"?rh(r,e):{}}function h6(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function f6(r){const e=h6(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function p6(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),h=e.invert().map(u);n.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),f6(n)}function dh(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r),o=_a(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}var m6=(r,e,t,n=20)=>{const i=r.doc.resolve(t);let s=n,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function Xa(r,e){return e.nodes[r]||e.marks[r]||null}function Rs(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}var g6=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,n-s))}),t};function Ya(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?ar(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Os(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,m=h.pos;r.doc.nodesBetween(f,m,(y,v)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(f,v),T=Math.min(m,v+y.nodeSize),D=T-x;o+=D,a.push(...y.marks.map(P=>({mark:P,from:x,to:T})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Os(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=o}function y6(r,e,t={}){if(!e)return Fr(r,null,t)||Ya(r,null,t);const n=zs(e,r.schema);return n==="node"?Fr(r,e,t):n==="mark"?Ya(r,e,t):!1}var v6=(r,e)=>{const{$from:t,$to:n,$anchor:i}=r.selection;if(e){const s=Is(a=>a.type.name===e)(r.selection);if(!s)return!1;const o=r.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(n.parentOffset<n.parent.nodeSize-2||t.pos!==n.pos)},b6=r=>{const{$from:e,$to:t}=r.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function hh(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function fh(r,e){const{nodeExtensions:t}=Hn(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=ke(oe(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Ps(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!=null?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(Ps(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function x6(r){return r instanceof se}var ph=class p1{constructor(e){this.position=e}static fromJSON(e){return new p1(e.position)}toJSON(){return{position:this.position}}};function w6(r,e){const t=e.mapping.mapResult(r.position);return{position:new ph(t.pos),mapResult:t}}function S6(r){return new ph(r)}function mh(r,e,t){const i=r.state.doc.content.size,s=lr(e,0,i),o=lr(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,m=u-c,x={top:c,bottom:u,left:d,right:h,width:f,height:m,x:d,y:c};return{...x,toJSON:()=>x}}function k6(r,e,t){var n;const{selection:i}=e;let s=null;if(ja(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!=null?n:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(t));c=f&&m}return!c}),c})}var M6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=ar(r,n.schema);if(i)if(o){const c=rh(n,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;n.doc.nodesBetween(u,d,(h,f)=>{const m=Math.max(f,u),y=Math.min(f+h.nodeSize,d);h.marks.find(x=>x.type===l)?h.marks.forEach(x=>{l===x.type&&t.addMark(m,y,l.create({...x.attrs,...e}))}):t.addMark(m,y,l.create(e))})});return k6(n,t,l)},T6=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),C6=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=Ve(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Iu(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Iu(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},E6=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=lr(r,0,n.content.size),s=se.create(n,i);e.setSelection(s)}return!0},A6=(r,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=n;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:r})}),!0},O6=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=de.atStart(n).from,a=de.atEnd(n).to,l=lr(i,o,a),c=lr(s,o,a),u=de.create(n,l,c);e.setSelection(u)}return!0},N6=r=>({state:e,dispatch:t})=>{const n=Ve(r,e.schema);return k2(n)(e,t)};function gh(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}var D6=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=Rs(c,a.node().type.name,a.node().attrs);if(s instanceof se&&s.node.isBlock)return!a.parentOffset||!rr(o,a.pos)?!1:(n&&(r&&gh(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:i6(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,m=rr(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!m&&rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,f=h?[{type:h,attrs:u}]:void 0),n){if(m&&(s instanceof de&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const y=e.mapping.map(a.before()),v=e.doc.resolve(y);a.node(-1).canReplaceWith(v.index(),v.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}r&&gh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},z6=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=Ve(r,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let x=H.empty;const T=l.index(-1)?1:l.index(-2)?2:3;for(let $=l.depth-T;$>=l.depth-3;$-=1)x=H.from(l.node($).copy(x));const D=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,P={...Rs(h,l.node().type.name,l.node().attrs),...e},N=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(P))||void 0;x=x.append(H.from(a.createAndFill(null,N)||void 0));const O=l.before(l.depth-(T-1));t.replace(O,l.after(-D),new X(x,4-T,0));let A=-1;t.doc.nodesBetween(O,t.doc.content.size,($,F)=>{if(A>-1)return!1;$.isTextblock&&$.content.size===0&&(A=F+1)}),A>-1&&t.setSelection(de.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Rs(h,d.type.name,d.attrs),...e},y={...Rs(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const v=f?[{type:a,attrs:m},{type:f,attrs:y}]:[{type:a,attrs:m}];if(!rr(t.doc,l.pos,2))return!1;if(i){const{selection:x,storedMarks:T}=n,{splittableMarks:D}=s.extensionManager,P=T||x.$to.parentOffset&&x.$from.marks();if(t.split(l.pos,2,v).scrollIntoView(),!P||!i)return!0;const N=P.filter(O=>D.includes(O.type.name));t.ensureMarks(N)}return!0},Za=(r,e)=>{const t=Is(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ar(r.doc,t.pos)&&r.join(t.pos),!0},Qa=(r,e)=>{const t=Is(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ar(r.doc,n)&&r.join(n),!0},I6=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Ve(r,o.schema),m=Ve(e,o.schema),{selection:y,storedMarks:v}=o,{$from:x,$to:T}=y,D=x.blockRange(T),P=v||y.$to.parentOffset&&y.$from.marks();if(!D)return!1;const N=Is(O=>fh(O.type.name,d))(y);if(D.depth>=1&&N&&D.depth-N.depth<=1){if(N.node.type===f)return c.liftListItem(m);if(fh(N.node.type.name,d)&&f.validContent(N.node.content)&&a)return l().command(()=>(s.setNodeMarkup(N.pos,f),!0)).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()}return!t||!P||!a?l().command(()=>u().wrapInList(f,n)?!0:c.clearNodes()).wrapInList(f,n).command(()=>Za(s,f)).command(()=>Qa(s,f)).run():l().command(()=>{const O=u().wrapInList(f,n),A=P.filter($=>h.includes($.type.name));return s.ensureMarks(A),O?!0:c.clearNodes()}).wrapInList(f,n).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()},R6=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ar(r,n.schema);return Ya(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},P6=(r,e,t={})=>({state:n,commands:i})=>{const s=Ve(r,n.schema),o=Ve(e,n.schema),a=Fr(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},L6=(r,e={})=>({state:t,commands:n})=>{const i=Ve(r,t.schema);return Fr(t,i,e)?n.lift(i):n.wrapIn(i,e)},B6=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},F6=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},$6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=ar(r,n.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:h,to:f}=a;const m=(s=c.marks().find(v=>v.type===l))==null?void 0:s.attrs,y=_a(c,l,m);y&&(h=y.from,f=y.to),t.removeMark(h,f,l)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},H6=r=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let s,o;return typeof r=="number"?(s=r,o=r):r&&"from"in r&&"to"in r?(s=r.from,o=r.to):(s=i.from,o=i.to),n&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},V6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=Ve(r,n.schema)),a==="mark"&&(o=ar(r,n.schema));let l=!1;return t.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,m,y;t.selection.empty?n.doc.nodesBetween(u,d,(v,x)=>{s&&s===v.type&&(l=!0,m=Math.max(x,u),y=Math.min(x+v.nodeSize,d),h=x,f=v)}):n.doc.nodesBetween(u,d,(v,x)=>{x<u&&s&&s===v.type&&(l=!0,m=Math.max(x,u),y=Math.min(x+v.nodeSize,d),h=x,f=v),x>=u&&x<=d&&(s&&s===v.type&&(l=!0,i&&t.setNodeMarkup(x,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(l=!0,i)){const D=Math.max(x,u),P=Math.min(x+v.nodeSize,d);t.addMark(D,P,o.create({...T.attrs,...e}))}}))}),f&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(v=>{o===v.type&&i&&t.addMark(m,y,o.create({...v.attrs,...e}))}))}),l},q6=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return g2(i,e)(t,n)},_6=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return y2(i,e)(t,n)},j6=class{constructor(){this.callbacks={}}on(r,e){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(e),this}emit(r,...e){const t=this.callbacks[r];return t&&t.forEach(n=>n.apply(this,e)),this}off(r,e){const t=this.callbacks[r];return t&&(e?this.callbacks[r]=t.filter(n=>n!==e):delete this.callbacks[r]),this}once(r,e){const t=(...n)=>{this.off(r,t),e.apply(this,n)};return this.on(r,t)}removeAllListeners(){this.callbacks={}}},el=class{constructor(r){var e;this.find=r.find,this.handler=r.handler,this.undoable=(e=r.undoable)!=null?e:!0}},U6=(r,e)=>{if(qa(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function Ls(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=g6(c)+s;return o.forEach(h=>{if(u)return;const f=U6(d,h.find);if(!f)return;const m=l.state.tr,y=Es({state:l.state,transaction:m}),v={from:n-(f[0].length-s.length),to:i},{commands:x,chain:T,can:D}=new As({editor:t,state:y});h.handler({state:y,range:v,match:f,commands:x,chain:T,can:D})===null||!m.steps.length||(h.undoable&&m.setMeta(a,{transform:m,from:n,to:i,text:s}),l.dispatch(m),u=!0)}),u}function W6(r){const{editor:e,rules:t}=r,n=new Pe({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Ga(H.from(u),o.schema);const{from:d}=l,h=d+u.length;Ls({editor:e,from:d,to:h,text:u,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Ls({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ls({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ls({editor:e,from:o.pos,to:o.pos,text:`
28
- `,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function G6(r){return Object.prototype.toString.call(r).slice(8,-1)}function Bs(r){return G6(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function yh(r,e){const t={...r};return Bs(r)&&Bs(e)&&Object.keys(e).forEach(n=>{Bs(e[n])&&Bs(r[n])?t[n]=yh(r[n],e[n]):t[n]=e[n]}),t}var tl=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...ke(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>yh(this.options,r)});return e.name=this.name,e.parent=this.parent,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Ni=class m1 extends tl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new m1(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function K6(r){return typeof r=="number"}var J6=class{constructor(r){this.find=r.find,this.handler=r.handler}},X6=(r,e,t)=>{if(qa(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Y6(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:c,can:u}=new As({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(f,m)=>{var y,v,x,T,D;if((v=(y=f.type)==null?void 0:y.spec)!=null&&v.code||!(f.isText||f.isTextblock||f.isInline))return;const P=(D=(T=(x=f.content)==null?void 0:x.size)!=null?T:f.nodeSize)!=null?D:0,N=Math.max(n,m),O=Math.min(i,m+P);if(N>=O)return;const A=f.isText?f.text||"":f.textBetween(N-m,O-m,void 0,"");X6(A,s.find,o).forEach(F=>{if(F.index===void 0)return;const q=N+F.index+1,te=q+F[0].length,Y={from:t.tr.mapping.map(q),to:t.tr.mapping.map(te)},he=s.handler({state:t,range:Y,match:F,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(he)})}),d.every(f=>f!==null)}var Fs=null,Z6=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function Q6(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:f,pasteEvt:m})=>{const y=u.tr,v=Es({state:u,transaction:y});if(!(!Y6({editor:e,state:v,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:m,dropEvent:a})||!y.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return t.map(u=>new Pe({view(d){const h=m=>{var y;n=(y=d.dom.parentElement)!=null&&y.contains(m.target)?d.dom.parentElement:null,n&&(Fs=e)},f=()=>{Fs&&(Fs=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=n===d.dom.parentElement,a=h,!s){const f=Fs;f?.isEditable&&setTimeout(()=>{const m=f.state.selection;m&&f.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,h)=>{var f;const m=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const m=d[0],y=m.getMeta("uiEvent")==="paste"&&!i,v=m.getMeta("uiEvent")==="drop"&&!s,x=m.getMeta("applyPasteRules"),T=!!x;if(!y&&!v&&!T)return;if(T){let{text:N}=x;typeof N=="string"?N=N:N=Ga(H.from(N),f.schema);const{from:O}=x,A=O+N.length,$=Z6(N);return l({rule:u,state:f,from:O,to:{b:A},pasteEvt:$})}const D=h.doc.content.findDiffStart(f.doc.content),P=h.doc.content.findDiffEnd(f.doc.content);if(!(!K6(D)||!P||D===P.b))return l({rule:u,state:f,from:D,to:P,pasteEvt:o})}}))}var $s=class{constructor(r,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=lh(r),this.schema=l6(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xa(e.name,this.schema)},n=oe(e,"addCommands",t);return n?{...r,...n()}:r},{})}get plugins(){const{editor:r}=this;return Ka([...this.extensions].reverse()).flatMap(n=>{const i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:r,type:Xa(n.name,this.schema)},s=[],o=oe(n,"addKeyboardShortcuts",i);let a={};if(n.type==="mark"&&oe(n,"exitable",i)&&(a.ArrowRight=()=>Ni.handleExit({editor:r,mark:n})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,m])=>[f,()=>m({editor:r})]));a={...a,...h}}const l=h3(a);s.push(l);const c=oe(n,"addInputRules",i);if(hh(n,r.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=W6({editor:r,rules:h}),m=Array.isArray(f)?f:[f];s.push(...m)}}const u=oe(n,"addPasteRules",i);if(hh(n,r.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=Q6({editor:r,rules:h});s.push(...f)}}const d=oe(n,"addProseMirrorPlugins",i);if(d){const h=d();s.push(...h)}return s})}get attributes(){return ih(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=Hn(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addNodeView")).map(t=>{const n=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:Ve(t.name,this.schema)},s=oe(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,u,d,h)=>{const f=Oi(l,n);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:h,editor:r,extension:t,HTMLAttributes:f})};return[t.name,a]}))}get markViews(){const{editor:r}=this,{markExtensions:e}=Hn(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addMarkView")).map(t=>{const n=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:ar(t.name,this.schema)},s=oe(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const u=Oi(a,n);return s()({mark:a,view:l,inline:c,editor:r,extension:t,HTMLAttributes:u,updateAttributes:d=>{d7(a,r,d)}})};return[t.name,o]}))}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xa(e.name,this.schema)};e.type==="mark"&&((t=ke(oe(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name);const i=oe(e,"onBeforeCreate",n),s=oe(e,"onCreate",n),o=oe(e,"onUpdate",n),a=oe(e,"onSelectionUpdate",n),l=oe(e,"onTransaction",n),c=oe(e,"onFocus",n),u=oe(e,"onBlur",n),d=oe(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};$s.resolve=lh,$s.sort=Ka,$s.flatten=Wa;var e7={};Va(e7,{ClipboardTextSerializer:()=>vh,Commands:()=>bh,Delete:()=>xh,Drop:()=>wh,Editable:()=>Sh,FocusEvents:()=>Mh,Keymap:()=>Th,Paste:()=>Ch,Tabindex:()=>Eh,TextDirection:()=>Ah,focusEventsPluginKey:()=>kh});var Se=class g1 extends tl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new g1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},vh=Se.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pe({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Ja(t);return ch(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),bh=Se.create({name:"commands",addCommands(){return{...Kd}}}),xh=Se.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,n,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,r))!=null?c:r.getMeta("y-sync$"))return;const u=n6(r.before,[r,...e]);p6(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(m,y)=>{const v=y+m.nodeSize-2,x=f.oldRange.from<=y&&v<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:y,to:v,newFrom:u.mapping.map(y),newTo:u.mapping.map(v),deletedRange:f.oldRange,newRange:f.newRange,partial:!x,editor:this.editor,transaction:r,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,m)=>{var y,v;if(f instanceof Pt){const x=h.slice(m).map(f.from,-1),T=h.slice(m).map(f.to),D=h.invert().map(x,-1),P=h.invert().map(T),N=(y=u.doc.nodeAt(x-1))==null?void 0:y.marks.some(A=>A.eq(f.mark)),O=(v=u.doc.nodeAt(T))==null?void 0:v.marks.some(A=>A.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:D,to:P},newRange:{from:x,to:T},partial:!!(O||N),editor:this.editor,transaction:r,combinedTransform:u})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(s,0):s()}}),wh=Se.create({name:"drop",addProseMirrorPlugins(){return[new Pe({key:new Fe("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),Sh=Se.create({name:"editable",addProseMirrorPlugins(){return[new Pe({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),kh=new Fe("focusEvents"),Mh=Se.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Pe({key:kh,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Th=Se.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:h,parent:f}=d,m=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,y=m.parent.type.spec.isolating,v=d.pos-d.parentOffset,x=y&&m.parent.childCount===1?v===d.pos:ce.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!x||x&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ns()||eh()?s:i},addProseMirrorPlugins(){return[new Pe({key:new Fe("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(y=>y.getMeta("composition")))return;const n=r.some(y=>y.docChanged)&&!e.doc.eq(t.doc),i=r.some(y=>y.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=ce.atStart(e.doc).from,c=ce.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!Ps(t.doc))return;const h=t.tr,f=Es({state:t,transaction:h}),{commands:m}=new As({editor:this.editor,state:f});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Ch=Se.create({name:"paste",addProseMirrorPlugins(){return[new Pe({key:new Fe("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Eh=Se.create({name:"tabindex",addProseMirrorPlugins(){return[new Pe({key:new Fe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Ah=Se.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=Hn(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pe({key:new Fe("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),t7=class Qn{constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Qn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Qn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Qn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Qn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Qn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else n=i;i=i.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},r7=`.ProseMirror {
16
+ `},pc=C4(N4)(fc),D4={config:A4},z4=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(s,o){return o(s)},i)}};function mc(r,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&r[t]&&Object.assign(e[t],mc(r[t],e[t]))}),uc(uc({},r),e)}var I4={type:"cancelation",msg:"operation is manually canceled"};function jo(r){var e=!1,t=new Promise(function(n,i){r.then(function(s){return e?i(I4):n(s)}),r.catch(i)});return t.cancel=function(){return e=!0},t}var R4=["monaco"],P4=M4.create({config:T4,isInitialized:!1,resolve:null,reject:null,monaco:null}),gc=o4(P4,2),li=gc[0],rs=gc[1];function L4(r){var e=D4.config(r),t=e.monaco,n=i4(e,R4);rs(function(i){return{config:mc(i.config,n),monaco:t}})}function B4(){var r=li(function(e){var t=e.monaco,n=e.isInitialized,i=e.resolve;return{monaco:t,isInitialized:n,resolve:i}});if(!r.isInitialized){if(rs({isInitialized:!0}),r.monaco)return r.resolve(r.monaco),jo(Uo);if(window.monaco&&window.monaco.editor)return yc(window.monaco),r.resolve(window.monaco),jo(Uo);z4(F4,H4)(V4)}return jo(Uo)}function F4(r){return document.body.appendChild(r)}function $4(r){var e=document.createElement("script");return r&&(e.src=r),e}function H4(r){var e=li(function(n){var i=n.config,s=n.reject;return{config:i,reject:s}}),t=$4("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return r()},t.onerror=e.reject,t}function V4(){var r=li(function(t){var n=t.config,i=t.resolve,s=t.reject;return{config:n,resolve:i,reject:s}}),e=window.require;e.config(r.config),e(["vs/editor/editor.main"],function(t){var n=t.m||t;yc(n),r.resolve(n)},function(t){r.reject(t)})}function yc(r){li().monaco||rs({monaco:r})}function q4(){return li(function(r){var e=r.monaco;return e})}var Uo=new Promise(function(r,e){return rs({resolve:r,reject:e})}),vc={config:L4,init:B4,__getMonacoInstance:q4},_4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Wo=_4,j4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},U4=j4;function W4({children:r}){return z.createElement("div",{style:U4.container},r)}var G4=W4,K4=G4;function J4({width:r,height:e,isEditorReady:t,loading:n,_ref:i,className:s,wrapperProps:o}){return z.createElement("section",{style:{...Wo.wrapper,width:r,height:e},...o},!t&&z.createElement(K4,null,n),z.createElement("div",{ref:i,style:{...Wo.fullWidth,...!t&&Wo.hide},className:s}))}var X4=J4,bc=z.memo(X4);function Y4(r){z.useEffect(r,[])}var xc=Y4;function Z4(r,e,t=!0){let n=z.useRef(!0);z.useEffect(n.current||!t?()=>{n.current=!1}:r,e)}var gt=Z4;function ci(){}function En(r,e,t,n){return Q4(r,n)||eg(r,e,t,n)}function Q4(r,e){return r.editor.getModel(wc(r,e))}function eg(r,e,t,n){return r.editor.createModel(e,t,n?wc(r,n):void 0)}function wc(r,e){return r.Uri.parse(e)}function tg({original:r,modified:e,language:t,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:h="100%",width:f="100%",className:m,wrapperProps:y={},beforeMount:v=ci,onMount:x=ci}){let[T,D]=z.useState(!1),[P,E]=z.useState(!0),N=z.useRef(null),O=z.useRef(null),$=z.useRef(null),F=z.useRef(x),q=z.useRef(v),te=z.useRef(!1);xc(()=>{let W=vc.init();return W.then(ne=>(O.current=ne)&&E(!1)).catch(ne=>ne?.type!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>N.current?Q():W.cancel()}),gt(()=>{if(N.current&&O.current){let W=N.current.getOriginalEditor(),ne=En(O.current,r||"",n||t||"text",s||"");ne!==W.getModel()&&W.setModel(ne)}},[s],T),gt(()=>{if(N.current&&O.current){let W=N.current.getModifiedEditor(),ne=En(O.current,e||"",i||t||"text",o||"");ne!==W.getModel()&&W.setModel(ne)}},[o],T),gt(()=>{let W=N.current.getModifiedEditor();W.getOption(O.current.editor.EditorOption.readOnly)?W.setValue(e||""):e!==W.getValue()&&(W.executeEdits("",[{range:W.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),W.pushUndoStop())},[e],T),gt(()=>{N.current?.getModel()?.original.setValue(r||"")},[r],T),gt(()=>{let{original:W,modified:ne}=N.current.getModel();O.current.editor.setModelLanguage(W,n||t||"text"),O.current.editor.setModelLanguage(ne,i||t||"text")},[t,n,i],T),gt(()=>{O.current?.editor.setTheme(c)},[c],T),gt(()=>{N.current?.updateOptions(d)},[d],T);let Y=z.useCallback(()=>{if(!O.current)return;q.current(O.current);let W=En(O.current,r||"",n||t||"text",s||""),ne=En(O.current,e||"",i||t||"text",o||"");N.current?.setModel({original:W,modified:ne})},[t,e,i,r,n,s,o]),he=z.useCallback(()=>{!te.current&&$.current&&(N.current=O.current.editor.createDiffEditor($.current,{automaticLayout:!0,...d}),Y(),O.current?.editor.setTheme(c),D(!0),te.current=!0)},[d,c,Y]);z.useEffect(()=>{T&&F.current(N.current,O.current)},[T]),z.useEffect(()=>{!P&&!T&&he()},[P,T,he]);function Q(){let W=N.current?.getModel();a||W?.original?.dispose(),l||W?.modified?.dispose(),N.current?.dispose()}return z.createElement(bc,{width:f,height:h,isEditorReady:T,loading:u,_ref:$,className:m,wrapperProps:y})}var rg=tg;z.memo(rg);function ng(r){let e=z.useRef();return z.useEffect(()=>{e.current=r},[r]),e.current}var ig=ng,ns=new Map;function sg({defaultValue:r,defaultLanguage:e,defaultPath:t,value:n,language:i,path:s,theme:o="light",line:a,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:h=!1,width:f="100%",height:m="100%",className:y,wrapperProps:v={},beforeMount:x=ci,onMount:T=ci,onChange:D,onValidate:P=ci}){let[E,N]=z.useState(!1),[O,$]=z.useState(!0),F=z.useRef(null),q=z.useRef(null),te=z.useRef(null),Y=z.useRef(T),he=z.useRef(x),Q=z.useRef(),W=z.useRef(n),ne=ig(s),ve=z.useRef(!1),ge=z.useRef(!1);xc(()=>{let w=vc.init();return w.then(I=>(F.current=I)&&$(!1)).catch(I=>I?.type!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>q.current?C():w.cancel()}),gt(()=>{let w=En(F.current,r||n||"",e||i||"",s||t||"");w!==q.current?.getModel()&&(d&&ns.set(ne,q.current?.saveViewState()),q.current?.setModel(w),d&&q.current?.restoreViewState(ns.get(s)))},[s],E),gt(()=>{q.current?.updateOptions(c)},[c],E),gt(()=>{!q.current||n===void 0||(q.current.getOption(F.current.editor.EditorOption.readOnly)?q.current.setValue(n):n!==q.current.getValue()&&(ge.current=!0,q.current.executeEdits("",[{range:q.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),q.current.pushUndoStop(),ge.current=!1))},[n],E),gt(()=>{let w=q.current?.getModel();w&&i&&F.current?.editor.setModelLanguage(w,i)},[i],E),gt(()=>{a!==void 0&&q.current?.revealLine(a)},[a],E),gt(()=>{F.current?.editor.setTheme(o)},[o],E);let Ae=z.useCallback(()=>{if(!(!te.current||!F.current)&&!ve.current){he.current(F.current);let w=s||t,I=En(F.current,n||r||"",e||i||"",w||"");q.current=F.current?.editor.create(te.current,{model:I,automaticLayout:!0,...c},u),d&&q.current.restoreViewState(ns.get(w)),F.current.editor.setTheme(o),a!==void 0&&q.current.revealLine(a),N(!0),ve.current=!0}},[r,e,t,n,i,s,c,u,d,o,a]);z.useEffect(()=>{E&&Y.current(q.current,F.current)},[E]),z.useEffect(()=>{!O&&!E&&Ae()},[O,E,Ae]),W.current=n,z.useEffect(()=>{E&&D&&(Q.current?.dispose(),Q.current=q.current?.onDidChangeModelContent(w=>{ge.current||D(q.current.getValue(),w)}))},[E,D]),z.useEffect(()=>{if(E){let w=F.current.editor.onDidChangeMarkers(I=>{let L=q.current.getModel()?.uri;if(L&&I.find(B=>B.path===L.path)){let B=F.current.editor.getModelMarkers({resource:L});P?.(B)}});return()=>{w?.dispose()}}return()=>{}},[E,P]);function C(){Q.current?.dispose(),h?d&&ns.set(s,q.current.saveViewState()):q.current.getModel()?.dispose(),q.current.dispose()}return z.createElement(bc,{width:f,height:m,isEditorReady:E,loading:l,_ref:te,className:y,wrapperProps:v})}var og=sg,ag=z.memo(og);const lg={automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},Sc=({content:r,onChange:e,onRebuild:t,onSave:n})=>{const i=z.useRef(null),s=z.useRef(null),o=z.useRef(null),[,a]=z.useState(!1),[,l]=z.useState(!1),c=z.useRef(t),u=z.useRef(n);z.useEffect(()=>{c.current=t},[t]),z.useEffect(()=>{u.current=n},[n]),z.useEffect(()=>()=>{s.current?.dispose?.(),o.current&&clearTimeout(o.current)},[]),z.useEffect(()=>{const m=i.current;if(!m)return;const y=m.getModel();if(y&&y.getValue()!==r){const v=m.getPosition(),x=m.getSelections();y.setValue(r),v&&m.setPosition(v),x&&m.setSelections(x)}},[r]);const d=(m,y)=>{i.current=m;const v=m.getModel();v&&v.getValue()!==r&&v.setValue(r),s.current?.dispose?.(),s.current=m.onDidChangeModelContent(()=>{h()}),h(),m.addCommand(y.KeyMod.CtrlCmd|y.KeyCode.Enter,()=>{c.current?.()}),m.addCommand(y.KeyMod.CtrlCmd|y.KeyCode.KeyS,()=>{u.current?.()})},h=()=>{const m=i.current?.getModel?.();if(m&&typeof m.canUndo=="function"&&typeof m.canRedo=="function")try{a(m.canUndo()),l(m.canRedo());return}catch{}const y=!!i.current;a(y),l(y)},f=m=>{e(m)};return J.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:J.jsx("div",{style:{flex:1},children:J.jsx(ag,{options:lg,height:"100%",language:"xml",defaultValue:r,onMount:d,onChange:m=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{f(m||"")},500)}})})})};function Je(r){this.content=r}Je.prototype={constructor:Je,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Je(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Je(t)},addToStart:function(r,e){return new Je([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Je(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Je(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Je.from(r),r.size?new Je(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Je.from(r),r.size?new Je(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Je.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},Je.from=function(r){if(r instanceof Je)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Je(e)};function kc(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=kc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Mc(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||a.content.size){let c=Mc(o.content,a.content,t-1,n-1);if(c)return c}t-=l,n-=l}}class H{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),n,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new H(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new H(n,i)}cutByIndex(e,t){return e==t?H.empty:e==0&&t==this.content.length?this:new H(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new H(i,s)}addToStart(e){return new H([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new H(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return kc(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Mc(this,e,t,n)}findIndex(e){if(e==0)return is(0,e);if(e==this.size)return is(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?is(t+1,s):is(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return H.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new H(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return H.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new H(t||e,n)}static from(e){if(!e)return H.empty;if(e instanceof H)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new H([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}H.empty=new H([],0);const Go={index:0,offset:0};function is(r,e){return Go.index=r,Go.offset=e,Go}function ss(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!ss(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!ss(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Me=class A0{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ss(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return A0.none;if(e instanceof A0)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Me.none=[];class as extends Error{}class X{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Cc(this.content,e+this.openStart,t);return n&&new X(n,this.openStart,this.openEnd)}removeBetween(e,t){return new X(Tc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return X.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new X(H.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new X(e,n,i)}}X.empty=new X(H.empty,0,0);function Tc(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Tc(s.content,e-i-1,t-i-1)))}function Cc(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Cc(o.content,e-s-1,t,o);return a&&r.replaceChild(i,o.copy(a))}function cg(r,e,t){if(t.openStart>r.depth)throw new as("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new as("Inconsistent open depths");return Ec(r,e,t,0)}function Ec(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Ec(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return rn(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=ug(t,r);return rn(s,Oc(r,o,a,e,n))}else return rn(s,ls(r,e,n))}function Ac(r,e){if(!e.type.compatibleContent(r.type))throw new as("Cannot join "+e.type.name+" onto "+r.type.name)}function Ko(r,e,t){let n=r.node(t);return Ac(n,e.node(t)),n}function tn(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ui(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(tn(r.nodeAfter,n),s++));for(let a=s;a<o;a++)tn(i.child(a),n);e&&e.depth==t&&e.textOffset&&tn(e.nodeBefore,n)}function rn(r,e){return r.type.checkContent(e),r.copy(e)}function Oc(r,e,t,n,i){let s=r.depth>i&&Ko(r,e,i+1),o=n.depth>i&&Ko(t,n,i+1),a=[];return ui(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(Ac(s,o),tn(rn(s,Oc(r,e,t,n,i+1)),a)):(s&&tn(rn(s,ls(r,e,i+1)),a),ui(e,t,i,a),o&&tn(rn(o,ls(t,n,i+1)),a)),ui(n,null,i,a),new H(a)}function ls(r,e,t){let n=[];if(ui(null,r,t,n),r.depth>t){let i=Ko(r,e,t+1);tn(rn(i,ls(r,e,t+1)),n)}return ui(e,null,t,n),new H(n)}function ug(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(H.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class di{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Me.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new cs(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(n.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new di(t,n,s)}static resolveCached(e,t){let n=Nc.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Nc.set(e,n=new dg);let i=n.elts[n.i]=di.resolve(e,t);return n.i=(n.i+1)%hg,i}}class dg{constructor(){this.elts=[],this.i=0}}const hg=12,Nc=new WeakMap;class cs{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fg=Object.create(null);let Mr=class O0{constructor(e,t,n,i=Me.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||H.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ss(this.attrs,t||e.defaultAttrs||fg)&&Me.sameSet(this.marks,n||Me.none)}copy(e=null){return e==this.content?this:new O0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new O0(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return X.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new X(c,i.depth-o,s.depth-o)}replace(e,t,n){return cg(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return di.resolveCached(this,e)}resolveNoCache(e){return di.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Dc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=H.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Me.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Me.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=H.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Mr.prototype.text=void 0;let pg=class N0 extends Mr{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Dc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new N0(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new N0(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Dc(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class nn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new mg(e,t);if(n.next==null)return nn.empty;let i=zc(n);n.next&&n.err("Unexpected trailing text");let s=Sg(wg(i));return kg(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return H.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
17
+ `)}}nn.empty=new nn(!0);class mg{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function zc(r){let e=[];do e.push(gg(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gg(r){let e=[];do e.push(yg(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yg(r){let e=xg(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=vg(r,e);else break;return e}function Ic(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function vg(r,e){let t=Ic(r),n=t;return r.eat(",")&&(r.next!="}"?n=Ic(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function bg(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function xg(r){if(r.eat("(")){let e=zc(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=bg(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function wg(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();n(l,u),i(s(o.expr,l),u),l=u}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Rc(r,e){return e-r}function Pc(r,e){let t=[];return n(e),t.sort(Rc);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function Sg(r){let e=Object.create(null);return t(Pc(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Pc(r,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[n.join(",")]=new nn(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Rc);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function kg(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Lc(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Bc(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Fc(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function $c(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Tg(r,n,e[n]);return t}let Hc=class f1{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=$c(e,n.attrs),this.defaultAttrs=Lc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==nn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Bc(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Mr(this,this.computeAttrs(e),H.from(t),Me.setFrom(n))}createChecked(e=null,t,n){return t=H.from(t),this.checkContent(t),new Mr(this,this.computeAttrs(e),t,Me.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=H.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(H.empty,!0);return s?new Mr(this,e,t.append(s),Me.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Fc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Me.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new f1(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Mg(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Tg{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Mg(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class us{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=$c(e,i.attrs),this.excluded=null;let s=Lc(this.attrs);this.instance=s?new Me(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Me(this,Bc(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new us(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Vc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Je.from(e.nodes),t.marks=Je.from(e.marks||{}),this.nodes=Hc.compile(this.spec.nodes,this),this.marks=us.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=nn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?qc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:qc(this,o.split(" "))}this.nodeFromJSON=i=>Mr.fromJSON(this,i),this.markFromJSON=i=>Me.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Hc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new pg(n,n.defaultAttrs,e,Me.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function qc(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Cg(r){return r.tag!=null}function Eg(r){return r.style!=null}class Tr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Cg(i))this.tags.push(i);else if(Eg(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new Wc(this,t,!1);return n.addAll(e,Me.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Wc(this,t,!0);return n.addAll(e,Me.none,t.from,t.to),X.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Ng(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Gc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Gc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Tr(e,Tr.schemaRules(e)))}}const _c={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ag={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jc={ol:!0,ul:!0},hi=1,Jo=2,fi=4;function Uc(r,e,t){return e!=null?(e?hi:0)|(e==="full"?Jo:0):r&&r.whitespace=="pre"?hi|Jo:t&~fi}class ds{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Me.none,this.match=s||(o&fi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(H.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&hi)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=H.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(H.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_c.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Wc{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Uc(null,t.preserveWhitespace,0)|(n?fi:0);i?s=new ds(i.type,i.attrs,Me.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new ds(null,null,Me.none,!0,null,o):s=new ds(e.schema.topNodeType,null,Me.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Jo?"full":this.localPreserveWS||(i.options&hi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
18
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;jc.hasOwnProperty(o)&&this.parser.normalizeLists&&Og(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Ag.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(_c.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
19
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(n)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Me.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Kc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Uc(e,s,o.options);o.options&fi&&o.content.length==0&&(a|=fi);let l=Me.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):Kc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ds(e,t,l,i,null,a)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=hi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function Og(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&jc.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Ng(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Gc(r){let e={};for(let t in r)e[t]=r[t];return e}function Kc(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class sn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Xo(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=hs(Xo(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&hs(Xo(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return hs(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Jc(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Jc(e.marks)}}function Jc(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Xo(r){return r.document||window.document}const Xc=new WeakMap;function Dg(r){let e=Xc.get(r);return e===void 0&&Xc.set(r,e=zg(r)),e}function zg(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function hs(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Dg(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:m}=hs(r,h,t,n);if(l.appendChild(f),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Yc=65535,Zc=Math.pow(2,16);function Ig(r,e){return r+e*Zc}function Qc(r){return r&Yc}function Rg(r){return(r-(r&Yc))/Zc}const eu=1,tu=2,fs=4,ru=8;class Yo{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&ru)>0}get deletedBefore(){return(this.delInfo&(eu|fs))>0}get deletedAfter(){return(this.delInfo&(tu|fs))>0}get deletedAcross(){return(this.delInfo&fs)>0}}class yt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yt.empty)return yt.empty}recover(e){let t=0,n=Qc(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Rg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:u);if(n)return f;let m=e==(t<0?l:d)?null:Ig(a/3,e-l),y=e==l?tu:e==d?eu:fs;return(t<0?e!=l:e!=d)&&(y|=ru),new Yo(f,y,m)}i+=u-c}return n?e+i:new Yo(e+i,0,null)}touches(e,t){let n=0,i=Qc(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+n];e(a,a+c,l,l+u),s+=u-c}}invert(){return new yt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yt.empty:new yt(e<0?[0,-e,0]:[0,0,e])}}yt.empty=new yt([]);class pi{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new pi(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new pi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new Yo(e,i,null)}}const Zo=Object.create(null);class Ze{getMap(){return yt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Zo[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Zo)throw new RangeError("Duplicate use of step JSON ID "+e);return Zo[e]=t,t.prototype.jsonID=e,t}}class He{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new He(e,null)}static fail(e){return new He(null,e)}static fromReplace(e,t,n,i){try{return He.ok(e.replace(t,n,i))}catch(s){if(s instanceof as)return He.fail(s.message);throw s}}}function Qo(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Qo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return H.fromArray(n)}class Cr extends Ze{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new X(Qo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return He.fromReplace(e,this.from,this.to,s)}invert(){return new Pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Cr(t.pos,n.pos,this.mark)}merge(e){return e instanceof Cr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Cr(t.from,t.to,e.markFromJSON(t.mark))}}Ze.jsonID("addMark",Cr);class Pt extends Ze{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new X(Qo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return He.fromReplace(e,this.from,this.to,n)}invert(){return new Cr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Pt(t.pos,n.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Pt(t.from,t.to,e.markFromJSON(t.mark))}}Ze.jsonID("removeMark",Pt);class Er extends Ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Er(this.pos,t.marks[i]);return new Er(this.pos,this.mark)}}return new on(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}Ze.jsonID("addNodeMark",Er);class on extends Ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new on(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new on(t.pos,e.markFromJSON(t.mark))}}Ze.jsonID("removeNodeMark",on);class Ue extends Ze{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&ea(e,this.from,this.to)?He.fail("Structure replace would overwrite content"):He.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ue(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Ue(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ue)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?X.empty:new X(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ue(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?X.empty:new X(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ue(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ue(t.from,t.to,X.fromJSON(e,t.slice),!!t.structure)}}Ze.jsonID("replace",Ue);class We extends Ze{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(ea(e,this.from,this.gapFrom)||ea(e,this.gapTo,this.to)))return He.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return He.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?He.fromReplace(e,this.from,this.to,n):He.fail("Content does not fit in gap")}getMap(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new We(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new We(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new We(t.from,t.to,t.gapFrom,t.gapTo,X.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ze.jsonID("replaceAround",We);function ea(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Pg(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!n.isInSet(d)&&u.type.allowsMarkType(n.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),m=n.addToSet(d);for(let y=0;y<d.length;y++)d[y].isInSet(m)||(o&&o.to==h&&o.mark.eq(d[y])?o.to=f:i.push(o=new Pt(h,f,d[y])));a&&a.to==h?a.to=f:s.push(a=new Cr(h,f,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function Lg(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof us){let c=o.marks,u;for(;u=n.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let m=i[f];m.step==s-1&&d.eq(i[f].style)&&(h=m)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>r.step(new Pt(o.from,o.to,o.style)))}function ta(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=n.matchType(c.type);if(!d)o.push(new Ue(a,u,X.empty));else{n=d;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||r.step(new Pt(a,u,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,m;for(;h=f.exec(c.text);)m||(m=new X(H.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Ue(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!n.validEnd){let l=n.fillBefore(H.empty,!0);r.replace(a,a,new X(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function Bg(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function An(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),a=r.$from.index(n)+i,l=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!Bg(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Fg(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,c=a,u=H.empty,d=0;for(let m=s,y=!1;m>t;m--)y||n.index(m)>0?(y=!0,u=H.from(n.node(m).copy(u)),d++):l--;let h=H.empty,f=0;for(let m=s,y=!1;m>t;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=H.from(i.node(m).copy(h)),f++):c++;r.step(new We(l,c,o,a,new X(u.append(h),d,f),u.size-d,!0))}function ra(r,e,t=null,n=r){let i=$g(r,e),s=i&&Hg(n,e);return s?i.map(nu).concat({type:e,attrs:t}).concat(s.map(nu)):null}function nu(r){return{type:r,attrs:null}}function $g(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function Hg(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function Vg(r,e,t){let n=H.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=H.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new We(i,s,i,s,new X(n,0,0),t.length,!0))}function qg(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&_g(r.doc,r.mapping.slice(s).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let f=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);f&&!m?c=!1:!f&&m&&(c=!0)}c===!1&&su(r,o,a,s),ta(r,r.mapping.slice(s).map(a,1),n,void 0,c===null);let u=r.mapping.slice(s),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return r.step(new We(d,h,d+1,h-1,new X(H.from(n.create(l,null,o.marks)),0,0),1,!0)),c===!0&&iu(r,o,a,s),!1}})}function iu(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function su(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
20
+ `))}})}function _g(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function jg(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new We(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new X(H.from(o),0,0),1,!0))}function rr(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),m=n&&n[u+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let y=n&&n[u]||d;if(!d.canReplace(h+1,d.childCount)||!y.type.validContent(f))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Ug(r,e,t=1,n){let i=r.doc.resolve(e),s=H.empty,o=H.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=H.from(i.node(a).copy(s));let u=n&&n[c];o=H.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}r.step(new Ue(e,e,new X(s.append(o),t,t),!0))}function Ar(r,e){let t=r.resolve(e),n=t.index();return ou(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function Wg(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function ou(r,e){return!!(r&&e&&!r.isLeaf&&Wg(r,e))}function ps(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&ou(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function Gg(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?n=!1:!u&&d&&(n=!0)}let a=r.steps.length;if(n===!1){let u=r.doc.resolve(e+t);su(r,u.node(),u.before(),a)}o.inlineContent&&ta(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),c=l.map(e-t);if(r.step(new Ue(c,l.map(e+t,-1),X.empty,!0)),n===!0){let u=r.doc.resolve(c);iu(r,u.node(),u.before(),r.steps.length)}return r}function Kg(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function au(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),c=n.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function ms(r,e,t=e,n=X.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return lu(i,s,n)?new Ue(e,t,n):new Jg(i,s,n).fit()}function lu(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class Jg{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=H.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=H.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new X(s,o,a);return e>-1?new We(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Ue(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=na(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(H.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=na(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new X(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=na(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new X(mi(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new X(mi(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(i){for(let y=0;y<i.childCount;y++)u.push(i.child(y));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),v=d.matchType(y.type);if(!v)break;c++,(c>1||l==0||y.content.size)&&(d=v,u.push(cu(y.mark(h.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=gi(this.placed,t,H.from(u)),this.frontier[t].match=d,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,v=a;y<f;y++){let x=v.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),v=x.content}this.unplaced=m?e==0?X.empty:new X(mi(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new X(mi(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ia(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ia(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ia(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gi(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=gi(this.placed,this.depth,H.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(H.empty,!0);t.childCount&&(this.placed=gi(this.placed,this.frontier.length,t))}}function mi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(mi(r.firstChild.content,e-1,t)))}function gi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(gi(r.lastChild.content,e-1,t)))}function na(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function cu(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,cu(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(H.empty,!0)))),r.copy(n)}function ia(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!Xg(t,s.content,o)?a:null}function Xg(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Yg(r){return r.spec.defining||r.spec.definingForContent}function Zg(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(lu(i,s,n))return r.step(new Ue(e,t,n));let o=du(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=n.openStart;for(let h=n.content,f=0;;f++){let m=h.firstChild;if(c.push(m),f==n.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let f=c[h],m=Yg(f.type);if(m&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(m||!f.type.isTextblock)break}for(let h=n.openStart;h>=0;h--){let f=(h+u+1)%(n.openStart+1),m=c[f];if(m)for(let y=0;y<o.length;y++){let v=o[(y+l)%o.length],x=!0;v<0&&(x=!1,v=-v);let T=i.node(v-1),D=i.index(v-1);if(T.canReplaceWith(D,D,m.type,m.marks))return r.replace(i.before(v),x?s.after(v):t,new X(uu(n.content,0,n.openStart,f),f,n.openEnd))}}let d=r.steps.length;for(let h=o.length-1;h>=0&&(r.replace(e,t,n),!(r.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function uu(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(uu(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(H.empty,!0))}return r}function Qg(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=Kg(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new X(H.from(n),0,0))}function e2(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=du(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function du(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class On extends Ze{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return He.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return He.fromReplace(e,this.pos,this.pos+1,new X(H.from(i),0,t.isLeaf?0:1))}getMap(){return yt.empty}invert(e){return new On(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new On(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new On(t.pos,t.attr,t.value)}}Ze.jsonID("attr",On);class yi extends Ze{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return He.ok(n)}getMap(){return yt.empty}invert(e){return new yi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yi(t.attr,t.value)}}Ze.jsonID("docAttr",yi);let Nn=class extends Error{};Nn=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},Nn.prototype=Object.create(Error.prototype),Nn.prototype.constructor=Nn,Nn.prototype.name="TransformError";class hu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new pi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Nn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=X.empty){let i=ms(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new X(H.from(n),0,0))}delete(e,t){return this.replace(e,t,X.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Zg(this,e,t,n),this}replaceRangeWith(e,t,n){return Qg(this,e,t,n),this}deleteRange(e,t){return e2(this,e,t),this}lift(e,t){return Fg(this,e,t),this}join(e,t=1){return Gg(this,e,t),this}wrap(e,t){return Vg(this,e,t),this}setBlockType(e,t=e,n,i=null){return qg(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return jg(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new On(e,t,n)),this}setDocAttribute(e,t){return this.step(new yi(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Me)t.isInSet(n.marks)&&this.step(new on(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new on(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return Ug(this,e,t,n),this}addMark(e,t,n){return Pg(this,e,t,n),this}removeMark(e,t,n){return Lg(this,e,t,n),this}clearIncompatible(e,t,n){return ta(this,e,t,n),this}}const sa=Object.create(null);class ce{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new fu(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=X.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?X.empty:t),a==0&&gu(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),gu(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new de(e):Dn(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Dn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):Dn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new vt(e.node(0))}static atStart(e){return Dn(e,e,0,0,1)||new vt(e)}static atEnd(e){return Dn(e,e,e.content.size,e.childCount,-1)||new vt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=sa[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sa)throw new RangeError("Duplicate use of selection JSON ID "+e);return sa[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}ce.prototype.visible=!0;class fu{constructor(e,t){this.$from=e,this.$to=t}}let pu=!1;function mu(r){!pu&&!r.parent.inlineContent&&(pu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class de extends ce{constructor(e,t=e){mu(e),mu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return ce.near(n);let i=e.resolve(t.map(this.anchor));return new de(i.parent.inlineContent?i:n,n)}replace(e,t=X.empty){if(super.replace(e,t),t==X.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=ce.findFrom(t,n,!0)||ce.findFrom(t,-n,!0);if(s)t=s.$head;else return ce.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(ce.findFrom(e,-n,!0)||ce.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new de(e,t)}}ce.jsonID("text",de);class gs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gs(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class se extends ce{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?ce.near(s):new se(s)}content(){return new X(H.from(this.node),0,0)}eq(e){return e instanceof se&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new oa(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new se(e.resolve(t.anchor))}static create(e,t){return new se(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}se.prototype.visible=!1,ce.jsonID("node",se);class oa{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new gs(n,n):new oa(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&se.isSelectable(n)?new se(t):ce.near(t)}}class vt extends ce{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=X.empty){if(t==X.empty){e.delete(0,e.doc.content.size);let n=ce.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vt(e)}map(e){return new vt(e)}eq(e){return e instanceof vt}getBookmark(){return t2}}ce.jsonID("all",vt);const t2={map(){return this},resolve(r){return new vt(r)}};function Dn(r,e,t,n,i,s=!1){if(e.inlineContent)return de.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&se.isSelectable(a))return se.create(r,t-(i<0?a.nodeSize:0))}else{let l=Dn(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function gu(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof Ue||i instanceof We))return;let s=r.mapping.maps[n],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),r.setSelection(ce.near(r.doc.resolve(o),t))}const yu=1,ys=2,vu=4;class r2 extends hu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|yu)&~ys,this.storedMarks=null,this}get selectionSet(){return(this.updated&yu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ys,this}ensureMarks(e){return Me.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ys)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ys,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Me.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ce.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=vu,this}get scrolledIntoView(){return(this.updated&vu)>0}}function bu(r,e){return!e||!r?r:r.bind(e)}class vi{constructor(e,t,n){this.name=e,this.init=bu(t.init,n),this.apply=bu(t.apply,n)}}const n2=[new vi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new vi("selection",{init(r,e){return r.selection||ce.atStart(e.doc)},apply(r){return r.selection}}),new vi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new vi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class aa{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=n2.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new vi(n.key,n.spec.state,n))})}}class zn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,n);if(u&&n.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(u),n=n.applyInner(u),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new zn(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new r2(this)}static create(e){let t=new aa(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new zn(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new aa(this.schema,e.plugins),n=t.fields,i=new zn(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new aa(e.schema,e.plugins),s=new zn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Mr.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=ce.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function xu(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=xu(i,e,{})),t[n]=i}return t}class Pe{constructor(e){this.spec=e,this.props={},e.props&&xu(e.props,this,this.props),this.key=e.key?e.key.key:wu("plugin")}getState(e){return e[this.key]}}const la=Object.create(null);function wu(r){return r in la?r+"$"+ ++la[r]:(la[r]=0,r+"$")}class Fe{constructor(e="key"){this.key=wu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ca=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Su(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const ku=(r,e,t)=>{let n=Su(r,t);if(!n)return!1;let i=ua(n);if(!i){let o=n.blockRange(),a=o&&An(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(zu(r,i,e,-1))return!0;if(n.parent.content.size==0&&(In(s,"end")||se.isSelectable(s)))for(let o=n.depth;;o--){let a=ms(r.doc,n.before(o),n.after(o),X.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(In(s,"end")?ce.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):se.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},i2=(r,e,t)=>{let n=Su(r,t);if(!n)return!1;let i=ua(n);return i?Mu(r,i,e):!1},s2=(r,e,t)=>{let n=Cu(r,t);if(!n)return!1;let i=da(n);return i?Mu(r,i,e):!1};function Mu(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=ms(r.doc,s,l,X.empty);if(!c||c.from!=s||c instanceof Ue&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(de.create(u.doc,s)),t(u.scrollIntoView())}return!0}function In(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Tu=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=ua(n)}let o=s&&s.nodeBefore;return!o||!se.isSelectable(o)?!1:(e&&e(r.tr.setSelection(se.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ua(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Cu(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Eu=(r,e,t)=>{let n=Cu(r,t);if(!n)return!1;let i=da(n);if(!i)return!1;let s=i.nodeAfter;if(zu(r,i,e,1))return!0;if(n.parent.content.size==0&&(In(s,"start")||se.isSelectable(s))){let o=ms(r.doc,n.before(),n.after(),X.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(In(s,"start")?ce.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):se.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Au=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=da(n)}let o=s&&s.nodeAfter;return!o||!se.isSelectable(o)?!1:(e&&e(r.tr.setSelection(se.create(r.doc,s.pos)).scrollIntoView()),!0)};function da(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const o2=(r,e)=>{let t=r.selection,n=t instanceof se,i;if(n){if(t.node.isTextblock||!Ar(r.doc,t.from))return!1;i=t.from}else if(i=ps(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(se.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},a2=(r,e)=>{let t=r.selection,n;if(t instanceof se){if(t.node.isTextblock||!Ar(r.doc,t.to))return!1;n=t.to}else if(n=ps(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},l2=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&An(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},Ou=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
21
+ `).scrollIntoView()),!0)};function ha(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const c2=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=ha(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ce.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Nu=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof vt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=ha(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(de.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Du=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(rr(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&An(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function u2(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof se&&e.selection.node.isBlock)return!n.parentOffset||!rr(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=n.depth;;f--)if(n.node(f).isBlock){l=n.end(f)==n.pos+(n.depth-f),c=n.start(f)==n.pos-(n.depth-f),a=ha(n.node(f-1).contentMatchAt(n.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof de||e.selection instanceof vt)&&u.deleteSelection();let d=u.mapping.map(n.pos),h=rr(u.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=rr(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!l&&c&&n.node(o).type!=a){let f=u.mapping.map(n.before(o)),m=u.doc.resolve(f);a&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(o)),a)}return t&&t(u.scrollIntoView()),!0}}const d2=u2(),h2=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(se.create(r.doc,i))),!0)};function f2(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ar(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function zu(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&f2(r,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,m=H.empty;for(let x=o.length-1;x>=0;x--)m=H.from(o[x].create(null,m));m=H.from(i.copy(m));let y=r.tr.step(new We(e.pos-1,f,e.pos,f,new X(m,1,0),o.length,!0)),v=y.doc.resolve(f+2*o.length);v.nodeAfter&&v.nodeAfter.type==i.type&&Ar(y.doc,v.pos)&&y.join(v.pos),t(y.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:ce.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&An(d);if(h!=null&&h>=e.depth)return t&&t(r.tr.lift(d,h).scrollIntoView()),!0;if(c&&In(s,"start",!0)&&In(i,"end")){let f=i,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let y=s,v=1;for(;!y.isTextblock;y=y.firstChild)v++;if(f.canReplace(f.childCount,f.childCount,y.content)){if(t){let x=H.empty;for(let D=m.length-1;D>=0;D--)x=H.from(m[D].copy(x));let T=r.tr.step(new We(e.pos-m.length,e.pos+s.nodeSize,e.pos+v,e.pos+s.nodeSize-v,new X(x,m.length,0),0,!0));t(T.scrollIntoView())}return!0}}return!1}function Iu(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const p2=Iu(-1),m2=Iu(1);function g2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&ra(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Ru(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function fa(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}fa(ca,ku,Tu),fa(ca,Eu,Au),fa(Ou,Nu,Du,d2),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function y2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return v2(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function v2(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new cs(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new cs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ra(s,t,n,e);return a?(r&&b2(r,e,a,i,t),!0):!1}function b2(r,e,t,n,i){let s=H.empty;for(let u=t.length-1;u>=0;u--)s=H.from(t[u].type.create(t[u].attrs,s));r.step(new We(e.start-(n?2:0),e.end,e.start,e.end,new X(s,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==i&&(o=u+1);let a=t.length-o,l=e.start+t.length-(n?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&rr(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return r}function x2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?w2(e,t,r,s):S2(e,t,s):!0:!1}}function w2(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new We(s-1,o,s,o,new X(H.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new cs(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=An(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ar(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function S2(r,e,t){let n=r.tr,i=t.parent;for(let f=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)f-=i.child(m).nodeSize,n.delete(f-1,f+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?H.empty:H.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return n.step(new We(d-(a?1:0),h+(l?1:0),d+1,h-1,new X((a?H.empty:H.from(i.copy(H.empty))).append(l?H.empty:H.from(i.copy(H.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function k2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=H.from(c?r.create():null),d=new X(H.from(r.create(null,H.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new We(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const Xe=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Rn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let pa=null;const nr=function(r,e,t){let n=pa||(pa=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},M2=function(){pa=null},an=function(r,e,t,n){return t&&(Pu(r,e,t,n,-1)||Pu(r,e,t,n,1))},T2=/^(img|br|input|textarea|hr)$/i;function Pu(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Mt(r))){let o=r.parentNode;if(!o||o.nodeType!=1||bi(r)||T2.test(r.nodeName)||r.contentEditable=="false")return!1;e=Xe(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?Mt(r):0}else return!1}}function Mt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function C2(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Mt(r)}else if(r.parentNode&&!bi(r))e=Xe(r),r=r.parentNode;else return null}}function E2(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!bi(r))e=Xe(r)+1,r=r.parentNode;else return null}}function A2(r,e,t){for(let n=e==0,i=e==Mt(r);n||i;){if(r==t)return!0;let s=Xe(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Mt(r)}}function bi(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const vs=function(r){return r.focusNode&&an(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function ln(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function O2(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function N2(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Mt(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Mt(n.startContainer),n.startOffset)}}}const Vt=typeof navigator<"u"?navigator:null,Lu=typeof document<"u"?document:null,Or=Vt&&Vt.userAgent||"",ma=/Edge\/(\d+)/.exec(Or),Bu=/MSIE \d/.exec(Or),ga=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Or),ut=!!(Bu||ga||ma),Nr=Bu?document.documentMode:ga?+ga[1]:ma?+ma[1]:0,Tt=!ut&&/gecko\/(\d+)/i.test(Or);Tt&&+(/Firefox\/(\d+)/.exec(Or)||[0,0])[1];const ya=!ut&&/Chrome\/(\d+)/.exec(Or),Ge=!!ya,Fu=ya?+ya[1]:0,Qe=!ut&&!!Vt&&/Apple Computer/.test(Vt.vendor),Pn=Qe&&(/Mobile\/\w+/.test(Or)||!!Vt&&Vt.maxTouchPoints>2),Ct=Pn||(Vt?/Mac/.test(Vt.platform):!1),$u=Vt?/Win/.test(Vt.platform):!1,ir=/Android \d/.test(Or),xi=!!Lu&&"webkitFontSmoothing"in Lu.documentElement.style,D2=xi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z2(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function sr(r,e){return typeof r=="number"?r:r[e]}function I2(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function Hu(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;){if(o.nodeType!=1){o=Rn(o);continue}let a=o,l=a==s.body,c=l?z2(s):I2(a),u=0,d=0;if(e.top<c.top+sr(n,"top")?d=-(c.top-e.top+sr(i,"top")):e.bottom>c.bottom-sr(n,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+sr(i,"top")-c.top:e.bottom-c.bottom+sr(i,"bottom")),e.left<c.left+sr(n,"left")?u=-(c.left-e.left+sr(i,"left")):e.right>c.right-sr(n,"right")&&(u=e.right-c.right+sr(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let y=a.scrollLeft-f,v=a.scrollTop-m;e={left:e.left-y,top:e.top-v,right:e.right-y,bottom:e.bottom-v}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Rn(o)}}function R2(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=r.root.elementFromPoint(s,o);if(!a||a==r.dom||!r.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){n=a,i=l.top;break}}return{refDOM:n,refTop:i,stack:Vu(r.dom)}}function Vu(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Rn(n));return e}function P2({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;qu(t,n==0?0:n-e)}function qu(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let Ln=null;function L2(r){if(r.setActive)return r.setActive();if(Ln)return r.focus(Ln);let e=Vu(r);r.focus(Ln==null?{get preventScroll(){return Ln={preventScroll:!0},!0}}:void 0),Ln||(Ln=!1,qu(e,0))}function _u(r,e){let t,n=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=r.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=nr(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let m=h[f];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<n){t=u,n=y,i=y&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(s=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=c,n=0),t&&t.nodeType==3?B2(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:_u(t,i)}function B2(r,e){let t=r.nodeValue.length,n=document.createRange(),i;for(let s=0;s<t;s++){n.setEnd(r,s+1),n.setStart(r,s);let o=Dr(n,1);if(o.top!=o.bottom&&va(e,o)){i={node:r,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:r,offset:0}}function va(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function F2(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function $2(r,e,t){let{node:n,offset:i}=_u(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function H2(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let a=r.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>n.left||l.top>n.top?i=a.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function ju(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(va(e,c))return ju(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function V2(r,e){let t=r.dom.ownerDocument,n,i=0,s=N2(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),a;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=r.dom.getBoundingClientRect();if(!va(e,c)||(o=ju(r.dom,e,c),!o))return null}if(Qe)for(let c=o;n&&c;c=Rn(c))c.draggable&&(n=void 0);if(o=F2(o,e),n){if(Tt&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let u=n.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;xi&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=H2(r,n,i,e))}a==null&&(a=$2(r,o,e));let l=r.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Uu(r){return r.top<r.bottom||r.left<r.right}function Dr(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(Uu(n))return n}return Array.prototype.find.call(t,Uu)||r.getBoundingClientRect()}const q2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Wu(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=xi||Tt;if(n.nodeType==3)if(o&&(q2.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=Dr(nr(n,i,i),t);if(Tt&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=Dr(nr(n,i-1,i-1),-1);if(c.top==l.top){let u=Dr(nr(n,i,i+1),-1);if(u.top!=l.top)return wi(u,u.left<c.left)}}return l}else{let l=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==n.nodeValue.length?(l--,u=1):t<0?l--:c++,wi(Dr(nr(n,l,c),u),u<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Mt(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!1)}if(s==null&&i<Mt(n)){let l=n.childNodes[i];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!0)}return ba(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Mt(n))){let l=n.childNodes[i-1],c=l.nodeType==3?nr(l,Mt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return wi(Dr(c,1),!1)}if(s==null&&i<Mt(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?nr(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return wi(Dr(c,-1),!0)}return wi(Dr(n.nodeType==3?nr(n):n,-t),t>=0)}function wi(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function ba(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function Gu(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function _2(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Gu(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=r.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Wu(r,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=nr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const j2=/[\u0590-\u08ac]/;function U2(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,a=r.domSelection();return a?!j2.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Gu(r,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=r.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:m,focusOffset:y}=r.domSelectionRange(),v=m&&!f.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),v}):n.pos==n.start()||n.pos==n.end()}let Ku=null,Ju=null,Xu=!1;function W2(r,e,t){return Ku==e&&Ju==t?Xu:(Ku=e,Ju=t,Xu=t=="up"||t=="down"?_2(r,e,t):U2(r,e,t))}const Et=0,Yu=1,cn=2,qt=3;class Si{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Et,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let i=this.children[t];if(i==e)return n;n+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Xe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.size;if(a>e||o instanceof ed){i=e-s;break}s=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof Zu&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Xe(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Xe(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=n,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Xe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Xe(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,m=0;f<this.children.length;f++){let y=this.children[f],v=m+y.size;if(s>m&&o<v)return y.setSelection(e-m-y.border,t-m-y.border,n,i);m=v}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),u=n.domSelectionRange(),d=!1;if((Tt||Qe)&&e==t){let{node:f,offset:m}=a;if(f.nodeType==3){if(d=!!(m&&f.nodeValue[m-1]==`
22
+ `),d&&m==f.nodeValue.length)for(let y=f,v;y;y=y.parentNode){if(v=y.nextSibling){v.nodeName=="BR"&&(a=l={node:v.parentNode,offset:Xe(v)+1});break}let x=y.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let y=f.childNodes[m-1];d=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(Tt&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Qe)&&an(a.node,a.offset,u.anchorNode,u.anchorOffset)&&an(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(d&&Tt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let m=a;a=l,l=m}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,i=0;i<this.children.length;i++){let s=this.children[i],o=n+s.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let a=n+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==n||t==o?cn:Yu,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=qt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?cn:qt}n=o}this.dirty=cn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?cn:Yu;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Zu extends Si{constructor(e,t,n,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Et&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class G2 extends Si{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class un extends Si{constructor(e,t,n,i,s){super(e,[],n,i),this.mark=t,this.spec=s}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=sn.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new un(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Et){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Et}}slice(e,t,n){let i=un.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=wa(s,t,o,n)),e>0&&(s=wa(s,0,e,n));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zr extends Si{constructor(e,t,n,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=a}static create(e,t,n,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=sn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=nd(u,n,t),c?l=new K2(e,t,n,i,u,d||null,h,c,s,o+1):t.isText?new bs(e,t,n,i,u,h,s):new zr(e,t,n,i,u,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>H.empty)}return e}matchesNode(e,t,n){return this.dirty==Et&&e.eq(this.node)&&xs(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new X2(this,o&&o.node,e);Q2(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Me.none:this.node.child(u).marks,n,e),l.placeWidget(c,e,i)},(c,u,d,h)=>{l.syncToMarks(c.marks,n,e);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==cn)&&(o&&this.protectLocalComposition(e,o),td(this.contentDOM,this.children,e),Pn&&e5(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof de)||n<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=t5(this.node.content,o,n-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new G2(this,s,t,i);e.input.compositionNodes.push(o),this.children=wa(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==qt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Et}updateOuterDeco(e){if(xs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=rd(this.dom,this.nodeDOM,xa(this.outerDeco,this.node,t),xa(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Qu(r,e,t,n,i){nd(n,e,r);let s=new zr(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bs extends zr{constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==qt||this.dirty!=Et&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Et||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Et,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new bs(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=qt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ed extends Si{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Et&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class K2 extends zr{constructor(e,t,n,i,s,o,a,l,c,u){super(e,t,n,i,s,o,a,c,u),this.spec=l}update(e,t,n,i){if(this.dirty==qt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function td(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==r){for(;a!=n;)n=id(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(a,n);if(o instanceof un){let l=n?n.previousSibling:r.lastChild;td(o.contentDOM,o.children,t),n=l?l.nextSibling:r.firstChild}}for(;n;)n=id(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const ki=function(r){r&&(this.nodeName=r)};ki.prototype=Object.create(null);const dn=[new ki];function xa(r,e,t){if(r.length==0)return dn;let n=t?dn[0]:new ki,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new ki(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(n=new ki(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return i}function rd(r,e,t,n){if(t==dn&&n==dn)return e;let i=e;for(let s=0;s<n.length;s++){let o=n[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=r&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=dn[0]),i=l}J2(i,a||dn[0],o)}return i}function J2(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<n.length;s++)i.indexOf(n[s])==-1&&r.classList.remove(n[s]);for(let s=0;s<i.length;s++)n.indexOf(i[s])==-1&&r.classList.add(i[s]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function nd(r,e,t){return rd(r,r,dn,xa(e,t,r.nodeType!=1))}function xs(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function id(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class X2{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Y2(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Et,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=un.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,n,i,s){let o=this.top.children[i];return o.dirty==qt&&o.dom==o.contentDOM&&(o.dirty=cn),o.update(e,t,n,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof zr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=qt&&xs(t,l.outerDeco));if(!h&&l.update(e,t,n,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,n,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=cn,d.updateChildren(i,o+1),d.dirty=Et),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!xs(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=zr.create(this.top,t,n,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,n,i,s){let o=zr.create(this.top,e,t,n,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Zu(this.top,e,t,n);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof un;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof bs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Qe||Ge)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new ed(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Y2(r,e){let t=e,n=t.children.length,i=r.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(n){let c=t.children[n-1];if(c instanceof un)t=c,n=c.children.length;else{a=c,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=r.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Z2(r,e){return r.type.side-e.type.side}function Q2(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let c=0;c<r.childCount;c++){let u=r.child(c);n(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let v=i[o++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(Z2);for(let v=0;v<d.length;v++)t(d[v],c,!!l)}else t(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<r.childCount)f=c,h=r.child(c++);else break;for(let v=0;v<a.length;v++)a[v].to<=s&&a.splice(v--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let v=m;o<i.length&&i[o].from<v&&(v=i[o].from);for(let x=0;x<a.length;x++)a[x].to<v&&(v=a[x].to);v<m&&(l=h.cut(v-s),h=h.cut(0,v-s),m=v,f=-1)}else for(;o<i.length&&i[o].to<m;)o++;let y=h.isInline&&!h.isLeaf?a.filter(v=>!v.inline):a.slice();n(h,y,e.forChild(s,h),f),s=m}}function e5(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function t5(r,e,t,n){for(let i=0,s=0;i<r.childCount&&s<=n;){let o=r.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<r.childCount;){let c=r.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let c=a<n?l.lastIndexOf(e,n-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function wa(r,e,t,n,i){let s=[];for(let o=0,a=0;o<r.length;o++){let l=r[o],c=a,u=a+=l.size;c>=t||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,n)),i&&(s.push(i),i=void 0),u>t&&s.push(l.slice(t-c,l.size,n)))}return s}function Sa(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,c;if(vs(t)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&se.isSelectable(d)&&i.parent&&!(d.isInline&&A2(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new se(o==h?a:n.resolve(h))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,h=o;for(let f=0;f<t.rangeCount;f++){let m=t.getRangeAt(f);d=Math.min(d,r.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,r.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=h==r.state.selection.anchor?[h,d]:[d,h],a=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=n.resolve(l);if(!c){let d=e=="pointer"||r.state.selection.head<a.pos&&!s?1:-1;c=Ma(r,u,a,d)}return c}function sd(r){return r.editable?r.hasFocus():hd(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function or(r,e=!1){let t=r.state.selection;if(cd(r,t),!!sd(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&Ge){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&an(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)n5(r);else{let{anchor:n,head:i}=t,s,o;od&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=ad(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=ad(r,t.to))),r.docView.setSelection(n,i,r,e),od&&(s&&ld(s),o&&ld(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&r5(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const od=Qe||Ge&&Fu<63;function ad(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(Qe&&i&&i.contentEditable=="false")return ka(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ka(i);if(s)return ka(s)}}function ka(r){return r.contentEditable="true",Qe&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function ld(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function r5(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!sd(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function n5(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,Xe(t)+1):e.collapse(t,0),!n&&!r.state.selection.visible&&ut&&Nr<=11&&(t.disabled=!0,t.disabled=!1)}function cd(r,e){if(e instanceof se){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(ud(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else ud(r)}function ud(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function Ma(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||de.between(e,t,n)}function dd(r){return r.editable&&!r.hasFocus()?!1:hd(r)}function hd(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function i5(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return an(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ta(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ce.findFrom(s,e)}function Ir(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function fd(r,e,t){let n=r.state.selection;if(n instanceof de)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ir(r,new de(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Ta(r.state,e);return i&&i instanceof se?Ir(r,i):!1}else if(!(Ct&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(a))&&!o.contentDOM?se.isSelectable(s)?Ir(r,new se(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):xi?Ir(r,new de(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof se&&n.node.isInline)return Ir(r,new de(e>0?n.$to:n.$from));{let i=Ta(r.state,e);return i?Ir(r,i):!1}}}function ws(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Mi(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function Bn(r,e){return e<0?s5(r):o5(r)}function s5(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(Tt&&t.nodeType==1&&n<ws(t)&&Mi(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(Mi(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(pd(t))break;{let a=t.previousSibling;for(;a&&Mi(a,-1);)i=t.parentNode,s=Xe(a),a=a.previousSibling;if(a)t=a,n=ws(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Ca(r,t,n):i&&Ca(r,i,s)}function o5(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=ws(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(Mi(a,1))s=t,o=++n;else break}else{if(pd(t))break;{let a=t.nextSibling;for(;a&&Mi(a,1);)s=a.parentNode,o=Xe(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=ws(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Ca(r,s,o)}function pd(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function a5(r,e){for(;r&&e==r.childNodes.length&&!bi(r);)e=Xe(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function l5(r,e){for(;r&&!e&&!bi(r);)e=Xe(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Ca(r,e,t){if(e.nodeType!=3){let s,o;(o=a5(e,t))?(e=o,t=0):(s=l5(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(vs(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&or(r)},50)}function md(r,e){let t=r.state.doc.resolve(e);if(!(Ge||$u)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function gd(r,e,t){let n=r.state.selection;if(n instanceof de&&!n.empty||t.indexOf("s")>-1||Ct&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Ta(r.state,e);if(o&&o instanceof se)return Ir(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof vt?ce.near(o,e):ce.findFrom(o,e);return a?Ir(r,a):!1}return!1}function yd(r,e){if(!(r.state.selection instanceof de))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function vd(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function c5(r){if(!Qe||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;vd(r,n,"true"),setTimeout(()=>vd(r,n,"false"),20)}return!1}function u5(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function d5(r,e){let t=e.keyCode,n=u5(e);if(t==8||Ct&&t==72&&n=="c")return yd(r,-1)||Bn(r,-1);if(t==46&&!e.shiftKey||Ct&&t==68&&n=="c")return yd(r,1)||Bn(r,1);if(t==13||t==27)return!0;if(t==37||Ct&&t==66&&n=="c"){let i=t==37?md(r,r.state.selection.from)=="ltr"?-1:1:-1;return fd(r,i,n)||Bn(r,i)}else if(t==39||Ct&&t==70&&n=="c"){let i=t==39?md(r,r.state.selection.from)=="ltr"?1:-1:1;return fd(r,i,n)||Bn(r,i)}else{if(t==38||Ct&&t==80&&n=="c")return gd(r,-1,n)||Bn(r,-1);if(t==40||Ct&&t==78&&n=="c")return c5(r)||gd(r,1,n)||Bn(r,1);if(n==(Ct?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ea(r,e){r.someProp("transformCopied",f=>{e=f(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let f=n.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),n=f.content}let o=r.someProp("clipboardSerializer")||sn.fromSchema(r.state.schema),a=Cd(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Md[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let m=a.createElement(u[f]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let h=r.someProp("clipboardTextSerializer",f=>f(e,r))||e.content.textBetween(0,e.content.size,`
23
+
24
+ `);return{dom:l,text:h,slice:e}}function bd(r,e,t,n,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(n||s||!t);if(l){if(r.someProp("transformPastedText",h=>{e=h(e,s||n,r)}),s)return a=new X(H.from(r.state.schema.text(e.replace(/\r\n?/g,`
25
+ `))),0,0),r.someProp("transformPasted",h=>{a=h(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",h=>h(e,i,n,r));if(d)a=d;else{let h=i.marks(),{schema:f}=r.state,m=sn.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let v=o.appendChild(document.createElement("p"));y&&v.appendChild(m.serializeNode(f.text(y,h)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=m5(t),xi&&g5(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Tr.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!h5.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=y5(kd(a,+u[1],+u[2]),u[4]);else if(a=X.maxOpen(f5(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=kd(a,d,h)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const h5=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function f5(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&wd(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Sd(o[o.length-1],s.length));let u=xd(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return H.from(o)}return r}function xd(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,H.from(r));return r}function wd(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=wd(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(H.from(xd(t,r,i+1))))}}function Sd(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Sd(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(H.empty,!0);return r.copy(t.append(n))}function Aa(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Aa(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(H.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function kd(r,e,t){return e<r.openStart&&(r=new X(Aa(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new X(Aa(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Md={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Td=null;function Cd(){return Td||(Td=document.implementation.createHTMLDocument("title"))}let Oa=null;function p5(r){let e=window.trustedTypes;return e?(Oa||(Oa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Oa.createHTML(r)):r}function m5(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Cd().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Md[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=p5(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function g5(r){let e=r.querySelectorAll(Ge?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function y5(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=H.from(l.create(n[a+1],i)),s++,o++}return new X(i,s,o)}const tt={},rt={},v5={touchstart:!0,touchmove:!0};class b5{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function x5(r){for(let e in tt){let t=tt[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{S5(r,n)&&!Da(r,n)&&(r.editable||!(n.type in rt))&&t(r,n)},v5[e]?{passive:!0}:void 0)}Qe&&r.dom.addEventListener("input",()=>null),Na(r)}function Rr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function w5(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Na(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>Da(r,n))})}function Da(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function S5(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function k5(r,e){!Da(r,e)&&tt[e.type]&&(r.editable||!(e.type in rt))&&tt[e.type](r,e)}rt.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Ad(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(ir&&Ge&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),Pn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,ln(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||d5(r,t)?t.preventDefault():Rr(r,"key")},rt.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},rt.keypress=(r,e)=>{let t=e;if(Ad(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ct&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof de)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Ss(r){return{left:r.clientX,top:r.clientY}}function M5(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function za(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Fn(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function T5(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&se.isSelectable(n)?(Fn(r,new se(t)),!0):!1}function C5(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof se&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(se.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Fn(r,se.create(r.state.doc,i)),!0):!1}function E5(r,e,t,n,i){return za(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?C5(r,t):T5(r,t))}function A5(r,e,t,n){return za(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function O5(r,e,t,n){return za(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||N5(r,t,n)}function N5(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Fn(r,de.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Fn(r,de.create(n,a+1,a+1+o.content.size));else if(se.isSelectable(o))Fn(r,se.create(n,a));else continue;return!0}}function Ia(r){return ks(r)}const Ed=Ct?"metaKey":"ctrlKey";tt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Ia(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&M5(t,r.input.lastClick)&&!t[Ed]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(Ss(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new D5(r,o,t,!!n)):(s=="doubleClick"?A5:O5)(r,o.pos,o.inside,t)?t.preventDefault():Rr(r,"pointer"))};class D5{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ed],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof se&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Tt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Rr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>or(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ss(e))),this.updateAllowDefault(e),this.allowDefault||!t?Rr(this.view,"pointer"):E5(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qe&&this.mightDrag&&!this.mightDrag.node.isAtom||Ge&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Fn(this.view,ce.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Rr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Rr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tt.touchstart=r=>{r.input.lastTouch=Date.now(),Ia(r),Rr(r,"pointer")},tt.touchmove=r=>{r.input.lastTouch=Date.now(),Rr(r,"pointer")},tt.contextmenu=r=>Ia(r);function Ad(r,e){return r.composing?!0:Qe&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const z5=ir?5e3:-1;rt.compositionstart=rt.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Ge&&$u&&I5(r)))r.markCursor=r.state.storedMarks||t.marks(),ks(r,!0),r.markCursor=null;else if(ks(r,!e.selection.empty),Tt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Od(r,z5)};function I5(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}rt.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Od(r,20))};function Od(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>ks(r),e))}function Nd(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=P5());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function R5(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=C2(e.focusNode,e.focusOffset),n=E2(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function P5(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function ks(r,e=!1){if(!(ir&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Nd(r),e||r.docView&&r.docView.dirty){let t=Sa(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function L5(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ti=ut&&Nr<15||Pn&&D2<604;tt.copy=rt.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Ti?null:t.clipboardData,o=n.content(),{dom:a,text:l}=Ea(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):L5(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function B5(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function F5(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Ci(r,n.value,null,i,e):Ci(r,n.textContent,n.innerHTML,i,e)},50)}function Ci(r,e,t,n,i){let s=bd(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||X.empty)))return!0;if(!s)return!1;let o=B5(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Dd(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}rt.paste=(r,e)=>{let t=e;if(r.composing&&!ir)return;let n=Ti?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Ci(r,Dd(n),n.getData("text/html"),i,t)?t.preventDefault():F5(r,t)};class zd{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const $5=Ct?"altKey":"ctrlKey";function Id(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[$5]}tt.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Ss(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof se?i.to-1:i.to))){if(n&&n.mightDrag)o=se.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=se.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=Ea(r,a);(!t.dataTransfer.files.length||!Ge||Fu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ti?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ti||t.dataTransfer.setData("text/plain",c),r.dragging=new zd(u,Id(r,t),o)},tt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},rt.dragover=rt.dragenter=(r,e)=>e.preventDefault(),rt.drop=(r,e)=>{try{H5(r,e,r.dragging)}finally{r.dragging=null}};function H5(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Ss(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",f=>{s=f(s,r,!1)}):s=bd(r,Dd(e.dataTransfer),Ti?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Id(r,e));if(r.someProp("handleDrop",f=>f(r,e,s||X.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?au(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&se.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new se(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,y,v,x)=>f=x),l.setSelection(Ma(r,h,l.doc.resolve(f)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}tt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&or(r)},20))},tt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},tt.beforeinput=(r,e)=>{if(Ge&&ir&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,ln(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in rt)tt[r]=rt[r];function Ei(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Ms{constructor(e,t){this.toDOM=e,this.spec=t||hn,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new nt(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ms&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ei(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pr{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new nt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Pr&&Ei(this.attrs,e.attrs)&&Ei(this.spec,e.spec)}static is(e){return e.type instanceof Pr}destroy(){}}class Ra{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new nt(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ra&&Ei(this.attrs,e.attrs)&&Ei(this.spec,e.spec)}destroy(){}}class nt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new nt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new nt(e,e,new Ms(t,n))}static inline(e,t,n,i){return new nt(e,t,new Pr(n,i))}static node(e,t,n,i){return new nt(e,t,new Ra(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pr}get widget(){return this.type instanceof Ms}}const $n=[],hn={};class De{constructor(e,t){this.local=e.length?e:$n,this.children=t.length?t:$n}static create(e,t){return t.length?Ts(t,e,0,hn):et}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==et||e.maps.length==0?this:this.mapInner(e,t,0,0,n||hn)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?V5(this.children,o||[],e,t,n,i,s):o?new De(o.sort(fn),$n):et}add(e,t){return t.length?this==et?De.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let c=l+n,u;if(u=Pd(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,Ts(u,a,c+1,hn)),s+=3}});let o=Rd(s?Ld(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new De(o.length?this.local.concat(o).sort(fn):this.local,i||this.children)}remove(e){return e.length==0||this==et?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,a+1);c!=et?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new De(i,n):et}forChild(e,t){if(this==et)return this;if(t.isLeaf)return De.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Pr){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new De(i.sort(fn),$n);return n?new Lr([a,n]):a}return n||et}eq(e){if(this==e)return!0;if(!(e instanceof De)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Pa(this.localsInner(e))}localsInner(e){if(this==et)return $n;if(e.inlineContent||!this.local.some(Pr.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Pr||t.push(this.local[n]);return t}forEachSet(e){e(this)}}De.empty=new De([],[]),De.removeOverlap=Pa;const et=De.empty;class Lr{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,hn));return Lr.from(n)}forChild(e,t){if(t.isLeaf)return De.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=et&&(s instanceof Lr?n=n.concat(s.members):n.push(s))}return Lr.from(n)}eq(e){if(!(e instanceof Lr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Pa(n?t:t.sort(fn)):$n}static from(e){switch(e.length){case 0:return et;case 1:return e[0];default:return new Lr(e.every(t=>t instanceof De)?e:e.reduce((t,n)=>t.concat(n instanceof De?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function V5(r,e,t,n,i,s,o){let a=r.slice();for(let c=0,u=s;c<t.maps.length;c++){let d=0;t.maps[c].forEach((h,f,m,y)=>{let v=y-m-(f-h);for(let x=0;x<a.length;x+=3){let T=a[x+1];if(T<0||h>T+u-d)continue;let D=a[x]+u-d;f>=D?a[x+1]=h<=D?-2:-1:h>=u&&v&&(a[x]+=v,a[x+1]+=v)}d+=v}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(r[c]+s),d=u-i;if(d<0||d>=n.content.size){l=!0;continue}let h=t.map(r[c+1]+s,-1),f=h-i,{index:m,offset:y}=n.content.findIndex(d),v=n.maybeChild(m);if(v&&y==d&&y+v.nodeSize==f){let x=a[c+2].mapInner(t,v,u+1,r[c]+s+1,o);x!=et?(a[c]=d,a[c+1]=f,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=q5(a,r,e,t,i,s,o),u=Ts(c,n,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new De(e.sort(fn),a)}function Rd(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new nt(i.from+e,i.to+e,i.type))}return t}function q5(r,e,t,n,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(n,i,c);d?t.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function Pd(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function Ld(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Ts(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=Pd(r,a,l+t);if(c){s=!0;let u=Ts(c,a,t+l+1,n);u!=et&&i.push(l,l+a.nodeSize,u)}});let o=Rd(s?Ld(r):r,-t).sort(fn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new De(o,i):et}function fn(r,e){return r.from-e.from||r.to-e.to}function Pa(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Bd(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Bd(e,i,n.copy(s.from,n.to)));break}}}return e}function Bd(r,e,t){for(;e<r.length&&fn(t,r[e])>0;)e++;r.splice(e,0,t)}function La(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=et&&e.push(n)}),r.cursorWrapper&&e.push(De.create(r.state.doc,[r.cursorWrapper.deco])),Lr.from(e)}const _5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},j5=ut&&Nr<=11;class U5{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class W5{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new U5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);ut&&Nr<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),j5&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_5)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(dd(this.view)){if(this.suppressingSelectionUpdates)return or(this.view);if(ut&&Nr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&an(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Rn(s))t.add(s);for(let s=e.anchorNode;s;s=Rn(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&dd(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Tt&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||J5(e,d)!=f)&&h.remove()}}}else if((Ge||Qe)&&l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&vs(n)&&(c=Sa(e))&&c.eq(ce.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,or(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),G5(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||or(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ut&&Nr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Xe(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Xe(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Fd=new WeakMap,$d=!1;function G5(r){if(!Fd.has(r)&&(Fd.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Tt,$d)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),$d=!0}}function Hd(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return an(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function K5(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return Hd(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?Hd(r,t):null}function J5(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function X5(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:a}=r.docView.parseRange(e,t),l=r.domSelectionRange(),c,u=l.anchorNode;if(u&&r.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],vs(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ge&&r.input.lastKeyCode===8)for(let v=s;v>i;v--){let x=n.childNodes[v-1],T=x.pmViewDesc;if(x.nodeName=="BR"&&!T){s=v;break}if(!T||T.size)break}let d=r.state.doc,h=r.someProp("domParser")||Tr.fromSchema(r.state.schema),f=d.resolve(o),m=null,y=h.parse(n,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Y5,context:f});if(c&&c[0].pos!=null){let v=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=v),m={anchor:v+o,head:x+o}}return{doc:y,sel:m,from:o,to:a}}function Y5(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(Qe&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||Qe&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Z5=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Q5(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let O=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,$=Sa(r,O);if($&&!r.state.selection.eq($)){if(Ge&&ir&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",q=>q(r,ln(13,"Enter"))))return;let F=r.state.tr.setSelection($);O=="pointer"?F.setMeta("pointer",!0):O=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),r.dispatch(F)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,c=X5(r,e,t),u=r.state.doc,d=u.slice(c.from,c.to),h,f;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(h=r.state.selection.to,f="end"):(h=r.state.selection.from,f="start"),r.input.lastKeyCode=null;let m=r3(d.content,c.doc.content,c.from,h,f);if(m&&r.input.domChangeCount++,(Pn&&r.input.lastIOSEnter>Date.now()-225||ir)&&i.some(O=>O.nodeType==1&&!Z5.test(O.nodeName))&&(!m||m.endA>=m.endB)&&r.someProp("handleKeyDown",O=>O(r,ln(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let O=Vd(r,r.state.doc,c.sel);if(O&&!O.eq(r.state.selection)){let $=r.state.tr.setSelection(O);s&&$.setMeta("composition",s),r.dispatch($)}}return}r.state.selection.from<r.state.selection.to&&m.start==m.endB&&r.state.selection instanceof de&&(m.start>r.state.selection.from&&m.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?m.start=r.state.selection.from:m.endA<r.state.selection.to&&m.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(m.endB+=r.state.selection.to-m.endA,m.endA=r.state.selection.to)),ut&&Nr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),v=c.doc.resolveNoCache(m.endB-c.from),x=u.resolve(m.start),T=y.sameParent(v)&&y.parent.inlineContent&&x.end()>=m.endA;if((Pn&&r.input.lastIOSEnter>Date.now()-225&&(!T||i.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!T&&y.pos<c.doc.content.size&&(!y.sameParent(v)||!y.parent.inlineContent)&&y.pos<v.pos&&!/\S/.test(c.doc.textBetween(y.pos,v.pos,"","")))&&r.someProp("handleKeyDown",O=>O(r,ln(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>m.start&&t3(u,m.start,m.endA,y,v)&&r.someProp("handleKeyDown",O=>O(r,ln(8,"Backspace")))){ir&&Ge&&r.domObserver.suppressSelectionUpdates();return}Ge&&m.endB==m.start&&(r.input.lastChromeDelete=Date.now()),ir&&!T&&y.start()!=v.start()&&v.parentOffset==0&&y.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,v=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(O){return O(r,ln(13,"Enter"))})},20));let D=m.start,P=m.endA,E=O=>{let $=O||r.state.tr.replace(D,P,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let F=Vd(r,$.doc,c.sel);F&&!(Ge&&r.composing&&F.empty&&(m.start!=m.endB||r.input.lastChromeDelete<Date.now()-100)&&(F.head==D||F.head==$.mapping.map(P)-1)||ut&&F.empty&&F.head==D)&&$.setSelection(F)}return s&&$.setMeta("composition",s),$.scrollIntoView()},N;if(T)if(y.pos==v.pos){ut&&Nr<=11&&y.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>or(r),20));let O=E(r.state.tr.delete(D,P)),$=u.resolve(m.start).marksAcross(u.resolve(m.endA));$&&O.ensureMarks($),r.dispatch(O)}else if(m.endA==m.endB&&(N=e3(y.parent.content.cut(y.parentOffset,v.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let O=E(r.state.tr);N.type=="add"?O.addMark(D,P,N.mark):O.removeMark(D,P,N.mark),r.dispatch(O)}else if(y.parent.child(y.index()).isText&&y.index()==v.index()-(v.textOffset?0:1)){let O=y.parent.textBetween(y.parentOffset,v.parentOffset),$=()=>E(r.state.tr.insertText(O,D,P));r.someProp("handleTextInput",F=>F(r,D,P,O,$))||r.dispatch($())}else r.dispatch(E());else r.dispatch(E())}function Vd(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ma(r,e.resolve(t.anchor),e.resolve(t.head))}function e3(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(H.from(c).eq(r))return{mark:a,type:o}}function t3(r,e,t,n,i){if(t-e<=i.pos-n.pos||Ba(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(Ba(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Ba(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function Ba(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function r3(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&r.size<e.size){let l=n<=s&&n>=o?s-n:0;s-=l,s&&s<e.size&&qd(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,s&&s<r.size&&qd(r.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function qd(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class _d{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new b5,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Kd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Wd(this),Ud(this),this.nodeViews=Gd(this),this.docView=Qu(this.state.doc,jd(this),La(this),this.dom,this),this.domObserver=new W5(this,(n,i,s,o)=>Q5(this,n,i,s,o)),this.domObserver.start(),x5(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Na(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Kd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Nd(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Gd(this);i3(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Na(this),this.editable=Wd(this),Ud(this);let l=La(this),c=jd(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&R2(this);if(o){this.domObserver.stop();let f=d&&(ut||Ge)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&n3(i.selection,e.selection);if(d){let m=Ge?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=R5(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Qu(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&i5(this))?or(this,f):(cd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&P2(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof se){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Hu(this,t.getBoundingClientRect(),e)}else Hu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new zd(e.slice,e.move,i<0?void 0:se.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(ut){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&L2(this.dom),or(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return V2(this,e)}coordsAtPos(e,t=1){return Wu(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return W2(this,t||this.state,e)}pasteHTML(e,t){return Ci(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ci(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ea(this,e)}destroy(){this.docView&&(w5(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],La(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,M2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return k5(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qe&&this.root.nodeType===11&&O2(this.dom.ownerDocument)==this.dom&&K5(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}_d.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function jd(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[nt.node(0,r.state.doc.content.size,e)]}function Ud(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:nt.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function Wd(r){return!r.someProp("editable",e=>e(r.state)===!1)}function n3(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function Gd(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function i3(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function Kd(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Cs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s3=typeof navigator<"u"&&/Mac/.test(navigator.platform),o3=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ye=0;Ye<10;Ye++)Br[48+Ye]=Br[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)Br[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)Br[Ye]=String.fromCharCode(Ye+32),Cs[Ye]=String.fromCharCode(Ye);for(var Fa in Br)Cs.hasOwnProperty(Fa)||(Cs[Fa]=Br[Fa]);function a3(r){var e=s3&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||o3&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Cs:Br)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const l3=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),c3=typeof navigator<"u"&&/Win/.test(navigator.platform);function u3(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))l3?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function d3(r){let e=Object.create(null);for(let t in r)e[u3(t)]=r[t];return e}function $a(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function h3(r){return new Pe({props:{handleKeyDown:Ha(r)}})}function Ha(r){let e=d3(r);return function(t,n){let i=a3(n),s,o=e[$a(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[$a(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(c3&&n.ctrlKey&&n.altKey)&&(s=Br[n.keyCode])&&s!=i){let a=e[$a(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var f3=Object.defineProperty,Va=(r,e)=>{for(var t in e)f3(r,t,{get:e[t],enumerable:!0})};function Es(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}var As=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:n}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(r).map(([o,a])=>[o,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o=[],a=!!r,l=r||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,h])=>[d,(...m)=>{const y=this.buildProps(l,e),v=h(...m)(y);return o.push(v),u}])),run:c};return u}createCan(r){const{rawCommands:e,state:t}=this,n=!1,i=r||t.tr,s=this.buildProps(i,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,n)}}buildProps(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o={tr:r,editor:n,view:s,state:Es({state:i,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},Jd={};Va(Jd,{blur:()=>p3,clearContent:()=>m3,clearNodes:()=>g3,command:()=>y3,createParagraphNear:()=>v3,cut:()=>b3,deleteCurrentNode:()=>x3,deleteNode:()=>w3,deleteRange:()=>S3,deleteSelection:()=>k3,enter:()=>M3,exitCode:()=>T3,extendMarkRange:()=>C3,first:()=>E3,focus:()=>A3,forEach:()=>O3,insertContent:()=>N3,insertContentAt:()=>I3,joinBackward:()=>L3,joinDown:()=>P3,joinForward:()=>B3,joinItemBackward:()=>F3,joinItemForward:()=>$3,joinTextblockBackward:()=>H3,joinTextblockForward:()=>V3,joinUp:()=>R3,keyboardShortcut:()=>_3,lift:()=>j3,liftEmptyBlock:()=>U3,liftListItem:()=>W3,newlineInCode:()=>G3,resetAttributes:()=>K3,scrollIntoView:()=>J3,selectAll:()=>X3,selectNodeBackward:()=>Y3,selectNodeForward:()=>Z3,selectParentNode:()=>Q3,selectTextblockEnd:()=>e6,selectTextblockStart:()=>t6,setContent:()=>r6,setMark:()=>M6,setMeta:()=>T6,setNode:()=>C6,setNodeSelection:()=>E6,setTextDirection:()=>A6,setTextSelection:()=>O6,sinkListItem:()=>N6,splitBlock:()=>D6,splitListItem:()=>z6,toggleList:()=>I6,toggleMark:()=>R6,toggleNode:()=>P6,toggleWrap:()=>L6,undoInputRule:()=>B6,unsetAllMarks:()=>F6,unsetMark:()=>$6,unsetTextDirection:()=>H6,updateAttributes:()=>V6,wrapIn:()=>q6,wrapInList:()=>_6});var p3=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),m3=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),g3=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const m=An(f);if(a.type.isTextblock){const{defaultType:y}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,y)}(m||m===0)&&e.lift(f,m)})}),!0},y3=r=>e=>r(e),v3=()=>({state:r,dispatch:e})=>Nu(r,e),b3=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new de(n.doc.resolve(Math.max(o-1,0)))),!0},x3=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1};function Ve(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var w3=r=>({tr:e,state:t,dispatch:n})=>{const i=Ve(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},S3=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},k3=()=>({state:r,dispatch:e})=>ca(r,e),M3=()=>({commands:r})=>r.keyboardShortcut("Enter"),T3=()=>({state:r,dispatch:e})=>c2(r,e);function qa(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function Os(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:qa(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function Xd(r,e,t={}){return r.find(n=>n.type===e&&Os(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function Yd(r,e,t={}){return!!Xd(r,e,t)}function _a(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((n=i.node.marks[0])==null?void 0:n.attrs),!Xd([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Yd([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&Yd([...r.parent.child(l).marks],e,t);)c+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function ar(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var C3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=ar(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=_a(l,s,e);if(d&&d.from<=c&&d.to>=u){const h=de.create(o,d.from,d.to);t.setSelection(h)}}return!0},E3=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function ja(r){return r instanceof de}function lr(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function Zd(r,e=null){if(!e)return null;const t=ce.atStart(r),n=ce.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?de.create(r,lr(0,i,s),lr(r.content.size,i,s)):de.create(r,lr(e,i,s),lr(e,i,s))}function Qd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ns(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var A3=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ns()||Qd())&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!ja(t.state.selection))return o(),!0;const a=Zd(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},O3=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),N3=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),eh=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&eh(n)}return r};function Ds(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return eh(t)}function Ai(r,e,t){if(r instanceof Mr||r instanceof H)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return H.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Ai("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Vc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Tr.fromSchema(l).parseSlice(Ds(r),t.parseOptions):Tr.fromSchema(l).parse(Ds(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Tr.fromSchema(e);return t.slice?s.parseSlice(Ds(r),t.parseOptions).content:s.parse(Ds(r),t.parseOptions)}return Ai("",e,t)}function D3(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof Ue||i instanceof We))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),r.setSelection(ce.near(r.doc.resolve(o),t))}var z3=r=>!("type"in r),I3=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=v=>{s.emit("contentError",{editor:s,error:v,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ai(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){l(v)}try{a=Ai(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(v){return l(v),!1}let{from:u,to:d}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},h=!0,f=!0;if((z3(a)?a:[a]).forEach(v=>{v.check(),h=h?v.isText&&v.marks.length===0:!1,f=f?v.isBlock:!1}),u===d&&f){const{parent:v}=n.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let y;if(h){if(Array.isArray(e))y=e.map(v=>v.text||"").join("");else if(e instanceof H){let v="";e.forEach(x=>{x.text&&(v+=x.text)}),y=v}else typeof e=="object"&&e&&e.text?y=e.text:y=e;n.insertText(y,u,d)}else{y=a;const v=n.doc.resolve(u),x=v.node(),T=v.parentOffset===0,D=x.isText||x.isTextblock,P=x.content.size>0;T&&D&&P&&(u=Math.max(0,u-1)),n.replaceWith(u,d,y)}t.updateSelection&&D3(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:u,text:y}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:u,text:y})}return!0},R3=()=>({state:r,dispatch:e})=>o2(r,e),P3=()=>({state:r,dispatch:e})=>a2(r,e),L3=()=>({state:r,dispatch:e})=>ku(r,e),B3=()=>({state:r,dispatch:e})=>Eu(r,e),F3=()=>({state:r,dispatch:e,tr:t})=>{try{const n=ps(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},$3=()=>({state:r,dispatch:e,tr:t})=>{try{const n=ps(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},H3=()=>({state:r,dispatch:e})=>i2(r,e),V3=()=>({state:r,dispatch:e})=>s2(r,e);function th(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function q3(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Ns()||th()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var _3=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=q3(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(n.mapping);u&&i&&n.maybeStep(u)}),!0};function Fr(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?Ve(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(d,h)=>{if(d.isText)return;const f=Math.max(n,h),m=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:m})});const l=i-n,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Os(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}var j3=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return Fr(t,i,e)?l2(t,n):!1},U3=()=>({state:r,dispatch:e})=>Du(r,e),W3=r=>({state:e,dispatch:t})=>{const n=Ve(r,e.schema);return x2(n)(e,t)},G3=()=>({state:r,dispatch:e})=>Ou(r,e);function zs(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function rh(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}var K3=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=Ve(r,n.schema)),a==="mark"&&(o=ar(r,n.schema));let l=!1;return t.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,rh(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(l=!0,i&&t.addMark(d,d+u.nodeSize,o.create(rh(h.attrs,e))))})})}),l},J3=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),X3=()=>({tr:r,dispatch:e})=>{if(e){const t=new vt(r.doc);r.setSelection(t)}return!0},Y3=()=>({state:r,dispatch:e})=>Tu(r,e),Z3=()=>({state:r,dispatch:e})=>Au(r,e),Q3=()=>({state:r,dispatch:e})=>h2(r,e),e6=()=>({state:r,dispatch:e})=>m2(r,e),t6=()=>({state:r,dispatch:e})=>p2(r,e);function Ua(r,e,t={},n={}){return Ai(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var r6=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(n.preserveWhitespace!=="full"){const c=Ua(r,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},r,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function nh(r,e){const t=ar(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function n6(r,e){const t=new hu(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function i6(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function s6(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function Is(r){return e=>s6(e.$from,r)}function oe(r,e,t){return r.config[e]===void 0&&r.parent?oe(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?oe(r.parent,e,t):null}):r.config[e]}function Wa(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},n=oe(e,"addExtensions",t);return n?[e,...Wa(n())]:e}).flat(10)}function Ga(r,e){const t=sn.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function ih(r){return typeof r=="function"}function ke(r,e=void 0,...t){return ih(r)?e?r.bind(e)(...t):r(...t):r}function o6(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Hn(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function sh(r){const e=[],{nodeExtensions:t,markExtensions:n}=Hn(r),i=[...t,...n],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=oe(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=oe(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function ye(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=n[i]?n[i].split(" "):[],c=a.filter(u=>!l.includes(u));n[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),a.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),n[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else n[i]=s}),n},{})}function Oi(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>ye(t,n),{})}function a6(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function oh(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):a6(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function ah(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&o6(t)?!1:t!=null))}function lh(r){var e,t;const n={};return!((e=r?.attribute)!=null&&e.isRequired)&&"default"in(r?.attribute||{})&&(n.default=r.attribute.default),((t=r?.attribute)==null?void 0:t.validate)!==void 0&&(n.validate=r.attribute.validate),[r.name,n]}function l6(r,e){var t;const n=sh(r),{nodeExtensions:i,markExtensions:s}=Hn(r),o=(t=i.find(c=>oe(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=n.filter(x=>x.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=r.reduce((x,T)=>{const D=oe(T,"extendNodeSchema",d);return{...x,...D?D(c):{}}},{}),f=ah({...h,content:ke(oe(c,"content",d)),marks:ke(oe(c,"marks",d)),group:ke(oe(c,"group",d)),inline:ke(oe(c,"inline",d)),atom:ke(oe(c,"atom",d)),selectable:ke(oe(c,"selectable",d)),draggable:ke(oe(c,"draggable",d)),code:ke(oe(c,"code",d)),whitespace:ke(oe(c,"whitespace",d)),linebreakReplacement:ke(oe(c,"linebreakReplacement",d)),defining:ke(oe(c,"defining",d)),isolating:ke(oe(c,"isolating",d)),attrs:Object.fromEntries(u.map(lh))}),m=ke(oe(c,"parseHTML",d));m&&(f.parseDOM=m.map(x=>oh(x,u)));const y=oe(c,"renderHTML",d);y&&(f.toDOM=x=>y({node:x,HTMLAttributes:Oi(x,u)}));const v=oe(c,"renderText",d);return v&&(f.toText=v),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const u=n.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=r.reduce((v,x)=>{const T=oe(x,"extendMarkSchema",d);return{...v,...T?T(c):{}}},{}),f=ah({...h,inclusive:ke(oe(c,"inclusive",d)),excludes:ke(oe(c,"excludes",d)),group:ke(oe(c,"group",d)),spanning:ke(oe(c,"spanning",d)),code:ke(oe(c,"code",d)),attrs:Object.fromEntries(u.map(lh))}),m=ke(oe(c,"parseHTML",d));m&&(f.parseDOM=m.map(v=>oh(v,u)));const y=oe(c,"renderHTML",d);return y&&(f.toDOM=v=>y({mark:v,HTMLAttributes:Oi(v,u)})),[c.name,f]}));return new Vc({topNode:o,nodes:a,marks:l})}function c6(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}function Ka(r){return r.sort((t,n)=>{const i=oe(t,"priority")||100,s=oe(n,"priority")||100;return i>s?-1:i<s?1:0})}function ch(r){const e=Ka(Wa(r)),t=c6(e.map(n=>n.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function uh(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
26
+
27
+ `,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,c,u,d)=>{var h;l.isBlock&&c>n&&(a+=s);const f=o?.[l.type.name];if(f)return u&&(a+=f({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(n,c)-c,i-c))}),a}function dh(r,e){const t={from:0,to:r.content.size};return uh(r,t,e)}function Ja(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function u6(r,e){const t=Ve(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function d6(r,e){const t=zs(typeof e=="string"?e:e.name,r.schema);return t==="node"?u6(r,e):t==="mark"?nh(r,e):{}}function h6(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function f6(r){const e=h6(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function p6(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),h=e.invert().map(u);n.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),f6(n)}function hh(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r),o=_a(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}var m6=(r,e,t,n=20)=>{const i=r.doc.resolve(t);let s=n,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function Xa(r,e){return e.nodes[r]||e.marks[r]||null}function Rs(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}var g6=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,n-s))}),t};function Ya(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?ar(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Os(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,m=h.pos;r.doc.nodesBetween(f,m,(y,v)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(f,v),T=Math.min(m,v+y.nodeSize),D=T-x;o+=D,a.push(...y.marks.map(P=>({mark:P,from:x,to:T})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Os(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=o}function y6(r,e,t={}){if(!e)return Fr(r,null,t)||Ya(r,null,t);const n=zs(e,r.schema);return n==="node"?Fr(r,e,t):n==="mark"?Ya(r,e,t):!1}var v6=(r,e)=>{const{$from:t,$to:n,$anchor:i}=r.selection;if(e){const s=Is(a=>a.type.name===e)(r.selection);if(!s)return!1;const o=r.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(n.parentOffset<n.parent.nodeSize-2||t.pos!==n.pos)},b6=r=>{const{$from:e,$to:t}=r.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function fh(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function ph(r,e){const{nodeExtensions:t}=Hn(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=ke(oe(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Ps(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!=null?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(Ps(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function x6(r){return r instanceof se}var mh=class p1{constructor(e){this.position=e}static fromJSON(e){return new p1(e.position)}toJSON(){return{position:this.position}}};function w6(r,e){const t=e.mapping.mapResult(r.position);return{position:new mh(t.pos),mapResult:t}}function S6(r){return new mh(r)}function gh(r,e,t){const i=r.state.doc.content.size,s=lr(e,0,i),o=lr(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,m=u-c,x={top:c,bottom:u,left:d,right:h,width:f,height:m,x:d,y:c};return{...x,toJSON:()=>x}}function k6(r,e,t){var n;const{selection:i}=e;let s=null;if(ja(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!=null?n:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(t));c=f&&m}return!c}),c})}var M6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=ar(r,n.schema);if(i)if(o){const c=nh(n,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;n.doc.nodesBetween(u,d,(h,f)=>{const m=Math.max(f,u),y=Math.min(f+h.nodeSize,d);h.marks.find(x=>x.type===l)?h.marks.forEach(x=>{l===x.type&&t.addMark(m,y,l.create({...x.attrs,...e}))}):t.addMark(m,y,l.create(e))})});return k6(n,t,l)},T6=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),C6=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=Ve(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Ru(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Ru(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},E6=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=lr(r,0,n.content.size),s=se.create(n,i);e.setSelection(s)}return!0},A6=(r,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=n;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:r})}),!0},O6=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=de.atStart(n).from,a=de.atEnd(n).to,l=lr(i,o,a),c=lr(s,o,a),u=de.create(n,l,c);e.setSelection(u)}return!0},N6=r=>({state:e,dispatch:t})=>{const n=Ve(r,e.schema);return k2(n)(e,t)};function yh(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}var D6=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=Rs(c,a.node().type.name,a.node().attrs);if(s instanceof se&&s.node.isBlock)return!a.parentOffset||!rr(o,a.pos)?!1:(n&&(r&&yh(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:i6(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,m=rr(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!m&&rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,f=h?[{type:h,attrs:u}]:void 0),n){if(m&&(s instanceof de&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const y=e.mapping.map(a.before()),v=e.doc.resolve(y);a.node(-1).canReplaceWith(v.index(),v.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}r&&yh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},z6=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=Ve(r,n.schema),{$from:l,$to:c}=n.selection,u=n.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let x=H.empty;const T=l.index(-1)?1:l.index(-2)?2:3;for(let $=l.depth-T;$>=l.depth-3;$-=1)x=H.from(l.node($).copy(x));const D=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,P={...Rs(h,l.node().type.name,l.node().attrs),...e},E=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(P))||void 0;x=x.append(H.from(a.createAndFill(null,E)||void 0));const N=l.before(l.depth-(T-1));t.replace(N,l.after(-D),new X(x,4-T,0));let O=-1;t.doc.nodesBetween(N,t.doc.content.size,($,F)=>{if(O>-1)return!1;$.isTextblock&&$.content.size===0&&(O=F+1)}),O>-1&&t.setSelection(de.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Rs(h,d.type.name,d.attrs),...e},y={...Rs(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const v=f?[{type:a,attrs:m},{type:f,attrs:y}]:[{type:a,attrs:m}];if(!rr(t.doc,l.pos,2))return!1;if(i){const{selection:x,storedMarks:T}=n,{splittableMarks:D}=s.extensionManager,P=T||x.$to.parentOffset&&x.$from.marks();if(t.split(l.pos,2,v).scrollIntoView(),!P||!i)return!0;const E=P.filter(N=>D.includes(N.type.name));t.ensureMarks(E)}return!0},Za=(r,e)=>{const t=Is(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ar(r.doc,t.pos)&&r.join(t.pos),!0},Qa=(r,e)=>{const t=Is(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ar(r.doc,n)&&r.join(n),!0},I6=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Ve(r,o.schema),m=Ve(e,o.schema),{selection:y,storedMarks:v}=o,{$from:x,$to:T}=y,D=x.blockRange(T),P=v||y.$to.parentOffset&&y.$from.marks();if(!D)return!1;const E=Is(N=>ph(N.type.name,d))(y);if(D.depth>=1&&E&&D.depth-E.depth<=1){if(E.node.type===f)return c.liftListItem(m);if(ph(E.node.type.name,d)&&f.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,f),!0)).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()}return!t||!P||!a?l().command(()=>u().wrapInList(f,n)?!0:c.clearNodes()).wrapInList(f,n).command(()=>Za(s,f)).command(()=>Qa(s,f)).run():l().command(()=>{const N=u().wrapInList(f,n),O=P.filter($=>h.includes($.type.name));return s.ensureMarks(O),N?!0:c.clearNodes()}).wrapInList(f,n).command(()=>Za(s,f)).command(()=>Qa(s,f)).run()},R6=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ar(r,n.schema);return Ya(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},P6=(r,e,t={})=>({state:n,commands:i})=>{const s=Ve(r,n.schema),o=Ve(e,n.schema),a=Fr(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},L6=(r,e={})=>({state:t,commands:n})=>{const i=Ve(r,t.schema);return Fr(t,i,e)?n.lift(i):n.wrapIn(i,e)},B6=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},F6=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},$6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=ar(r,n.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:h,to:f}=a;const m=(s=c.marks().find(v=>v.type===l))==null?void 0:s.attrs,y=_a(c,l,m);y&&(h=y.from,f=y.to),t.removeMark(h,f,l)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},H6=r=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let s,o;return typeof r=="number"?(s=r,o=r):r&&"from"in r&&"to"in r?(s=r.from,o=r.to):(s=i.from,o=i.to),n&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},V6=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=Ve(r,n.schema)),a==="mark"&&(o=ar(r,n.schema));let l=!1;return t.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,m,y;t.selection.empty?n.doc.nodesBetween(u,d,(v,x)=>{s&&s===v.type&&(l=!0,m=Math.max(x,u),y=Math.min(x+v.nodeSize,d),h=x,f=v)}):n.doc.nodesBetween(u,d,(v,x)=>{x<u&&s&&s===v.type&&(l=!0,m=Math.max(x,u),y=Math.min(x+v.nodeSize,d),h=x,f=v),x>=u&&x<=d&&(s&&s===v.type&&(l=!0,i&&t.setNodeMarkup(x,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(l=!0,i)){const D=Math.max(x,u),P=Math.min(x+v.nodeSize,d);t.addMark(D,P,o.create({...T.attrs,...e}))}}))}),f&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(v=>{o===v.type&&i&&t.addMark(m,y,o.create({...v.attrs,...e}))}))}),l},q6=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return g2(i,e)(t,n)},_6=(r,e={})=>({state:t,dispatch:n})=>{const i=Ve(r,t.schema);return y2(i,e)(t,n)},j6=class{constructor(){this.callbacks={}}on(r,e){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(e),this}emit(r,...e){const t=this.callbacks[r];return t&&t.forEach(n=>n.apply(this,e)),this}off(r,e){const t=this.callbacks[r];return t&&(e?this.callbacks[r]=t.filter(n=>n!==e):delete this.callbacks[r]),this}once(r,e){const t=(...n)=>{this.off(r,t),e.apply(this,n)};return this.on(r,t)}removeAllListeners(){this.callbacks={}}},el=class{constructor(r){var e;this.find=r.find,this.handler=r.handler,this.undoable=(e=r.undoable)!=null?e:!0}},U6=(r,e)=>{if(qa(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function Ls(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=g6(c)+s;return o.forEach(h=>{if(u)return;const f=U6(d,h.find);if(!f)return;const m=l.state.tr,y=Es({state:l.state,transaction:m}),v={from:n-(f[0].length-s.length),to:i},{commands:x,chain:T,can:D}=new As({editor:t,state:y});h.handler({state:y,range:v,match:f,commands:x,chain:T,can:D})===null||!m.steps.length||(h.undoable&&m.setMeta(a,{transform:m,from:n,to:i,text:s}),l.dispatch(m),u=!0)}),u}function W6(r){const{editor:e,rules:t}=r,n=new Pe({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Ga(H.from(u),o.schema);const{from:d}=l,h=d+u.length;Ls({editor:e,from:d,to:h,text:u,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Ls({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ls({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ls({editor:e,from:o.pos,to:o.pos,text:`
28
+ `,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function G6(r){return Object.prototype.toString.call(r).slice(8,-1)}function Bs(r){return G6(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function vh(r,e){const t={...r};return Bs(r)&&Bs(e)&&Object.keys(e).forEach(n=>{Bs(e[n])&&Bs(r[n])?t[n]=vh(r[n],e[n]):t[n]=e[n]}),t}var tl=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...ke(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>vh(this.options,r)});return e.name=this.name,e.parent=this.parent,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Ni=class m1 extends tl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new m1(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function K6(r){return typeof r=="number"}var J6=class{constructor(r){this.find=r.find,this.handler=r.handler}},X6=(r,e,t)=>{if(qa(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Y6(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:c,can:u}=new As({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(f,m)=>{var y,v,x,T,D;if((v=(y=f.type)==null?void 0:y.spec)!=null&&v.code||!(f.isText||f.isTextblock||f.isInline))return;const P=(D=(T=(x=f.content)==null?void 0:x.size)!=null?T:f.nodeSize)!=null?D:0,E=Math.max(n,m),N=Math.min(i,m+P);if(E>=N)return;const O=f.isText?f.text||"":f.textBetween(E-m,N-m,void 0,"");X6(O,s.find,o).forEach(F=>{if(F.index===void 0)return;const q=E+F.index+1,te=q+F[0].length,Y={from:t.tr.mapping.map(q),to:t.tr.mapping.map(te)},he=s.handler({state:t,range:Y,match:F,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(he)})}),d.every(f=>f!==null)}var Fs=null,Z6=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function Q6(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:f,pasteEvt:m})=>{const y=u.tr,v=Es({state:u,transaction:y});if(!(!Y6({editor:e,state:v,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:m,dropEvent:a})||!y.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return t.map(u=>new Pe({view(d){const h=m=>{var y;n=(y=d.dom.parentElement)!=null&&y.contains(m.target)?d.dom.parentElement:null,n&&(Fs=e)},f=()=>{Fs&&(Fs=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=n===d.dom.parentElement,a=h,!s){const f=Fs;f?.isEditable&&setTimeout(()=>{const m=f.state.selection;m&&f.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,h)=>{var f;const m=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const m=d[0],y=m.getMeta("uiEvent")==="paste"&&!i,v=m.getMeta("uiEvent")==="drop"&&!s,x=m.getMeta("applyPasteRules"),T=!!x;if(!y&&!v&&!T)return;if(T){let{text:E}=x;typeof E=="string"?E=E:E=Ga(H.from(E),f.schema);const{from:N}=x,O=N+E.length,$=Z6(E);return l({rule:u,state:f,from:N,to:{b:O},pasteEvt:$})}const D=h.doc.content.findDiffStart(f.doc.content),P=h.doc.content.findDiffEnd(f.doc.content);if(!(!K6(D)||!P||D===P.b))return l({rule:u,state:f,from:D,to:P,pasteEvt:o})}}))}var $s=class{constructor(r,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=ch(r),this.schema=l6(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xa(e.name,this.schema)},n=oe(e,"addCommands",t);return n?{...r,...n()}:r},{})}get plugins(){const{editor:r}=this;return Ka([...this.extensions].reverse()).flatMap(n=>{const i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:r,type:Xa(n.name,this.schema)},s=[],o=oe(n,"addKeyboardShortcuts",i);let a={};if(n.type==="mark"&&oe(n,"exitable",i)&&(a.ArrowRight=()=>Ni.handleExit({editor:r,mark:n})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,m])=>[f,()=>m({editor:r})]));a={...a,...h}}const l=h3(a);s.push(l);const c=oe(n,"addInputRules",i);if(fh(n,r.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=W6({editor:r,rules:h}),m=Array.isArray(f)?f:[f];s.push(...m)}}const u=oe(n,"addPasteRules",i);if(fh(n,r.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=Q6({editor:r,rules:h});s.push(...f)}}const d=oe(n,"addProseMirrorPlugins",i);if(d){const h=d();s.push(...h)}return s})}get attributes(){return sh(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=Hn(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addNodeView")).map(t=>{const n=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:Ve(t.name,this.schema)},s=oe(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,u,d,h)=>{const f=Oi(l,n);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:h,editor:r,extension:t,HTMLAttributes:f})};return[t.name,a]}))}get markViews(){const{editor:r}=this,{markExtensions:e}=Hn(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addMarkView")).map(t=>{const n=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:ar(t.name,this.schema)},s=oe(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const u=Oi(a,n);return s()({mark:a,view:l,inline:c,editor:r,extension:t,HTMLAttributes:u,updateAttributes:d=>{d7(a,r,d)}})};return[t.name,o]}))}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xa(e.name,this.schema)};e.type==="mark"&&((t=ke(oe(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name);const i=oe(e,"onBeforeCreate",n),s=oe(e,"onCreate",n),o=oe(e,"onUpdate",n),a=oe(e,"onSelectionUpdate",n),l=oe(e,"onTransaction",n),c=oe(e,"onFocus",n),u=oe(e,"onBlur",n),d=oe(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};$s.resolve=ch,$s.sort=Ka,$s.flatten=Wa;var e7={};Va(e7,{ClipboardTextSerializer:()=>bh,Commands:()=>xh,Delete:()=>wh,Drop:()=>Sh,Editable:()=>kh,FocusEvents:()=>Th,Keymap:()=>Ch,Paste:()=>Eh,Tabindex:()=>Ah,TextDirection:()=>Oh,focusEventsPluginKey:()=>Mh});var Se=class g1 extends tl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new g1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},bh=Se.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pe({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Ja(t);return uh(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xh=Se.create({name:"commands",addCommands(){return{...Jd}}}),wh=Se.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,n,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,r))!=null?c:r.getMeta("y-sync$"))return;const u=n6(r.before,[r,...e]);p6(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(m,y)=>{const v=y+m.nodeSize-2,x=f.oldRange.from<=y&&v<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:y,to:v,newFrom:u.mapping.map(y),newTo:u.mapping.map(v),deletedRange:f.oldRange,newRange:f.newRange,partial:!x,editor:this.editor,transaction:r,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,m)=>{var y,v;if(f instanceof Pt){const x=h.slice(m).map(f.from,-1),T=h.slice(m).map(f.to),D=h.invert().map(x,-1),P=h.invert().map(T),E=(y=u.doc.nodeAt(x-1))==null?void 0:y.marks.some(O=>O.eq(f.mark)),N=(v=u.doc.nodeAt(T))==null?void 0:v.marks.some(O=>O.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:D,to:P},newRange:{from:x,to:T},partial:!!(N||E),editor:this.editor,transaction:r,combinedTransform:u})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(s,0):s()}}),Sh=Se.create({name:"drop",addProseMirrorPlugins(){return[new Pe({key:new Fe("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),kh=Se.create({name:"editable",addProseMirrorPlugins(){return[new Pe({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Mh=new Fe("focusEvents"),Th=Se.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Pe({key:Mh,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Ch=Se.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:h,parent:f}=d,m=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,y=m.parent.type.spec.isolating,v=d.pos-d.parentOffset,x=y&&m.parent.childCount===1?v===d.pos:ce.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!x||x&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ns()||th()?s:i},addProseMirrorPlugins(){return[new Pe({key:new Fe("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(y=>y.getMeta("composition")))return;const n=r.some(y=>y.docChanged)&&!e.doc.eq(t.doc),i=r.some(y=>y.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=ce.atStart(e.doc).from,c=ce.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!Ps(t.doc))return;const h=t.tr,f=Es({state:t,transaction:h}),{commands:m}=new As({editor:this.editor,state:f});if(m.clearNodes(),!!h.steps.length)return h}})]}}),Eh=Se.create({name:"paste",addProseMirrorPlugins(){return[new Pe({key:new Fe("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ah=Se.create({name:"tabindex",addProseMirrorPlugins(){return[new Pe({key:new Fe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Oh=Se.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=Hn(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pe({key:new Fe("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),t7=class Qn{constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Qn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Qn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Qn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Qn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Qn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else n=i;i=i.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},r7=`.ProseMirror {
29
29
  position: relative;
30
30
  }
31
31
 
@@ -95,35 +95,35 @@ img.ProseMirror-separator {
95
95
 
96
96
  .ProseMirror-focused .ProseMirror-gapcursor {
97
97
  display: block;
98
- }`;function n7(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}var i7=class extends j6{constructor(r={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:w6,createMappablePosition:S6},this.setOptions(r),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:i,moved:s})=>this.options.onDrop(n,i,s)),this.on("paste",({event:n,slice:i})=>this.options.onPaste(n,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Yd(e,this.options.autofocus);this.editorState=zn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(r){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(r),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const r=this.editorView.dom;r?.editor&&delete r.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(r){console.warn("Failed to remove CSS element:",r)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=n7(r7,this.options.injectNonce))}setOptions(r={}){this.options={...this.options,...r},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(r,e=!0){this.setOptions({editable:r}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:r=>{this.editorState=r},dispatch:r=>{this.dispatchTransaction(r)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(r,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in r)return Reflect.get(r,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(r,e){const t=nh(e)?e(r,[...this.state.plugins]):[...this.state.plugins,r],n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}unregisterPlugin(r){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(r).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}createExtensionManager(){var r,e;const n=[...this.options.enableCoreExtensions?[Sh,vh.configure({blockSeparator:(e=(r=this.options.coreExtensionOptions)==null?void 0:r.clipboardTextSerializer)==null?void 0:e.blockSeparator}),bh,Mh,Th,Eh,wh,Ch,xh,Ah.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new $s(n,this)}createCommandManager(){this.commandManager=new As({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let r;try{r=Ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),r=Ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return r}createView(r){var e;this.editorView=new qd(r,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const n=this.view.dom;n.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(r){this.isCapturingTransaction=!0,r(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(r){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=r;return}r.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(r),n=!this.state.selection.eq(e.selection),i=t.includes(r),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:r,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:r,appendedTransactions:t.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:r});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(r.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:r,appendedTransactions:t.slice(1)})}getAttributes(r){return d6(this.state,r)}isActive(r,e){const t=typeof r=="string"?r:null,n=typeof r=="string"?e:r;return y6(this.state,t,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ga(this.state.doc.content,this.schema)}getText(r){const{blockSeparator:e=`
98
+ }`;function n7(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}var i7=class extends j6{constructor(r={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:w6,createMappablePosition:S6},this.setOptions(r),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:i,moved:s})=>this.options.onDrop(n,i,s)),this.on("paste",({event:n,slice:i})=>this.options.onPaste(n,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Zd(e,this.options.autofocus);this.editorState=zn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(r){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(r),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const r=this.editorView.dom;r?.editor&&delete r.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(r){console.warn("Failed to remove CSS element:",r)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=n7(r7,this.options.injectNonce))}setOptions(r={}){this.options={...this.options,...r},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(r,e=!0){this.setOptions({editable:r}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:r=>{this.editorState=r},dispatch:r=>{this.dispatchTransaction(r)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(r,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in r)return Reflect.get(r,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(r,e){const t=ih(e)?e(r,[...this.state.plugins]):[...this.state.plugins,r],n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}unregisterPlugin(r){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(r).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}createExtensionManager(){var r,e;const n=[...this.options.enableCoreExtensions?[kh,bh.configure({blockSeparator:(e=(r=this.options.coreExtensionOptions)==null?void 0:r.clipboardTextSerializer)==null?void 0:e.blockSeparator}),xh,Th,Ch,Ah,Sh,Eh,wh,Oh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new $s(n,this)}createCommandManager(){this.commandManager=new As({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let r;try{r=Ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),r=Ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return r}createView(r){var e;this.editorView=new _d(r,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const n=this.view.dom;n.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(r){this.isCapturingTransaction=!0,r(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(r){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=r;return}r.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(r),n=!this.state.selection.eq(e.selection),i=t.includes(r),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:r,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:r,appendedTransactions:t.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:r});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(r.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:r,appendedTransactions:t.slice(1)})}getAttributes(r){return d6(this.state,r)}isActive(r,e){const t=typeof r=="string"?r:null,n=typeof r=="string"?e:r;return y6(this.state,t,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ga(this.state.doc.content,this.schema)}getText(r){const{blockSeparator:e=`
99
99
 
100
- `,textSerializers:t={}}=r||{};return uh(this.state.doc,{blockSeparator:e,textSerializers:{...Ja(this.schema),...t}})}get isEmpty(){return Ps(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var r,e;return(e=(r=this.editorView)==null?void 0:r.isDestroyed)!=null?e:!0}$node(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(r,e))||null}$nodes(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(r,e))||null}$pos(r){const e=this.state.doc.resolve(r);return new t7(e,this)}get $doc(){return this.$pos(0)}};function $r(r){return new el({find:r.find,handler:({state:e,range:t,match:n})=>{const i=ke(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],a=n[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(dh(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(y=>y===r.type&&y!==f.mark.type)).filter(f=>f.to>c).length)return null;u<t.to&&s.delete(u,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,r.type.create(i||{})),s.removeStoredMark(r.type)}},undoable:r.undoable})}function rl(r){return new el({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=ke(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)},undoable:r.undoable})}function it(r){return new el({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=ke(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&ra(l,r.type,s);if(!c)return null;if(o.wrap(l,c),r.keepMarks&&r.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=r.editor.extensionManager,m=h||d.$to.parentOffset&&d.$from.marks();if(m){const y=m.filter(v=>f.includes(v.type.name));o.ensureMarks(y)}}if(r.keepAttributes){const d=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===r.type&&Ar(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,u))&&o.join(t.from-1)},undoable:r.undoable})}var s7={};Va(s7,{createAtomBlockMarkdownSpec:()=>o7,createBlockMarkdownSpec:()=>a7,createInlineMarkdownSpec:()=>u7,parseAttributes:()=>nl,parseIndentedBlocks:()=>sl,renderNestedMarkdownContent:()=>ol,serializeAttributes:()=>il});function nl(r){if(!r?.trim())return{};const e={},t=[],n=r.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function il(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function o7(r){const{nodeName:e,name:t,parseAttributes:n=nl,serializeAttributes:i=il,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=r,l=t||e,c=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...s,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(f);if(!m)return;const y=m[1]||"",v=n(y);if(!o.find(T=>!(T in v)))return{type:e,raw:m[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function a7(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=nl,serializeAttributes:s=il,defaultAttributes:o={},content:a="block",allowedAttributes:l}=r,c=t||e,u=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(n){const y=n(d);f=typeof y=="string"?[{type:"text",text:y}]:y}else a==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const m={...o,...d.attributes};return h.createNode(e,m,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),m=(h=d.match(f))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(d,h,f){var m;const y=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(y);if(!v)return;const[x,T=""]=v,D=i(T);let P=1;const N=x.length;let O="";const A=/^:::([\w-]*)(\s.*)?/gm,$=d.slice(N);for(A.lastIndex=0;;){const F=A.exec($);if(F===null)break;const q=F.index,te=F[1];if(!((m=F[2])!=null&&m.endsWith(":::"))){if(te)P+=1;else if(P-=1,P===0){const Y=$.slice(0,q);O=Y.trim();const he=d.slice(0,N+q+F[0].length);let Q=[];if(O)if(a==="block")for(Q=f.blockTokens(Y),Q.forEach(W=>{W.text&&(!W.tokens||W.tokens.length===0)&&(W.tokens=f.inlineTokens(W.text))});Q.length>0;){const W=Q[Q.length-1];if(W.type==="paragraph"&&(!W.text||W.text.trim()===""))Q.pop();else break}else Q=f.inlineTokens(O);return{type:e,raw:he,attributes:D,content:O,tokens:Q}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),m=s(f),y=m?` {${m}}`:"",v=h.renderChildren(d.content||[],`
100
+ `,textSerializers:t={}}=r||{};return dh(this.state.doc,{blockSeparator:e,textSerializers:{...Ja(this.schema),...t}})}get isEmpty(){return Ps(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var r,e;return(e=(r=this.editorView)==null?void 0:r.isDestroyed)!=null?e:!0}$node(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(r,e))||null}$nodes(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(r,e))||null}$pos(r){const e=this.state.doc.resolve(r);return new t7(e,this)}get $doc(){return this.$pos(0)}};function $r(r){return new el({find:r.find,handler:({state:e,range:t,match:n})=>{const i=ke(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],a=n[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(hh(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(y=>y===r.type&&y!==f.mark.type)).filter(f=>f.to>c).length)return null;u<t.to&&s.delete(u,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,r.type.create(i||{})),s.removeStoredMark(r.type)}},undoable:r.undoable})}function rl(r){return new el({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=ke(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)},undoable:r.undoable})}function it(r){return new el({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=ke(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&ra(l,r.type,s);if(!c)return null;if(o.wrap(l,c),r.keepMarks&&r.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=r.editor.extensionManager,m=h||d.$to.parentOffset&&d.$from.marks();if(m){const y=m.filter(v=>f.includes(v.type.name));o.ensureMarks(y)}}if(r.keepAttributes){const d=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===r.type&&Ar(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,u))&&o.join(t.from-1)},undoable:r.undoable})}var s7={};Va(s7,{createAtomBlockMarkdownSpec:()=>o7,createBlockMarkdownSpec:()=>a7,createInlineMarkdownSpec:()=>u7,parseAttributes:()=>nl,parseIndentedBlocks:()=>sl,renderNestedMarkdownContent:()=>ol,serializeAttributes:()=>il});function nl(r){if(!r?.trim())return{};const e={},t=[],n=r.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function il(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function o7(r){const{nodeName:e,name:t,parseAttributes:n=nl,serializeAttributes:i=il,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=r,l=t||e,c=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...s,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(f);if(!m)return;const y=m[1]||"",v=n(y);if(!o.find(T=>!(T in v)))return{type:e,raw:m[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function a7(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=nl,serializeAttributes:s=il,defaultAttributes:o={},content:a="block",allowedAttributes:l}=r,c=t||e,u=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(n){const y=n(d);f=typeof y=="string"?[{type:"text",text:y}]:y}else a==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const m={...o,...d.attributes};return h.createNode(e,m,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),m=(h=d.match(f))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(d,h,f){var m;const y=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(y);if(!v)return;const[x,T=""]=v,D=i(T);let P=1;const E=x.length;let N="";const O=/^:::([\w-]*)(\s.*)?/gm,$=d.slice(E);for(O.lastIndex=0;;){const F=O.exec($);if(F===null)break;const q=F.index,te=F[1];if(!((m=F[2])!=null&&m.endsWith(":::"))){if(te)P+=1;else if(P-=1,P===0){const Y=$.slice(0,q);N=Y.trim();const he=d.slice(0,E+q+F[0].length);let Q=[];if(N)if(a==="block")for(Q=f.blockTokens(Y),Q.forEach(W=>{W.text&&(!W.tokens||W.tokens.length===0)&&(W.tokens=f.inlineTokens(W.text))});Q.length>0;){const W=Q[Q.length-1];if(W.type==="paragraph"&&(!W.text||W.text.trim()===""))Q.pop();else break}else Q=f.inlineTokens(N);return{type:e,raw:he,attributes:D,content:N,tokens:Q}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),m=s(f),y=m?` {${m}}`:"",v=h.renderChildren(d.content||[],`
101
101
 
102
102
  `);return`:::${c}${y}
103
103
 
104
104
  ${v}
105
105
 
106
- :::`}}}function l7(r){if(!r.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=t.exec(r);for(;n!==null;){const[,i,s,o]=n;e[i]=s||o,n=t.exec(r)}return e}function c7(r){return Object.entries(r).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function u7(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=l7,serializeAttributes:s=c7,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=r,c=t||e,u=h=>{if(!l)return h;const f={};return l.forEach(m=>{const y=typeof m=="string"?m:m.name,v=typeof m=="string"?void 0:m.skipIfDefault;if(y in h){const x=h[y];if(v!==void 0&&x===v)return;f[y]=x}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const m={...o,...h.attributes};if(a)return f.createNode(e,m);const y=n?n(h):h.content||"";return y?f.createNode(e,m,[f.createTextNode(y)]):f.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=h.match(f),y=m?.index;return y!==void 0?y:-1},tokenize(h,f,m){const y=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=h.match(y);if(!v)return;let x="",T="";if(a){const[,P]=v;T=P}else{const[,P,N]=v;T=P,x=N||""}const D=i(T.trim());return{type:e,raw:v[0],content:x.trim(),attributes:D}}},renderMarkdown:h=>{let f="";n?f=n(h):h.content&&h.content.length>0&&(f=h.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(h.attrs||{}),y=s(m),v=y?` ${y}`:"";return a?`[${c}${v}]`:`[${c}${v}]${f}[/${c}]`}}}function sl(r,e,t){var n,i,s,o;const a=r.split(`
106
+ :::`}}}function l7(r){if(!r.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=t.exec(r);for(;n!==null;){const[,i,s,o]=n;e[i]=s||o,n=t.exec(r)}return e}function c7(r){return Object.entries(r).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function u7(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=l7,serializeAttributes:s=c7,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=r,c=t||e,u=h=>{if(!l)return h;const f={};return l.forEach(m=>{const y=typeof m=="string"?m:m.name,v=typeof m=="string"?void 0:m.skipIfDefault;if(y in h){const x=h[y];if(v!==void 0&&x===v)return;f[y]=x}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const m={...o,...h.attributes};if(a)return f.createNode(e,m);const y=n?n(h):h.content||"";return y?f.createNode(e,m,[f.createTextNode(y)]):f.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=h.match(f),y=m?.index;return y!==void 0?y:-1},tokenize(h,f,m){const y=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),v=h.match(y);if(!v)return;let x="",T="";if(a){const[,P]=v;T=P}else{const[,P,E]=v;T=P,x=E||""}const D=i(T.trim());return{type:e,raw:v[0],content:x.trim(),attributes:D}}},renderMarkdown:h=>{let f="";n?f=n(h):h.content&&h.content.length>0&&(f=h.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(h.attrs||{}),y=s(m),v=y?` ${y}`:"";return a?`[${c}${v}]`:`[${c}${v}]${f}[/${c}]`}}}function sl(r,e,t){var n,i,s,o;const a=r.split(`
107
107
  `),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const h=a[u],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
108
108
  `;continue}else return}const m=e.extractItemData(f),{indentLevel:y,mainContent:v}=m;c=`${c}${h}
109
- `;const x=[v];for(u+=1;u<a.length;){const N=a[u];if(N.trim()===""){const A=a.slice(u+1).findIndex(q=>q.trim()!=="");if(A===-1)break;if((((i=(n=a[u+1+A].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:i.length)||0)>y){x.push(N),c=`${c}${N}
110
- `,u+=1;continue}else break}if((((o=(s=N.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>y)x.push(N),c=`${c}${N}
111
- `,u+=1;else break}let T;const D=x.slice(1);if(D.length>0){const N=D.map(O=>O.slice(y+d)).join(`
112
- `);N.trim()&&(e.customNestedParser?T=e.customNestedParser(N):T=t.blockTokens(N))}const P=e.createToken(m,T);l.push(P)}if(l.length!==0)return{items:l,raw:c}}function ol(r,e,t,n){if(!r||!Array.isArray(r.content))return"";const i=typeof t=="function"?t(n):t,[s,...o]=r.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
109
+ `;const x=[v];for(u+=1;u<a.length;){const E=a[u];if(E.trim()===""){const O=a.slice(u+1).findIndex(q=>q.trim()!=="");if(O===-1)break;if((((i=(n=a[u+1+O].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:i.length)||0)>y){x.push(E),c=`${c}${E}
110
+ `,u+=1;continue}else break}if((((o=(s=E.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>y)x.push(E),c=`${c}${E}
111
+ `,u+=1;else break}let T;const D=x.slice(1);if(D.length>0){const E=D.map(N=>N.slice(y+d)).join(`
112
+ `);E.trim()&&(e.customNestedParser?T=e.customNestedParser(E):T=t.blockTokens(E))}const P=e.createToken(m,T);l.push(P)}if(l.length!==0)return{items:l,raw:c}}function ol(r,e,t,n){if(!r||!Array.isArray(r.content))return"";const i=typeof t=="function"?t(n):t,[s,...o]=r.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
113
113
  `).map(h=>h?e.indent(h):"").join(`
114
114
  `);l.push(d)}}),l.join(`
115
- `)}function d7(r,e,t={}){const{state:n}=e,{doc:i,tr:s}=n,o=r;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==d.attrs[f]&&(h=!0)}),h){const f=r.type.create({...r.attrs,...t});s.removeMark(c,u,r.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var we=class y1 extends tl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new y1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},h7=class{constructor(r,e,t){this.isDragging=!1,this.component=r,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(r){var e,t,n,i,s,o,a;const{view:l}=this.editor,c=r.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const T=this.dom.getBoundingClientRect(),D=u.getBoundingClientRect(),P=(i=r.offsetX)!=null?i:(n=r.nativeEvent)==null?void 0:n.offsetX,N=(o=r.offsetY)!=null?o:(s=r.nativeEvent)==null?void 0:s.offsetY;d=D.x-T.x+P,h=D.y-T.y+N}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),(a=r.dataTransfer)==null||a.setDragImage(f,d,h)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const y=this.getPos();if(typeof y!="number")return;const v=se.create(l.state.doc,y),x=l.state.tr.setSelection(v);l.dispatch(x)}stopEvent(r){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:r});const t=r.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=r.type.startsWith("drag"),s=r.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=se.isSelectable(this.node),d=r.type==="copy",h=r.type==="paste",f=r.type==="cut",m=r.type==="mousedown";if(!c&&u&&i&&r.target===this.dom&&r.preventDefault(),c&&i&&!l&&r.target===this.dom)return r.preventDefault(),!1;if(c&&a&&!l&&m){const y=t.closest("[data-drag-handle]");y&&(this.dom===y||this.dom.contains(y))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||h||f||m&&u)}ignoreMutation(r){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:r}):this.node.isLeaf||this.node.isAtom?!0:r.type==="selection"||this.dom.contains(r.target)&&r.type==="childList"&&(Ns()||Zd())&&this.editor.isFocused&&[...Array.from(r.addedNodes),...Array.from(r.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===r.target&&r.type==="attributes"?!0:!this.contentDOM.contains(r.target)}updateAttributes(r){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...r}),!0)})}deleteNode(){const r=this.getPos();if(typeof r!="number")return;const e=r+this.node.nodeSize;this.editor.commands.deleteRange({from:r,to:e})}};function Hs(r){return new J6({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=ke(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,a=n[n.length-1],l=n[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),h=d+a.length;if(dh(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(v=>v===r.type&&v!==m.mark.type)).filter(m=>m.to>d).length)return null;h<t.to&&o.delete(h,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function f7(r={}){return new Pe({view(e){return new p7(e,r)}})}class p7{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),y=d?m.bottom:m.top;d&&h&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;n={left:m.left,right:m.right,top:y-v,bottom:y+v}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;n={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*f}this.element.style.left=(n.left-c)/o+"px",this.element.style.top=(n.top-u)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ou(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Le extends ce{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Le.valid(n)?new Le(n):ce.near(n)}content(){return X.empty}eq(e){return e instanceof Le&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Le(e.resolve(t.pos))}getBookmark(){return new al(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!m7(e)||!g7(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Le.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Le.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!se.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Le.valid(a))return a}return null}}}Le.prototype.visible=!1,Le.findFrom=Le.findGapCursorFrom,ce.jsonID("gapcursor",Le);class al{constructor(e){this.pos=e}map(e){return new al(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Le.valid(t)?new Le(t):ce.near(t)}}function Oh(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function m7(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Oh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function g7(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Oh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function y7(){return new Pe({props:{decorations:w7,createSelectionBetween(r,e,t){return e.pos==t.pos&&Le.valid(t)?new Le(t):null},handleClick:b7,handleKeyDown:v7,handleDOMEvents:{beforeinput:x7}}})}const v7=Ha({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1)});function Vs(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=Le.findGapCursorFrom(a,e,l);return c?(i&&i(n.tr.setSelection(new Le(c))),!0):!1}}function b7(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!Le.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&se.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Le(n))),!0)}function x7(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Le))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=H.empty;for(let o=n.length-1;o>=0;o--)i=H.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new X(i,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function w7(r){if(!(r.selection instanceof Le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(r.doc,[nt.widget(r.selection.head,e,{key:"gapcursor"})])}var qs=200,Ke=function(){};Ke.prototype.append=function(e){return e.length?(e=Ke.from(e),!this.length&&e||e.length<qs&&this.leafAppend(e)||this.length<qs&&e.leafPrepend(this)||this.appendInner(e)):this},Ke.prototype.prepend=function(e){return e.length?Ke.from(e).append(this):this},Ke.prototype.appendInner=function(e){return new S7(this,e)},Ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ke.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Ke.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},Ke.from=function(e){return e instanceof Ke?e:e&&e.length?new Nh(e):Ke.empty};var Nh=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=qs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=qs)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ke);Ke.empty=new Nh([]);var S7=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(n,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(n,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Ke);const k7=500;class Lt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(n,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new _t(d.map));let f=d.step.map(i.slice(s)),m;f&&o.maybeStep(f).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new _t(m,void 0,void 0,c.length+u.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Lt(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,n,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new _t(e.mapping.maps[u],d,t),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-n.depth;return c>T7&&(a=M7(a,c),o-=c),new Lt(a.append(s),o)}remapping(e,t){let n=new pi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new Lt(this.items.append(e.map(t=>new _t(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let m=s.maps[f];if(h.step){let y=e.steps[f].invert(e.docs[f]),v=h.selection&&h.selection.map(s.slice(l+1,f));v&&a++,n.push(new _t(m,y,v))}else n.push(new _t(m))},i);let c=[];for(let h=t;h<o;h++)c.push(new _t(s.maps[h]));let u=this.items.slice(0,i).append(c).append(n),d=new Lt(u,a);return d.emptyItemCount()>k7&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(n)),c=l&&l.getMap();if(n--,c&&t.appendMap(c,n),l){let u=o.selection&&o.selection.map(t.slice(n));u&&s++;let d=new _t(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&n--},this.items.length,0),new Lt(Ke.from(i.reverse()),s)}}Lt.empty=new Lt(Ke.empty,0);function M7(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class _t{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _t(t.getMap().invert(),t,this.selection)}}}class Hr{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const T7=20;function C7(r,e,t,n){let i=t.getMeta(pn),s;if(i)return i.historyState;t.getMeta(O7)&&(r=new Hr(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(pn))return o.getMeta(pn).redo?new Hr(r.done.addTransform(t,void 0,n,_s(e)),r.undone,Dh(t.mapping.maps),r.prevTime,r.prevComposition):new Hr(r.done,r.undone.addTransform(t,void 0,n,_s(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=a&&(r.prevTime<(t.time||0)-n.newGroupDelay||!E7(t,r.prevRanges)),c=o?ll(r.prevRanges,t.mapping):Dh(t.mapping.maps);return new Hr(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,_s(e)),Lt.empty,c,t.time,a??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Hr(r.done.rebased(t,s),r.undone.rebased(t,s),ll(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Hr(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),ll(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function E7(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Dh(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function ll(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function A7(r,e,t){let n=_s(e),i=pn.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),l=new Hr(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(pn,{redo:t,historyState:l})}let cl=!1,zh=null;function _s(r){let e=r.plugins;if(zh!=e){cl=!1,zh=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){cl=!0;break}}return cl}const pn=new Fe("history"),O7=new Fe("closeHistory");function N7(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Pe({key:pn,state:{init(){return new Hr(Lt.empty,Lt.empty,null,0,-1)},apply(e,t,n){return C7(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Rh:n=="historyRedo"?Ph:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function Ih(r,e){return(t,n)=>{let i=pn.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=A7(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const Rh=Ih(!1,!0),Ph=Ih(!0,!0);Se.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=r?.node||this.editor.state.doc;if((r?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=r?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Pe({key:new Fe("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=n.tr.deleteRange(a,l);return r=!0,c}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=n||i>n&&s>n&&s<=i)return!0;if(i>n&&s>n&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-n,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>n)}})]}}),Se.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[f7(this.options)]}});var D7=Se.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Pe({key:new Fe("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,s=[];if(!t||!n)return De.create(r,[]);let o=0;this.options.mode==="deepest"&&r.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return r.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(nt.node(c,c+l.nodeSize,{class:this.options.className}))}),De.create(r,s)}}})]}}),z7=Se.create({name:"gapCursor",addProseMirrorPlugins(){return[y7()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=ke(oe(r,"allowGapCursor",t)))!=null?e:null}}});Se.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Pe({key:new Fe("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return r.descendants((o,a)=>{const l=n>=a&&n<=a+o.nodeSize,c=!o.isLeaf&&Ps(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const d=nt.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),De.create(r,i)}}})]}}),Se.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new Pe({key:new Fe("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||x6(t.selection)||r.view.dragging?null:De.create(t.doc,[nt.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Lh({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||e?.type===r}Se.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Fe(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Pe({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,h=c.nodes[t];if(u)return l.insert(d,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Lh({node:o,types:n})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Lh({node:o,types:n})}}})]}});var I7=Se.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>Rh(r,e),redo:()=>({state:r,dispatch:e})=>Ph(r,e)}},addProseMirrorPlugins(){return[N7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),js={exports:{}},ul={};var Bh;function R7(){if(Bh)return ul;Bh=1;var r=z;function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(d,h){var f=h(),m=n({inst:{value:f,getSnapshot:h}}),y=m[0].inst,v=m[1];return s(function(){y.value=f,y.getSnapshot=h,l(y)&&v({inst:y})},[d,f,h]),i(function(){return l(y)&&v({inst:y}),d(function(){l(y)&&v({inst:y})})},[d]),o(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!t(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return ul.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,ul}var dl={};var Fh;function P7(){return Fh||(Fh=1,process.env.NODE_ENV!=="production"&&(function(){function r(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}function e(f,m){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!d){var v=m();s(y,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=o({inst:{value:y,getSnapshot:m}});var x=v[0].inst,T=v[1];return l(function(){x.value=y,x.getSnapshot=m,t(x)&&T({inst:x})},[f,y,m]),a(function(){return t(x)&&T({inst:x}),f(function(){t(x)&&T({inst:x})})},[f]),c(y),y}function t(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!s(f,y)}catch{return!0}}function n(f,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=z,s=typeof Object.is=="function"?Object.is:r,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,u=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:e;dl.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),dl}var $h;function hl(){return $h||($h=1,process.env.NODE_ENV==="production"?js.exports=R7():js.exports=P7()),js.exports}var Hh=hl();const{getOwnPropertyNames:L7,getOwnPropertySymbols:B7}=Object,{hasOwnProperty:F7}=Object.prototype;function fl(r,e){return function(n,i,s){return r(n,i,s)&&e(n,i,s)}}function Us(r){return function(t,n,i){if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);const{cache:s}=i,o=s.get(t),a=s.get(n);if(o&&a)return o===n&&a===t;s.set(t,n),s.set(n,t);const l=r(t,n,i);return s.delete(t),s.delete(n),l}}function $7(r){return r?.[Symbol.toStringTag]}function Vh(r){return L7(r).concat(B7(r))}const H7=Object.hasOwn||((r,e)=>F7.call(r,e));function mn(r,e){return r===e||!r&&!e&&r!==r&&e!==e}const V7="__v",q7="__o",_7="_owner",{getOwnPropertyDescriptor:qh,keys:_h}=Object;function j7(r,e){return r.byteLength===e.byteLength&&Ws(new Uint8Array(r),new Uint8Array(e))}function U7(r,e,t){let n=r.length;if(e.length!==n)return!1;for(;n-- >0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}function W7(r,e){return r.byteLength===e.byteLength&&Ws(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function G7(r,e){return mn(r.getTime(),e.getTime())}function K7(r,e){return r.name===e.name&&r.message===e.message&&r.cause===e.cause&&r.stack===e.stack}function J7(r,e){return r===e}function jh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const h=o.value,f=a.value;if(t.equals(h[0],f[0],l,d,r,e,t)&&t.equals(h[1],f[1],h[0],f[0],r,e,t)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const X7=mn;function Y7(r,e,t){const n=_h(r);let i=n.length;if(_h(e).length!==i)return!1;for(;i-- >0;)if(!Wh(r,e,t,n[i]))return!1;return!0}function Di(r,e,t){const n=Vh(r);let i=n.length;if(Vh(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=n[i],!Wh(r,e,t,s)||(o=qh(r,s),a=qh(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Z7(r,e){return mn(r.valueOf(),e.valueOf())}function Q7(r,e){return r.source===e.source&&r.flags===e.flags}function Uh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&t.equals(o.value,a.value,o.value,a.value,r,e,t)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Ws(r,e){let t=r.byteLength;if(e.byteLength!==t||r.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}function ey(r,e){return r.hostname===e.hostname&&r.pathname===e.pathname&&r.protocol===e.protocol&&r.port===e.port&&r.hash===e.hash&&r.username===e.username&&r.password===e.password}function Wh(r,e,t,n){return(n===_7||n===q7||n===V7)&&(r.$$typeof||e.$$typeof)?!0:H7(e,n)&&t.equals(r[n],e[n],n,n,r,e,t)}const ty="[object ArrayBuffer]",ry="[object Arguments]",ny="[object Boolean]",iy="[object DataView]",sy="[object Date]",oy="[object Error]",ay="[object Map]",ly="[object Number]",cy="[object Object]",uy="[object RegExp]",dy="[object Set]",hy="[object String]",fy={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},py="[object URL]",my=Object.prototype.toString;function gy({areArrayBuffersEqual:r,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:f,unknownTagComparators:m}){return function(v,x,T){if(v===x)return!0;if(v==null||x==null)return!1;const D=typeof v;if(D!==typeof x)return!1;if(D!=="object")return D==="number"?a(v,x,T):D==="function"?s(v,x,T):!1;const P=v.constructor;if(P!==x.constructor)return!1;if(P===Object)return l(v,x,T);if(Array.isArray(v))return e(v,x,T);if(P===Date)return n(v,x,T);if(P===RegExp)return u(v,x,T);if(P===Map)return o(v,x,T);if(P===Set)return d(v,x,T);const N=my.call(v);if(N===sy)return n(v,x,T);if(N===uy)return u(v,x,T);if(N===ay)return o(v,x,T);if(N===dy)return d(v,x,T);if(N===cy)return typeof v.then!="function"&&typeof x.then!="function"&&l(v,x,T);if(N===py)return f(v,x,T);if(N===oy)return i(v,x,T);if(N===ry)return l(v,x,T);if(fy[N])return h(v,x,T);if(N===ty)return r(v,x,T);if(N===iy)return t(v,x,T);if(N===ny||N===ly||N===hy)return c(v,x,T);if(m){let O=m[N];if(!O){const A=$7(v);A&&(O=m[A])}if(O)return O(v,x,T)}return!1}}function yy({circular:r,createCustomConfig:e,strict:t}){let n={areArrayBuffersEqual:j7,areArraysEqual:t?Di:U7,areDataViewsEqual:W7,areDatesEqual:G7,areErrorsEqual:K7,areFunctionsEqual:J7,areMapsEqual:t?fl(jh,Di):jh,areNumbersEqual:X7,areObjectsEqual:t?Di:Y7,arePrimitiveWrappersEqual:Z7,areRegExpsEqual:Q7,areSetsEqual:t?fl(Uh,Di):Uh,areTypedArraysEqual:t?fl(Ws,Di):Ws,areUrlsEqual:ey,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),r){const i=Us(n.areArraysEqual),s=Us(n.areMapsEqual),o=Us(n.areObjectsEqual),a=Us(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return n}function vy(r){return function(e,t,n,i,s,o,a){return r(e,t,a)}}function by({circular:r,comparator:e,createState:t,equals:n,strict:i}){if(t)return function(a,l){const{cache:c=r?new WeakMap:void 0,meta:u}=t();return e(a,l,{cache:c,equals:n,meta:u,strict:i})};if(r)return function(a,l){return e(a,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const s={cache:void 0,equals:n,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const xy=Vr();Vr({strict:!0}),Vr({circular:!0}),Vr({circular:!0,strict:!0}),Vr({createInternalComparator:()=>mn}),Vr({strict:!0,createInternalComparator:()=>mn}),Vr({circular:!0,createInternalComparator:()=>mn}),Vr({circular:!0,createInternalComparator:()=>mn,strict:!0});function Vr(r={}){const{circular:e=!1,createInternalComparator:t,createState:n,strict:i=!1}=r,s=yy(r),o=gy(s),a=t?t(o):vy(o);return by({circular:e,comparator:o,createState:n,equals:a,strict:i})}var Gs={exports:{}},pl={};var Gh;function wy(){if(Gh)return pl;Gh=1;var r=z,e=hl();function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,l=r.useDebugValue;return pl.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function x(O){if(!T){if(T=!0,D=O,O=h(O),f!==void 0&&y.hasValue){var A=y.value;if(f(A,O))return P=A}return P=O}if(A=P,n(D,O))return A;var $=h(O);return f!==void 0&&f(A,$)?(D=O,A):(D=O,P=$)}var T=!1,D,P,N=d===void 0?null:d;return[function(){return x(u())},N===null?void 0:function(){return x(N())}]},[u,d,h,f]);var v=i(c,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=v},[v]),l(v),v},pl}var ml={};var Kh;function Sy(){return Kh||(Kh=1,process.env.NODE_ENV!=="production"&&(function(){function r(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=z,t=hl(),n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;ml.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function x(O){if(!T){if(T=!0,D=O,O=h(O),f!==void 0&&y.hasValue){var A=y.value;if(f(A,O))return P=A}return P=O}if(A=P,n(D,O))return A;var $=h(O);return f!==void 0&&f(A,$)?(D=O,A):(D=O,P=$)}var T=!1,D,P,N=d===void 0?null:d;return[function(){return x(u())},N===null?void 0:function(){return x(N())}]},[u,d,h,f]);var v=i(c,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=v},[v]),l(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ml}var Jh;function ky(){return Jh||(Jh=1,process.env.NODE_ENV==="production"?Gs.exports=wy():Gs.exports=Sy()),Gs.exports}var My=ky(),Ty=(...r)=>e=>{r.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Cy=({contentComponent:r})=>{const e=Hh.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getServerSnapshot);return J.jsx(J.Fragment,{children:Object.values(e)})};function Ey(){const r=new Set;let e={};return{subscribe(t){return r.add(t),()=>{r.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,n){e={...e,[t]:ji.createPortal(n.reactElement,n.element,t)},r.forEach(i=>i())},removeRenderer(t){const n={...e};delete n[t],e=n,r.forEach(i=>i())}}}var Ay=class extends z.Component{constructor(r){var e;super(r),this.editorContentRef=z.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=r.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var r;const e=this.props.editor;if(e&&!e.isDestroyed&&((r=e.view.dom)!=null&&r.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Ey(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var r;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((r=e.view.dom)!=null&&r.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:r,innerRef:e,...t}=this.props;return J.jsxs(J.Fragment,{children:[J.jsx("div",{ref:Ty(e,this.editorContentRef),...t}),r?.contentComponent&&J.jsx(Cy,{contentComponent:r.contentComponent})]})}},Oy=z.forwardRef((r,e)=>{const t=z.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[r.editor]);return z.createElement(Ay,{key:t,innerRef:e,...r})}),Ny=z.memo(Oy),Dy=typeof window<"u"?z.useLayoutEffect:z.useEffect,zy=class{constructor(r){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=r,this.lastSnapshot={editor:r,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}watch(r){if(this.editor=r,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Xh(r){var e;const[t]=z.useState(()=>new zy(r.editor)),n=My.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,r.selector,(e=r.equalityFn)!=null?e:xy);return Dy(()=>t.watch(r.editor),[r.editor,t]),z.useDebugValue(n),n}var Yh=process.env.NODE_ENV!=="production",gl=typeof window>"u",Iy=gl||!!(typeof window<"u"&&window.next),Ry=class v1{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(gl||Iy){if(Yh)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&gl&&Yh)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...n)},onBlur:(...n)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...n)},onCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...n)},onDestroy:(...n)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...n)},onFocus:(...n)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...n)},onSelectionUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...n)},onTransaction:(...n)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...n)},onUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...n)},onContentError:(...n)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...n)},onDrop:(...n)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...n)},onPaste:(...n)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...n)},onDelete:(...n)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...n)}};return new i7(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=t.extensions)==null?void 0:o[s])}):e[n]===t[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?v1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,i)=>n===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Py(r={},e=[]){const t=z.useRef(r);t.current=r;const[n]=z.useState(()=>new Ry(t)),i=Hh.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return z.useDebugValue(i),z.useEffect(n.onRender(e)),Xh({editor:i,selector:({transactionNumber:s})=>r.shouldRerenderOnTransaction===!1||r.shouldRerenderOnTransaction===void 0?null:r.immediatelyRender&&s===0?0:s+1}),i}var Zh=z.createContext({editor:null});Zh.Consumer;var Qh=()=>z.useContext(Zh),ef=z.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),tf=()=>z.useContext(ef);function rf({as:r="div",...e}){const{nodeViewContentRef:t,nodeViewContentChildren:n}=tf();return J.jsx(r,{...e,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:n})}var nf=z.forwardRef((r,e)=>{const{onDragStart:t}=tf(),n=r.as||"div";return J.jsx(n,{...r,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...r.style}})});function sf(r){return!!(typeof r=="function"&&r.prototype&&r.prototype.isReactComponent)}function of(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.forward_ref)"||r.$$typeof.description==="react.forward_ref"))}function Ly(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.memo)"||r.$$typeof.description==="react.memo"))}function By(r){if(sf(r)||of(r))return!0;if(Ly(r)){const e=r.type;if(e)return sf(e)||of(e)}return!1}function Fy(){try{if(z.version)return parseInt(z.version.split(".")[0],10)>=19}catch{}return!1}var $y=class{constructor(r,{editor:e,props:t={},as:n="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=r,this.editor=e,this.props=t,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?ji.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var r;const e=this.component,t=this.props,n=this.editor,i=Fy(),s=By(e),o={...t};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=J.jsx(e,{...o}),(r=n?.contentComponent)==null||r.setRenderer(this.id,this)}updateProps(r={}){this.props={...this.props,...r},this.render()}destroy(){var r;const e=this.editor;(r=e?.contentComponent)==null||r.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(r){Object.keys(r).forEach(e=>{this.element.setAttribute(e,r[e])})}};z.createContext({markViewContentRef:()=>{}});var Hy=class extends h7{constructor(r,e,t){if(super(r,e,t),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}}mount(){const r={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:z.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const n={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,s=z.memo(l=>J.jsx(ef.Provider,{value:n,children:z.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new $y(s,{editor:this.editor,props:r,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var r;if(this.renderer.element.firstElementChild&&!((r=this.renderer.element.firstElementChild)!=null&&r.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:r,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(r<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(r,e,t){const n=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(r.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=r,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:r,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>n({node:r,decorations:e,innerDecorations:t})})}return r===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=r,this.decorations=e,this.innerDecorations=t,n({node:r,decorations:e,innerDecorations:t})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let r={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Oi(this.node,e);r=this.options.attrs({node:this.node,HTMLAttributes:t})}else r=this.options.attrs;this.renderer.updateAttributes(r)}}};function gn(r,e){return t=>t.editor.contentComponent?new Hy(r,t,e):{}}var Vy=Object.defineProperty,qy=(r,e)=>{for(var t in e)Vy(r,t,{get:e[t],enumerable:!0})},_y="listItem",af="textStyle",lf=/^\s*([-+*])\s$/,cf=we.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
116
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_y,this.editor.getAttributes(af)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=it({find:lf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=it({find:lf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(af),editor:this.editor})),[r]}}),uf=we.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{if(r.type!=="list_item")return[];let t=[];if(r.tokens&&r.tokens.length>0)if(r.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(r.tokens);else{const i=r.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],r.tokens.length>1){const o=r.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(r.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(r,e,t)=>ol(r,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),jy={};qy(jy,{findListItemPos:()=>zi,getNextListDepth:()=>yl,handleBackspace:()=>vl,handleDelete:()=>bl,hasListBefore:()=>df,hasListItemAfter:()=>Uy,hasListItemBefore:()=>hf,listItemHasSubList:()=>ff,nextListIsDeeper:()=>pf,nextListIsHigher:()=>mf});var zi=(r,e)=>{const{$from:t}=e.selection,n=Ve(r,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===n?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},yl=(r,e)=>{const t=zi(r,e);if(!t)return!1;const[,n]=m6(e,r,t.$pos.pos+4);return n},df=(r,e,t)=>{const{$anchor:n}=r.selection,i=Math.max(0,n.pos-2),s=r.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},hf=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==r)},ff=(r,e,t)=>{if(!t)return!1;const n=Ve(r,e.schema);let i=!1;return t.descendants(s=>{s.type===n&&(i=!0)}),i},vl=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!Fr(r.state,e)&&df(r.state,e,t)){const{$anchor:a}=r.state.selection,l=r.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const u=c.at(-1);if(!u)return!1;const d=r.state.doc.resolve(l.start()+u.pos+1);return r.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Fr(r.state,e)||!b6(r.state))return!1;const n=zi(e,r.state);if(!n)return!1;const s=r.state.doc.resolve(n.$pos.pos-2).node(n.depth),o=ff(e,r.state,s);return hf(e,r.state)&&!o?r.commands.joinItemBackward():r.chain().liftListItem(e).run()},pf=(r,e)=>{const t=yl(r,e),n=zi(r,e);return!n||!t?!1:t>n.depth},mf=(r,e)=>{const t=yl(r,e),n=zi(r,e);return!n||!t?!1:t<n.depth},bl=(r,e)=>{if(!Fr(r.state,e)||!v6(r.state,e))return!1;const{selection:t}=r.state,{$from:n,$to:i}=t;return!t.empty&&n.sameParent(i)?!1:pf(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():mf(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},Uy=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-n.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==r)},Wy=Se.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&bl(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&bl(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&vl(r,t,n)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&vl(r,t,n)&&(e=!0)}),e}}}}),gf=/^(\s*)(\d+)\.\s+(.*)$/,Gy=/^\s/;function Ky(r){const e=[];let t=0,n=0;for(;t<r.length;){const i=r[t],s=i.match(gf);if(!s)break;const[,o,a,l]=s,c=o.length;let u=l,d=t+1;const h=[i];for(;d<r.length;){const f=r[d];if(f.match(gf))break;if(f.trim()==="")h.push(f),u+=`
115
+ `)}function d7(r,e,t={}){const{state:n}=e,{doc:i,tr:s}=n,o=r;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==d.attrs[f]&&(h=!0)}),h){const f=r.type.create({...r.attrs,...t});s.removeMark(c,u,r.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var we=class y1 extends tl{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new y1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},h7=class{constructor(r,e,t){this.isDragging=!1,this.component=r,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(r){var e,t,n,i,s,o,a;const{view:l}=this.editor,c=r.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const T=this.dom.getBoundingClientRect(),D=u.getBoundingClientRect(),P=(i=r.offsetX)!=null?i:(n=r.nativeEvent)==null?void 0:n.offsetX,E=(o=r.offsetY)!=null?o:(s=r.nativeEvent)==null?void 0:s.offsetY;d=D.x-T.x+P,h=D.y-T.y+E}const f=this.dom.cloneNode(!0);try{const T=this.dom.getBoundingClientRect();f.style.width=`${Math.round(T.width)}px`,f.style.height=`${Math.round(T.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),(a=r.dataTransfer)==null||a.setDragImage(f,d,h)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const y=this.getPos();if(typeof y!="number")return;const v=se.create(l.state.doc,y),x=l.state.tr.setSelection(v);l.dispatch(x)}stopEvent(r){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:r});const t=r.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=r.type.startsWith("drag"),s=r.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=se.isSelectable(this.node),d=r.type==="copy",h=r.type==="paste",f=r.type==="cut",m=r.type==="mousedown";if(!c&&u&&i&&r.target===this.dom&&r.preventDefault(),c&&i&&!l&&r.target===this.dom)return r.preventDefault(),!1;if(c&&a&&!l&&m){const y=t.closest("[data-drag-handle]");y&&(this.dom===y||this.dom.contains(y))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||h||f||m&&u)}ignoreMutation(r){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:r}):this.node.isLeaf||this.node.isAtom?!0:r.type==="selection"||this.dom.contains(r.target)&&r.type==="childList"&&(Ns()||Qd())&&this.editor.isFocused&&[...Array.from(r.addedNodes),...Array.from(r.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===r.target&&r.type==="attributes"?!0:!this.contentDOM.contains(r.target)}updateAttributes(r){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...r}),!0)})}deleteNode(){const r=this.getPos();if(typeof r!="number")return;const e=r+this.node.nodeSize;this.editor.commands.deleteRange({from:r,to:e})}};function Hs(r){return new J6({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=ke(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,a=n[n.length-1],l=n[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),h=d+a.length;if(hh(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(v=>v===r.type&&v!==m.mark.type)).filter(m=>m.to>d).length)return null;h<t.to&&o.delete(h,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function f7(r={}){return new Pe({view(e){return new p7(e,r)}})}class p7{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),y=d?m.bottom:m.top;d&&h&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;n={left:m.left,right:m.right,top:y-v,bottom:y+v}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;n={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*f}this.element.style.left=(n.left-c)/o+"px",this.element.style.top=(n.top-u)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=au(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Le extends ce{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Le.valid(n)?new Le(n):ce.near(n)}content(){return X.empty}eq(e){return e instanceof Le&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Le(e.resolve(t.pos))}getBookmark(){return new al(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!m7(e)||!g7(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Le.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Le.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!se.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Le.valid(a))return a}return null}}}Le.prototype.visible=!1,Le.findFrom=Le.findGapCursorFrom,ce.jsonID("gapcursor",Le);class al{constructor(e){this.pos=e}map(e){return new al(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Le.valid(t)?new Le(t):ce.near(t)}}function Nh(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function m7(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Nh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function g7(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Nh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function y7(){return new Pe({props:{decorations:w7,createSelectionBetween(r,e,t){return e.pos==t.pos&&Le.valid(t)?new Le(t):null},handleClick:b7,handleKeyDown:v7,handleDOMEvents:{beforeinput:x7}}})}const v7=Ha({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1)});function Vs(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let c=Le.findGapCursorFrom(a,e,l);return c?(i&&i(n.tr.setSelection(new Le(c))),!0):!1}}function b7(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!Le.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&se.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Le(n))),!0)}function x7(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Le))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=H.empty;for(let o=n.length-1;o>=0;o--)i=H.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new X(i,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function w7(r){if(!(r.selection instanceof Le))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(r.doc,[nt.widget(r.selection.head,e,{key:"gapcursor"})])}var qs=200,Ke=function(){};Ke.prototype.append=function(e){return e.length?(e=Ke.from(e),!this.length&&e||e.length<qs&&this.leafAppend(e)||this.length<qs&&e.leafPrepend(this)||this.appendInner(e)):this},Ke.prototype.prepend=function(e){return e.length?Ke.from(e).append(this):this},Ke.prototype.appendInner=function(e){return new S7(this,e)},Ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ke.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Ke.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},Ke.from=function(e){return e instanceof Ke?e:e&&e.length?new Dh(e):Ke.empty};var Dh=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=qs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=qs)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ke);Ke.empty=new Dh([]);var S7=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(n,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(n,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Ke);const k7=500;class Lt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(n,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new _t(d.map));let f=d.step.map(i.slice(s)),m;f&&o.maybeStep(f).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new _t(m,void 0,void 0,c.length+u.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Lt(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,n,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new _t(e.mapping.maps[u],d,t),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-n.depth;return c>T7&&(a=M7(a,c),o-=c),new Lt(a.append(s),o)}remapping(e,t){let n=new pi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new Lt(this.items.append(e.map(t=>new _t(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let m=s.maps[f];if(h.step){let y=e.steps[f].invert(e.docs[f]),v=h.selection&&h.selection.map(s.slice(l+1,f));v&&a++,n.push(new _t(m,y,v))}else n.push(new _t(m))},i);let c=[];for(let h=t;h<o;h++)c.push(new _t(s.maps[h]));let u=this.items.slice(0,i).append(c).append(n),d=new Lt(u,a);return d.emptyItemCount()>k7&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(n)),c=l&&l.getMap();if(n--,c&&t.appendMap(c,n),l){let u=o.selection&&o.selection.map(t.slice(n));u&&s++;let d=new _t(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&n--},this.items.length,0),new Lt(Ke.from(i.reverse()),s)}}Lt.empty=new Lt(Ke.empty,0);function M7(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class _t{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _t(t.getMap().invert(),t,this.selection)}}}class Hr{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const T7=20;function C7(r,e,t,n){let i=t.getMeta(pn),s;if(i)return i.historyState;t.getMeta(O7)&&(r=new Hr(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(pn))return o.getMeta(pn).redo?new Hr(r.done.addTransform(t,void 0,n,_s(e)),r.undone,zh(t.mapping.maps),r.prevTime,r.prevComposition):new Hr(r.done,r.undone.addTransform(t,void 0,n,_s(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=a&&(r.prevTime<(t.time||0)-n.newGroupDelay||!E7(t,r.prevRanges)),c=o?ll(r.prevRanges,t.mapping):zh(t.mapping.maps);return new Hr(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,_s(e)),Lt.empty,c,t.time,a??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Hr(r.done.rebased(t,s),r.undone.rebased(t,s),ll(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Hr(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),ll(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function E7(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function zh(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function ll(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function A7(r,e,t){let n=_s(e),i=pn.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),l=new Hr(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(pn,{redo:t,historyState:l})}let cl=!1,Ih=null;function _s(r){let e=r.plugins;if(Ih!=e){cl=!1,Ih=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){cl=!0;break}}return cl}const pn=new Fe("history"),O7=new Fe("closeHistory");function N7(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Pe({key:pn,state:{init(){return new Hr(Lt.empty,Lt.empty,null,0,-1)},apply(e,t,n){return C7(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Ph:n=="historyRedo"?Lh:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function Rh(r,e){return(t,n)=>{let i=pn.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=A7(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const Ph=Rh(!1,!0),Lh=Rh(!0,!0);Se.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=r?.node||this.editor.state.doc;if((r?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=r?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Pe({key:new Fe("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=n.tr.deleteRange(a,l);return r=!0,c}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=n||i>n&&s>n&&s<=i)return!0;if(i>n&&s>n&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-n,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>n)}})]}}),Se.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[f7(this.options)]}});var D7=Se.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Pe({key:new Fe("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,s=[];if(!t||!n)return De.create(r,[]);let o=0;this.options.mode==="deepest"&&r.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return r.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(nt.node(c,c+l.nodeSize,{class:this.options.className}))}),De.create(r,s)}}})]}}),z7=Se.create({name:"gapCursor",addProseMirrorPlugins(){return[y7()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=ke(oe(r,"allowGapCursor",t)))!=null?e:null}}});Se.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Pe({key:new Fe("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return r.descendants((o,a)=>{const l=n>=a&&n<=a+o.nodeSize,c=!o.isLeaf&&Ps(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const d=nt.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),De.create(r,i)}}})]}}),Se.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new Pe({key:new Fe("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||x6(t.selection)||r.view.dragging?null:De.create(t.doc,[nt.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Bh({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||e?.type===r}Se.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Fe(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Pe({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,h=c.nodes[t];if(u)return l.insert(d,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Bh({node:o,types:n})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Bh({node:o,types:n})}}})]}});var I7=Se.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>Ph(r,e),redo:()=>({state:r,dispatch:e})=>Lh(r,e)}},addProseMirrorPlugins(){return[N7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),js={exports:{}},ul={};var Fh;function R7(){if(Fh)return ul;Fh=1;var r=z;function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(d,h){var f=h(),m=n({inst:{value:f,getSnapshot:h}}),y=m[0].inst,v=m[1];return s(function(){y.value=f,y.getSnapshot=h,l(y)&&v({inst:y})},[d,f,h]),i(function(){return l(y)&&v({inst:y}),d(function(){l(y)&&v({inst:y})})},[d]),o(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!t(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return ul.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,ul}var dl={};var $h;function P7(){return $h||($h=1,process.env.NODE_ENV!=="production"&&(function(){function r(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}function e(f,m){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!d){var v=m();s(y,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=o({inst:{value:y,getSnapshot:m}});var x=v[0].inst,T=v[1];return l(function(){x.value=y,x.getSnapshot=m,t(x)&&T({inst:x})},[f,y,m]),a(function(){return t(x)&&T({inst:x}),f(function(){t(x)&&T({inst:x})})},[f]),c(y),y}function t(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!s(f,y)}catch{return!0}}function n(f,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=z,s=typeof Object.is=="function"?Object.is:r,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,u=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:e;dl.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),dl}var Hh;function hl(){return Hh||(Hh=1,process.env.NODE_ENV==="production"?js.exports=R7():js.exports=P7()),js.exports}var Vh=hl();const{getOwnPropertyNames:L7,getOwnPropertySymbols:B7}=Object,{hasOwnProperty:F7}=Object.prototype;function fl(r,e){return function(n,i,s){return r(n,i,s)&&e(n,i,s)}}function Us(r){return function(t,n,i){if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);const{cache:s}=i,o=s.get(t),a=s.get(n);if(o&&a)return o===n&&a===t;s.set(t,n),s.set(n,t);const l=r(t,n,i);return s.delete(t),s.delete(n),l}}function $7(r){return r?.[Symbol.toStringTag]}function qh(r){return L7(r).concat(B7(r))}const H7=Object.hasOwn||((r,e)=>F7.call(r,e));function mn(r,e){return r===e||!r&&!e&&r!==r&&e!==e}const V7="__v",q7="__o",_7="_owner",{getOwnPropertyDescriptor:_h,keys:jh}=Object;function j7(r,e){return r.byteLength===e.byteLength&&Ws(new Uint8Array(r),new Uint8Array(e))}function U7(r,e,t){let n=r.length;if(e.length!==n)return!1;for(;n-- >0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}function W7(r,e){return r.byteLength===e.byteLength&&Ws(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function G7(r,e){return mn(r.getTime(),e.getTime())}function K7(r,e){return r.name===e.name&&r.message===e.message&&r.cause===e.cause&&r.stack===e.stack}function J7(r,e){return r===e}function Uh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const h=o.value,f=a.value;if(t.equals(h[0],f[0],l,d,r,e,t)&&t.equals(h[1],f[1],h[0],f[0],r,e,t)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const X7=mn;function Y7(r,e,t){const n=jh(r);let i=n.length;if(jh(e).length!==i)return!1;for(;i-- >0;)if(!Gh(r,e,t,n[i]))return!1;return!0}function Di(r,e,t){const n=qh(r);let i=n.length;if(qh(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=n[i],!Gh(r,e,t,s)||(o=_h(r,s),a=_h(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Z7(r,e){return mn(r.valueOf(),e.valueOf())}function Q7(r,e){return r.source===e.source&&r.flags===e.flags}function Wh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&t.equals(o.value,a.value,o.value,a.value,r,e,t)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Ws(r,e){let t=r.byteLength;if(e.byteLength!==t||r.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}function ey(r,e){return r.hostname===e.hostname&&r.pathname===e.pathname&&r.protocol===e.protocol&&r.port===e.port&&r.hash===e.hash&&r.username===e.username&&r.password===e.password}function Gh(r,e,t,n){return(n===_7||n===q7||n===V7)&&(r.$$typeof||e.$$typeof)?!0:H7(e,n)&&t.equals(r[n],e[n],n,n,r,e,t)}const ty="[object ArrayBuffer]",ry="[object Arguments]",ny="[object Boolean]",iy="[object DataView]",sy="[object Date]",oy="[object Error]",ay="[object Map]",ly="[object Number]",cy="[object Object]",uy="[object RegExp]",dy="[object Set]",hy="[object String]",fy={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},py="[object URL]",my=Object.prototype.toString;function gy({areArrayBuffersEqual:r,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:f,unknownTagComparators:m}){return function(v,x,T){if(v===x)return!0;if(v==null||x==null)return!1;const D=typeof v;if(D!==typeof x)return!1;if(D!=="object")return D==="number"?a(v,x,T):D==="function"?s(v,x,T):!1;const P=v.constructor;if(P!==x.constructor)return!1;if(P===Object)return l(v,x,T);if(Array.isArray(v))return e(v,x,T);if(P===Date)return n(v,x,T);if(P===RegExp)return u(v,x,T);if(P===Map)return o(v,x,T);if(P===Set)return d(v,x,T);const E=my.call(v);if(E===sy)return n(v,x,T);if(E===uy)return u(v,x,T);if(E===ay)return o(v,x,T);if(E===dy)return d(v,x,T);if(E===cy)return typeof v.then!="function"&&typeof x.then!="function"&&l(v,x,T);if(E===py)return f(v,x,T);if(E===oy)return i(v,x,T);if(E===ry)return l(v,x,T);if(fy[E])return h(v,x,T);if(E===ty)return r(v,x,T);if(E===iy)return t(v,x,T);if(E===ny||E===ly||E===hy)return c(v,x,T);if(m){let N=m[E];if(!N){const O=$7(v);O&&(N=m[O])}if(N)return N(v,x,T)}return!1}}function yy({circular:r,createCustomConfig:e,strict:t}){let n={areArrayBuffersEqual:j7,areArraysEqual:t?Di:U7,areDataViewsEqual:W7,areDatesEqual:G7,areErrorsEqual:K7,areFunctionsEqual:J7,areMapsEqual:t?fl(Uh,Di):Uh,areNumbersEqual:X7,areObjectsEqual:t?Di:Y7,arePrimitiveWrappersEqual:Z7,areRegExpsEqual:Q7,areSetsEqual:t?fl(Wh,Di):Wh,areTypedArraysEqual:t?fl(Ws,Di):Ws,areUrlsEqual:ey,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),r){const i=Us(n.areArraysEqual),s=Us(n.areMapsEqual),o=Us(n.areObjectsEqual),a=Us(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return n}function vy(r){return function(e,t,n,i,s,o,a){return r(e,t,a)}}function by({circular:r,comparator:e,createState:t,equals:n,strict:i}){if(t)return function(a,l){const{cache:c=r?new WeakMap:void 0,meta:u}=t();return e(a,l,{cache:c,equals:n,meta:u,strict:i})};if(r)return function(a,l){return e(a,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const s={cache:void 0,equals:n,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const xy=Vr();Vr({strict:!0}),Vr({circular:!0}),Vr({circular:!0,strict:!0}),Vr({createInternalComparator:()=>mn}),Vr({strict:!0,createInternalComparator:()=>mn}),Vr({circular:!0,createInternalComparator:()=>mn}),Vr({circular:!0,createInternalComparator:()=>mn,strict:!0});function Vr(r={}){const{circular:e=!1,createInternalComparator:t,createState:n,strict:i=!1}=r,s=yy(r),o=gy(s),a=t?t(o):vy(o);return by({circular:e,comparator:o,createState:n,equals:a,strict:i})}var Gs={exports:{}},pl={};var Kh;function wy(){if(Kh)return pl;Kh=1;var r=z,e=hl();function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,l=r.useDebugValue;return pl.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function x(N){if(!T){if(T=!0,D=N,N=h(N),f!==void 0&&y.hasValue){var O=y.value;if(f(O,N))return P=O}return P=N}if(O=P,n(D,N))return O;var $=h(N);return f!==void 0&&f(O,$)?(D=N,O):(D=N,P=$)}var T=!1,D,P,E=d===void 0?null:d;return[function(){return x(u())},E===null?void 0:function(){return x(E())}]},[u,d,h,f]);var v=i(c,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=v},[v]),l(v),v},pl}var ml={};var Jh;function Sy(){return Jh||(Jh=1,process.env.NODE_ENV!=="production"&&(function(){function r(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=z,t=hl(),n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;ml.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function x(N){if(!T){if(T=!0,D=N,N=h(N),f!==void 0&&y.hasValue){var O=y.value;if(f(O,N))return P=O}return P=N}if(O=P,n(D,N))return O;var $=h(N);return f!==void 0&&f(O,$)?(D=N,O):(D=N,P=$)}var T=!1,D,P,E=d===void 0?null:d;return[function(){return x(u())},E===null?void 0:function(){return x(E())}]},[u,d,h,f]);var v=i(c,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=v},[v]),l(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ml}var Xh;function ky(){return Xh||(Xh=1,process.env.NODE_ENV==="production"?Gs.exports=wy():Gs.exports=Sy()),Gs.exports}var My=ky(),Ty=(...r)=>e=>{r.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Cy=({contentComponent:r})=>{const e=Vh.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getServerSnapshot);return J.jsx(J.Fragment,{children:Object.values(e)})};function Ey(){const r=new Set;let e={};return{subscribe(t){return r.add(t),()=>{r.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,n){e={...e,[t]:ji.createPortal(n.reactElement,n.element,t)},r.forEach(i=>i())},removeRenderer(t){const n={...e};delete n[t],e=n,r.forEach(i=>i())}}}var Ay=class extends z.Component{constructor(r){var e;super(r),this.editorContentRef=z.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=r.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var r;const e=this.props.editor;if(e&&!e.isDestroyed&&((r=e.view.dom)!=null&&r.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Ey(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var r;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((r=e.view.dom)!=null&&r.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:r,innerRef:e,...t}=this.props;return J.jsxs(J.Fragment,{children:[J.jsx("div",{ref:Ty(e,this.editorContentRef),...t}),r?.contentComponent&&J.jsx(Cy,{contentComponent:r.contentComponent})]})}},Oy=z.forwardRef((r,e)=>{const t=z.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[r.editor]);return z.createElement(Ay,{key:t,innerRef:e,...r})}),Ny=z.memo(Oy),Dy=typeof window<"u"?z.useLayoutEffect:z.useEffect,zy=class{constructor(r){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=r,this.lastSnapshot={editor:r,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}watch(r){if(this.editor=r,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Yh(r){var e;const[t]=z.useState(()=>new zy(r.editor)),n=My.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,r.selector,(e=r.equalityFn)!=null?e:xy);return Dy(()=>t.watch(r.editor),[r.editor,t]),z.useDebugValue(n),n}var Zh=process.env.NODE_ENV!=="production",gl=typeof window>"u",Iy=gl||!!(typeof window<"u"&&window.next),Ry=class v1{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(gl||Iy){if(Zh)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&gl&&Zh)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...n)},onBlur:(...n)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...n)},onCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...n)},onDestroy:(...n)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...n)},onFocus:(...n)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...n)},onSelectionUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...n)},onTransaction:(...n)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...n)},onUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...n)},onContentError:(...n)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...n)},onDrop:(...n)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...n)},onPaste:(...n)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...n)},onDelete:(...n)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...n)}};return new i7(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=t.extensions)==null?void 0:o[s])}):e[n]===t[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?v1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,i)=>n===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Py(r={},e=[]){const t=z.useRef(r);t.current=r;const[n]=z.useState(()=>new Ry(t)),i=Vh.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return z.useDebugValue(i),z.useEffect(n.onRender(e)),Yh({editor:i,selector:({transactionNumber:s})=>r.shouldRerenderOnTransaction===!1||r.shouldRerenderOnTransaction===void 0?null:r.immediatelyRender&&s===0?0:s+1}),i}var Qh=z.createContext({editor:null});Qh.Consumer;var ef=()=>z.useContext(Qh),tf=z.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),rf=()=>z.useContext(tf);function nf({as:r="div",...e}){const{nodeViewContentRef:t,nodeViewContentChildren:n}=rf();return J.jsx(r,{...e,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:n})}var sf=z.forwardRef((r,e)=>{const{onDragStart:t}=rf(),n=r.as||"div";return J.jsx(n,{...r,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...r.style}})});function of(r){return!!(typeof r=="function"&&r.prototype&&r.prototype.isReactComponent)}function af(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.forward_ref)"||r.$$typeof.description==="react.forward_ref"))}function Ly(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.memo)"||r.$$typeof.description==="react.memo"))}function By(r){if(of(r)||af(r))return!0;if(Ly(r)){const e=r.type;if(e)return of(e)||af(e)}return!1}function Fy(){try{if(z.version)return parseInt(z.version.split(".")[0],10)>=19}catch{}return!1}var $y=class{constructor(r,{editor:e,props:t={},as:n="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=r,this.editor=e,this.props=t,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?ji.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var r;const e=this.component,t=this.props,n=this.editor,i=Fy(),s=By(e),o={...t};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=J.jsx(e,{...o}),(r=n?.contentComponent)==null||r.setRenderer(this.id,this)}updateProps(r={}){this.props={...this.props,...r},this.render()}destroy(){var r;const e=this.editor;(r=e?.contentComponent)==null||r.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(r){Object.keys(r).forEach(e=>{this.element.setAttribute(e,r[e])})}};z.createContext({markViewContentRef:()=>{}});var Hy=class extends h7{constructor(r,e,t){if(super(r,e,t),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}}mount(){const r={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:z.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const n={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,s=z.memo(l=>J.jsx(tf.Provider,{value:n,children:z.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new $y(s,{editor:this.editor,props:r,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var r;if(this.renderer.element.firstElementChild&&!((r=this.renderer.element.firstElementChild)!=null&&r.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:r,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(r<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(r,e,t){const n=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(r.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=r,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:r,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>n({node:r,decorations:e,innerDecorations:t})})}return r===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=r,this.decorations=e,this.innerDecorations=t,n({node:r,decorations:e,innerDecorations:t})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let r={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Oi(this.node,e);r=this.options.attrs({node:this.node,HTMLAttributes:t})}else r=this.options.attrs;this.renderer.updateAttributes(r)}}};function gn(r,e){return t=>t.editor.contentComponent?new Hy(r,t,e):{}}var Vy=Object.defineProperty,qy=(r,e)=>{for(var t in e)Vy(r,t,{get:e[t],enumerable:!0})},_y="listItem",lf="textStyle",cf=/^\s*([-+*])\s$/,uf=we.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
116
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_y,this.editor.getAttributes(lf)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=it({find:cf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=it({find:cf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lf),editor:this.editor})),[r]}}),df=we.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{if(r.type!=="list_item")return[];let t=[];if(r.tokens&&r.tokens.length>0)if(r.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(r.tokens);else{const i=r.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],r.tokens.length>1){const o=r.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(r.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(r,e,t)=>ol(r,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),jy={};qy(jy,{findListItemPos:()=>zi,getNextListDepth:()=>yl,handleBackspace:()=>vl,handleDelete:()=>bl,hasListBefore:()=>hf,hasListItemAfter:()=>Uy,hasListItemBefore:()=>ff,listItemHasSubList:()=>pf,nextListIsDeeper:()=>mf,nextListIsHigher:()=>gf});var zi=(r,e)=>{const{$from:t}=e.selection,n=Ve(r,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===n?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},yl=(r,e)=>{const t=zi(r,e);if(!t)return!1;const[,n]=m6(e,r,t.$pos.pos+4);return n},hf=(r,e,t)=>{const{$anchor:n}=r.selection,i=Math.max(0,n.pos-2),s=r.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},ff=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==r)},pf=(r,e,t)=>{if(!t)return!1;const n=Ve(r,e.schema);let i=!1;return t.descendants(s=>{s.type===n&&(i=!0)}),i},vl=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!Fr(r.state,e)&&hf(r.state,e,t)){const{$anchor:a}=r.state.selection,l=r.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const u=c.at(-1);if(!u)return!1;const d=r.state.doc.resolve(l.start()+u.pos+1);return r.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Fr(r.state,e)||!b6(r.state))return!1;const n=zi(e,r.state);if(!n)return!1;const s=r.state.doc.resolve(n.$pos.pos-2).node(n.depth),o=pf(e,r.state,s);return ff(e,r.state)&&!o?r.commands.joinItemBackward():r.chain().liftListItem(e).run()},mf=(r,e)=>{const t=yl(r,e),n=zi(r,e);return!n||!t?!1:t>n.depth},gf=(r,e)=>{const t=yl(r,e),n=zi(r,e);return!n||!t?!1:t<n.depth},bl=(r,e)=>{if(!Fr(r.state,e)||!v6(r.state,e))return!1;const{selection:t}=r.state,{$from:n,$to:i}=t;return!t.empty&&n.sameParent(i)?!1:mf(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():gf(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},Uy=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-n.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==r)},Wy=Se.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&bl(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&bl(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&vl(r,t,n)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&vl(r,t,n)&&(e=!0)}),e}}}}),yf=/^(\s*)(\d+)\.\s+(.*)$/,Gy=/^\s/;function Ky(r){const e=[];let t=0,n=0;for(;t<r.length;){const i=r[t],s=i.match(yf);if(!s)break;const[,o,a,l]=s,c=o.length;let u=l,d=t+1;const h=[i];for(;d<r.length;){const f=r[d];if(f.match(yf))break;if(f.trim()==="")h.push(f),u+=`
117
117
  `,d+=1;else if(f.match(Gy))h.push(f),u+=`
118
118
  ${f.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:h.join(`
119
- `)}),n=d,t=d}return[e,n]}function yf(r,e,t){var n;const i=[];let s=0;for(;s<r.length;){const o=r[s];if(o.indent===e){const a=o.content.split(`
119
+ `)}),n=d,t=d}return[e,n]}function vf(r,e,t){var n;const i=[];let s=0;for(;s<r.length;){const o=r[s];if(o.indent===e){const a=o.content.split(`
120
120
  `),l=((n=a[0])==null?void 0:n.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const u=a.slice(1).join(`
121
- `).trim();if(u){const f=t.blockTokens(u);c.push(...f)}let d=s+1;const h=[];for(;d<r.length&&r[d].indent>e;)h.push(r[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(y=>y.indent)),m=yf(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(y=>y.raw).join(`
122
- `)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=d}else s+=1}return i}function Jy(r,e){return r.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const n=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")n.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);n.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&n.push(...s)}}),{type:"listItem",content:n}})}var Xy="listItem",vf="textStyle",bf=/^(\d+)\.\s$/,xf=we.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",ye(this.options.HTMLAttributes,t),0]:["ol",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>{if(r.type!=="list"||!r.ordered)return[];const t=r.start||1,n=r.items?Jy(r.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:n}:{type:"orderedList",content:n}},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
121
+ `).trim();if(u){const f=t.blockTokens(u);c.push(...f)}let d=s+1;const h=[];for(;d<r.length&&r[d].indent>e;)h.push(r[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(y=>y.indent)),m=vf(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(y=>y.raw).join(`
122
+ `)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=d}else s+=1}return i}function Jy(r,e){return r.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const n=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")n.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);n.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&n.push(...s)}}),{type:"listItem",content:n}})}var Xy="listItem",bf="textStyle",xf=/^(\d+)\.\s$/,wf=we.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",ye(this.options.HTMLAttributes,t),0]:["ol",ye(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>{if(r.type!=="list"||!r.ordered)return[];const t=r.start||1,n=r.items?Jy(r.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:n}:{type:"orderedList",content:n}},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
123
123
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:r=>{const e=r.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(r,e,t)=>{var n;const i=r.split(`
124
- `),[s,o]=Ky(i);if(s.length===0)return;const a=yf(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=s[0])==null?void 0:n.number)||1,items:a,raw:i.slice(0,o).join(`
125
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Xy,this.editor.getAttributes(vf)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=it({find:bf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=it({find:bf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(vf)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),Yy=/^\s*(\[([( |x])?\])\s$/,Zy=we.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:r=>{const e=r.getAttribute("data-checked");return e===""||e==="true"},renderHTML:r=>({"data-checked":r.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:r,HTMLAttributes:e}){return["li",ye(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:r.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(r,e)=>{const t=[];if(r.tokens&&r.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(r.tokens))):r.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:r.text})])):t.push(e.createNode("paragraph",{},[])),r.nestedTokens&&r.nestedTokens.length>0){const n=e.parseChildren(r.nestedTokens);t.push(...n)}return e.createNode("taskItem",{checked:r.checked||!1},t)},renderMarkdown:(r,e)=>{var t;const i=`- [${(t=r.attrs)!=null&&t.checked?"x":" "}] `;return ol(r,e,i)},addKeyboardShortcuts(){const r={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...r,Tab:()=>this.editor.commands.sinkListItem(this.name)}:r},addNodeView(){return({node:r,HTMLAttributes:e,getPos:t,editor:n})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,h;a.ariaLabel=((h=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:h.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(r),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;n.isEditable&&typeof t=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const m=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...m?.attrs,checked:d}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(r,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{i.setAttribute(u,d)}),i.dataset.checked=r.attrs.checked,a.checked=r.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,d])=>{i.setAttribute(u,d)}),{dom:i,contentDOM:l,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[it({find:Yy,type:this.type,getAttributes:r=>({checked:r[r.length-1]==="x"})})]}}),Qy=we.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:r}){return["ul",ye(this.options.HTMLAttributes,r,{"data-type":this.name}),0]},parseMarkdown:(r,e)=>e.createNode("taskList",{},e.parseChildren(r.items||[])),renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
126
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const n=s=>{const o=sl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=sl(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:n},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Se.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(cf.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(uf.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Wy.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(xf.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(Zy.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(Qy.configure(this.options.taskList)),r}});class dt{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?null:new dt(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class bt{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 bt(t,dt.range(this,e))}}class U{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+a.slice(i-15,i):c=a.slice(0,i);var u;s+15<a.length?u=a.slice(s,s+15)+"…":u=a.slice(s),n+=c+l+u}var d=new Error(n);return d.name="ParseError",d.__proto__=U.prototype,d.position=i,i!=null&&s!=null&&(d.length=s-i),d.rawMessage=e,d}}U.prototype.__proto__=Error.prototype;var ev=function(e,t){return e===void 0?t:e},tv=/([A-Z])/g,rv=function(e){return e.replace(tv,"-$1").toLowerCase()},nv={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},iv=/[&><"']/g;function sv(r){return String(r).replace(iv,e=>nv[e])}var wf=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},ov=function(e){var t=wf(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},av=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},lv=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},xe={deflt:ev,escape:sv,hyphenate:rv,getBaseElem:wf,isCharacterBox:ov,protocolFromUrl:lv},Ks={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:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},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:r=>Math.max(0,r),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"],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:r=>Math.max(0,r),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:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function cv(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class xl{constructor(e){this.displayMode=void 0,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||{};for(var t in Ks)if(Ks.hasOwnProperty(t)){var n=Ks[t];this[t]=e[t]!==void 0?n.processor?n.processor(e[t]):e[t]:cv(n)}}reportNonstrict(e,t,n){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new U("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var i=this.strict;if(typeof i=="function")try{i=i(e,t,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=xe.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class qr{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 jt[uv[this.id]]}sub(){return jt[dv[this.id]]}fracNum(){return jt[hv[this.id]]}fracDen(){return jt[fv[this.id]]}cramp(){return jt[pv[this.id]]}text(){return jt[mv[this.id]]}isTight(){return this.size>=2}}var wl=0,Js=1,Vn=2,cr=3,Ii=4,At=5,qn=6,st=7,jt=[new qr(wl,0,!1),new qr(Js,0,!0),new qr(Vn,1,!1),new qr(cr,1,!0),new qr(Ii,2,!1),new qr(At,2,!0),new qr(qn,3,!1),new qr(st,3,!0)],uv=[Ii,At,Ii,At,qn,st,qn,st],dv=[At,At,At,At,st,st,st,st],hv=[Vn,cr,Ii,At,qn,st,qn,st],fv=[cr,cr,At,At,st,st,st,st],pv=[Js,Js,cr,cr,At,At,st,st],mv=[wl,Js,Vn,cr,Vn,cr,Vn,cr],ae={DISPLAY:jt[wl],TEXT:jt[Vn],SCRIPT:jt[Ii],SCRIPTSCRIPT:jt[qn]},Sl=[{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]]}];function gv(r){for(var e=0;e<Sl.length;e++)for(var t=Sl[e],n=0;n<t.blocks.length;n++){var i=t.blocks[n];if(r>=i[0]&&r<=i[1])return t.name}return null}var Xs=[];Sl.forEach(r=>r.blocks.forEach(e=>Xs.push(...e)));function Sf(r){for(var e=0;e<Xs.length;e+=2)if(r>=Xs[e]&&r<=Xs[e+1])return!0;return!1}var _n=80,yv=function(e,t){return"M95,"+(622+e+t)+`
124
+ `),[s,o]=Ky(i);if(s.length===0)return;const a=vf(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=s[0])==null?void 0:n.number)||1,items:a,raw:i.slice(0,o).join(`
125
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Xy,this.editor.getAttributes(bf)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=it({find:xf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=it({find:xf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(bf)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),Yy=/^\s*(\[([( |x])?\])\s$/,Zy=we.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:r=>{const e=r.getAttribute("data-checked");return e===""||e==="true"},renderHTML:r=>({"data-checked":r.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:r,HTMLAttributes:e}){return["li",ye(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:r.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(r,e)=>{const t=[];if(r.tokens&&r.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(r.tokens))):r.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:r.text})])):t.push(e.createNode("paragraph",{},[])),r.nestedTokens&&r.nestedTokens.length>0){const n=e.parseChildren(r.nestedTokens);t.push(...n)}return e.createNode("taskItem",{checked:r.checked||!1},t)},renderMarkdown:(r,e)=>{var t;const i=`- [${(t=r.attrs)!=null&&t.checked?"x":" "}] `;return ol(r,e,i)},addKeyboardShortcuts(){const r={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...r,Tab:()=>this.editor.commands.sinkListItem(this.name)}:r},addNodeView(){return({node:r,HTMLAttributes:e,getPos:t,editor:n})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,h;a.ariaLabel=((h=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:h.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(r),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;n.isEditable&&typeof t=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const m=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...m?.attrs,checked:d}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(r,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{i.setAttribute(u,d)}),i.dataset.checked=r.attrs.checked,a.checked=r.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,d])=>{i.setAttribute(u,d)}),{dom:i,contentDOM:l,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[it({find:Yy,type:this.type,getAttributes:r=>({checked:r[r.length-1]==="x"})})]}}),Qy=we.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:r}){return["ul",ye(this.options.HTMLAttributes,r,{"data-type":this.name}),0]},parseMarkdown:(r,e)=>e.createNode("taskList",{},e.parseChildren(r.items||[])),renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
126
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const n=s=>{const o=sl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=sl(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:n},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Se.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(uf.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(df.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Wy.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(wf.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(Zy.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(Qy.configure(this.options.taskList)),r}});class dt{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?null:new dt(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class bt{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 bt(t,dt.range(this,e))}}class U{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+a.slice(i-15,i):c=a.slice(0,i);var u;s+15<a.length?u=a.slice(s,s+15)+"…":u=a.slice(s),n+=c+l+u}var d=new Error(n);return d.name="ParseError",d.__proto__=U.prototype,d.position=i,i!=null&&s!=null&&(d.length=s-i),d.rawMessage=e,d}}U.prototype.__proto__=Error.prototype;var ev=function(e,t){return e===void 0?t:e},tv=/([A-Z])/g,rv=function(e){return e.replace(tv,"-$1").toLowerCase()},nv={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},iv=/[&><"']/g;function sv(r){return String(r).replace(iv,e=>nv[e])}var Sf=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},ov=function(e){var t=Sf(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},av=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},lv=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},xe={deflt:ev,escape:sv,hyphenate:rv,getBaseElem:Sf,isCharacterBox:ov,protocolFromUrl:lv},Ks={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:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},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:r=>Math.max(0,r),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"],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:r=>Math.max(0,r),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:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function cv(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class xl{constructor(e){this.displayMode=void 0,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||{};for(var t in Ks)if(Ks.hasOwnProperty(t)){var n=Ks[t];this[t]=e[t]!==void 0?n.processor?n.processor(e[t]):e[t]:cv(n)}}reportNonstrict(e,t,n){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new U("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var i=this.strict;if(typeof i=="function")try{i=i(e,t,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=xe.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class qr{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 jt[uv[this.id]]}sub(){return jt[dv[this.id]]}fracNum(){return jt[hv[this.id]]}fracDen(){return jt[fv[this.id]]}cramp(){return jt[pv[this.id]]}text(){return jt[mv[this.id]]}isTight(){return this.size>=2}}var wl=0,Js=1,Vn=2,cr=3,Ii=4,At=5,qn=6,st=7,jt=[new qr(wl,0,!1),new qr(Js,0,!0),new qr(Vn,1,!1),new qr(cr,1,!0),new qr(Ii,2,!1),new qr(At,2,!0),new qr(qn,3,!1),new qr(st,3,!0)],uv=[Ii,At,Ii,At,qn,st,qn,st],dv=[At,At,At,At,st,st,st,st],hv=[Vn,cr,Ii,At,qn,st,qn,st],fv=[cr,cr,At,At,st,st,st,st],pv=[Js,Js,cr,cr,At,At,st,st],mv=[wl,Js,Vn,cr,Vn,cr,Vn,cr],ae={DISPLAY:jt[wl],TEXT:jt[Vn],SCRIPT:jt[Ii],SCRIPTSCRIPT:jt[qn]},Sl=[{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]]}];function gv(r){for(var e=0;e<Sl.length;e++)for(var t=Sl[e],n=0;n<t.blocks.length;n++){var i=t.blocks[n];if(r>=i[0]&&r<=i[1])return t.name}return null}var Xs=[];Sl.forEach(r=>r.blocks.forEach(e=>Xs.push(...e)));function kf(r){for(var e=0;e<Xs.length;e+=2)if(r>=Xs[e]&&r<=Xs[e+1])return!0;return!1}var _n=80,yv=function(e,t){return"M95,"+(622+e+t)+`
127
127
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
128
128
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
129
129
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -174,7 +174,7 @@ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,1
174
174
  H742v`+i+`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
175
175
  h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
176
176
  c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
177
- 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},Mv=function(e,t,n){t=1e3*t;var i="";switch(e){case"sqrtMain":i=yv(t,_n);break;case"sqrtSize1":i=vv(t,_n);break;case"sqrtSize2":i=bv(t,_n);break;case"sqrtSize3":i=xv(t,_n);break;case"sqrtSize4":i=wv(t,_n);break;case"sqrtTall":i=kv(t,_n,n)}return i},Tv=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},kf={doubleleftarrow:`M262 157
177
+ 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},Mv=function(e,t,n){t=1e3*t;var i="";switch(e){case"sqrtMain":i=yv(t,_n);break;case"sqrtSize1":i=vv(t,_n);break;case"sqrtSize2":i=bv(t,_n);break;case"sqrtSize3":i=xv(t,_n);break;case"sqrtSize4":i=wv(t,_n);break;case"sqrtTall":i=kv(t,_n,n)}return i},Tv=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},Mf={doubleleftarrow:`M262 157
178
178
  l10-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
179
179
  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
180
180
  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
@@ -377,26 +377,26 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6
377
377
  c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
378
378
  c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
379
379
  l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
380
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Ri{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Ut={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ys={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Mf={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Ev(r,e){Ut[r]=e}function kl(r,e,t){if(!Ut[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),i=Ut[e][n];if(!i&&r[0]in Mf&&(n=Mf[r[0]].charCodeAt(0),i=Ut[e][n]),!i&&t==="text"&&Sf(n)&&(i=Ut[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ml={};function Av(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Ml[e]){var t=Ml[e]={cssEmPerMu:Ys.quad[e]/18};for(var n in Ys)Ys.hasOwnProperty(n)&&(t[n]=Ys[n][e])}return Ml[e]}var Ov=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Tf=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Cf=function(e,t){return t.size<2?e:Ov[e-1][t.size-1]};class ur{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||ur.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Tf[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new ur(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Cf(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Tf[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=Cf(ur.BASESIZE,e);return this.size===t&&this.textSize===ur.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==ur.BASESIZE?["sizing","reset-size"+this.size,"size"+ur.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Av(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}ur.BASESIZE=6;var Tl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Nv={ex:!0,em:!0,mu:!0},Ef=function(e){return typeof e!="string"&&(e=e.unit),e in Tl||e in Nv||e==="ex"},ze=function(e,t){var n;if(e.unit in Tl)n=Tl[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")n=i.fontMetrics().xHeight;else if(e.unit==="em")n=i.fontMetrics().quad;else throw new U("Invalid unit: '"+e.unit+"'");i!==t&&(n*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},G=function(e){return+e.toFixed(4)+"em"},_r=function(e){return e.filter(t=>t).join(" ")},Af=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},Of=function(e){var t=document.createElement(e);t.className=_r(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},Dv=/[\s"'>/=\x00-\x1f]/,Nf=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+xe.escape(_r(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=xe.hyphenate(i)+":"+this.style[i]+";");n&&(t+=' style="'+xe.escape(n)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Dv.test(s))throw new U("Invalid attribute name '"+s+"'");t+=" "+s+'="'+xe.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class Pi{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Af.call(this,e,n,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Of.call(this,"span")}toMarkup(){return Nf.call(this,"span")}}class Cl{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Af.call(this,t,i),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Of.call(this,"a")}toMarkup(){return Nf.call(this,"a")}}class zv{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+xe.escape(this.src)+'"'+(' alt="'+xe.escape(this.alt)+'"'),t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=xe.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+xe.escape(t)+'"'),e+="'/>",e}}var Iv={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Ot{constructor(e,t,n,i,s,o,a,l){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=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=gv(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Iv[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=G(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=_r(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(t=t||document.createElement("span"),t.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+=xe.escape(_r(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=xe.hyphenate(i)+":"+this.style[i]+";");n&&(e=!0,t+=' style="'+xe.escape(n)+'"');var s=xe.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class dr{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}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+'="'+xe.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class jr{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",kf[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+xe.escape(this.alternate)+'"/>':'<path d="'+xe.escape(kf[this.pathName])+'"/>'}}class El{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+xe.escape(this.attributes[t])+'"');return e+="/>",e}}function Df(r){if(r instanceof Ot)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function Rv(r){if(r instanceof Pi)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}var Pv={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Lv={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ee={math:{},text:{}};function p(r,e,t,n,i,s){Ee[r][i]={font:e,group:t,replace:n},s&&n&&(Ee[r][n]=Ee[r][i])}var g="math",V="text",b="main",k="ams",Oe="accent-token",ee="bin",ot="close",jn="inner",le="mathord",qe="op-token",xt="open",Zs="punct",M="rel",hr="spacing",E="textord";p(g,b,M,"≡","\\equiv",!0),p(g,b,M,"≺","\\prec",!0),p(g,b,M,"≻","\\succ",!0),p(g,b,M,"∼","\\sim",!0),p(g,b,M,"⊥","\\perp"),p(g,b,M,"⪯","\\preceq",!0),p(g,b,M,"⪰","\\succeq",!0),p(g,b,M,"≃","\\simeq",!0),p(g,b,M,"∣","\\mid",!0),p(g,b,M,"≪","\\ll",!0),p(g,b,M,"≫","\\gg",!0),p(g,b,M,"≍","\\asymp",!0),p(g,b,M,"∥","\\parallel"),p(g,b,M,"⋈","\\bowtie",!0),p(g,b,M,"⌣","\\smile",!0),p(g,b,M,"⊑","\\sqsubseteq",!0),p(g,b,M,"⊒","\\sqsupseteq",!0),p(g,b,M,"≐","\\doteq",!0),p(g,b,M,"⌢","\\frown",!0),p(g,b,M,"∋","\\ni",!0),p(g,b,M,"∝","\\propto",!0),p(g,b,M,"⊢","\\vdash",!0),p(g,b,M,"⊣","\\dashv",!0),p(g,b,M,"∋","\\owns"),p(g,b,Zs,".","\\ldotp"),p(g,b,Zs,"⋅","\\cdotp"),p(g,b,E,"#","\\#"),p(V,b,E,"#","\\#"),p(g,b,E,"&","\\&"),p(V,b,E,"&","\\&"),p(g,b,E,"ℵ","\\aleph",!0),p(g,b,E,"∀","\\forall",!0),p(g,b,E,"ℏ","\\hbar",!0),p(g,b,E,"∃","\\exists",!0),p(g,b,E,"∇","\\nabla",!0),p(g,b,E,"♭","\\flat",!0),p(g,b,E,"ℓ","\\ell",!0),p(g,b,E,"♮","\\natural",!0),p(g,b,E,"♣","\\clubsuit",!0),p(g,b,E,"℘","\\wp",!0),p(g,b,E,"♯","\\sharp",!0),p(g,b,E,"♢","\\diamondsuit",!0),p(g,b,E,"ℜ","\\Re",!0),p(g,b,E,"♡","\\heartsuit",!0),p(g,b,E,"ℑ","\\Im",!0),p(g,b,E,"♠","\\spadesuit",!0),p(g,b,E,"§","\\S",!0),p(V,b,E,"§","\\S"),p(g,b,E,"¶","\\P",!0),p(V,b,E,"¶","\\P"),p(g,b,E,"†","\\dag"),p(V,b,E,"†","\\dag"),p(V,b,E,"†","\\textdagger"),p(g,b,E,"‡","\\ddag"),p(V,b,E,"‡","\\ddag"),p(V,b,E,"‡","\\textdaggerdbl"),p(g,b,ot,"⎱","\\rmoustache",!0),p(g,b,xt,"⎰","\\lmoustache",!0),p(g,b,ot,"⟯","\\rgroup",!0),p(g,b,xt,"⟮","\\lgroup",!0),p(g,b,ee,"∓","\\mp",!0),p(g,b,ee,"⊖","\\ominus",!0),p(g,b,ee,"⊎","\\uplus",!0),p(g,b,ee,"⊓","\\sqcap",!0),p(g,b,ee,"∗","\\ast"),p(g,b,ee,"⊔","\\sqcup",!0),p(g,b,ee,"◯","\\bigcirc",!0),p(g,b,ee,"∙","\\bullet",!0),p(g,b,ee,"‡","\\ddagger"),p(g,b,ee,"≀","\\wr",!0),p(g,b,ee,"⨿","\\amalg"),p(g,b,ee,"&","\\And"),p(g,b,M,"⟵","\\longleftarrow",!0),p(g,b,M,"⇐","\\Leftarrow",!0),p(g,b,M,"⟸","\\Longleftarrow",!0),p(g,b,M,"⟶","\\longrightarrow",!0),p(g,b,M,"⇒","\\Rightarrow",!0),p(g,b,M,"⟹","\\Longrightarrow",!0),p(g,b,M,"↔","\\leftrightarrow",!0),p(g,b,M,"⟷","\\longleftrightarrow",!0),p(g,b,M,"⇔","\\Leftrightarrow",!0),p(g,b,M,"⟺","\\Longleftrightarrow",!0),p(g,b,M,"↦","\\mapsto",!0),p(g,b,M,"⟼","\\longmapsto",!0),p(g,b,M,"↗","\\nearrow",!0),p(g,b,M,"↩","\\hookleftarrow",!0),p(g,b,M,"↪","\\hookrightarrow",!0),p(g,b,M,"↘","\\searrow",!0),p(g,b,M,"↼","\\leftharpoonup",!0),p(g,b,M,"⇀","\\rightharpoonup",!0),p(g,b,M,"↙","\\swarrow",!0),p(g,b,M,"↽","\\leftharpoondown",!0),p(g,b,M,"⇁","\\rightharpoondown",!0),p(g,b,M,"↖","\\nwarrow",!0),p(g,b,M,"⇌","\\rightleftharpoons",!0),p(g,k,M,"≮","\\nless",!0),p(g,k,M,"","\\@nleqslant"),p(g,k,M,"","\\@nleqq"),p(g,k,M,"⪇","\\lneq",!0),p(g,k,M,"≨","\\lneqq",!0),p(g,k,M,"","\\@lvertneqq"),p(g,k,M,"⋦","\\lnsim",!0),p(g,k,M,"⪉","\\lnapprox",!0),p(g,k,M,"⊀","\\nprec",!0),p(g,k,M,"⋠","\\npreceq",!0),p(g,k,M,"⋨","\\precnsim",!0),p(g,k,M,"⪹","\\precnapprox",!0),p(g,k,M,"≁","\\nsim",!0),p(g,k,M,"","\\@nshortmid"),p(g,k,M,"∤","\\nmid",!0),p(g,k,M,"⊬","\\nvdash",!0),p(g,k,M,"⊭","\\nvDash",!0),p(g,k,M,"⋪","\\ntriangleleft"),p(g,k,M,"⋬","\\ntrianglelefteq",!0),p(g,k,M,"⊊","\\subsetneq",!0),p(g,k,M,"","\\@varsubsetneq"),p(g,k,M,"⫋","\\subsetneqq",!0),p(g,k,M,"","\\@varsubsetneqq"),p(g,k,M,"≯","\\ngtr",!0),p(g,k,M,"","\\@ngeqslant"),p(g,k,M,"","\\@ngeqq"),p(g,k,M,"⪈","\\gneq",!0),p(g,k,M,"≩","\\gneqq",!0),p(g,k,M,"","\\@gvertneqq"),p(g,k,M,"⋧","\\gnsim",!0),p(g,k,M,"⪊","\\gnapprox",!0),p(g,k,M,"⊁","\\nsucc",!0),p(g,k,M,"⋡","\\nsucceq",!0),p(g,k,M,"⋩","\\succnsim",!0),p(g,k,M,"⪺","\\succnapprox",!0),p(g,k,M,"≆","\\ncong",!0),p(g,k,M,"","\\@nshortparallel"),p(g,k,M,"∦","\\nparallel",!0),p(g,k,M,"⊯","\\nVDash",!0),p(g,k,M,"⋫","\\ntriangleright"),p(g,k,M,"⋭","\\ntrianglerighteq",!0),p(g,k,M,"","\\@nsupseteqq"),p(g,k,M,"⊋","\\supsetneq",!0),p(g,k,M,"","\\@varsupsetneq"),p(g,k,M,"⫌","\\supsetneqq",!0),p(g,k,M,"","\\@varsupsetneqq"),p(g,k,M,"⊮","\\nVdash",!0),p(g,k,M,"⪵","\\precneqq",!0),p(g,k,M,"⪶","\\succneqq",!0),p(g,k,M,"","\\@nsubseteqq"),p(g,k,ee,"⊴","\\unlhd"),p(g,k,ee,"⊵","\\unrhd"),p(g,k,M,"↚","\\nleftarrow",!0),p(g,k,M,"↛","\\nrightarrow",!0),p(g,k,M,"⇍","\\nLeftarrow",!0),p(g,k,M,"⇏","\\nRightarrow",!0),p(g,k,M,"↮","\\nleftrightarrow",!0),p(g,k,M,"⇎","\\nLeftrightarrow",!0),p(g,k,M,"△","\\vartriangle"),p(g,k,E,"ℏ","\\hslash"),p(g,k,E,"▽","\\triangledown"),p(g,k,E,"◊","\\lozenge"),p(g,k,E,"Ⓢ","\\circledS"),p(g,k,E,"®","\\circledR"),p(V,k,E,"®","\\circledR"),p(g,k,E,"∡","\\measuredangle",!0),p(g,k,E,"∄","\\nexists"),p(g,k,E,"℧","\\mho"),p(g,k,E,"Ⅎ","\\Finv",!0),p(g,k,E,"⅁","\\Game",!0),p(g,k,E,"‵","\\backprime"),p(g,k,E,"▲","\\blacktriangle"),p(g,k,E,"▼","\\blacktriangledown"),p(g,k,E,"■","\\blacksquare"),p(g,k,E,"⧫","\\blacklozenge"),p(g,k,E,"★","\\bigstar"),p(g,k,E,"∢","\\sphericalangle",!0),p(g,k,E,"∁","\\complement",!0),p(g,k,E,"ð","\\eth",!0),p(V,b,E,"ð","ð"),p(g,k,E,"╱","\\diagup"),p(g,k,E,"╲","\\diagdown"),p(g,k,E,"□","\\square"),p(g,k,E,"□","\\Box"),p(g,k,E,"◊","\\Diamond"),p(g,k,E,"¥","\\yen",!0),p(V,k,E,"¥","\\yen",!0),p(g,k,E,"✓","\\checkmark",!0),p(V,k,E,"✓","\\checkmark"),p(g,k,E,"ℶ","\\beth",!0),p(g,k,E,"ℸ","\\daleth",!0),p(g,k,E,"ℷ","\\gimel",!0),p(g,k,E,"ϝ","\\digamma",!0),p(g,k,E,"ϰ","\\varkappa"),p(g,k,xt,"┌","\\@ulcorner",!0),p(g,k,ot,"┐","\\@urcorner",!0),p(g,k,xt,"└","\\@llcorner",!0),p(g,k,ot,"┘","\\@lrcorner",!0),p(g,k,M,"≦","\\leqq",!0),p(g,k,M,"⩽","\\leqslant",!0),p(g,k,M,"⪕","\\eqslantless",!0),p(g,k,M,"≲","\\lesssim",!0),p(g,k,M,"⪅","\\lessapprox",!0),p(g,k,M,"≊","\\approxeq",!0),p(g,k,ee,"⋖","\\lessdot"),p(g,k,M,"⋘","\\lll",!0),p(g,k,M,"≶","\\lessgtr",!0),p(g,k,M,"⋚","\\lesseqgtr",!0),p(g,k,M,"⪋","\\lesseqqgtr",!0),p(g,k,M,"≑","\\doteqdot"),p(g,k,M,"≓","\\risingdotseq",!0),p(g,k,M,"≒","\\fallingdotseq",!0),p(g,k,M,"∽","\\backsim",!0),p(g,k,M,"⋍","\\backsimeq",!0),p(g,k,M,"⫅","\\subseteqq",!0),p(g,k,M,"⋐","\\Subset",!0),p(g,k,M,"⊏","\\sqsubset",!0),p(g,k,M,"≼","\\preccurlyeq",!0),p(g,k,M,"⋞","\\curlyeqprec",!0),p(g,k,M,"≾","\\precsim",!0),p(g,k,M,"⪷","\\precapprox",!0),p(g,k,M,"⊲","\\vartriangleleft"),p(g,k,M,"⊴","\\trianglelefteq"),p(g,k,M,"⊨","\\vDash",!0),p(g,k,M,"⊪","\\Vvdash",!0),p(g,k,M,"⌣","\\smallsmile"),p(g,k,M,"⌢","\\smallfrown"),p(g,k,M,"≏","\\bumpeq",!0),p(g,k,M,"≎","\\Bumpeq",!0),p(g,k,M,"≧","\\geqq",!0),p(g,k,M,"⩾","\\geqslant",!0),p(g,k,M,"⪖","\\eqslantgtr",!0),p(g,k,M,"≳","\\gtrsim",!0),p(g,k,M,"⪆","\\gtrapprox",!0),p(g,k,ee,"⋗","\\gtrdot"),p(g,k,M,"⋙","\\ggg",!0),p(g,k,M,"≷","\\gtrless",!0),p(g,k,M,"⋛","\\gtreqless",!0),p(g,k,M,"⪌","\\gtreqqless",!0),p(g,k,M,"≖","\\eqcirc",!0),p(g,k,M,"≗","\\circeq",!0),p(g,k,M,"≜","\\triangleq",!0),p(g,k,M,"∼","\\thicksim"),p(g,k,M,"≈","\\thickapprox"),p(g,k,M,"⫆","\\supseteqq",!0),p(g,k,M,"⋑","\\Supset",!0),p(g,k,M,"⊐","\\sqsupset",!0),p(g,k,M,"≽","\\succcurlyeq",!0),p(g,k,M,"⋟","\\curlyeqsucc",!0),p(g,k,M,"≿","\\succsim",!0),p(g,k,M,"⪸","\\succapprox",!0),p(g,k,M,"⊳","\\vartriangleright"),p(g,k,M,"⊵","\\trianglerighteq"),p(g,k,M,"⊩","\\Vdash",!0),p(g,k,M,"∣","\\shortmid"),p(g,k,M,"∥","\\shortparallel"),p(g,k,M,"≬","\\between",!0),p(g,k,M,"⋔","\\pitchfork",!0),p(g,k,M,"∝","\\varpropto"),p(g,k,M,"◀","\\blacktriangleleft"),p(g,k,M,"∴","\\therefore",!0),p(g,k,M,"∍","\\backepsilon"),p(g,k,M,"▶","\\blacktriangleright"),p(g,k,M,"∵","\\because",!0),p(g,k,M,"⋘","\\llless"),p(g,k,M,"⋙","\\gggtr"),p(g,k,ee,"⊲","\\lhd"),p(g,k,ee,"⊳","\\rhd"),p(g,k,M,"≂","\\eqsim",!0),p(g,b,M,"⋈","\\Join"),p(g,k,M,"≑","\\Doteq",!0),p(g,k,ee,"∔","\\dotplus",!0),p(g,k,ee,"∖","\\smallsetminus"),p(g,k,ee,"⋒","\\Cap",!0),p(g,k,ee,"⋓","\\Cup",!0),p(g,k,ee,"⩞","\\doublebarwedge",!0),p(g,k,ee,"⊟","\\boxminus",!0),p(g,k,ee,"⊞","\\boxplus",!0),p(g,k,ee,"⋇","\\divideontimes",!0),p(g,k,ee,"⋉","\\ltimes",!0),p(g,k,ee,"⋊","\\rtimes",!0),p(g,k,ee,"⋋","\\leftthreetimes",!0),p(g,k,ee,"⋌","\\rightthreetimes",!0),p(g,k,ee,"⋏","\\curlywedge",!0),p(g,k,ee,"⋎","\\curlyvee",!0),p(g,k,ee,"⊝","\\circleddash",!0),p(g,k,ee,"⊛","\\circledast",!0),p(g,k,ee,"⋅","\\centerdot"),p(g,k,ee,"⊺","\\intercal",!0),p(g,k,ee,"⋒","\\doublecap"),p(g,k,ee,"⋓","\\doublecup"),p(g,k,ee,"⊠","\\boxtimes",!0),p(g,k,M,"⇢","\\dashrightarrow",!0),p(g,k,M,"⇠","\\dashleftarrow",!0),p(g,k,M,"⇇","\\leftleftarrows",!0),p(g,k,M,"⇆","\\leftrightarrows",!0),p(g,k,M,"⇚","\\Lleftarrow",!0),p(g,k,M,"↞","\\twoheadleftarrow",!0),p(g,k,M,"↢","\\leftarrowtail",!0),p(g,k,M,"↫","\\looparrowleft",!0),p(g,k,M,"⇋","\\leftrightharpoons",!0),p(g,k,M,"↶","\\curvearrowleft",!0),p(g,k,M,"↺","\\circlearrowleft",!0),p(g,k,M,"↰","\\Lsh",!0),p(g,k,M,"⇈","\\upuparrows",!0),p(g,k,M,"↿","\\upharpoonleft",!0),p(g,k,M,"⇃","\\downharpoonleft",!0),p(g,b,M,"⊶","\\origof",!0),p(g,b,M,"⊷","\\imageof",!0),p(g,k,M,"⊸","\\multimap",!0),p(g,k,M,"↭","\\leftrightsquigarrow",!0),p(g,k,M,"⇉","\\rightrightarrows",!0),p(g,k,M,"⇄","\\rightleftarrows",!0),p(g,k,M,"↠","\\twoheadrightarrow",!0),p(g,k,M,"↣","\\rightarrowtail",!0),p(g,k,M,"↬","\\looparrowright",!0),p(g,k,M,"↷","\\curvearrowright",!0),p(g,k,M,"↻","\\circlearrowright",!0),p(g,k,M,"↱","\\Rsh",!0),p(g,k,M,"⇊","\\downdownarrows",!0),p(g,k,M,"↾","\\upharpoonright",!0),p(g,k,M,"⇂","\\downharpoonright",!0),p(g,k,M,"⇝","\\rightsquigarrow",!0),p(g,k,M,"⇝","\\leadsto"),p(g,k,M,"⇛","\\Rrightarrow",!0),p(g,k,M,"↾","\\restriction"),p(g,b,E,"‘","`"),p(g,b,E,"$","\\$"),p(V,b,E,"$","\\$"),p(V,b,E,"$","\\textdollar"),p(g,b,E,"%","\\%"),p(V,b,E,"%","\\%"),p(g,b,E,"_","\\_"),p(V,b,E,"_","\\_"),p(V,b,E,"_","\\textunderscore"),p(g,b,E,"∠","\\angle",!0),p(g,b,E,"∞","\\infty",!0),p(g,b,E,"′","\\prime"),p(g,b,E,"△","\\triangle"),p(g,b,E,"Γ","\\Gamma",!0),p(g,b,E,"Δ","\\Delta",!0),p(g,b,E,"Θ","\\Theta",!0),p(g,b,E,"Λ","\\Lambda",!0),p(g,b,E,"Ξ","\\Xi",!0),p(g,b,E,"Π","\\Pi",!0),p(g,b,E,"Σ","\\Sigma",!0),p(g,b,E,"Υ","\\Upsilon",!0),p(g,b,E,"Φ","\\Phi",!0),p(g,b,E,"Ψ","\\Psi",!0),p(g,b,E,"Ω","\\Omega",!0),p(g,b,E,"A","Α"),p(g,b,E,"B","Β"),p(g,b,E,"E","Ε"),p(g,b,E,"Z","Ζ"),p(g,b,E,"H","Η"),p(g,b,E,"I","Ι"),p(g,b,E,"K","Κ"),p(g,b,E,"M","Μ"),p(g,b,E,"N","Ν"),p(g,b,E,"O","Ο"),p(g,b,E,"P","Ρ"),p(g,b,E,"T","Τ"),p(g,b,E,"X","Χ"),p(g,b,E,"¬","\\neg",!0),p(g,b,E,"¬","\\lnot"),p(g,b,E,"⊤","\\top"),p(g,b,E,"⊥","\\bot"),p(g,b,E,"∅","\\emptyset"),p(g,k,E,"∅","\\varnothing"),p(g,b,le,"α","\\alpha",!0),p(g,b,le,"β","\\beta",!0),p(g,b,le,"γ","\\gamma",!0),p(g,b,le,"δ","\\delta",!0),p(g,b,le,"ϵ","\\epsilon",!0),p(g,b,le,"ζ","\\zeta",!0),p(g,b,le,"η","\\eta",!0),p(g,b,le,"θ","\\theta",!0),p(g,b,le,"ι","\\iota",!0),p(g,b,le,"κ","\\kappa",!0),p(g,b,le,"λ","\\lambda",!0),p(g,b,le,"μ","\\mu",!0),p(g,b,le,"ν","\\nu",!0),p(g,b,le,"ξ","\\xi",!0),p(g,b,le,"ο","\\omicron",!0),p(g,b,le,"π","\\pi",!0),p(g,b,le,"ρ","\\rho",!0),p(g,b,le,"σ","\\sigma",!0),p(g,b,le,"τ","\\tau",!0),p(g,b,le,"υ","\\upsilon",!0),p(g,b,le,"ϕ","\\phi",!0),p(g,b,le,"χ","\\chi",!0),p(g,b,le,"ψ","\\psi",!0),p(g,b,le,"ω","\\omega",!0),p(g,b,le,"ε","\\varepsilon",!0),p(g,b,le,"ϑ","\\vartheta",!0),p(g,b,le,"ϖ","\\varpi",!0),p(g,b,le,"ϱ","\\varrho",!0),p(g,b,le,"ς","\\varsigma",!0),p(g,b,le,"φ","\\varphi",!0),p(g,b,ee,"∗","*",!0),p(g,b,ee,"+","+"),p(g,b,ee,"−","-",!0),p(g,b,ee,"⋅","\\cdot",!0),p(g,b,ee,"∘","\\circ",!0),p(g,b,ee,"÷","\\div",!0),p(g,b,ee,"±","\\pm",!0),p(g,b,ee,"×","\\times",!0),p(g,b,ee,"∩","\\cap",!0),p(g,b,ee,"∪","\\cup",!0),p(g,b,ee,"∖","\\setminus",!0),p(g,b,ee,"∧","\\land"),p(g,b,ee,"∨","\\lor"),p(g,b,ee,"∧","\\wedge",!0),p(g,b,ee,"∨","\\vee",!0),p(g,b,E,"√","\\surd"),p(g,b,xt,"⟨","\\langle",!0),p(g,b,xt,"∣","\\lvert"),p(g,b,xt,"∥","\\lVert"),p(g,b,ot,"?","?"),p(g,b,ot,"!","!"),p(g,b,ot,"⟩","\\rangle",!0),p(g,b,ot,"∣","\\rvert"),p(g,b,ot,"∥","\\rVert"),p(g,b,M,"=","="),p(g,b,M,":",":"),p(g,b,M,"≈","\\approx",!0),p(g,b,M,"≅","\\cong",!0),p(g,b,M,"≥","\\ge"),p(g,b,M,"≥","\\geq",!0),p(g,b,M,"←","\\gets"),p(g,b,M,">","\\gt",!0),p(g,b,M,"∈","\\in",!0),p(g,b,M,"","\\@not"),p(g,b,M,"⊂","\\subset",!0),p(g,b,M,"⊃","\\supset",!0),p(g,b,M,"⊆","\\subseteq",!0),p(g,b,M,"⊇","\\supseteq",!0),p(g,k,M,"⊈","\\nsubseteq",!0),p(g,k,M,"⊉","\\nsupseteq",!0),p(g,b,M,"⊨","\\models"),p(g,b,M,"←","\\leftarrow",!0),p(g,b,M,"≤","\\le"),p(g,b,M,"≤","\\leq",!0),p(g,b,M,"<","\\lt",!0),p(g,b,M,"→","\\rightarrow",!0),p(g,b,M,"→","\\to"),p(g,k,M,"≱","\\ngeq",!0),p(g,k,M,"≰","\\nleq",!0),p(g,b,hr," ","\\ "),p(g,b,hr," ","\\space"),p(g,b,hr," ","\\nobreakspace"),p(V,b,hr," ","\\ "),p(V,b,hr," "," "),p(V,b,hr," ","\\space"),p(V,b,hr," ","\\nobreakspace"),p(g,b,hr,null,"\\nobreak"),p(g,b,hr,null,"\\allowbreak"),p(g,b,Zs,",",","),p(g,b,Zs,";",";"),p(g,k,ee,"⊼","\\barwedge",!0),p(g,k,ee,"⊻","\\veebar",!0),p(g,b,ee,"⊙","\\odot",!0),p(g,b,ee,"⊕","\\oplus",!0),p(g,b,ee,"⊗","\\otimes",!0),p(g,b,E,"∂","\\partial",!0),p(g,b,ee,"⊘","\\oslash",!0),p(g,k,ee,"⊚","\\circledcirc",!0),p(g,k,ee,"⊡","\\boxdot",!0),p(g,b,ee,"△","\\bigtriangleup"),p(g,b,ee,"▽","\\bigtriangledown"),p(g,b,ee,"†","\\dagger"),p(g,b,ee,"⋄","\\diamond"),p(g,b,ee,"⋆","\\star"),p(g,b,ee,"◃","\\triangleleft"),p(g,b,ee,"▹","\\triangleright"),p(g,b,xt,"{","\\{"),p(V,b,E,"{","\\{"),p(V,b,E,"{","\\textbraceleft"),p(g,b,ot,"}","\\}"),p(V,b,E,"}","\\}"),p(V,b,E,"}","\\textbraceright"),p(g,b,xt,"{","\\lbrace"),p(g,b,ot,"}","\\rbrace"),p(g,b,xt,"[","\\lbrack",!0),p(V,b,E,"[","\\lbrack",!0),p(g,b,ot,"]","\\rbrack",!0),p(V,b,E,"]","\\rbrack",!0),p(g,b,xt,"(","\\lparen",!0),p(g,b,ot,")","\\rparen",!0),p(V,b,E,"<","\\textless",!0),p(V,b,E,">","\\textgreater",!0),p(g,b,xt,"⌊","\\lfloor",!0),p(g,b,ot,"⌋","\\rfloor",!0),p(g,b,xt,"⌈","\\lceil",!0),p(g,b,ot,"⌉","\\rceil",!0),p(g,b,E,"\\","\\backslash"),p(g,b,E,"∣","|"),p(g,b,E,"∣","\\vert"),p(V,b,E,"|","\\textbar",!0),p(g,b,E,"∥","\\|"),p(g,b,E,"∥","\\Vert"),p(V,b,E,"∥","\\textbardbl"),p(V,b,E,"~","\\textasciitilde"),p(V,b,E,"\\","\\textbackslash"),p(V,b,E,"^","\\textasciicircum"),p(g,b,M,"↑","\\uparrow",!0),p(g,b,M,"⇑","\\Uparrow",!0),p(g,b,M,"↓","\\downarrow",!0),p(g,b,M,"⇓","\\Downarrow",!0),p(g,b,M,"↕","\\updownarrow",!0),p(g,b,M,"⇕","\\Updownarrow",!0),p(g,b,qe,"∐","\\coprod"),p(g,b,qe,"⋁","\\bigvee"),p(g,b,qe,"⋀","\\bigwedge"),p(g,b,qe,"⨄","\\biguplus"),p(g,b,qe,"⋂","\\bigcap"),p(g,b,qe,"⋃","\\bigcup"),p(g,b,qe,"∫","\\int"),p(g,b,qe,"∫","\\intop"),p(g,b,qe,"∬","\\iint"),p(g,b,qe,"∭","\\iiint"),p(g,b,qe,"∏","\\prod"),p(g,b,qe,"∑","\\sum"),p(g,b,qe,"⨂","\\bigotimes"),p(g,b,qe,"⨁","\\bigoplus"),p(g,b,qe,"⨀","\\bigodot"),p(g,b,qe,"∮","\\oint"),p(g,b,qe,"∯","\\oiint"),p(g,b,qe,"∰","\\oiiint"),p(g,b,qe,"⨆","\\bigsqcup"),p(g,b,qe,"∫","\\smallint"),p(V,b,jn,"…","\\textellipsis"),p(g,b,jn,"…","\\mathellipsis"),p(V,b,jn,"…","\\ldots",!0),p(g,b,jn,"…","\\ldots",!0),p(g,b,jn,"⋯","\\@cdots",!0),p(g,b,jn,"⋱","\\ddots",!0),p(g,b,E,"⋮","\\varvdots"),p(V,b,E,"⋮","\\varvdots"),p(g,b,Oe,"ˊ","\\acute"),p(g,b,Oe,"ˋ","\\grave"),p(g,b,Oe,"¨","\\ddot"),p(g,b,Oe,"~","\\tilde"),p(g,b,Oe,"ˉ","\\bar"),p(g,b,Oe,"˘","\\breve"),p(g,b,Oe,"ˇ","\\check"),p(g,b,Oe,"^","\\hat"),p(g,b,Oe,"⃗","\\vec"),p(g,b,Oe,"˙","\\dot"),p(g,b,Oe,"˚","\\mathring"),p(g,b,le,"","\\@imath"),p(g,b,le,"","\\@jmath"),p(g,b,E,"ı","ı"),p(g,b,E,"ȷ","ȷ"),p(V,b,E,"ı","\\i",!0),p(V,b,E,"ȷ","\\j",!0),p(V,b,E,"ß","\\ss",!0),p(V,b,E,"æ","\\ae",!0),p(V,b,E,"œ","\\oe",!0),p(V,b,E,"ø","\\o",!0),p(V,b,E,"Æ","\\AE",!0),p(V,b,E,"Œ","\\OE",!0),p(V,b,E,"Ø","\\O",!0),p(V,b,Oe,"ˊ","\\'"),p(V,b,Oe,"ˋ","\\`"),p(V,b,Oe,"ˆ","\\^"),p(V,b,Oe,"˜","\\~"),p(V,b,Oe,"ˉ","\\="),p(V,b,Oe,"˘","\\u"),p(V,b,Oe,"˙","\\."),p(V,b,Oe,"¸","\\c"),p(V,b,Oe,"˚","\\r"),p(V,b,Oe,"ˇ","\\v"),p(V,b,Oe,"¨",'\\"'),p(V,b,Oe,"˝","\\H"),p(V,b,Oe,"◯","\\textcircled");var zf={"--":!0,"---":!0,"``":!0,"''":!0};p(V,b,E,"–","--",!0),p(V,b,E,"–","\\textendash"),p(V,b,E,"—","---",!0),p(V,b,E,"—","\\textemdash"),p(V,b,E,"‘","`",!0),p(V,b,E,"‘","\\textquoteleft"),p(V,b,E,"’","'",!0),p(V,b,E,"’","\\textquoteright"),p(V,b,E,"“","``",!0),p(V,b,E,"“","\\textquotedblleft"),p(V,b,E,"”","''",!0),p(V,b,E,"”","\\textquotedblright"),p(g,b,E,"°","\\degree",!0),p(V,b,E,"°","\\degree"),p(V,b,E,"°","\\textdegree",!0),p(g,b,E,"£","\\pounds"),p(g,b,E,"£","\\mathsterling",!0),p(V,b,E,"£","\\pounds"),p(V,b,E,"£","\\textsterling",!0),p(g,k,E,"✠","\\maltese"),p(V,k,E,"✠","\\maltese");for(var If='0123456789/@."',Al=0;Al<If.length;Al++){var Rf=If.charAt(Al);p(g,b,E,Rf,Rf)}for(var Pf='0123456789!@*()-=+";:?/.,',Ol=0;Ol<Pf.length;Ol++){var Lf=Pf.charAt(Ol);p(V,b,E,Lf,Lf)}for(var Qs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Nl=0;Nl<Qs.length;Nl++){var eo=Qs.charAt(Nl);p(g,b,le,eo,eo),p(V,b,E,eo,eo)}p(g,k,E,"C","ℂ"),p(V,k,E,"C","ℂ"),p(g,k,E,"H","ℍ"),p(V,k,E,"H","ℍ"),p(g,k,E,"N","ℕ"),p(V,k,E,"N","ℕ"),p(g,k,E,"P","ℙ"),p(V,k,E,"P","ℙ"),p(g,k,E,"Q","ℚ"),p(V,k,E,"Q","ℚ"),p(g,k,E,"R","ℝ"),p(V,k,E,"R","ℝ"),p(g,k,E,"Z","ℤ"),p(V,k,E,"Z","ℤ"),p(g,b,le,"h","ℎ"),p(V,b,le,"h","ℎ");for(var ue="",at=0;at<Qs.length;at++){var Be=Qs.charAt(at);ue=String.fromCharCode(55349,56320+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56372+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56424+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56580+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56684+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56736+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56788+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56840+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56944+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),at<26&&(ue=String.fromCharCode(55349,56632+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue),ue=String.fromCharCode(55349,56476+at),p(g,b,le,Be,ue),p(V,b,E,Be,ue))}ue="𝕜",p(g,b,le,"k",ue),p(V,b,E,"k",ue);for(var yn=0;yn<10;yn++){var Ur=yn.toString();ue=String.fromCharCode(55349,57294+yn),p(g,b,le,Ur,ue),p(V,b,E,Ur,ue),ue=String.fromCharCode(55349,57314+yn),p(g,b,le,Ur,ue),p(V,b,E,Ur,ue),ue=String.fromCharCode(55349,57324+yn),p(g,b,le,Ur,ue),p(V,b,E,Ur,ue),ue=String.fromCharCode(55349,57334+yn),p(g,b,le,Ur,ue),p(V,b,E,Ur,ue)}for(var Dl="ÐÞþ",zl=0;zl<Dl.length;zl++){var to=Dl.charAt(zl);p(g,b,le,to,to),p(V,b,E,to,to)}var ro=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Bf=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Bv=function(e,t){var n=e.charCodeAt(0),i=e.charCodeAt(1),s=(n-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[ro[a][2],ro[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[Bf[l][2],Bf[l][o]]}else{if(s===120485||s===120486)return[ro[0][2],ro[0][o]];if(120486<s&&s<120782)return["",""];throw new U("Unsupported character: "+e)}},no=function(e,t,n){return Ee[n][e]&&Ee[n][e].replace&&(e=Ee[n][e].replace),{value:e,metrics:kl(e,t,n)}},Bt=function(e,t,n,i,s){var o=no(e,t,n),a=o.metrics;e=o.value;var l;if(a){var c=a.italic;(n==="text"||i&&i.font==="mathit")&&(c=0),l=new Ot(e,a.height,a.depth,c,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new Ot(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var u=i.getColor();u&&(l.style.color=u)}return l},Fv=function(e,t,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&no(e,"Main-Bold",t).metrics?Bt(e,"Main-Bold",t,n,i.concat(["mathbf"])):e==="\\"||Ee[t][e].font==="main"?Bt(e,"Main-Regular",t,n,i):Bt(e,"AMS-Regular",t,n,i.concat(["amsrm"]))},$v=function(e,t,n,i,s){return s!=="textord"&&no(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Hv=function(e,t,n){var i=e.mode,s=e.text,o=["mord"],a=i==="math"||i==="text"&&t.font,l=a?t.font:t.fontFamily,c="",u="";if(s.charCodeAt(0)===55349&&([c,u]=Bv(s,i)),c.length>0)return Bt(s,c,i,t,o.concat(u));if(l){var d,h;if(l==="boldsymbol"){var f=$v(s,i,t,o,n);d=f.fontName,h=[f.fontClass]}else a?(d=Hf[l].fontName,h=[l]):(d=io(l,t.fontWeight,t.fontShape),h=[l,t.fontWeight,t.fontShape]);if(no(s,d,i).metrics)return Bt(s,d,i,t,o.concat(h));if(zf.hasOwnProperty(s)&&d.slice(0,10)==="Typewriter"){for(var m=[],y=0;y<s.length;y++)m.push(Bt(s[y],d,i,t,o.concat(h)));return $f(m)}}if(n==="mathord")return Bt(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(n==="textord"){var v=Ee[i][s]&&Ee[i][s].font;if(v==="ams"){var x=io("amsrm",t.fontWeight,t.fontShape);return Bt(s,x,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(v==="main"||!v){var T=io("textrm",t.fontWeight,t.fontShape);return Bt(s,T,i,t,o.concat(t.fontWeight,t.fontShape))}else{var D=io(v,t.fontWeight,t.fontShape);return Bt(s,D,i,t,o.concat(D,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},Vv=(r,e)=>{if(_r(r.classes)!==_r(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize)return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n in r.style)if(r.style.hasOwnProperty(n)&&r.style[n]!==e.style[n])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&r.style[i]!==e.style[i])return!1;return!0},qv=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof Ot&&n instanceof Ot&&Vv(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},Il=function(e){for(var t=0,n=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=i},ht=function(e,t,n,i){var s=new Pi(e,t,n,i);return Il(s),s},Ff=(r,e,t,n)=>new Pi(r,e,t,n),_v=function(e,t,n){var i=ht([e],[],t);return i.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=G(i.height),i.maxFontSize=1,i},jv=function(e,t,n,i){var s=new Cl(e,t,n,i);return Il(s),s},$f=function(e){var t=new Ri(e);return Il(t),t},Uv=function(e,t){return e instanceof Ri?ht([],[e],t):e},Wv=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var a=-t[o].shift-s-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);s=s+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var f=e.children[0];if(f.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-f.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-f.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Gv=function(e,t){for(var{children:n,depth:i}=Wv(e),s=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=ht(["pstrut"],[]);c.style.height=G(s);for(var u=[],d=i,h=i,f=i,m=0;m<n.length;m++){var y=n[m];if(y.type==="kern")f+=y.size;else{var v=y.elem,x=y.wrapperClasses||[],T=y.wrapperStyle||{},D=ht(x,[c,v],void 0,T);D.style.top=G(-s-f-v.depth),y.marginLeft&&(D.style.marginLeft=y.marginLeft),y.marginRight&&(D.style.marginRight=y.marginRight),u.push(D),f+=v.height+v.depth}d=Math.min(d,f),h=Math.max(h,f)}var P=ht(["vlist"],u);P.style.height=G(h);var N;if(d<0){var O=ht([],[]),A=ht(["vlist"],[O]);A.style.height=G(-d);var $=ht(["vlist-s"],[new Ot("​")]);N=[ht(["vlist-r"],[P,$]),ht(["vlist-r"],[A])]}else N=[ht(["vlist-r"],[P])];var F=ht(["vlist-t"],N);return N.length===2&&F.classes.push("vlist-t2"),F.height=h,F.depth=-d,F},Kv=(r,e)=>{var t=ht(["mspace"],[],e),n=ze(r,e);return t.style.marginRight=G(n),t},io=function(e,t,n){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},Hf={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Vf={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Jv=function(e,t){var[n,i,s]=Vf[e],o=new jr(n),a=new dr([o],{width:G(i),height:G(s),style:"width:"+G(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=Ff(["overlay"],[a],t);return l.height=s,l.style.height=G(s),l.style.width=G(i),l},R={fontMap:Hf,makeSymbol:Bt,mathsym:Fv,makeSpan:ht,makeSvgSpan:Ff,makeLineSpan:_v,makeAnchor:jv,makeFragment:$f,wrapFragment:Uv,makeVList:Gv,makeOrd:Hv,makeGlue:Kv,staticSvg:Jv,svgData:Vf,tryCombineChars:qv},Ie={number:3,unit:"mu"},vn={number:4,unit:"mu"},fr={number:5,unit:"mu"},Xv={mord:{mop:Ie,mbin:vn,mrel:fr,minner:Ie},mop:{mord:Ie,mop:Ie,mrel:fr,minner:Ie},mbin:{mord:vn,mop:vn,mopen:vn,minner:vn},mrel:{mord:fr,mop:fr,mopen:fr,minner:fr},mopen:{},mclose:{mop:Ie,mbin:vn,mrel:fr,minner:Ie},mpunct:{mord:Ie,mop:Ie,mrel:fr,mopen:Ie,mclose:Ie,mpunct:Ie,minner:Ie},minner:{mord:Ie,mop:Ie,mbin:vn,mrel:fr,mopen:Ie,mpunct:Ie,minner:Ie}},Yv={mord:{mop:Ie},mop:{mord:Ie,mop:Ie},mbin:{},mrel:{},mopen:{},mclose:{mop:Ie},mpunct:{},minner:{mop:Ie}},qf={},so={},oo={};function Z(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<t.length;++l)qf[t[l]]=a;e&&(s&&(so[e]=s),o&&(oo[e]=o))}function bn(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;Z({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}var ao=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},$e=function(e){return e.type==="ordgroup"?e.body:[e]},pr=R.makeSpan,Zv=["leftmost","mbin","mopen","mrel","mop","mpunct"],Qv=["rightmost","mrel","mclose","mpunct"],e8={display:ae.DISPLAY,text:ae.TEXT,script:ae.SCRIPT,scriptscript:ae.SCRIPTSCRIPT},t8={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},_e=function(e,t,n,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=be(e[o],t);if(a instanceof Ri){var l=a.children;s.push(...l)}else s.push(a)}if(R.tryCombineChars(s),!n)return s;var c=t;if(e.length===1){var u=e[0];u.type==="sizing"?c=t.havingSize(u.size):u.type==="styling"&&(c=t.havingStyle(e8[u.style]))}var d=pr([i[0]||"leftmost"],[],t),h=pr([i[1]||"rightmost"],[],t),f=n==="root";return _f(s,(m,y)=>{var v=y.classes[0],x=m.classes[0];v==="mbin"&&Qv.includes(x)?y.classes[0]="mord":x==="mbin"&&Zv.includes(v)&&(m.classes[0]="mord")},{node:d},h,f),_f(s,(m,y)=>{var v=Rl(y),x=Rl(m),T=v&&x?m.hasClass("mtight")?Yv[v][x]:Xv[v][x]:null;if(T)return R.makeGlue(T,c)},{node:d},h,f),s},_f=function r(e,t,n,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=jf(a);if(l){r(l.children,t,n,null,s);continue}var c=!a.hasClass("mspace");if(c){var u=t(a,n.node);u&&(n.insertAfter?n.insertAfter(u):(e.unshift(u),o++))}c?n.node=a:s&&a.hasClass("newline")&&(n.node=pr(["leftmost"])),n.insertAfter=(d=>h=>{e.splice(d+1,0,h),o++})(o)}i&&e.pop()},jf=function(e){return e instanceof Ri||e instanceof Cl||e instanceof Pi&&e.hasClass("enclosing")?e:null},r8=function r(e,t){var n=jf(e);if(n){var i=n.children;if(i.length){if(t==="right")return r(i[i.length-1],"right");if(t==="left")return r(i[0],"left")}}return e},Rl=function(e,t){return e?(t&&(e=r8(e,t)),t8[e.classes[0]]||null):null},Li=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return pr(t.concat(n))},be=function(e,t,n){if(!e)return pr();if(so[e.type]){var i=so[e.type](e,t);if(n&&t.size!==n.size){i=pr(t.sizingClasses(n),[i],t);var s=t.sizeMultiplier/n.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new U("Got group of unknown type: '"+e.type+"'")};function lo(r,e){var t=pr(["base"],r,e),n=pr(["strut"]);return n.style.height=G(t.height+t.depth),t.depth&&(n.style.verticalAlign=G(-t.depth)),t.children.unshift(n),t}function Pl(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=_e(r,e,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var s=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(s.push(lo(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(lo(o,e)),o=[]),s.push(n[a]));o.length>0&&s.push(lo(o,e));var c;t?(c=lo(_e(t,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=pr(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=G(u.height+u.depth),u.depth&&(d.style.verticalAlign=G(-u.depth))}return u}function Uf(r){return new Ri(r)}class wt{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=_r(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Wt&&this.children[n+1]instanceof Wt){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Wt;)i+=this.children[++n].toText();e.appendChild(new Wt(i).toNode())}else 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+=xe.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+xe.escape(_r(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Wt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return xe.escape(this.toText())}toText(){return this.text}}class n8{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=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",G(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+G(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var _={MathNode:wt,TextNode:Wt,SpaceNode:n8,newDocumentFragment:Uf},Nt=function(e,t,n){return Ee[t][e]&&Ee[t][e].replace&&e.charCodeAt(0)!==55349&&!(zf.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ee[t][e].replace),new _.TextNode(e)},Ll=function(e){return e.length===1?e[0]:new _.MathNode("mrow",e)},Bl=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var i=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var s=e.text;if(["\\imath","\\jmath"].includes(s))return null;Ee[i][s]&&Ee[i][s].replace&&(s=Ee[i][s].replace);var o=R.fontMap[n].fontName;return kl(s,o,i)?R.fontMap[n].variant:null};function Fl(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Wt&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Wt&&t.text===","}else return!1}var ft=function(e,t,n){if(e.length===1){var i=Te(e[0],t);return n&&i instanceof wt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=Te(e[a],t);if(l instanceof wt&&o instanceof wt){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(Fl(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&Fl(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||Fl(o))){var c=l.children[0];c instanceof wt&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Wt&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Wt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),o=l}return s},Wr=function(e,t,n){return Ll(ft(e,t,n))},Te=function(e,t){if(!e)return new _.MathNode("mrow");if(oo[e.type]){var n=oo[e.type](e,t);return n}else throw new U("Got group of unknown type: '"+e.type+"'")};function Wf(r,e,t,n,i){var s=ft(r,t),o;s.length===1&&s[0]instanceof wt&&["mrow","mtable"].includes(s[0].type)?o=s[0]:o=new _.MathNode("mrow",s);var a=new _.MathNode("annotation",[new _.TextNode(e)]);a.setAttribute("encoding","application/x-tex");var l=new _.MathNode("semantics",[o,a]),c=new _.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return R.makeSpan([u],[c])}var Gf=function(e){return new ur({style:e.displayMode?ae.DISPLAY:ae.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Kf=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=R.makeSpan(n,[e])}return e},i8=function(e,t,n){var i=Gf(n),s;if(n.output==="mathml")return Wf(e,t,i,n.displayMode,!0);if(n.output==="html"){var o=Pl(e,i);s=R.makeSpan(["katex"],[o])}else{var a=Wf(e,t,i,n.displayMode,!1),l=Pl(e,i);s=R.makeSpan(["katex"],[a,l])}return Kf(s,n)},s8=function(e,t,n){var i=Gf(n),s=Pl(e,i),o=R.makeSpan(["katex"],[s]);return Kf(o,n)},o8={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},a8=function(e){var t=new _.MathNode("mo",[new _.TextNode(o8[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},l8={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],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],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},c8=function(e){return e.type==="ordgroup"?e.body.length:1},u8=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(l)){var c=e,u=c8(c.base),d,h,f;if(u>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,f=.42,h=l+"4"):(d=312,a=2340,f=.34,h="tilde4");else{var m=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],h=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],h="tilde"+m)}var y=new jr(h),v=new dr([y],{width:"100%",height:G(f),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:R.makeSvgSpan([],[v],t),minWidth:0,height:f}}else{var x=[],T=l8[l],[D,P,N]=T,O=N/1e3,A=D.length,$,F;if(A===1){var q=T[3];$=["hide-tail"],F=[q]}else if(A===2)$=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(A===3)$=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
381
- `+A+" children.");for(var te=0;te<A;te++){var Y=new jr(D[te]),he=new dr([Y],{width:"400em",height:G(O),viewBox:"0 0 "+a+" "+N,preserveAspectRatio:F[te]+" slice"}),Q=R.makeSvgSpan([$[te]],[he],t);if(A===1)return{span:Q,minWidth:P,height:O};Q.style.height=G(O),x.push(Q)}return{span:R.makeSpan(["stretchy"],x,t),minWidth:P,height:O}}}var{span:i,minWidth:s,height:o}=n();return i.height=o,i.style.height=G(o),s>0&&(i.style.minWidth=G(s)),i},d8=function(e,t,n,i,s){var o,a=e.height+e.depth+n+i;if(/fbox|color|angl/.test(t)){if(o=R.makeSpan(["stretchy",t],[],s),t==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new El({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&c.push(new El({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new dr(c,{width:"100%",height:G(a)});o=R.makeSvgSpan([],[u],s)}return o.height=a,o.style.height=G(a),o},mr={encloseSpan:d8,mathMLnode:a8,svgSpan:u8};function fe(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function $l(r){var e=co(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function co(r){return r&&(r.type==="atom"||Lv.hasOwnProperty(r.type))?r:null}var Hl=(r,e)=>{var t,n,i;r&&r.type==="supsub"?(n=fe(r.base,"accent"),t=n.base,r.base=t,i=Rv(be(r,e)),r.base=n):(n=fe(r,"accent"),t=n.base);var s=be(t,e.havingCrampedStyle()),o=n.isShifty&&xe.isCharacterBox(t),a=0;if(o){var l=xe.getBaseElem(t),c=be(l,e.havingCrampedStyle());a=Df(c).skew}var u=n.label==="\\c",d=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),h;if(n.isStretchy)h=mr.svgSpan(n,e),h=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+G(2*a)+")",marginLeft:G(2*a)}:void 0}]},e);else{var f,m;n.label==="\\vec"?(f=R.staticSvg("vec",e),m=R.svgData.vec[1]):(f=R.makeOrd({mode:n.mode,text:n.label},e,"textord"),f=Df(f),f.italic=0,m=f.width,u&&(d+=f.depth)),h=R.makeSpan(["accent-body"],[f]);var y=n.label==="\\textcircled";y&&(h.classes.push("accent-full"),d=s.height);var v=a;y||(v-=m/2),h.style.left=G(v),n.label==="\\textcircled"&&(h.style.top=".2em"),h=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:h}]},e)}var x=R.makeSpan(["mord","accent"],[h],e);return i?(i.children[0]=x,i.height=Math.max(x.height,i.height),i.classes[0]="mord",i):x},Jf=(r,e)=>{var t=r.isStretchy?mr.mathMLnode(r.label):new _.MathNode("mo",[Nt(r.label,r.mode)]),n=new _.MathNode("mover",[Te(r.base,e),t]);return n.setAttribute("accent","true"),n},h8=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));Z({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:(r,e)=>{var t=ao(e[0]),n=!h8.test(r.funcName),i=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:i,base:t}},htmlBuilder:Hl,mathmlBuilder:Jf}),Z({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:Hl,mathmlBuilder:Jf}),Z({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:i}},htmlBuilder:(r,e)=>{var t=be(r.base,e),n=mr.svgSpan(r,e),i=r.label==="\\utilde"?.12:0,s=R.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return R.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(r,e)=>{var t=mr.mathMLnode(r.label),n=new _.MathNode("munder",[Te(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});var uo=r=>{var e=new _.MathNode("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Z({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(r,e,t){var{parser:n,funcName:i}=r;return{type:"xArrow",mode:n.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),i=R.wrapFragment(be(r.body,n,e),e),s=r.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=R.wrapFragment(be(r.below,n,e),e),o.classes.push(s+"-arrow-pad"));var a=mr.svgSpan(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||r.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(o){var d=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:d}]},e)}else u=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]},e);return u.children[0].children[0].children[1].classes.push("svg-align"),R.makeSpan(["mrel","x-arrow"],[u],e)},mathmlBuilder(r,e){var t=mr.mathMLnode(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var i=uo(Te(r.body,e));if(r.below){var s=uo(Te(r.below,e));n=new _.MathNode("munderover",[t,s,i])}else n=new _.MathNode("mover",[t,i])}else if(r.below){var o=uo(Te(r.below,e));n=new _.MathNode("munder",[t,o])}else n=uo(),n=new _.MathNode("mover",[t,n]);return n}});var f8=R.makeSpan;function Xf(r,e){var t=_e(r.body,e,!0);return f8([r.mclass],t,e)}function Yf(r,e){var t,n=ft(r.body,e);return r.mclass==="minner"?t=new _.MathNode("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new _.MathNode("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new _.MathNode("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}Z({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:$e(i),isCharacterBox:xe.isCharacterBox(i)}},htmlBuilder:Xf,mathmlBuilder:Yf});var ho=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Z({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:ho(e[0]),body:$e(e[1]),isCharacterBox:xe.isCharacterBox(e[1])}}}),Z({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,i=e[1],s=e[0],o;n!=="\\stackrel"?o=ho(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:$e(i)},l={type:"supsub",mode:s.mode,base:a,sup:n==="\\underset"?null:s,sub:n==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:xe.isCharacterBox(l)}},htmlBuilder:Xf,mathmlBuilder:Yf}),Z({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:ho(e[0]),body:$e(e[0])}},htmlBuilder(r,e){var t=_e(r.body,e,!0),n=R.makeSpan([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=ft(r.body,e),n=new _.MathNode("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var p8={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Zf=()=>({type:"styling",body:[],mode:"math",style:"display"}),Qf=r=>r.type==="textord"&&r.text==="@",m8=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function g8(r,e,t){var n=p8[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function y8(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new U("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],i=[n],s=0;s<e.length;s++){for(var o=e[s],a=Zf(),l=0;l<o.length;l++)if(!Qf(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var c=$l(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(c)>-1))if("<>AV".indexOf(c)>-1)for(var d=0;d<2;d++){for(var h=!0,f=l+1;f<o.length;f++){if(m8(o[f],c)){h=!1,l=f;break}if(Qf(o[f]))throw new U("Missing a "+c+" character to complete a CD arrow.",o[f]);u[d].body.push(o[f])}if(h)throw new U("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new U('Expected one of "<>AV=|." after @',o[l]);var m=g8(c,u,r),y={type:"styling",body:[m],mode:"math",style:"display"};n.push(y),a=Zf()}s%2===0?n.push(a):n.shift(),n=[],i.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var v=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Z({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=R.wrapFragment(be(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=G(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new _.MathNode("mrow",[Te(r.label,e)]);return t=new _.MathNode("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new _.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}}),Z({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=R.wrapFragment(be(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new _.MathNode("mrow",[Te(r.fragment,e)])}}),Z({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=fe(e[0],"ordgroup"),i=n.body,s="",o=0;o<i.length;o++){var a=fe(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new U("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new U("\\@char with invalid code point "+s);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:c}}});var ep=(r,e)=>{var t=_e(r.body,e.withColor(r.color),!1);return R.makeFragment(t)},tp=(r,e)=>{var t=ft(r.body,e.withColor(r.color)),n=new _.MathNode("mstyle",t);return n.setAttribute("mathcolor",r.color),n};Z({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=fe(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:n,body:$e(i)}},htmlBuilder:ep,mathmlBuilder:tp}),Z({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,i=fe(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:ep,mathmlBuilder:tp}),Z({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,s=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:s,size:i&&fe(i,"size").value}},htmlBuilder(r,e){var t=R.makeSpan(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=G(ze(r.size,e)))),t},mathmlBuilder(r,e){var t=new _.MathNode("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",G(ze(r.size,e)))),t}});var Vl={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},rp=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new U("Expected a control sequence",r);return e},v8=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},np=(r,e,t,n)=>{var i=r.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,i,n)};Z({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Vl[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Vl[n.text]),fe(e.parseFunction(),"internal");throw new U("Invalid token after macro prefix",n)}}),Z({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new U("Expected a control sequence",n);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new U('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==s+1)throw new U('Argument number "'+n.text+'" out of order');s++,a.push([])}else{if(n.text==="EOF")throw new U("Expected a macro definition");a[s].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},t===Vl[t]),{type:"internal",mode:e.mode}}}),Z({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=rp(e.gullet.popToken());e.gullet.consumeSpaces();var i=v8(e);return np(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),Z({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=rp(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return np(e,n,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Bi=function(e,t,n){var i=Ee.math[e]&&Ee.math[e].replace,s=kl(i||e,t,n);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},ql=function(e,t,n,i){var s=n.havingBaseStyle(t),o=R.makeSpan(i.concat(s.sizingClasses(n)),[e],n),a=s.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},ip=function(e,t,n){var i=t.havingBaseStyle(n),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=G(s),e.height-=s,e.depth+=s},b8=function(e,t,n,i,s,o){var a=R.makeSymbol(e,"Main-Regular",s,i),l=ql(a,t,i,o);return n&&ip(l,i,t),l},x8=function(e,t,n,i){return R.makeSymbol(e,"Size"+t+"-Regular",n,i)},sp=function(e,t,n,i,s,o){var a=x8(e,t,s,i),l=ql(R.makeSpan(["delimsizing","size"+t],[a],i),ae.TEXT,i,o);return n&&ip(l,i,ae.TEXT),l},_l=function(e,t,n){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=R.makeSpan(["delimsizinginner",i],[R.makeSpan([],[R.makeSymbol(e,t,n)])]);return{type:"elem",elem:s}},jl=function(e,t,n){var i=Ut["Size4-Regular"][e.charCodeAt(0)]?Ut["Size4-Regular"][e.charCodeAt(0)][4]:Ut["Size1-Regular"][e.charCodeAt(0)][4],s=new jr("inner",Tv(e,Math.round(1e3*t))),o=new dr([s],{width:G(i),height:G(t),style:"width:"+G(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=R.makeSvgSpan([],[o],n);return a.height=t,a.style.height=G(t),a.style.width=G(i),{type:"elem",elem:a}},Ul=.008,fo={type:"kern",size:-1*Ul},w8=["|","\\lvert","\\rvert","\\vert"],S8=["\\|","\\lVert","\\rVert","\\Vert"],op=function(e,t,n,i,s,o){var a,l,c,u,d="",h=0;a=c=u=e,l=null;var f="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):w8.includes(e)?(c="∣",d="vert",h=333):S8.includes(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",u="⎣",f="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",u="⎦",f="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",u="⎣",f="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=u="⎢",f="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",u="⎦",f="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=u="⎥",f="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",u="⎝",f="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",u="⎠",f="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",f="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",u="⎩",c="⎪",f="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",u="⎭",c="⎪",f="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",u="⎩",c="⎪",f="Size4-Regular");var m=Bi(a,f,s),y=m.height+m.depth,v=Bi(c,f,s),x=v.height+v.depth,T=Bi(u,f,s),D=T.height+T.depth,P=0,N=1;if(l!==null){var O=Bi(l,f,s);P=O.height+O.depth,N=2}var A=y+D+P,$=Math.max(0,Math.ceil((t-A)/(N*x))),F=A+$*N*x,q=i.fontMetrics().axisHeight;n&&(q*=i.sizeMultiplier);var te=F/2-q,Y=[];if(d.length>0){var he=F-y-D,Q=Math.round(F*1e3),W=Cv(d,Math.round(he*1e3)),ne=new jr(d,W),ve=(h/1e3).toFixed(3)+"em",ge=(Q/1e3).toFixed(3)+"em",Ae=new dr([ne],{width:ve,height:ge,viewBox:"0 0 "+h+" "+Q}),C=R.makeSvgSpan([],[Ae],i);C.height=Q/1e3,C.style.width=ve,C.style.height=ge,Y.push({type:"elem",elem:C})}else{if(Y.push(_l(u,f,s)),Y.push(fo),l===null){var w=F-y-D+2*Ul;Y.push(jl(c,w,i))}else{var I=(F-y-D-P)/2+2*Ul;Y.push(jl(c,I,i)),Y.push(fo),Y.push(_l(l,f,s)),Y.push(fo),Y.push(jl(c,I,i))}Y.push(fo),Y.push(_l(a,f,s))}var L=i.havingBaseStyle(ae.TEXT),B=R.makeVList({positionType:"bottom",positionData:te,children:Y},L);return ql(R.makeSpan(["delimsizing","mult"],[B],L),ae.TEXT,i,o)},Wl=80,Gl=.08,Kl=function(e,t,n,i,s){var o=Mv(e,i,n),a=new jr(e,o),l=new dr([a],{width:"400em",height:G(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return R.makeSvgSpan(["hide-tail"],[l],s)},k8=function(e,t){var n=t.havingBaseSizing(),i=up("\\surd",e*n.sizeMultiplier,cp,n),s=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,c=0,u=0,d;return i.type==="small"?(u=1e3+1e3*o+Wl,e<1?s=1:e<1.4&&(s=.7),l=(1+o+Gl)/s,c=(1+o)/s,a=Kl("sqrtMain",l,u,o,t),a.style.minWidth="0.853em",d=.833/s):i.type==="large"?(u=(1e3+Wl)*Fi[i.size],c=(Fi[i.size]+o)/s,l=(Fi[i.size]+o+Gl)/s,a=Kl("sqrtSize"+i.size,l,u,o,t),a.style.minWidth="1.02em",d=1/s):(l=e+o+Gl,c=e+o,u=Math.floor(1e3*e+o)+Wl,a=Kl("sqrtTall",l,u,o,t),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=G(l),{span:a,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},ap=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],M8=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],lp=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Fi=[0,1.2,1.8,2.4,3],T8=function(e,t,n,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ap.includes(e)||lp.includes(e))return sp(e,t,!1,n,i,s);if(M8.includes(e))return op(e,Fi[t],!1,n,i,s);throw new U("Illegal delimiter: '"+e+"'")},C8=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],E8=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"stack"}],cp=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],A8=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},up=function(e,t,n,i){for(var s=Math.min(2,3-i.style.size),o=s;o<n.length&&n[o].type!=="stack";o++){var a=Bi(e,A8(n[o]),"math"),l=a.height+a.depth;if(n[o].type==="small"){var c=i.havingBaseStyle(n[o].style);l*=c.sizeMultiplier}if(l>t)return n[o]}return n[n.length-1]},dp=function(e,t,n,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;lp.includes(e)?a=C8:ap.includes(e)?a=cp:a=E8;var l=up(e,t,a,i);return l.type==="small"?b8(e,l.style,n,i,s,o):l.type==="large"?sp(e,l.size,n,i,s,o):op(e,t,n,i,s,o)},O8=function(e,t,n,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(t-a,n+a),d=Math.max(u/500*l,2*u-c);return dp(e,d,!0,i,s,o)},gr={sqrtImage:k8,sizedDelim:T8,sizeToMaxHeight:Fi,customSizedDelim:dp,leftRightDelim:O8},hp={"\\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}},N8=["(","\\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 po(r,e){var t=co(r);if(t&&N8.includes(t.text))return t;throw t?new U("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new U("Invalid delimiter type '"+r.type+"'",r)}Z({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:(r,e)=>{var t=po(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:hp[r.funcName].size,mclass:hp[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?R.makeSpan([r.mclass]):gr.sizedDelim(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Nt(r.delim,r.mode));var t=new _.MathNode("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=G(gr.sizeToMaxHeight[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});function fp(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Z({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new U("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:po(e[0],r).text,color:t}}}),Z({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=po(e[0],r),n=r.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var s=fe(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(r,e)=>{fp(r);for(var t=_e(r.body,e,!0,["mopen","mclose"]),n=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(n=Math.max(t[o].height,n),i=Math.max(t[o].depth,i));n*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(r.left==="."?a=Li(e,["mopen"]):a=gr.leftRightDelim(r.left,n,i,e,r.mode,["mopen"]),t.unshift(a),s)for(var l=1;l<t.length;l++){var c=t[l],u=c.isMiddle;u&&(t[l]=gr.leftRightDelim(u.delim,n,i,u.options,r.mode,[]))}var d;if(r.right===".")d=Li(e,["mclose"]);else{var h=r.rightColor?e.withColor(r.rightColor):e;d=gr.leftRightDelim(r.right,n,i,h,r.mode,["mclose"])}return t.push(d),R.makeSpan(["minner"],t,e)},mathmlBuilder:(r,e)=>{fp(r);var t=ft(r.body,e);if(r.left!=="."){var n=new _.MathNode("mo",[Nt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var i=new _.MathNode("mo",[Nt(r.right,r.mode)]);i.setAttribute("fence","true"),r.rightColor&&i.setAttribute("mathcolor",r.rightColor),t.push(i)}return Ll(t)}}),Z({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=po(e[0],r);if(!r.parser.leftrightDepth)throw new U("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=Li(e,[]);else{t=gr.sizedDelim(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Nt("|","text"):Nt(r.delim,r.mode),n=new _.MathNode("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var Jl=(r,e)=>{var t=R.wrapFragment(be(r.body,e),e),n=r.label.slice(1),i=e.sizeMultiplier,s,o=0,a=xe.isCharacterBox(r.body);if(n==="sout")s=R.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=ze({number:.6,unit:"pt"},e),c=ze({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var d=t.height+t.depth+l+c;t.style.paddingLeft=G(d/2+l);var h=Math.floor(1e3*d*i),f=Sv(h),m=new dr([new jr("phase",f)],{width:"400em",height:G(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});s=R.makeSvgSpan(["hide-tail"],[m],e),s.style.height=G(d),o=t.depth+l+c}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var y=0,v=0,x=0;/box/.test(n)?(x=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),y=e.fontMetrics().fboxsep+(n==="colorbox"?0:x),v=y):n==="angl"?(x=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),y=4*x,v=Math.max(0,.25-t.depth)):(y=a?.2:0,v=y),s=mr.encloseSpan(t,n,y,v,e),/fbox|boxed|fcolorbox/.test(n)?(s.style.borderStyle="solid",s.style.borderWidth=G(x)):n==="angl"&&x!==.049&&(s.style.borderTopWidth=G(x),s.style.borderRightWidth=G(x)),o=t.depth+v,r.backgroundColor&&(s.style.backgroundColor=r.backgroundColor,r.borderColor&&(s.style.borderColor=r.borderColor))}var T;if(r.backgroundColor)T=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var D=/cancel|phase/.test(n)?["svg-align"]:[];T=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:D}]},e)}return/cancel/.test(n)&&(T.height=t.height,T.depth=t.depth),/cancel/.test(n)&&!a?R.makeSpan(["mord","cancel-lap"],[T],e):R.makeSpan(["mord"],[T],e)},Xl=(r,e)=>{var t=0,n=new _.MathNode(r.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Te(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(r.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};Z({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=fe(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=fe(e[0],"color-token").color,o=fe(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}}),Z({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"enclose",mode:t.mode,label:n,body:i}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var pp={};function Gt(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<t.length;++l)pp[t[l]]=a;s&&(so[e]=s),o&&(oo[e]=o)}var mp={};function S(r,e){mp[r]=e}function gp(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}var mo=r=>{var e=r.parser.settings;if(!e.displayMode)throw new U("{"+r.envName+"} can be used only in display mode.")};function Yl(r){if(r.indexOf("ed")===-1)return r.indexOf("*")===-1}function Gr(r,e,t){var{hskipBeforeAndAfter:n,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:h}=e;if(r.gullet.beginGroup(),c||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var f=r.gullet.expandMacroAsText("\\arraystretch");if(f==null)o=1;else if(o=parseFloat(f),!o||o<0)throw new U("Invalid \\arraystretch: "+f)}r.gullet.beginGroup();var m=[],y=[m],v=[],x=[],T=l!=null?[]:void 0;function D(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function P(){T&&(r.gullet.macros.get("\\df@tag")?(T.push(r.subparse([new bt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(D(),x.push(gp(r));;){var N=r.parseExpression(!1,c?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup(),N={type:"ordgroup",mode:r.mode,body:N},t&&(N={type:"styling",mode:r.mode,style:t,body:[N]}),m.push(N);var O=r.fetch().text;if(O==="&"){if(d&&m.length===d){if(c||a)throw new U("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(O==="\\end"){P(),m.length===1&&N.type==="styling"&&N.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),x.length<y.length+1&&x.push([]);break}else if(O==="\\\\"){r.consume();var A=void 0;r.gullet.future().text!==" "&&(A=r.parseSizeGroup(!0)),v.push(A?A.value:null),P(),x.push(gp(r)),m=[],y.push(m),D()}else throw new U("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:i,arraystretch:o,body:y,cols:s,rowGaps:v,hskipBeforeAndAfter:n,hLinesBeforeRow:x,colSeparationType:a,tags:T,leqno:h}}function Zl(r){return r.slice(0,1)==="d"?"display":"text"}var Kt=function(e,t){var n,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],u=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var f=t.havingStyle(ae.SCRIPT).sizeMultiplier;h=.2778*(f/t.sizeMultiplier)}var m=e.colSeparationType==="CD"?ze({number:3,unit:"ex"},t):12*d,y=3*d,v=e.arraystretch*m,x=.7*v,T=.3*v,D=0;function P(je){for(var Sn=0;Sn<je.length;++Sn)Sn>0&&(D+=.25),c.push({pos:D,isDashed:je[Sn]})}for(P(o[0]),n=0;n<e.body.length;++n){var N=e.body[n],O=x,A=T;a<N.length&&(a=N.length);var $=new Array(N.length);for(i=0;i<N.length;++i){var F=be(N[i],t);A<F.depth&&(A=F.depth),O<F.height&&(O=F.height),$[i]=F}var q=e.rowGaps[n],te=0;q&&(te=ze(q,t),te>0&&(te+=T,A<te&&(A=te),te=0)),e.addJot&&(A+=y),$.height=O,$.depth=A,D+=O,$.pos=D,D+=A+te,l[n]=$,P(o[n+1])}var Y=D/2+t.fontMetrics().axisHeight,he=e.cols||[],Q=[],W,ne,ve=[];if(e.tags&&e.tags.some(je=>je))for(n=0;n<s;++n){var ge=l[n],Ae=ge.pos-Y,C=e.tags[n],w=void 0;C===!0?w=R.makeSpan(["eqn-num"],[],t):C===!1?w=R.makeSpan([],[],t):w=R.makeSpan([],_e(C,t,!0),t),w.depth=ge.depth,w.height=ge.height,ve.push({type:"elem",elem:w,shift:Ae})}for(i=0,ne=0;i<a||ne<he.length;++i,++ne){for(var I=he[ne]||{},L=!0;I.type==="separator";){if(L||(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(t.fontMetrics().doubleRuleSep),Q.push(W)),I.separator==="|"||I.separator===":"){var B=I.separator==="|"?"solid":"dashed",K=R.makeSpan(["vertical-separator"],[],t);K.style.height=G(D),K.style.borderRightWidth=G(u),K.style.borderRightStyle=B,K.style.margin="0 "+G(-u/2);var re=D-Y;re&&(K.style.verticalAlign=G(-re)),Q.push(K)}else throw new U("Invalid separator type: "+I.separator);ne++,I=he[ne]||{},L=!1}if(!(i>=a)){var j=void 0;(i>0||e.hskipBeforeAndAfter)&&(j=xe.deflt(I.pregap,h),j!==0&&(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(j),Q.push(W)));var ie=[];for(n=0;n<s;++n){var me=l[n],Ce=me[i];if(Ce){var zt=me.pos-Y;Ce.depth=me.depth,Ce.height=me.height,ie.push({type:"elem",elem:Ce,shift:zt})}}ie=R.makeVList({positionType:"individualShift",children:ie},t),ie=R.makeSpan(["col-align-"+(I.align||"c")],[ie]),Q.push(ie),(i<a-1||e.hskipBeforeAndAfter)&&(j=xe.deflt(I.postgap,h),j!==0&&(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(j),Q.push(W)))}}if(l=R.makeSpan(["mtable"],Q),c.length>0){for(var It=R.makeLineSpan("hline",t,u),Ne=R.makeLineSpan("hdashline",t,u),ct=[{type:"elem",elem:l,shift:0}];c.length>0;){var Xr=c.pop(),xn=Xr.pos-Y;Xr.isDashed?ct.push({type:"elem",elem:Ne,shift:xn}):ct.push({type:"elem",elem:It,shift:xn})}l=R.makeVList({positionType:"individualShift",children:ct},t)}if(ve.length===0)return R.makeSpan(["mord"],[l],t);var wn=R.makeVList({positionType:"individualShift",children:ve},t);return wn=R.makeSpan(["tag"],[wn],t),R.makeFragment([l,wn])},D8={c:"center ",l:"left ",r:"right "},Jt=function(e,t){for(var n=[],i=new _.MathNode("mtd",[],["mtr-glue"]),s=new _.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],c=0;c<a.length;c++)l.push(new _.MathNode("mtd",[Te(a[c],t)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),n.push(new _.MathNode("mtr",l))}var u=new _.MathNode("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",G(d));var h="",f="";if(e.cols&&e.cols.length>0){var m=e.cols,y="",v=!1,x=0,T=m.length;m[0].type==="separator"&&(h+="top ",x=1),m[m.length-1].type==="separator"&&(h+="bottom ",T-=1);for(var D=x;D<T;D++)m[D].type==="align"?(f+=D8[m[D].align],v&&(y+="none "),v=!0):m[D].type==="separator"&&v&&(y+=m[D].separator==="|"?"solid ":"dashed ",v=!1);u.setAttribute("columnalign",f.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(e.colSeparationType==="align"){for(var P=e.cols||[],N="",O=1;O<P.length;O++)N+=O%2?"0em ":"1em ";u.setAttribute("columnspacing",N.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var A="",$=e.hLinesBeforeRow;h+=$[0].length>0?"left ":"",h+=$[$.length-1].length>0?"right ":"";for(var F=1;F<$.length-1;F++)A+=$[F].length===0?"none ":$[F][0]?"dashed ":"solid ";return/[sd]/.test(A)&&u.setAttribute("rowlines",A.trim()),h!==""&&(u=new _.MathNode("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new _.MathNode("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},yp=function(e,t){e.envName.indexOf("ed")===-1&&mo(e);var n=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=Gr(e.parser,{cols:n,addJot:!0,autoTag:s?void 0:Yl(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var u="",d=0;d<t[0].body.length;d++){var h=fe(t[0].body[d],"textord");u+=h.text}a=Number(u),l=a*2}var f=!l;o.body.forEach(function(x){for(var T=1;T<x.length;T+=2){var D=fe(x[T],"styling"),P=fe(D.body[0],"ordgroup");P.body.unshift(c)}if(f)l<x.length&&(l=x.length);else{var N=x.length/2;if(a<N)throw new U("Too many math in a row: "+("expected "+a+", but got "+N),x[0])}});for(var m=0;m<l;++m){var y="r",v=0;m%2===1?y="l":m>0&&f&&(v=1),n[m]={type:"align",align:y,pregap:v,postgap:0}}return o.colSeparationType=f?"align":"alignat",o};Gt({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=co(e[0]),n=t?[e[0]]:fe(e[0],"ordgroup").body,i=n.map(function(o){var a=$l(o),l=a.text;if("lcr".indexOf(l)!==-1)return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new U("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Gr(r.parser,s,Zl(r.envName))},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var i=r.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new U("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:t}]}}var s=Gr(r.parser,n,Zl(r.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=Gr(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=co(e[0]),n=t?[e[0]]:fe(e[0],"ordgroup").body,i=n.map(function(o){var a=$l(o),l=a.text;if("lc".indexOf(l)!==-1)return{type:"align",align:l};throw new U("Unknown column alignment: "+l,o)});if(i.length>1)throw new U("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Gr(r.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new U("{subarray} can contain only one column");return s},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Gr(r.parser,e,Zl(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.indexOf("r")>-1?".":"\\{",right:r.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:yp,htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){["gather","gather*"].includes(r.envName)&&mo(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Yl(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return Gr(r.parser,e,"display")},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:yp,htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){mo(r);var e={autoTag:Yl(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return Gr(r.parser,e,"display")},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["CD"],props:{numArgs:0},handler(r){return mo(r),y8(r.parser)},htmlBuilder:Kt,mathmlBuilder:Jt}),S("\\nonumber","\\gdef\\@eqnsw{0}"),S("\\notag","\\nonumber"),Z({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new U(r.funcName+" valid only within array environment")}});var vp=pp;Z({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];if(i.type!=="ordgroup")throw new U("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=fe(i.body[o],"textord").text;if(n==="\\begin"){if(!vp.hasOwnProperty(s))throw new U("No such environment: "+s,i);var a=vp[s],{args:l,optArgs:c}=t.parseArguments("\\begin{"+s+"}",a),u={mode:t.mode,envName:s,parser:t},d=a.handler(u,l,c);t.expect("\\end",!1);var h=t.nextToken,f=fe(t.parseFunction(),"environment");if(f.name!==s)throw new U("Mismatch: \\begin{"+s+"} matched by \\end{"+f.name+"}",h);return d}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var bp=(r,e)=>{var t=r.font,n=e.withFont(t);return be(r.body,n)},xp=(r,e)=>{var t=r.font,n=e.withFont(t);return Te(r.body,n)},wp={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Z({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=ao(e[0]),s=n;return s in wp&&(s=wp[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:bp,mathmlBuilder:xp}),Z({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0],i=xe.isCharacterBox(n);return{type:"mclass",mode:t.mode,mclass:ho(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}}),Z({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:i}=r,{mode:s}=t,o=t.parseExpression(!0,i),a="math"+n.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:bp,mathmlBuilder:xp});var Sp=(r,e)=>{var t=e;return r==="display"?t=t.id>=ae.SCRIPT.id?t.text():ae.DISPLAY:r==="text"&&t.size===ae.DISPLAY.size?t=ae.TEXT:r==="script"?t=ae.SCRIPT:r==="scriptscript"&&(t=ae.SCRIPTSCRIPT),t},Ql=(r,e)=>{var t=Sp(r.size,e.style),n=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(n);var o=be(r.numer,s,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var c=be(r.denom,s,e),u,d,h;r.hasBarLine?(r.barSize?(d=ze(r.barSize,e),u=R.makeLineSpan("frac-line",e,d)):u=R.makeLineSpan("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var f,m,y;t.size===ae.DISPLAY.size||r.size==="display"?(f=e.fontMetrics().num1,d>0?m=3*h:m=7*h,y=e.fontMetrics().denom1):(d>0?(f=e.fontMetrics().num2,m=h):(f=e.fontMetrics().num3,m=3*h),y=e.fontMetrics().denom2);var v;if(u){var T=e.fontMetrics().axisHeight;f-o.depth-(T+.5*d)<m&&(f+=m-(f-o.depth-(T+.5*d))),T-.5*d-(c.height-y)<m&&(y+=m-(T-.5*d-(c.height-y)));var D=-(T-.5*d);v=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:D},{type:"elem",elem:o,shift:-f}]},e)}else{var x=f-o.depth-(c.height-y);x<m&&(f+=.5*(m-x),y+=.5*(m-x)),v=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-f}]},e)}s=e.havingStyle(t),v.height*=s.sizeMultiplier/e.sizeMultiplier,v.depth*=s.sizeMultiplier/e.sizeMultiplier;var P;t.size===ae.DISPLAY.size?P=e.fontMetrics().delim1:t.size===ae.SCRIPTSCRIPT.size?P=e.havingStyle(ae.SCRIPT).fontMetrics().delim2:P=e.fontMetrics().delim2;var N,O;return r.leftDelim==null?N=Li(e,["mopen"]):N=gr.customSizedDelim(r.leftDelim,P,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?O=R.makeSpan([]):r.rightDelim==null?O=Li(e,["mclose"]):O=gr.customSizedDelim(r.rightDelim,P,!0,e.havingStyle(t),r.mode,["mclose"]),R.makeSpan(["mord"].concat(s.sizingClasses(e)),[N,R.makeSpan(["mfrac"],[v]),O],e)},e0=(r,e)=>{var t=new _.MathNode("mfrac",[Te(r.numer,e),Te(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=ze(r.barSize,e);t.setAttribute("linethickness",G(n))}var i=Sp(r.size,e.style);if(i.size!==e.style.size){t=new _.MathNode("mstyle",[t]);var s=i.size===ae.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(r.leftDelim!=null||r.rightDelim!=null){var o=[];if(r.leftDelim!=null){var a=new _.MathNode("mo",[new _.TextNode(r.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}if(o.push(t),r.rightDelim!=null){var l=new _.MathNode("mo",[new _.TextNode(r.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}return Ll(o)}return t};Z({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1],o,a=null,l=null,c="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:a,rightDelim:l,size:c,barSize:null}},htmlBuilder:Ql,mathmlBuilder:e0}),Z({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Z({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});var kp=["display","text","script","scriptscript"],Mp=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};Z({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],i=e[5],s=ao(e[0]),o=s.type==="atom"&&s.family==="open"?Mp(s.text):null,a=ao(e[1]),l=a.type==="atom"&&a.family==="close"?Mp(a.text):null,c=fe(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h="auto",f=e[3];if(f.type==="ordgroup"){if(f.body.length>0){var m=fe(f.body[0],"textord");h=kp[Number(m.text)]}}else f=fe(f,"textord"),h=kp[Number(f.text)];return{type:"genfrac",mode:t.mode,numer:n,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l,size:h}},htmlBuilder:Ql,mathmlBuilder:e0}),Z({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:i}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:fe(e[0],"size").value,token:i}}}),Z({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=av(fe(e[1],"infix").size),o=e[2],a=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Ql,mathmlBuilder:e0});var Tp=(r,e)=>{var t=e.style,n,i;r.type==="supsub"?(n=r.sup?be(r.sup,e.havingStyle(t.sup()),e):be(r.sub,e.havingStyle(t.sub()),e),i=fe(r.base,"horizBrace")):i=fe(r,"horizBrace");var s=be(i.base,e.havingBaseStyle(ae.DISPLAY)),o=mr.svgSpan(i,e),a;if(i.isOver?(a=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),a.children[0].children[0].children[1].classes.push("svg-align")):(a=R.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=R.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},e):a=R.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return R.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e)},z8=(r,e)=>{var t=mr.mathMLnode(r.label);return new _.MathNode(r.isOver?"mover":"munder",[Te(r.base,e),t])};Z({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:/^\\over/.test(n),base:e[0]}},htmlBuilder:Tp,mathmlBuilder:z8}),Z({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],i=fe(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:$e(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=_e(r.body,e,!1);return R.makeAnchor(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=Wr(r.body,e);return t instanceof wt||(t=new wt("mrow",[t])),t.setAttribute("href",r.href),t}}),Z({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=fe(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:n,body:$e(a)}}}),Z({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:$e(e[0])}},htmlBuilder(r,e){var t=_e(r.body,e,!1);return R.makeFragment(t)},mathmlBuilder(r,e){return new _.MathNode("mrow",ft(r.body,e))}}),Z({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:i}=r,s=fe(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var d=c[u],h=d.indexOf("=");if(h<0)throw new U("\\htmlData key/value '"+d+"' missing equals sign");var f=d.slice(0,h),m=d.slice(h+1);l["data-"+f.trim()]=m}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:$e(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=_e(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var i=R.makeSpan(n,t,e);for(var s in r.attributes)s!=="class"&&r.attributes.hasOwnProperty(s)&&i.setAttribute(s,r.attributes[s]);return i},mathmlBuilder:(r,e)=>Wr(r.body,e)}),Z({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:$e(e[0]),mathml:$e(e[1])}},htmlBuilder:(r,e)=>{var t=_e(r.html,e,!1);return R.makeFragment(t)},mathmlBuilder:(r,e)=>Wr(r.mathml,e)});var t0=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 U("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Ef(n))throw new U("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Z({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=fe(t[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":a=h;break;case"width":i=t0(h);break;case"height":s=t0(h);break;case"totalheight":o=t0(h);break;default:throw new U("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var f=fe(e[0],"url").url;return a===""&&(a=f,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:f})?{type:"includegraphics",mode:n.mode,alt:a,width:i,height:s,totalheight:o,src:f}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=ze(r.height,e),n=0;r.totalheight.number>0&&(n=ze(r.totalheight,e)-t);var i=0;r.width.number>0&&(i=ze(r.width,e));var s={height:G(t+n)};i>0&&(s.width=G(i)),n>0&&(s.verticalAlign=G(-n));var o=new zv(r.src,r.alt,s);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mglyph",[]);t.setAttribute("alt",r.alt);var n=ze(r.height,e),i=0;if(r.totalheight.number>0&&(i=ze(r.totalheight,e)-n,t.setAttribute("valign",G(-i))),t.setAttribute("height",G(n+i)),r.width.number>0){var s=ze(r.width,e);t.setAttribute("width",G(s))}return t.setAttribute("src",r.src),t}}),Z({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=fe(e[0],"size");if(t.settings.strict){var s=n[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(r,e){return R.makeGlue(r.dimension,e)},mathmlBuilder(r,e){var t=ze(r.dimension,e);return new _.SpaceNode(t)}}),Z({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:i}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=R.makeSpan([],[be(r.body,e)]),t=R.makeSpan(["inner"],[t],e)):t=R.makeSpan(["inner"],[be(r.body,e)]);var n=R.makeSpan(["fix"],[]),i=R.makeSpan([r.alignment],[t,n],e),s=R.makeSpan(["strut"]);return s.style.height=G(i.height+i.depth),i.depth&&(s.style.verticalAlign=G(-i.depth)),i.children.unshift(s),i=R.makeSpan(["thinbox"],[i],e),R.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mpadded",[Te(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}}),Z({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,i=n.mode;n.switchMode("math");var s=t==="\\("?"\\)":"$",o=n.parseExpression(!1,s);return n.expect(s),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:o}}}),Z({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new U("Mismatched "+r.funcName)}});var Cp=(r,e)=>{switch(e.style.size){case ae.DISPLAY.size:return r.display;case ae.TEXT.size:return r.text;case ae.SCRIPT.size:return r.script;case ae.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};Z({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:$e(e[0]),text:$e(e[1]),script:$e(e[2]),scriptscript:$e(e[3])}},htmlBuilder:(r,e)=>{var t=Cp(r,e),n=_e(t,e,!1);return R.makeFragment(n)},mathmlBuilder:(r,e)=>{var t=Cp(r,e);return Wr(t,e)}});var Ep=(r,e,t,n,i,s,o)=>{r=R.makeSpan([],[r]);var a=t&&xe.isCharacterBox(t),l,c;if(e){var u=be(e,n.havingStyle(i.sup()),n);c={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(t){var d=be(t,n.havingStyle(i.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var f=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;h=R.makeVList({positionType:"bottom",positionData:f,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:G(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:G(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(l){var m=r.height-o;h=R.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:G(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r}]},n)}else if(c){var y=r.depth+o;h=R.makeVList({positionType:"bottom",positionData:y,children:[{type:"elem",elem:r},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:G(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return r;var v=[h];if(l&&s!==0&&!a){var x=R.makeSpan(["mspace"],[],n);x.style.marginRight=G(s),v.unshift(x)}return R.makeSpan(["mop","op-limits"],v,n)},Ap=["\\smallint"],Un=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=fe(r.base,"op"),i=!0):s=fe(r,"op");var o=e.style,a=!1;o.size===ae.DISPLAY.size&&s.symbol&&!Ap.includes(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",u="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(u=s.name.slice(1),s.name=u==="oiint"?"\\iint":"\\iiint"),l=R.makeSymbol(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),u.length>0){var d=l.italic,h=R.staticSvg(u+"Size"+(a?"2":"1"),e);l=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:a?.08:0}]},e),s.name="\\"+u,l.classes.unshift("mop"),l.italic=d}}else if(s.body){var f=_e(s.body,e,!0);f.length===1&&f[0]instanceof Ot?(l=f[0],l.classes[0]="mop"):l=R.makeSpan(["mop"],f,e)}else{for(var m=[],y=1;y<s.name.length;y++)m.push(R.mathsym(s.name[y],s.mode,e));l=R.makeSpan(["mop"],m,e)}var v=0,x=0;return(l instanceof Ot||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(v=(l.height-l.depth)/2-e.fontMetrics().axisHeight,x=l.italic),i?Ep(l,t,n,e,o,x,v):(v&&(l.style.position="relative",l.style.top=G(v)),l)},$i=(r,e)=>{var t;if(r.symbol)t=new wt("mo",[Nt(r.name,r.mode)]),Ap.includes(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new wt("mo",ft(r.body,e));else{t=new wt("mi",[new Wt(r.name.slice(1))]);var n=new wt("mo",[Nt("⁡","text")]);r.parentIsSupSub?t=new wt("mrow",[t,n]):t=Uf([t,n])}return t},I8={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Z({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=n;return i.length===1&&(i=I8[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:$e(n)}},htmlBuilder:Un,mathmlBuilder:$i});var R8={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Z({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"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=R8[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Un,mathmlBuilder:$i});var Op=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=fe(r.base,"operatorname"),i=!0):s=fe(r,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(d=>{var h=d.text;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=_e(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof Ot&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=R.makeSpan(["mop"],l,e)}else o=R.makeSpan(["mop"],[],e);return i?Ep(o,t,n,e,e.style,0,0):o},P8=(r,e)=>{for(var t=ft(r.body,e.withFont("mathrm")),n=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof _.SpaceNode))if(s instanceof _.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof _.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(u=>u.toText()).join("");t=[new _.TextNode(a)]}var l=new _.MathNode("mi",t);l.setAttribute("mathvariant","normal");var c=new _.MathNode("mo",[Nt("⁡","text")]);return r.parentIsSupSub?new _.MathNode("mrow",[l,c]):_.newDocumentFragment([l,c])};Z({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"operatorname",mode:t.mode,body:$e(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Op,mathmlBuilder:P8}),S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),bn({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?R.makeFragment(_e(r.body,e,!1)):R.makeSpan(["mord"],_e(r.body,e,!0),e)},mathmlBuilder(r,e){return Wr(r.body,e,!0)}}),Z({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=be(r.body,e.havingCrampedStyle()),n=R.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},e);return R.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(r,e){var t=new _.MathNode("mo",[new _.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new _.MathNode("mover",[Te(r.body,e),t]);return n.setAttribute("accent","true"),n}}),Z({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:$e(n)}},htmlBuilder:(r,e)=>{var t=_e(r.body,e.withPhantom(),!1);return R.makeFragment(t)},mathmlBuilder:(r,e)=>{var t=ft(r.body,e);return new _.MathNode("mphantom",t)}}),Z({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"hphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=R.makeSpan([],[be(r.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var n=0;n<t.children.length;n++)t.children[n].height=0,t.children[n].depth=0;return t=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),R.makeSpan(["mord"],[t],e)},mathmlBuilder:(r,e)=>{var t=ft($e(r.body),e),n=new _.MathNode("mphantom",t),i=new _.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),Z({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=R.makeSpan(["inner"],[be(r.body,e.withPhantom())]),n=R.makeSpan(["fix"],[]);return R.makeSpan(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=ft($e(r.body),e),n=new _.MathNode("mphantom",t),i=new _.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}}),Z({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=fe(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:i}},htmlBuilder(r,e){var t=be(r.body,e),n=ze(r.dy,e);return R.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){var t=new _.MathNode("mpadded",[Te(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}}),Z({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}}),Z({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,i=t[0],s=fe(e[0],"size"),o=fe(e[1],"size");return{type:"rule",mode:n.mode,shift:i&&fe(i,"size").value,width:s.value,height:o.value}},htmlBuilder(r,e){var t=R.makeSpan(["mord","rule"],[],e),n=ze(r.width,e),i=ze(r.height,e),s=r.shift?ze(r.shift,e):0;return t.style.borderRightWidth=G(n),t.style.borderTopWidth=G(i),t.style.bottom=G(s),t.width=n,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=ze(r.width,e),n=ze(r.height,e),i=r.shift?ze(r.shift,e):0,s=e.color&&e.getColor()||"black",o=new _.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",G(t)),o.setAttribute("height",G(n));var a=new _.MathNode("mpadded",[o]);return i>=0?a.setAttribute("height",G(i)):(a.setAttribute("height",G(i)),a.setAttribute("depth",G(-i))),a.setAttribute("voffset",G(i)),a}});function Np(r,e,t){for(var n=_e(r,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<n.length;s++){var o=n[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[s].classes,e.sizingClasses(t)):n[s].classes[o+1]==="reset-size"+e.size&&(n[s].classes[o+1]="reset-size"+t.size),n[s].height*=i,n[s].depth*=i}return R.makeFragment(n)}var Dp=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],L8=(r,e)=>{var t=e.havingSize(r.size);return Np(r.body,t,e)};Z({type:"sizing",names:Dp,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:Dp.indexOf(n)+1,body:s}},htmlBuilder:L8,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=ft(r.body,t),i=new _.MathNode("mstyle",n);return i.setAttribute("mathsize",G(t.sizeMultiplier)),i}}),Z({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,i=!1,s=!1,o=t[0]&&fe(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var c=o.body[l];if(a=c.text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:n.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(r,e)=>{var t=R.makeSpan([],[be(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0,t.children))for(var n=0;n<t.children.length;n++)t.children[n].height=0;if(r.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return R.makeSpan(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mpadded",[Te(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}}),Z({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,i=t[0],s=e[0];return{type:"sqrt",mode:n.mode,body:s,index:i}},htmlBuilder(r,e){var t=be(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=R.wrapFragment(t,e);var n=e.fontMetrics(),i=n.defaultRuleThickness,s=i;e.style.id<ae.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=t.height+t.depth+o+i,{span:l,ruleWidth:c,advanceWidth:u}=gr.sqrtImage(a,e),d=l.height-c;d>t.height+t.depth+o&&(o=(o+d-t.height-t.depth)/2);var h=l.height-t.height-o-c;t.style.paddingLeft=G(u);var f=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+h)},{type:"elem",elem:l},{type:"kern",size:c}]},e);if(r.index){var m=e.havingStyle(ae.SCRIPTSCRIPT),y=be(r.index,m,e),v=.6*(f.height-f.depth),x=R.makeVList({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]},e),T=R.makeSpan(["root"],[x]);return R.makeSpan(["mord","sqrt"],[T,f],e)}else return R.makeSpan(["mord","sqrt"],[f],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new _.MathNode("mroot",[Te(t,e),Te(n,e)]):new _.MathNode("msqrt",[Te(t,e)])}});var zp={display:ae.DISPLAY,text:ae.TEXT,script:ae.SCRIPT,scriptscript:ae.SCRIPTSCRIPT};Z({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(r,e){var t=zp[r.style],n=e.havingStyle(t).withFont("");return Np(r.body,n,e)},mathmlBuilder(r,e){var t=zp[r.style],n=e.havingStyle(t),i=ft(r.body,n),s=new _.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var B8=function(e,t){var n=e.base;if(n)if(n.type==="op"){var i=n.limits&&(t.style.size===ae.DISPLAY.size||n.alwaysHandleSupSub);return i?Un:null}else if(n.type==="operatorname"){var s=n.alwaysHandleSupSub&&(t.style.size===ae.DISPLAY.size||n.limits);return s?Op:null}else{if(n.type==="accent")return xe.isCharacterBox(n.base)?Hl:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?Tp:null}else return null}else return null};bn({type:"supsub",htmlBuilder(r,e){var t=B8(r,e);if(t)return t(r,e);var{base:n,sup:i,sub:s}=r,o=be(n,e),a,l,c=e.fontMetrics(),u=0,d=0,h=n&&xe.isCharacterBox(n);if(i){var f=e.havingStyle(e.style.sup());a=be(i,f,e),h||(u=o.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(s){var m=e.havingStyle(e.style.sub());l=be(s,m,e),h||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/e.sizeMultiplier)}var y;e.style===ae.DISPLAY?y=c.sup1:e.style.cramped?y=c.sup3:y=c.sup2;var v=e.sizeMultiplier,x=G(.5/c.ptPerEm/v),T=null;if(l){var D=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof Ot||D)&&(T=G(-o.italic))}var P;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var N=c.defaultRuleThickness,O=4*N;if(u-a.depth-(l.height-d)<O){d=O-(u-a.depth)+l.height;var A=.8*c.xHeight-(u-a.depth);A>0&&(u+=A,d-=A)}var $=[{type:"elem",elem:l,shift:d,marginRight:x,marginLeft:T},{type:"elem",elem:a,shift:-u,marginRight:x}];P=R.makeVList({positionType:"individualShift",children:$},e)}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var F=[{type:"elem",elem:l,marginLeft:T,marginRight:x}];P=R.makeVList({positionType:"shift",positionData:d,children:F},e)}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),P=R.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:x}]},e);else throw new Error("supsub must have either sup or sub.");var q=Rl(o,"right")||"mord";return R.makeSpan([q],[o,R.makeSpan(["msupsub"],[P])],e)},mathmlBuilder(r,e){var t=!1,n,i;r.base&&r.base.type==="horizBrace"&&(i=!!r.sup,i===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var s=[Te(r.base,e)];r.sub&&s.push(Te(r.sub,e)),r.sup&&s.push(Te(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var c=r.base;c&&c.type==="op"&&c.limits&&e.style===ae.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===ae.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===ae.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===ae.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===ae.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===ae.DISPLAY)?o="mover":o="msup"}return new _.MathNode(o,s)}}),bn({type:"atom",htmlBuilder(r,e){return R.mathsym(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new _.MathNode("mo",[Nt(r.text,r.mode)]);if(r.family==="bin"){var n=Bl(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var Ip={mi:"italic",mn:"normal",mtext:"normal"};bn({type:"mathord",htmlBuilder(r,e){return R.makeOrd(r,e,"mathord")},mathmlBuilder(r,e){var t=new _.MathNode("mi",[Nt(r.text,r.mode,e)]),n=Bl(r,e)||"italic";return n!==Ip[t.type]&&t.setAttribute("mathvariant",n),t}}),bn({type:"textord",htmlBuilder(r,e){return R.makeOrd(r,e,"textord")},mathmlBuilder(r,e){var t=Nt(r.text,r.mode,e),n=Bl(r,e)||"normal",i;return r.mode==="text"?i=new _.MathNode("mtext",[t]):/[0-9]/.test(r.text)?i=new _.MathNode("mn",[t]):r.text==="\\prime"?i=new _.MathNode("mo",[t]):i=new _.MathNode("mi",[t]),n!==Ip[i.type]&&i.setAttribute("mathvariant",n),i}});var r0={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},n0={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};bn({type:"spacing",htmlBuilder(r,e){if(n0.hasOwnProperty(r.text)){var t=n0[r.text].className||"";if(r.mode==="text"){var n=R.makeOrd(r,e,"textord");return n.classes.push(t),n}else return R.makeSpan(["mspace",t],[R.mathsym(r.text,r.mode,e)],e)}else{if(r0.hasOwnProperty(r.text))return R.makeSpan(["mspace",r0[r.text]],[],e);throw new U('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(n0.hasOwnProperty(r.text))t=new _.MathNode("mtext",[new _.TextNode(" ")]);else{if(r0.hasOwnProperty(r.text))return new _.MathNode("mspace");throw new U('Unknown type of space "'+r.text+'"')}return t}});var Rp=()=>{var r=new _.MathNode("mtd",[]);return r.setAttribute("width","50%"),r};bn({type:"tag",mathmlBuilder(r,e){var t=new _.MathNode("mtable",[new _.MathNode("mtr",[Rp(),new _.MathNode("mtd",[Wr(r.body,e)]),Rp(),new _.MathNode("mtd",[Wr(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var Pp={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Lp={"\\textbf":"textbf","\\textmd":"textmd"},F8={"\\textit":"textit","\\textup":"textup"},Bp=(r,e)=>{var t=r.font;if(t){if(Pp[t])return e.withTextFontFamily(Pp[t]);if(Lp[t])return e.withTextFontWeight(Lp[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(F8[t])};Z({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"text",mode:t.mode,body:$e(i),font:n}},htmlBuilder(r,e){var t=Bp(r,e),n=_e(r.body,t,!0);return R.makeSpan(["mord","text"],n,t)},mathmlBuilder(r,e){var t=Bp(r,e);return Wr(r.body,t)}}),Z({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=be(r.body,e),n=R.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=R.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return R.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(r,e){var t=new _.MathNode("mo",[new _.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new _.MathNode("munder",[Te(r.body,e),t]);return n.setAttribute("accentunder","true"),n}}),Z({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=be(r.body,e),n=e.fontMetrics().axisHeight,i=.5*(t.height-n-(t.depth+n));return R.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){return new _.MathNode("mpadded",[Te(r.body,e)],["vcenter"])}}),Z({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new U("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=Fp(r),n=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),n.push(R.makeSymbol(o,"Typewriter-Regular",r.mode,i,["mord","texttt"]))}return R.makeSpan(["mord","text"].concat(i.sizingClasses(e)),R.tryCombineChars(n),i)},mathmlBuilder(r,e){var t=new _.TextNode(Fp(r)),n=new _.MathNode("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});var Fp=r=>r.body.replace(/ /g,r.star?"␣":" "),Kr=qf,$p=`[ \r
382
- ]`,$8="\\\\[a-zA-Z@]+",H8="\\\\[^\uD800-\uDFFF]",V8="("+$8+")"+$p+"*",q8=`\\\\(
380
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Ri{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Ut={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ys={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Tf={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Ev(r,e){Ut[r]=e}function kl(r,e,t){if(!Ut[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),i=Ut[e][n];if(!i&&r[0]in Tf&&(n=Tf[r[0]].charCodeAt(0),i=Ut[e][n]),!i&&t==="text"&&kf(n)&&(i=Ut[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ml={};function Av(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Ml[e]){var t=Ml[e]={cssEmPerMu:Ys.quad[e]/18};for(var n in Ys)Ys.hasOwnProperty(n)&&(t[n]=Ys[n][e])}return Ml[e]}var Ov=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Cf=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Ef=function(e,t){return t.size<2?e:Ov[e-1][t.size-1]};class ur{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||ur.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Cf[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new ur(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Ef(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Cf[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=Ef(ur.BASESIZE,e);return this.size===t&&this.textSize===ur.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==ur.BASESIZE?["sizing","reset-size"+this.size,"size"+ur.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Av(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}ur.BASESIZE=6;var Tl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Nv={ex:!0,em:!0,mu:!0},Af=function(e){return typeof e!="string"&&(e=e.unit),e in Tl||e in Nv||e==="ex"},ze=function(e,t){var n;if(e.unit in Tl)n=Tl[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")n=i.fontMetrics().xHeight;else if(e.unit==="em")n=i.fontMetrics().quad;else throw new U("Invalid unit: '"+e.unit+"'");i!==t&&(n*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},G=function(e){return+e.toFixed(4)+"em"},_r=function(e){return e.filter(t=>t).join(" ")},Of=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},Nf=function(e){var t=document.createElement(e);t.className=_r(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},Dv=/[\s"'>/=\x00-\x1f]/,Df=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+xe.escape(_r(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=xe.hyphenate(i)+":"+this.style[i]+";");n&&(t+=' style="'+xe.escape(n)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Dv.test(s))throw new U("Invalid attribute name '"+s+"'");t+=" "+s+'="'+xe.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class Pi{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Of.call(this,e,n,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Nf.call(this,"span")}toMarkup(){return Df.call(this,"span")}}class Cl{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Of.call(this,t,i),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Nf.call(this,"a")}toMarkup(){return Df.call(this,"a")}}class zv{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+xe.escape(this.src)+'"'+(' alt="'+xe.escape(this.alt)+'"'),t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=xe.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+xe.escape(t)+'"'),e+="'/>",e}}var Iv={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Ot{constructor(e,t,n,i,s,o,a,l){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=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=gv(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Iv[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=G(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=_r(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(t=t||document.createElement("span"),t.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+=xe.escape(_r(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=xe.hyphenate(i)+":"+this.style[i]+";");n&&(e=!0,t+=' style="'+xe.escape(n)+'"');var s=xe.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class dr{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}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+'="'+xe.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class jr{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",Mf[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+xe.escape(this.alternate)+'"/>':'<path d="'+xe.escape(Mf[this.pathName])+'"/>'}}class El{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+xe.escape(this.attributes[t])+'"');return e+="/>",e}}function zf(r){if(r instanceof Ot)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function Rv(r){if(r instanceof Pi)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}var Pv={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Lv={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ee={math:{},text:{}};function p(r,e,t,n,i,s){Ee[r][i]={font:e,group:t,replace:n},s&&n&&(Ee[r][n]=Ee[r][i])}var g="math",V="text",b="main",k="ams",Oe="accent-token",ee="bin",ot="close",jn="inner",le="mathord",qe="op-token",xt="open",Zs="punct",M="rel",hr="spacing",A="textord";p(g,b,M,"≡","\\equiv",!0),p(g,b,M,"≺","\\prec",!0),p(g,b,M,"≻","\\succ",!0),p(g,b,M,"∼","\\sim",!0),p(g,b,M,"⊥","\\perp"),p(g,b,M,"⪯","\\preceq",!0),p(g,b,M,"⪰","\\succeq",!0),p(g,b,M,"≃","\\simeq",!0),p(g,b,M,"∣","\\mid",!0),p(g,b,M,"≪","\\ll",!0),p(g,b,M,"≫","\\gg",!0),p(g,b,M,"≍","\\asymp",!0),p(g,b,M,"∥","\\parallel"),p(g,b,M,"⋈","\\bowtie",!0),p(g,b,M,"⌣","\\smile",!0),p(g,b,M,"⊑","\\sqsubseteq",!0),p(g,b,M,"⊒","\\sqsupseteq",!0),p(g,b,M,"≐","\\doteq",!0),p(g,b,M,"⌢","\\frown",!0),p(g,b,M,"∋","\\ni",!0),p(g,b,M,"∝","\\propto",!0),p(g,b,M,"⊢","\\vdash",!0),p(g,b,M,"⊣","\\dashv",!0),p(g,b,M,"∋","\\owns"),p(g,b,Zs,".","\\ldotp"),p(g,b,Zs,"⋅","\\cdotp"),p(g,b,A,"#","\\#"),p(V,b,A,"#","\\#"),p(g,b,A,"&","\\&"),p(V,b,A,"&","\\&"),p(g,b,A,"ℵ","\\aleph",!0),p(g,b,A,"∀","\\forall",!0),p(g,b,A,"ℏ","\\hbar",!0),p(g,b,A,"∃","\\exists",!0),p(g,b,A,"∇","\\nabla",!0),p(g,b,A,"♭","\\flat",!0),p(g,b,A,"ℓ","\\ell",!0),p(g,b,A,"♮","\\natural",!0),p(g,b,A,"♣","\\clubsuit",!0),p(g,b,A,"℘","\\wp",!0),p(g,b,A,"♯","\\sharp",!0),p(g,b,A,"♢","\\diamondsuit",!0),p(g,b,A,"ℜ","\\Re",!0),p(g,b,A,"♡","\\heartsuit",!0),p(g,b,A,"ℑ","\\Im",!0),p(g,b,A,"♠","\\spadesuit",!0),p(g,b,A,"§","\\S",!0),p(V,b,A,"§","\\S"),p(g,b,A,"¶","\\P",!0),p(V,b,A,"¶","\\P"),p(g,b,A,"†","\\dag"),p(V,b,A,"†","\\dag"),p(V,b,A,"†","\\textdagger"),p(g,b,A,"‡","\\ddag"),p(V,b,A,"‡","\\ddag"),p(V,b,A,"‡","\\textdaggerdbl"),p(g,b,ot,"⎱","\\rmoustache",!0),p(g,b,xt,"⎰","\\lmoustache",!0),p(g,b,ot,"⟯","\\rgroup",!0),p(g,b,xt,"⟮","\\lgroup",!0),p(g,b,ee,"∓","\\mp",!0),p(g,b,ee,"⊖","\\ominus",!0),p(g,b,ee,"⊎","\\uplus",!0),p(g,b,ee,"⊓","\\sqcap",!0),p(g,b,ee,"∗","\\ast"),p(g,b,ee,"⊔","\\sqcup",!0),p(g,b,ee,"◯","\\bigcirc",!0),p(g,b,ee,"∙","\\bullet",!0),p(g,b,ee,"‡","\\ddagger"),p(g,b,ee,"≀","\\wr",!0),p(g,b,ee,"⨿","\\amalg"),p(g,b,ee,"&","\\And"),p(g,b,M,"⟵","\\longleftarrow",!0),p(g,b,M,"⇐","\\Leftarrow",!0),p(g,b,M,"⟸","\\Longleftarrow",!0),p(g,b,M,"⟶","\\longrightarrow",!0),p(g,b,M,"⇒","\\Rightarrow",!0),p(g,b,M,"⟹","\\Longrightarrow",!0),p(g,b,M,"↔","\\leftrightarrow",!0),p(g,b,M,"⟷","\\longleftrightarrow",!0),p(g,b,M,"⇔","\\Leftrightarrow",!0),p(g,b,M,"⟺","\\Longleftrightarrow",!0),p(g,b,M,"↦","\\mapsto",!0),p(g,b,M,"⟼","\\longmapsto",!0),p(g,b,M,"↗","\\nearrow",!0),p(g,b,M,"↩","\\hookleftarrow",!0),p(g,b,M,"↪","\\hookrightarrow",!0),p(g,b,M,"↘","\\searrow",!0),p(g,b,M,"↼","\\leftharpoonup",!0),p(g,b,M,"⇀","\\rightharpoonup",!0),p(g,b,M,"↙","\\swarrow",!0),p(g,b,M,"↽","\\leftharpoondown",!0),p(g,b,M,"⇁","\\rightharpoondown",!0),p(g,b,M,"↖","\\nwarrow",!0),p(g,b,M,"⇌","\\rightleftharpoons",!0),p(g,k,M,"≮","\\nless",!0),p(g,k,M,"","\\@nleqslant"),p(g,k,M,"","\\@nleqq"),p(g,k,M,"⪇","\\lneq",!0),p(g,k,M,"≨","\\lneqq",!0),p(g,k,M,"","\\@lvertneqq"),p(g,k,M,"⋦","\\lnsim",!0),p(g,k,M,"⪉","\\lnapprox",!0),p(g,k,M,"⊀","\\nprec",!0),p(g,k,M,"⋠","\\npreceq",!0),p(g,k,M,"⋨","\\precnsim",!0),p(g,k,M,"⪹","\\precnapprox",!0),p(g,k,M,"≁","\\nsim",!0),p(g,k,M,"","\\@nshortmid"),p(g,k,M,"∤","\\nmid",!0),p(g,k,M,"⊬","\\nvdash",!0),p(g,k,M,"⊭","\\nvDash",!0),p(g,k,M,"⋪","\\ntriangleleft"),p(g,k,M,"⋬","\\ntrianglelefteq",!0),p(g,k,M,"⊊","\\subsetneq",!0),p(g,k,M,"","\\@varsubsetneq"),p(g,k,M,"⫋","\\subsetneqq",!0),p(g,k,M,"","\\@varsubsetneqq"),p(g,k,M,"≯","\\ngtr",!0),p(g,k,M,"","\\@ngeqslant"),p(g,k,M,"","\\@ngeqq"),p(g,k,M,"⪈","\\gneq",!0),p(g,k,M,"≩","\\gneqq",!0),p(g,k,M,"","\\@gvertneqq"),p(g,k,M,"⋧","\\gnsim",!0),p(g,k,M,"⪊","\\gnapprox",!0),p(g,k,M,"⊁","\\nsucc",!0),p(g,k,M,"⋡","\\nsucceq",!0),p(g,k,M,"⋩","\\succnsim",!0),p(g,k,M,"⪺","\\succnapprox",!0),p(g,k,M,"≆","\\ncong",!0),p(g,k,M,"","\\@nshortparallel"),p(g,k,M,"∦","\\nparallel",!0),p(g,k,M,"⊯","\\nVDash",!0),p(g,k,M,"⋫","\\ntriangleright"),p(g,k,M,"⋭","\\ntrianglerighteq",!0),p(g,k,M,"","\\@nsupseteqq"),p(g,k,M,"⊋","\\supsetneq",!0),p(g,k,M,"","\\@varsupsetneq"),p(g,k,M,"⫌","\\supsetneqq",!0),p(g,k,M,"","\\@varsupsetneqq"),p(g,k,M,"⊮","\\nVdash",!0),p(g,k,M,"⪵","\\precneqq",!0),p(g,k,M,"⪶","\\succneqq",!0),p(g,k,M,"","\\@nsubseteqq"),p(g,k,ee,"⊴","\\unlhd"),p(g,k,ee,"⊵","\\unrhd"),p(g,k,M,"↚","\\nleftarrow",!0),p(g,k,M,"↛","\\nrightarrow",!0),p(g,k,M,"⇍","\\nLeftarrow",!0),p(g,k,M,"⇏","\\nRightarrow",!0),p(g,k,M,"↮","\\nleftrightarrow",!0),p(g,k,M,"⇎","\\nLeftrightarrow",!0),p(g,k,M,"△","\\vartriangle"),p(g,k,A,"ℏ","\\hslash"),p(g,k,A,"▽","\\triangledown"),p(g,k,A,"◊","\\lozenge"),p(g,k,A,"Ⓢ","\\circledS"),p(g,k,A,"®","\\circledR"),p(V,k,A,"®","\\circledR"),p(g,k,A,"∡","\\measuredangle",!0),p(g,k,A,"∄","\\nexists"),p(g,k,A,"℧","\\mho"),p(g,k,A,"Ⅎ","\\Finv",!0),p(g,k,A,"⅁","\\Game",!0),p(g,k,A,"‵","\\backprime"),p(g,k,A,"▲","\\blacktriangle"),p(g,k,A,"▼","\\blacktriangledown"),p(g,k,A,"■","\\blacksquare"),p(g,k,A,"⧫","\\blacklozenge"),p(g,k,A,"★","\\bigstar"),p(g,k,A,"∢","\\sphericalangle",!0),p(g,k,A,"∁","\\complement",!0),p(g,k,A,"ð","\\eth",!0),p(V,b,A,"ð","ð"),p(g,k,A,"╱","\\diagup"),p(g,k,A,"╲","\\diagdown"),p(g,k,A,"□","\\square"),p(g,k,A,"□","\\Box"),p(g,k,A,"◊","\\Diamond"),p(g,k,A,"¥","\\yen",!0),p(V,k,A,"¥","\\yen",!0),p(g,k,A,"✓","\\checkmark",!0),p(V,k,A,"✓","\\checkmark"),p(g,k,A,"ℶ","\\beth",!0),p(g,k,A,"ℸ","\\daleth",!0),p(g,k,A,"ℷ","\\gimel",!0),p(g,k,A,"ϝ","\\digamma",!0),p(g,k,A,"ϰ","\\varkappa"),p(g,k,xt,"┌","\\@ulcorner",!0),p(g,k,ot,"┐","\\@urcorner",!0),p(g,k,xt,"└","\\@llcorner",!0),p(g,k,ot,"┘","\\@lrcorner",!0),p(g,k,M,"≦","\\leqq",!0),p(g,k,M,"⩽","\\leqslant",!0),p(g,k,M,"⪕","\\eqslantless",!0),p(g,k,M,"≲","\\lesssim",!0),p(g,k,M,"⪅","\\lessapprox",!0),p(g,k,M,"≊","\\approxeq",!0),p(g,k,ee,"⋖","\\lessdot"),p(g,k,M,"⋘","\\lll",!0),p(g,k,M,"≶","\\lessgtr",!0),p(g,k,M,"⋚","\\lesseqgtr",!0),p(g,k,M,"⪋","\\lesseqqgtr",!0),p(g,k,M,"≑","\\doteqdot"),p(g,k,M,"≓","\\risingdotseq",!0),p(g,k,M,"≒","\\fallingdotseq",!0),p(g,k,M,"∽","\\backsim",!0),p(g,k,M,"⋍","\\backsimeq",!0),p(g,k,M,"⫅","\\subseteqq",!0),p(g,k,M,"⋐","\\Subset",!0),p(g,k,M,"⊏","\\sqsubset",!0),p(g,k,M,"≼","\\preccurlyeq",!0),p(g,k,M,"⋞","\\curlyeqprec",!0),p(g,k,M,"≾","\\precsim",!0),p(g,k,M,"⪷","\\precapprox",!0),p(g,k,M,"⊲","\\vartriangleleft"),p(g,k,M,"⊴","\\trianglelefteq"),p(g,k,M,"⊨","\\vDash",!0),p(g,k,M,"⊪","\\Vvdash",!0),p(g,k,M,"⌣","\\smallsmile"),p(g,k,M,"⌢","\\smallfrown"),p(g,k,M,"≏","\\bumpeq",!0),p(g,k,M,"≎","\\Bumpeq",!0),p(g,k,M,"≧","\\geqq",!0),p(g,k,M,"⩾","\\geqslant",!0),p(g,k,M,"⪖","\\eqslantgtr",!0),p(g,k,M,"≳","\\gtrsim",!0),p(g,k,M,"⪆","\\gtrapprox",!0),p(g,k,ee,"⋗","\\gtrdot"),p(g,k,M,"⋙","\\ggg",!0),p(g,k,M,"≷","\\gtrless",!0),p(g,k,M,"⋛","\\gtreqless",!0),p(g,k,M,"⪌","\\gtreqqless",!0),p(g,k,M,"≖","\\eqcirc",!0),p(g,k,M,"≗","\\circeq",!0),p(g,k,M,"≜","\\triangleq",!0),p(g,k,M,"∼","\\thicksim"),p(g,k,M,"≈","\\thickapprox"),p(g,k,M,"⫆","\\supseteqq",!0),p(g,k,M,"⋑","\\Supset",!0),p(g,k,M,"⊐","\\sqsupset",!0),p(g,k,M,"≽","\\succcurlyeq",!0),p(g,k,M,"⋟","\\curlyeqsucc",!0),p(g,k,M,"≿","\\succsim",!0),p(g,k,M,"⪸","\\succapprox",!0),p(g,k,M,"⊳","\\vartriangleright"),p(g,k,M,"⊵","\\trianglerighteq"),p(g,k,M,"⊩","\\Vdash",!0),p(g,k,M,"∣","\\shortmid"),p(g,k,M,"∥","\\shortparallel"),p(g,k,M,"≬","\\between",!0),p(g,k,M,"⋔","\\pitchfork",!0),p(g,k,M,"∝","\\varpropto"),p(g,k,M,"◀","\\blacktriangleleft"),p(g,k,M,"∴","\\therefore",!0),p(g,k,M,"∍","\\backepsilon"),p(g,k,M,"▶","\\blacktriangleright"),p(g,k,M,"∵","\\because",!0),p(g,k,M,"⋘","\\llless"),p(g,k,M,"⋙","\\gggtr"),p(g,k,ee,"⊲","\\lhd"),p(g,k,ee,"⊳","\\rhd"),p(g,k,M,"≂","\\eqsim",!0),p(g,b,M,"⋈","\\Join"),p(g,k,M,"≑","\\Doteq",!0),p(g,k,ee,"∔","\\dotplus",!0),p(g,k,ee,"∖","\\smallsetminus"),p(g,k,ee,"⋒","\\Cap",!0),p(g,k,ee,"⋓","\\Cup",!0),p(g,k,ee,"⩞","\\doublebarwedge",!0),p(g,k,ee,"⊟","\\boxminus",!0),p(g,k,ee,"⊞","\\boxplus",!0),p(g,k,ee,"⋇","\\divideontimes",!0),p(g,k,ee,"⋉","\\ltimes",!0),p(g,k,ee,"⋊","\\rtimes",!0),p(g,k,ee,"⋋","\\leftthreetimes",!0),p(g,k,ee,"⋌","\\rightthreetimes",!0),p(g,k,ee,"⋏","\\curlywedge",!0),p(g,k,ee,"⋎","\\curlyvee",!0),p(g,k,ee,"⊝","\\circleddash",!0),p(g,k,ee,"⊛","\\circledast",!0),p(g,k,ee,"⋅","\\centerdot"),p(g,k,ee,"⊺","\\intercal",!0),p(g,k,ee,"⋒","\\doublecap"),p(g,k,ee,"⋓","\\doublecup"),p(g,k,ee,"⊠","\\boxtimes",!0),p(g,k,M,"⇢","\\dashrightarrow",!0),p(g,k,M,"⇠","\\dashleftarrow",!0),p(g,k,M,"⇇","\\leftleftarrows",!0),p(g,k,M,"⇆","\\leftrightarrows",!0),p(g,k,M,"⇚","\\Lleftarrow",!0),p(g,k,M,"↞","\\twoheadleftarrow",!0),p(g,k,M,"↢","\\leftarrowtail",!0),p(g,k,M,"↫","\\looparrowleft",!0),p(g,k,M,"⇋","\\leftrightharpoons",!0),p(g,k,M,"↶","\\curvearrowleft",!0),p(g,k,M,"↺","\\circlearrowleft",!0),p(g,k,M,"↰","\\Lsh",!0),p(g,k,M,"⇈","\\upuparrows",!0),p(g,k,M,"↿","\\upharpoonleft",!0),p(g,k,M,"⇃","\\downharpoonleft",!0),p(g,b,M,"⊶","\\origof",!0),p(g,b,M,"⊷","\\imageof",!0),p(g,k,M,"⊸","\\multimap",!0),p(g,k,M,"↭","\\leftrightsquigarrow",!0),p(g,k,M,"⇉","\\rightrightarrows",!0),p(g,k,M,"⇄","\\rightleftarrows",!0),p(g,k,M,"↠","\\twoheadrightarrow",!0),p(g,k,M,"↣","\\rightarrowtail",!0),p(g,k,M,"↬","\\looparrowright",!0),p(g,k,M,"↷","\\curvearrowright",!0),p(g,k,M,"↻","\\circlearrowright",!0),p(g,k,M,"↱","\\Rsh",!0),p(g,k,M,"⇊","\\downdownarrows",!0),p(g,k,M,"↾","\\upharpoonright",!0),p(g,k,M,"⇂","\\downharpoonright",!0),p(g,k,M,"⇝","\\rightsquigarrow",!0),p(g,k,M,"⇝","\\leadsto"),p(g,k,M,"⇛","\\Rrightarrow",!0),p(g,k,M,"↾","\\restriction"),p(g,b,A,"‘","`"),p(g,b,A,"$","\\$"),p(V,b,A,"$","\\$"),p(V,b,A,"$","\\textdollar"),p(g,b,A,"%","\\%"),p(V,b,A,"%","\\%"),p(g,b,A,"_","\\_"),p(V,b,A,"_","\\_"),p(V,b,A,"_","\\textunderscore"),p(g,b,A,"∠","\\angle",!0),p(g,b,A,"∞","\\infty",!0),p(g,b,A,"′","\\prime"),p(g,b,A,"△","\\triangle"),p(g,b,A,"Γ","\\Gamma",!0),p(g,b,A,"Δ","\\Delta",!0),p(g,b,A,"Θ","\\Theta",!0),p(g,b,A,"Λ","\\Lambda",!0),p(g,b,A,"Ξ","\\Xi",!0),p(g,b,A,"Π","\\Pi",!0),p(g,b,A,"Σ","\\Sigma",!0),p(g,b,A,"Υ","\\Upsilon",!0),p(g,b,A,"Φ","\\Phi",!0),p(g,b,A,"Ψ","\\Psi",!0),p(g,b,A,"Ω","\\Omega",!0),p(g,b,A,"A","Α"),p(g,b,A,"B","Β"),p(g,b,A,"E","Ε"),p(g,b,A,"Z","Ζ"),p(g,b,A,"H","Η"),p(g,b,A,"I","Ι"),p(g,b,A,"K","Κ"),p(g,b,A,"M","Μ"),p(g,b,A,"N","Ν"),p(g,b,A,"O","Ο"),p(g,b,A,"P","Ρ"),p(g,b,A,"T","Τ"),p(g,b,A,"X","Χ"),p(g,b,A,"¬","\\neg",!0),p(g,b,A,"¬","\\lnot"),p(g,b,A,"⊤","\\top"),p(g,b,A,"⊥","\\bot"),p(g,b,A,"∅","\\emptyset"),p(g,k,A,"∅","\\varnothing"),p(g,b,le,"α","\\alpha",!0),p(g,b,le,"β","\\beta",!0),p(g,b,le,"γ","\\gamma",!0),p(g,b,le,"δ","\\delta",!0),p(g,b,le,"ϵ","\\epsilon",!0),p(g,b,le,"ζ","\\zeta",!0),p(g,b,le,"η","\\eta",!0),p(g,b,le,"θ","\\theta",!0),p(g,b,le,"ι","\\iota",!0),p(g,b,le,"κ","\\kappa",!0),p(g,b,le,"λ","\\lambda",!0),p(g,b,le,"μ","\\mu",!0),p(g,b,le,"ν","\\nu",!0),p(g,b,le,"ξ","\\xi",!0),p(g,b,le,"ο","\\omicron",!0),p(g,b,le,"π","\\pi",!0),p(g,b,le,"ρ","\\rho",!0),p(g,b,le,"σ","\\sigma",!0),p(g,b,le,"τ","\\tau",!0),p(g,b,le,"υ","\\upsilon",!0),p(g,b,le,"ϕ","\\phi",!0),p(g,b,le,"χ","\\chi",!0),p(g,b,le,"ψ","\\psi",!0),p(g,b,le,"ω","\\omega",!0),p(g,b,le,"ε","\\varepsilon",!0),p(g,b,le,"ϑ","\\vartheta",!0),p(g,b,le,"ϖ","\\varpi",!0),p(g,b,le,"ϱ","\\varrho",!0),p(g,b,le,"ς","\\varsigma",!0),p(g,b,le,"φ","\\varphi",!0),p(g,b,ee,"∗","*",!0),p(g,b,ee,"+","+"),p(g,b,ee,"−","-",!0),p(g,b,ee,"⋅","\\cdot",!0),p(g,b,ee,"∘","\\circ",!0),p(g,b,ee,"÷","\\div",!0),p(g,b,ee,"±","\\pm",!0),p(g,b,ee,"×","\\times",!0),p(g,b,ee,"∩","\\cap",!0),p(g,b,ee,"∪","\\cup",!0),p(g,b,ee,"∖","\\setminus",!0),p(g,b,ee,"∧","\\land"),p(g,b,ee,"∨","\\lor"),p(g,b,ee,"∧","\\wedge",!0),p(g,b,ee,"∨","\\vee",!0),p(g,b,A,"√","\\surd"),p(g,b,xt,"⟨","\\langle",!0),p(g,b,xt,"∣","\\lvert"),p(g,b,xt,"∥","\\lVert"),p(g,b,ot,"?","?"),p(g,b,ot,"!","!"),p(g,b,ot,"⟩","\\rangle",!0),p(g,b,ot,"∣","\\rvert"),p(g,b,ot,"∥","\\rVert"),p(g,b,M,"=","="),p(g,b,M,":",":"),p(g,b,M,"≈","\\approx",!0),p(g,b,M,"≅","\\cong",!0),p(g,b,M,"≥","\\ge"),p(g,b,M,"≥","\\geq",!0),p(g,b,M,"←","\\gets"),p(g,b,M,">","\\gt",!0),p(g,b,M,"∈","\\in",!0),p(g,b,M,"","\\@not"),p(g,b,M,"⊂","\\subset",!0),p(g,b,M,"⊃","\\supset",!0),p(g,b,M,"⊆","\\subseteq",!0),p(g,b,M,"⊇","\\supseteq",!0),p(g,k,M,"⊈","\\nsubseteq",!0),p(g,k,M,"⊉","\\nsupseteq",!0),p(g,b,M,"⊨","\\models"),p(g,b,M,"←","\\leftarrow",!0),p(g,b,M,"≤","\\le"),p(g,b,M,"≤","\\leq",!0),p(g,b,M,"<","\\lt",!0),p(g,b,M,"→","\\rightarrow",!0),p(g,b,M,"→","\\to"),p(g,k,M,"≱","\\ngeq",!0),p(g,k,M,"≰","\\nleq",!0),p(g,b,hr," ","\\ "),p(g,b,hr," ","\\space"),p(g,b,hr," ","\\nobreakspace"),p(V,b,hr," ","\\ "),p(V,b,hr," "," "),p(V,b,hr," ","\\space"),p(V,b,hr," ","\\nobreakspace"),p(g,b,hr,null,"\\nobreak"),p(g,b,hr,null,"\\allowbreak"),p(g,b,Zs,",",","),p(g,b,Zs,";",";"),p(g,k,ee,"⊼","\\barwedge",!0),p(g,k,ee,"⊻","\\veebar",!0),p(g,b,ee,"⊙","\\odot",!0),p(g,b,ee,"⊕","\\oplus",!0),p(g,b,ee,"⊗","\\otimes",!0),p(g,b,A,"∂","\\partial",!0),p(g,b,ee,"⊘","\\oslash",!0),p(g,k,ee,"⊚","\\circledcirc",!0),p(g,k,ee,"⊡","\\boxdot",!0),p(g,b,ee,"△","\\bigtriangleup"),p(g,b,ee,"▽","\\bigtriangledown"),p(g,b,ee,"†","\\dagger"),p(g,b,ee,"⋄","\\diamond"),p(g,b,ee,"⋆","\\star"),p(g,b,ee,"◃","\\triangleleft"),p(g,b,ee,"▹","\\triangleright"),p(g,b,xt,"{","\\{"),p(V,b,A,"{","\\{"),p(V,b,A,"{","\\textbraceleft"),p(g,b,ot,"}","\\}"),p(V,b,A,"}","\\}"),p(V,b,A,"}","\\textbraceright"),p(g,b,xt,"{","\\lbrace"),p(g,b,ot,"}","\\rbrace"),p(g,b,xt,"[","\\lbrack",!0),p(V,b,A,"[","\\lbrack",!0),p(g,b,ot,"]","\\rbrack",!0),p(V,b,A,"]","\\rbrack",!0),p(g,b,xt,"(","\\lparen",!0),p(g,b,ot,")","\\rparen",!0),p(V,b,A,"<","\\textless",!0),p(V,b,A,">","\\textgreater",!0),p(g,b,xt,"⌊","\\lfloor",!0),p(g,b,ot,"⌋","\\rfloor",!0),p(g,b,xt,"⌈","\\lceil",!0),p(g,b,ot,"⌉","\\rceil",!0),p(g,b,A,"\\","\\backslash"),p(g,b,A,"∣","|"),p(g,b,A,"∣","\\vert"),p(V,b,A,"|","\\textbar",!0),p(g,b,A,"∥","\\|"),p(g,b,A,"∥","\\Vert"),p(V,b,A,"∥","\\textbardbl"),p(V,b,A,"~","\\textasciitilde"),p(V,b,A,"\\","\\textbackslash"),p(V,b,A,"^","\\textasciicircum"),p(g,b,M,"↑","\\uparrow",!0),p(g,b,M,"⇑","\\Uparrow",!0),p(g,b,M,"↓","\\downarrow",!0),p(g,b,M,"⇓","\\Downarrow",!0),p(g,b,M,"↕","\\updownarrow",!0),p(g,b,M,"⇕","\\Updownarrow",!0),p(g,b,qe,"∐","\\coprod"),p(g,b,qe,"⋁","\\bigvee"),p(g,b,qe,"⋀","\\bigwedge"),p(g,b,qe,"⨄","\\biguplus"),p(g,b,qe,"⋂","\\bigcap"),p(g,b,qe,"⋃","\\bigcup"),p(g,b,qe,"∫","\\int"),p(g,b,qe,"∫","\\intop"),p(g,b,qe,"∬","\\iint"),p(g,b,qe,"∭","\\iiint"),p(g,b,qe,"∏","\\prod"),p(g,b,qe,"∑","\\sum"),p(g,b,qe,"⨂","\\bigotimes"),p(g,b,qe,"⨁","\\bigoplus"),p(g,b,qe,"⨀","\\bigodot"),p(g,b,qe,"∮","\\oint"),p(g,b,qe,"∯","\\oiint"),p(g,b,qe,"∰","\\oiiint"),p(g,b,qe,"⨆","\\bigsqcup"),p(g,b,qe,"∫","\\smallint"),p(V,b,jn,"…","\\textellipsis"),p(g,b,jn,"…","\\mathellipsis"),p(V,b,jn,"…","\\ldots",!0),p(g,b,jn,"…","\\ldots",!0),p(g,b,jn,"⋯","\\@cdots",!0),p(g,b,jn,"⋱","\\ddots",!0),p(g,b,A,"⋮","\\varvdots"),p(V,b,A,"⋮","\\varvdots"),p(g,b,Oe,"ˊ","\\acute"),p(g,b,Oe,"ˋ","\\grave"),p(g,b,Oe,"¨","\\ddot"),p(g,b,Oe,"~","\\tilde"),p(g,b,Oe,"ˉ","\\bar"),p(g,b,Oe,"˘","\\breve"),p(g,b,Oe,"ˇ","\\check"),p(g,b,Oe,"^","\\hat"),p(g,b,Oe,"⃗","\\vec"),p(g,b,Oe,"˙","\\dot"),p(g,b,Oe,"˚","\\mathring"),p(g,b,le,"","\\@imath"),p(g,b,le,"","\\@jmath"),p(g,b,A,"ı","ı"),p(g,b,A,"ȷ","ȷ"),p(V,b,A,"ı","\\i",!0),p(V,b,A,"ȷ","\\j",!0),p(V,b,A,"ß","\\ss",!0),p(V,b,A,"æ","\\ae",!0),p(V,b,A,"œ","\\oe",!0),p(V,b,A,"ø","\\o",!0),p(V,b,A,"Æ","\\AE",!0),p(V,b,A,"Œ","\\OE",!0),p(V,b,A,"Ø","\\O",!0),p(V,b,Oe,"ˊ","\\'"),p(V,b,Oe,"ˋ","\\`"),p(V,b,Oe,"ˆ","\\^"),p(V,b,Oe,"˜","\\~"),p(V,b,Oe,"ˉ","\\="),p(V,b,Oe,"˘","\\u"),p(V,b,Oe,"˙","\\."),p(V,b,Oe,"¸","\\c"),p(V,b,Oe,"˚","\\r"),p(V,b,Oe,"ˇ","\\v"),p(V,b,Oe,"¨",'\\"'),p(V,b,Oe,"˝","\\H"),p(V,b,Oe,"◯","\\textcircled");var If={"--":!0,"---":!0,"``":!0,"''":!0};p(V,b,A,"–","--",!0),p(V,b,A,"–","\\textendash"),p(V,b,A,"—","---",!0),p(V,b,A,"—","\\textemdash"),p(V,b,A,"‘","`",!0),p(V,b,A,"‘","\\textquoteleft"),p(V,b,A,"’","'",!0),p(V,b,A,"’","\\textquoteright"),p(V,b,A,"“","``",!0),p(V,b,A,"“","\\textquotedblleft"),p(V,b,A,"”","''",!0),p(V,b,A,"”","\\textquotedblright"),p(g,b,A,"°","\\degree",!0),p(V,b,A,"°","\\degree"),p(V,b,A,"°","\\textdegree",!0),p(g,b,A,"£","\\pounds"),p(g,b,A,"£","\\mathsterling",!0),p(V,b,A,"£","\\pounds"),p(V,b,A,"£","\\textsterling",!0),p(g,k,A,"✠","\\maltese"),p(V,k,A,"✠","\\maltese");for(var Rf='0123456789/@."',Al=0;Al<Rf.length;Al++){var Pf=Rf.charAt(Al);p(g,b,A,Pf,Pf)}for(var Lf='0123456789!@*()-=+";:?/.,',Ol=0;Ol<Lf.length;Ol++){var Bf=Lf.charAt(Ol);p(V,b,A,Bf,Bf)}for(var Qs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Nl=0;Nl<Qs.length;Nl++){var eo=Qs.charAt(Nl);p(g,b,le,eo,eo),p(V,b,A,eo,eo)}p(g,k,A,"C","ℂ"),p(V,k,A,"C","ℂ"),p(g,k,A,"H","ℍ"),p(V,k,A,"H","ℍ"),p(g,k,A,"N","ℕ"),p(V,k,A,"N","ℕ"),p(g,k,A,"P","ℙ"),p(V,k,A,"P","ℙ"),p(g,k,A,"Q","ℚ"),p(V,k,A,"Q","ℚ"),p(g,k,A,"R","ℝ"),p(V,k,A,"R","ℝ"),p(g,k,A,"Z","ℤ"),p(V,k,A,"Z","ℤ"),p(g,b,le,"h","ℎ"),p(V,b,le,"h","ℎ");for(var ue="",at=0;at<Qs.length;at++){var Be=Qs.charAt(at);ue=String.fromCharCode(55349,56320+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56372+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56424+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56580+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56684+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56736+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56788+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56840+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56944+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),at<26&&(ue=String.fromCharCode(55349,56632+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue),ue=String.fromCharCode(55349,56476+at),p(g,b,le,Be,ue),p(V,b,A,Be,ue))}ue="𝕜",p(g,b,le,"k",ue),p(V,b,A,"k",ue);for(var yn=0;yn<10;yn++){var Ur=yn.toString();ue=String.fromCharCode(55349,57294+yn),p(g,b,le,Ur,ue),p(V,b,A,Ur,ue),ue=String.fromCharCode(55349,57314+yn),p(g,b,le,Ur,ue),p(V,b,A,Ur,ue),ue=String.fromCharCode(55349,57324+yn),p(g,b,le,Ur,ue),p(V,b,A,Ur,ue),ue=String.fromCharCode(55349,57334+yn),p(g,b,le,Ur,ue),p(V,b,A,Ur,ue)}for(var Dl="ÐÞþ",zl=0;zl<Dl.length;zl++){var to=Dl.charAt(zl);p(g,b,le,to,to),p(V,b,A,to,to)}var ro=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Ff=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Bv=function(e,t){var n=e.charCodeAt(0),i=e.charCodeAt(1),s=(n-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[ro[a][2],ro[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[Ff[l][2],Ff[l][o]]}else{if(s===120485||s===120486)return[ro[0][2],ro[0][o]];if(120486<s&&s<120782)return["",""];throw new U("Unsupported character: "+e)}},no=function(e,t,n){return Ee[n][e]&&Ee[n][e].replace&&(e=Ee[n][e].replace),{value:e,metrics:kl(e,t,n)}},Bt=function(e,t,n,i,s){var o=no(e,t,n),a=o.metrics;e=o.value;var l;if(a){var c=a.italic;(n==="text"||i&&i.font==="mathit")&&(c=0),l=new Ot(e,a.height,a.depth,c,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new Ot(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var u=i.getColor();u&&(l.style.color=u)}return l},Fv=function(e,t,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&no(e,"Main-Bold",t).metrics?Bt(e,"Main-Bold",t,n,i.concat(["mathbf"])):e==="\\"||Ee[t][e].font==="main"?Bt(e,"Main-Regular",t,n,i):Bt(e,"AMS-Regular",t,n,i.concat(["amsrm"]))},$v=function(e,t,n,i,s){return s!=="textord"&&no(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Hv=function(e,t,n){var i=e.mode,s=e.text,o=["mord"],a=i==="math"||i==="text"&&t.font,l=a?t.font:t.fontFamily,c="",u="";if(s.charCodeAt(0)===55349&&([c,u]=Bv(s,i)),c.length>0)return Bt(s,c,i,t,o.concat(u));if(l){var d,h;if(l==="boldsymbol"){var f=$v(s,i,t,o,n);d=f.fontName,h=[f.fontClass]}else a?(d=Vf[l].fontName,h=[l]):(d=io(l,t.fontWeight,t.fontShape),h=[l,t.fontWeight,t.fontShape]);if(no(s,d,i).metrics)return Bt(s,d,i,t,o.concat(h));if(If.hasOwnProperty(s)&&d.slice(0,10)==="Typewriter"){for(var m=[],y=0;y<s.length;y++)m.push(Bt(s[y],d,i,t,o.concat(h)));return Hf(m)}}if(n==="mathord")return Bt(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(n==="textord"){var v=Ee[i][s]&&Ee[i][s].font;if(v==="ams"){var x=io("amsrm",t.fontWeight,t.fontShape);return Bt(s,x,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(v==="main"||!v){var T=io("textrm",t.fontWeight,t.fontShape);return Bt(s,T,i,t,o.concat(t.fontWeight,t.fontShape))}else{var D=io(v,t.fontWeight,t.fontShape);return Bt(s,D,i,t,o.concat(D,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},Vv=(r,e)=>{if(_r(r.classes)!==_r(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize)return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n in r.style)if(r.style.hasOwnProperty(n)&&r.style[n]!==e.style[n])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&r.style[i]!==e.style[i])return!1;return!0},qv=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof Ot&&n instanceof Ot&&Vv(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},Il=function(e){for(var t=0,n=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=i},ht=function(e,t,n,i){var s=new Pi(e,t,n,i);return Il(s),s},$f=(r,e,t,n)=>new Pi(r,e,t,n),_v=function(e,t,n){var i=ht([e],[],t);return i.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=G(i.height),i.maxFontSize=1,i},jv=function(e,t,n,i){var s=new Cl(e,t,n,i);return Il(s),s},Hf=function(e){var t=new Ri(e);return Il(t),t},Uv=function(e,t){return e instanceof Ri?ht([],[e],t):e},Wv=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var a=-t[o].shift-s-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);s=s+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var f=e.children[0];if(f.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-f.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-f.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Gv=function(e,t){for(var{children:n,depth:i}=Wv(e),s=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=ht(["pstrut"],[]);c.style.height=G(s);for(var u=[],d=i,h=i,f=i,m=0;m<n.length;m++){var y=n[m];if(y.type==="kern")f+=y.size;else{var v=y.elem,x=y.wrapperClasses||[],T=y.wrapperStyle||{},D=ht(x,[c,v],void 0,T);D.style.top=G(-s-f-v.depth),y.marginLeft&&(D.style.marginLeft=y.marginLeft),y.marginRight&&(D.style.marginRight=y.marginRight),u.push(D),f+=v.height+v.depth}d=Math.min(d,f),h=Math.max(h,f)}var P=ht(["vlist"],u);P.style.height=G(h);var E;if(d<0){var N=ht([],[]),O=ht(["vlist"],[N]);O.style.height=G(-d);var $=ht(["vlist-s"],[new Ot("​")]);E=[ht(["vlist-r"],[P,$]),ht(["vlist-r"],[O])]}else E=[ht(["vlist-r"],[P])];var F=ht(["vlist-t"],E);return E.length===2&&F.classes.push("vlist-t2"),F.height=h,F.depth=-d,F},Kv=(r,e)=>{var t=ht(["mspace"],[],e),n=ze(r,e);return t.style.marginRight=G(n),t},io=function(e,t,n){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},Vf={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},qf={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Jv=function(e,t){var[n,i,s]=qf[e],o=new jr(n),a=new dr([o],{width:G(i),height:G(s),style:"width:"+G(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=$f(["overlay"],[a],t);return l.height=s,l.style.height=G(s),l.style.width=G(i),l},R={fontMap:Vf,makeSymbol:Bt,mathsym:Fv,makeSpan:ht,makeSvgSpan:$f,makeLineSpan:_v,makeAnchor:jv,makeFragment:Hf,wrapFragment:Uv,makeVList:Gv,makeOrd:Hv,makeGlue:Kv,staticSvg:Jv,svgData:qf,tryCombineChars:qv},Ie={number:3,unit:"mu"},vn={number:4,unit:"mu"},fr={number:5,unit:"mu"},Xv={mord:{mop:Ie,mbin:vn,mrel:fr,minner:Ie},mop:{mord:Ie,mop:Ie,mrel:fr,minner:Ie},mbin:{mord:vn,mop:vn,mopen:vn,minner:vn},mrel:{mord:fr,mop:fr,mopen:fr,minner:fr},mopen:{},mclose:{mop:Ie,mbin:vn,mrel:fr,minner:Ie},mpunct:{mord:Ie,mop:Ie,mrel:fr,mopen:Ie,mclose:Ie,mpunct:Ie,minner:Ie},minner:{mord:Ie,mop:Ie,mbin:vn,mrel:fr,mopen:Ie,mpunct:Ie,minner:Ie}},Yv={mord:{mop:Ie},mop:{mord:Ie,mop:Ie},mbin:{},mrel:{},mopen:{},mclose:{mop:Ie},mpunct:{},minner:{mop:Ie}},_f={},so={},oo={};function Z(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<t.length;++l)_f[t[l]]=a;e&&(s&&(so[e]=s),o&&(oo[e]=o))}function bn(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;Z({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}var ao=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},$e=function(e){return e.type==="ordgroup"?e.body:[e]},pr=R.makeSpan,Zv=["leftmost","mbin","mopen","mrel","mop","mpunct"],Qv=["rightmost","mrel","mclose","mpunct"],e8={display:ae.DISPLAY,text:ae.TEXT,script:ae.SCRIPT,scriptscript:ae.SCRIPTSCRIPT},t8={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},_e=function(e,t,n,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=be(e[o],t);if(a instanceof Ri){var l=a.children;s.push(...l)}else s.push(a)}if(R.tryCombineChars(s),!n)return s;var c=t;if(e.length===1){var u=e[0];u.type==="sizing"?c=t.havingSize(u.size):u.type==="styling"&&(c=t.havingStyle(e8[u.style]))}var d=pr([i[0]||"leftmost"],[],t),h=pr([i[1]||"rightmost"],[],t),f=n==="root";return jf(s,(m,y)=>{var v=y.classes[0],x=m.classes[0];v==="mbin"&&Qv.includes(x)?y.classes[0]="mord":x==="mbin"&&Zv.includes(v)&&(m.classes[0]="mord")},{node:d},h,f),jf(s,(m,y)=>{var v=Rl(y),x=Rl(m),T=v&&x?m.hasClass("mtight")?Yv[v][x]:Xv[v][x]:null;if(T)return R.makeGlue(T,c)},{node:d},h,f),s},jf=function r(e,t,n,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Uf(a);if(l){r(l.children,t,n,null,s);continue}var c=!a.hasClass("mspace");if(c){var u=t(a,n.node);u&&(n.insertAfter?n.insertAfter(u):(e.unshift(u),o++))}c?n.node=a:s&&a.hasClass("newline")&&(n.node=pr(["leftmost"])),n.insertAfter=(d=>h=>{e.splice(d+1,0,h),o++})(o)}i&&e.pop()},Uf=function(e){return e instanceof Ri||e instanceof Cl||e instanceof Pi&&e.hasClass("enclosing")?e:null},r8=function r(e,t){var n=Uf(e);if(n){var i=n.children;if(i.length){if(t==="right")return r(i[i.length-1],"right");if(t==="left")return r(i[0],"left")}}return e},Rl=function(e,t){return e?(t&&(e=r8(e,t)),t8[e.classes[0]]||null):null},Li=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return pr(t.concat(n))},be=function(e,t,n){if(!e)return pr();if(so[e.type]){var i=so[e.type](e,t);if(n&&t.size!==n.size){i=pr(t.sizingClasses(n),[i],t);var s=t.sizeMultiplier/n.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new U("Got group of unknown type: '"+e.type+"'")};function lo(r,e){var t=pr(["base"],r,e),n=pr(["strut"]);return n.style.height=G(t.height+t.depth),t.depth&&(n.style.verticalAlign=G(-t.depth)),t.children.unshift(n),t}function Pl(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=_e(r,e,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var s=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(s.push(lo(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(lo(o,e)),o=[]),s.push(n[a]));o.length>0&&s.push(lo(o,e));var c;t?(c=lo(_e(t,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=pr(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=G(u.height+u.depth),u.depth&&(d.style.verticalAlign=G(-u.depth))}return u}function Wf(r){return new Ri(r)}class wt{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=_r(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Wt&&this.children[n+1]instanceof Wt){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Wt;)i+=this.children[++n].toText();e.appendChild(new Wt(i).toNode())}else 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+=xe.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+xe.escape(_r(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Wt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return xe.escape(this.toText())}toText(){return this.text}}class n8{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=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",G(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+G(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var _={MathNode:wt,TextNode:Wt,SpaceNode:n8,newDocumentFragment:Wf},Nt=function(e,t,n){return Ee[t][e]&&Ee[t][e].replace&&e.charCodeAt(0)!==55349&&!(If.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ee[t][e].replace),new _.TextNode(e)},Ll=function(e){return e.length===1?e[0]:new _.MathNode("mrow",e)},Bl=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var i=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var s=e.text;if(["\\imath","\\jmath"].includes(s))return null;Ee[i][s]&&Ee[i][s].replace&&(s=Ee[i][s].replace);var o=R.fontMap[n].fontName;return kl(s,o,i)?R.fontMap[n].variant:null};function Fl(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Wt&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Wt&&t.text===","}else return!1}var ft=function(e,t,n){if(e.length===1){var i=Te(e[0],t);return n&&i instanceof wt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=Te(e[a],t);if(l instanceof wt&&o instanceof wt){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(Fl(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&Fl(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||Fl(o))){var c=l.children[0];c instanceof wt&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Wt&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Wt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),o=l}return s},Wr=function(e,t,n){return Ll(ft(e,t,n))},Te=function(e,t){if(!e)return new _.MathNode("mrow");if(oo[e.type]){var n=oo[e.type](e,t);return n}else throw new U("Got group of unknown type: '"+e.type+"'")};function Gf(r,e,t,n,i){var s=ft(r,t),o;s.length===1&&s[0]instanceof wt&&["mrow","mtable"].includes(s[0].type)?o=s[0]:o=new _.MathNode("mrow",s);var a=new _.MathNode("annotation",[new _.TextNode(e)]);a.setAttribute("encoding","application/x-tex");var l=new _.MathNode("semantics",[o,a]),c=new _.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return R.makeSpan([u],[c])}var Kf=function(e){return new ur({style:e.displayMode?ae.DISPLAY:ae.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Jf=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=R.makeSpan(n,[e])}return e},i8=function(e,t,n){var i=Kf(n),s;if(n.output==="mathml")return Gf(e,t,i,n.displayMode,!0);if(n.output==="html"){var o=Pl(e,i);s=R.makeSpan(["katex"],[o])}else{var a=Gf(e,t,i,n.displayMode,!1),l=Pl(e,i);s=R.makeSpan(["katex"],[a,l])}return Jf(s,n)},s8=function(e,t,n){var i=Kf(n),s=Pl(e,i),o=R.makeSpan(["katex"],[s]);return Jf(o,n)},o8={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},a8=function(e){var t=new _.MathNode("mo",[new _.TextNode(o8[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},l8={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],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],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},c8=function(e){return e.type==="ordgroup"?e.body.length:1},u8=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(l)){var c=e,u=c8(c.base),d,h,f;if(u>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,f=.42,h=l+"4"):(d=312,a=2340,f=.34,h="tilde4");else{var m=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],h=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],h="tilde"+m)}var y=new jr(h),v=new dr([y],{width:"100%",height:G(f),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:R.makeSvgSpan([],[v],t),minWidth:0,height:f}}else{var x=[],T=l8[l],[D,P,E]=T,N=E/1e3,O=D.length,$,F;if(O===1){var q=T[3];$=["hide-tail"],F=[q]}else if(O===2)$=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(O===3)$=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
381
+ `+O+" children.");for(var te=0;te<O;te++){var Y=new jr(D[te]),he=new dr([Y],{width:"400em",height:G(N),viewBox:"0 0 "+a+" "+E,preserveAspectRatio:F[te]+" slice"}),Q=R.makeSvgSpan([$[te]],[he],t);if(O===1)return{span:Q,minWidth:P,height:N};Q.style.height=G(N),x.push(Q)}return{span:R.makeSpan(["stretchy"],x,t),minWidth:P,height:N}}}var{span:i,minWidth:s,height:o}=n();return i.height=o,i.style.height=G(o),s>0&&(i.style.minWidth=G(s)),i},d8=function(e,t,n,i,s){var o,a=e.height+e.depth+n+i;if(/fbox|color|angl/.test(t)){if(o=R.makeSpan(["stretchy",t],[],s),t==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new El({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&c.push(new El({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new dr(c,{width:"100%",height:G(a)});o=R.makeSvgSpan([],[u],s)}return o.height=a,o.style.height=G(a),o},mr={encloseSpan:d8,mathMLnode:a8,svgSpan:u8};function fe(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function $l(r){var e=co(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function co(r){return r&&(r.type==="atom"||Lv.hasOwnProperty(r.type))?r:null}var Hl=(r,e)=>{var t,n,i;r&&r.type==="supsub"?(n=fe(r.base,"accent"),t=n.base,r.base=t,i=Rv(be(r,e)),r.base=n):(n=fe(r,"accent"),t=n.base);var s=be(t,e.havingCrampedStyle()),o=n.isShifty&&xe.isCharacterBox(t),a=0;if(o){var l=xe.getBaseElem(t),c=be(l,e.havingCrampedStyle());a=zf(c).skew}var u=n.label==="\\c",d=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),h;if(n.isStretchy)h=mr.svgSpan(n,e),h=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+G(2*a)+")",marginLeft:G(2*a)}:void 0}]},e);else{var f,m;n.label==="\\vec"?(f=R.staticSvg("vec",e),m=R.svgData.vec[1]):(f=R.makeOrd({mode:n.mode,text:n.label},e,"textord"),f=zf(f),f.italic=0,m=f.width,u&&(d+=f.depth)),h=R.makeSpan(["accent-body"],[f]);var y=n.label==="\\textcircled";y&&(h.classes.push("accent-full"),d=s.height);var v=a;y||(v-=m/2),h.style.left=G(v),n.label==="\\textcircled"&&(h.style.top=".2em"),h=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:h}]},e)}var x=R.makeSpan(["mord","accent"],[h],e);return i?(i.children[0]=x,i.height=Math.max(x.height,i.height),i.classes[0]="mord",i):x},Xf=(r,e)=>{var t=r.isStretchy?mr.mathMLnode(r.label):new _.MathNode("mo",[Nt(r.label,r.mode)]),n=new _.MathNode("mover",[Te(r.base,e),t]);return n.setAttribute("accent","true"),n},h8=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));Z({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:(r,e)=>{var t=ao(e[0]),n=!h8.test(r.funcName),i=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:i,base:t}},htmlBuilder:Hl,mathmlBuilder:Xf}),Z({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:Hl,mathmlBuilder:Xf}),Z({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:i}},htmlBuilder:(r,e)=>{var t=be(r.base,e),n=mr.svgSpan(r,e),i=r.label==="\\utilde"?.12:0,s=R.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return R.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(r,e)=>{var t=mr.mathMLnode(r.label),n=new _.MathNode("munder",[Te(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});var uo=r=>{var e=new _.MathNode("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Z({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(r,e,t){var{parser:n,funcName:i}=r;return{type:"xArrow",mode:n.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),i=R.wrapFragment(be(r.body,n,e),e),s=r.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=R.wrapFragment(be(r.below,n,e),e),o.classes.push(s+"-arrow-pad"));var a=mr.svgSpan(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||r.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(o){var d=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:d}]},e)}else u=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]},e);return u.children[0].children[0].children[1].classes.push("svg-align"),R.makeSpan(["mrel","x-arrow"],[u],e)},mathmlBuilder(r,e){var t=mr.mathMLnode(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var i=uo(Te(r.body,e));if(r.below){var s=uo(Te(r.below,e));n=new _.MathNode("munderover",[t,s,i])}else n=new _.MathNode("mover",[t,i])}else if(r.below){var o=uo(Te(r.below,e));n=new _.MathNode("munder",[t,o])}else n=uo(),n=new _.MathNode("mover",[t,n]);return n}});var f8=R.makeSpan;function Yf(r,e){var t=_e(r.body,e,!0);return f8([r.mclass],t,e)}function Zf(r,e){var t,n=ft(r.body,e);return r.mclass==="minner"?t=new _.MathNode("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new _.MathNode("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new _.MathNode("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}Z({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:$e(i),isCharacterBox:xe.isCharacterBox(i)}},htmlBuilder:Yf,mathmlBuilder:Zf});var ho=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Z({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:ho(e[0]),body:$e(e[1]),isCharacterBox:xe.isCharacterBox(e[1])}}}),Z({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,i=e[1],s=e[0],o;n!=="\\stackrel"?o=ho(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:$e(i)},l={type:"supsub",mode:s.mode,base:a,sup:n==="\\underset"?null:s,sub:n==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:xe.isCharacterBox(l)}},htmlBuilder:Yf,mathmlBuilder:Zf}),Z({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:ho(e[0]),body:$e(e[0])}},htmlBuilder(r,e){var t=_e(r.body,e,!0),n=R.makeSpan([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=ft(r.body,e),n=new _.MathNode("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var p8={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Qf=()=>({type:"styling",body:[],mode:"math",style:"display"}),ep=r=>r.type==="textord"&&r.text==="@",m8=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function g8(r,e,t){var n=p8[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function y8(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new U("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],i=[n],s=0;s<e.length;s++){for(var o=e[s],a=Qf(),l=0;l<o.length;l++)if(!ep(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var c=$l(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(c)>-1))if("<>AV".indexOf(c)>-1)for(var d=0;d<2;d++){for(var h=!0,f=l+1;f<o.length;f++){if(m8(o[f],c)){h=!1,l=f;break}if(ep(o[f]))throw new U("Missing a "+c+" character to complete a CD arrow.",o[f]);u[d].body.push(o[f])}if(h)throw new U("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new U('Expected one of "<>AV=|." after @',o[l]);var m=g8(c,u,r),y={type:"styling",body:[m],mode:"math",style:"display"};n.push(y),a=Qf()}s%2===0?n.push(a):n.shift(),n=[],i.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var v=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Z({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=R.wrapFragment(be(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=G(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new _.MathNode("mrow",[Te(r.label,e)]);return t=new _.MathNode("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new _.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}}),Z({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=R.wrapFragment(be(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new _.MathNode("mrow",[Te(r.fragment,e)])}}),Z({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=fe(e[0],"ordgroup"),i=n.body,s="",o=0;o<i.length;o++){var a=fe(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new U("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new U("\\@char with invalid code point "+s);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:c}}});var tp=(r,e)=>{var t=_e(r.body,e.withColor(r.color),!1);return R.makeFragment(t)},rp=(r,e)=>{var t=ft(r.body,e.withColor(r.color)),n=new _.MathNode("mstyle",t);return n.setAttribute("mathcolor",r.color),n};Z({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=fe(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:n,body:$e(i)}},htmlBuilder:tp,mathmlBuilder:rp}),Z({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,i=fe(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:tp,mathmlBuilder:rp}),Z({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,s=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:s,size:i&&fe(i,"size").value}},htmlBuilder(r,e){var t=R.makeSpan(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=G(ze(r.size,e)))),t},mathmlBuilder(r,e){var t=new _.MathNode("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",G(ze(r.size,e)))),t}});var Vl={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},np=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new U("Expected a control sequence",r);return e},v8=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},ip=(r,e,t,n)=>{var i=r.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,i,n)};Z({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Vl[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Vl[n.text]),fe(e.parseFunction(),"internal");throw new U("Invalid token after macro prefix",n)}}),Z({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new U("Expected a control sequence",n);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new U('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==s+1)throw new U('Argument number "'+n.text+'" out of order');s++,a.push([])}else{if(n.text==="EOF")throw new U("Expected a macro definition");a[s].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},t===Vl[t]),{type:"internal",mode:e.mode}}}),Z({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=np(e.gullet.popToken());e.gullet.consumeSpaces();var i=v8(e);return ip(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),Z({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=np(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return ip(e,n,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Bi=function(e,t,n){var i=Ee.math[e]&&Ee.math[e].replace,s=kl(i||e,t,n);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},ql=function(e,t,n,i){var s=n.havingBaseStyle(t),o=R.makeSpan(i.concat(s.sizingClasses(n)),[e],n),a=s.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},sp=function(e,t,n){var i=t.havingBaseStyle(n),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=G(s),e.height-=s,e.depth+=s},b8=function(e,t,n,i,s,o){var a=R.makeSymbol(e,"Main-Regular",s,i),l=ql(a,t,i,o);return n&&sp(l,i,t),l},x8=function(e,t,n,i){return R.makeSymbol(e,"Size"+t+"-Regular",n,i)},op=function(e,t,n,i,s,o){var a=x8(e,t,s,i),l=ql(R.makeSpan(["delimsizing","size"+t],[a],i),ae.TEXT,i,o);return n&&sp(l,i,ae.TEXT),l},_l=function(e,t,n){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=R.makeSpan(["delimsizinginner",i],[R.makeSpan([],[R.makeSymbol(e,t,n)])]);return{type:"elem",elem:s}},jl=function(e,t,n){var i=Ut["Size4-Regular"][e.charCodeAt(0)]?Ut["Size4-Regular"][e.charCodeAt(0)][4]:Ut["Size1-Regular"][e.charCodeAt(0)][4],s=new jr("inner",Tv(e,Math.round(1e3*t))),o=new dr([s],{width:G(i),height:G(t),style:"width:"+G(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=R.makeSvgSpan([],[o],n);return a.height=t,a.style.height=G(t),a.style.width=G(i),{type:"elem",elem:a}},Ul=.008,fo={type:"kern",size:-1*Ul},w8=["|","\\lvert","\\rvert","\\vert"],S8=["\\|","\\lVert","\\rVert","\\Vert"],ap=function(e,t,n,i,s,o){var a,l,c,u,d="",h=0;a=c=u=e,l=null;var f="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):w8.includes(e)?(c="∣",d="vert",h=333):S8.includes(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",u="⎣",f="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",u="⎦",f="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",u="⎣",f="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=u="⎢",f="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",u="⎦",f="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=u="⎥",f="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",u="⎝",f="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",u="⎠",f="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",f="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",u="⎩",c="⎪",f="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",u="⎭",c="⎪",f="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",u="⎩",c="⎪",f="Size4-Regular");var m=Bi(a,f,s),y=m.height+m.depth,v=Bi(c,f,s),x=v.height+v.depth,T=Bi(u,f,s),D=T.height+T.depth,P=0,E=1;if(l!==null){var N=Bi(l,f,s);P=N.height+N.depth,E=2}var O=y+D+P,$=Math.max(0,Math.ceil((t-O)/(E*x))),F=O+$*E*x,q=i.fontMetrics().axisHeight;n&&(q*=i.sizeMultiplier);var te=F/2-q,Y=[];if(d.length>0){var he=F-y-D,Q=Math.round(F*1e3),W=Cv(d,Math.round(he*1e3)),ne=new jr(d,W),ve=(h/1e3).toFixed(3)+"em",ge=(Q/1e3).toFixed(3)+"em",Ae=new dr([ne],{width:ve,height:ge,viewBox:"0 0 "+h+" "+Q}),C=R.makeSvgSpan([],[Ae],i);C.height=Q/1e3,C.style.width=ve,C.style.height=ge,Y.push({type:"elem",elem:C})}else{if(Y.push(_l(u,f,s)),Y.push(fo),l===null){var w=F-y-D+2*Ul;Y.push(jl(c,w,i))}else{var I=(F-y-D-P)/2+2*Ul;Y.push(jl(c,I,i)),Y.push(fo),Y.push(_l(l,f,s)),Y.push(fo),Y.push(jl(c,I,i))}Y.push(fo),Y.push(_l(a,f,s))}var L=i.havingBaseStyle(ae.TEXT),B=R.makeVList({positionType:"bottom",positionData:te,children:Y},L);return ql(R.makeSpan(["delimsizing","mult"],[B],L),ae.TEXT,i,o)},Wl=80,Gl=.08,Kl=function(e,t,n,i,s){var o=Mv(e,i,n),a=new jr(e,o),l=new dr([a],{width:"400em",height:G(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return R.makeSvgSpan(["hide-tail"],[l],s)},k8=function(e,t){var n=t.havingBaseSizing(),i=dp("\\surd",e*n.sizeMultiplier,up,n),s=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,c=0,u=0,d;return i.type==="small"?(u=1e3+1e3*o+Wl,e<1?s=1:e<1.4&&(s=.7),l=(1+o+Gl)/s,c=(1+o)/s,a=Kl("sqrtMain",l,u,o,t),a.style.minWidth="0.853em",d=.833/s):i.type==="large"?(u=(1e3+Wl)*Fi[i.size],c=(Fi[i.size]+o)/s,l=(Fi[i.size]+o+Gl)/s,a=Kl("sqrtSize"+i.size,l,u,o,t),a.style.minWidth="1.02em",d=1/s):(l=e+o+Gl,c=e+o,u=Math.floor(1e3*e+o)+Wl,a=Kl("sqrtTall",l,u,o,t),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=G(l),{span:a,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},lp=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],M8=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],cp=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Fi=[0,1.2,1.8,2.4,3],T8=function(e,t,n,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),lp.includes(e)||cp.includes(e))return op(e,t,!1,n,i,s);if(M8.includes(e))return ap(e,Fi[t],!1,n,i,s);throw new U("Illegal delimiter: '"+e+"'")},C8=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],E8=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"stack"}],up=[{type:"small",style:ae.SCRIPTSCRIPT},{type:"small",style:ae.SCRIPT},{type:"small",style:ae.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],A8=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},dp=function(e,t,n,i){for(var s=Math.min(2,3-i.style.size),o=s;o<n.length&&n[o].type!=="stack";o++){var a=Bi(e,A8(n[o]),"math"),l=a.height+a.depth;if(n[o].type==="small"){var c=i.havingBaseStyle(n[o].style);l*=c.sizeMultiplier}if(l>t)return n[o]}return n[n.length-1]},hp=function(e,t,n,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;cp.includes(e)?a=C8:lp.includes(e)?a=up:a=E8;var l=dp(e,t,a,i);return l.type==="small"?b8(e,l.style,n,i,s,o):l.type==="large"?op(e,l.size,n,i,s,o):ap(e,t,n,i,s,o)},O8=function(e,t,n,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(t-a,n+a),d=Math.max(u/500*l,2*u-c);return hp(e,d,!0,i,s,o)},gr={sqrtImage:k8,sizedDelim:T8,sizeToMaxHeight:Fi,customSizedDelim:hp,leftRightDelim:O8},fp={"\\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}},N8=["(","\\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 po(r,e){var t=co(r);if(t&&N8.includes(t.text))return t;throw t?new U("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new U("Invalid delimiter type '"+r.type+"'",r)}Z({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:(r,e)=>{var t=po(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:fp[r.funcName].size,mclass:fp[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?R.makeSpan([r.mclass]):gr.sizedDelim(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Nt(r.delim,r.mode));var t=new _.MathNode("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=G(gr.sizeToMaxHeight[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});function pp(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Z({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new U("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:po(e[0],r).text,color:t}}}),Z({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=po(e[0],r),n=r.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var s=fe(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(r,e)=>{pp(r);for(var t=_e(r.body,e,!0,["mopen","mclose"]),n=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(n=Math.max(t[o].height,n),i=Math.max(t[o].depth,i));n*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(r.left==="."?a=Li(e,["mopen"]):a=gr.leftRightDelim(r.left,n,i,e,r.mode,["mopen"]),t.unshift(a),s)for(var l=1;l<t.length;l++){var c=t[l],u=c.isMiddle;u&&(t[l]=gr.leftRightDelim(u.delim,n,i,u.options,r.mode,[]))}var d;if(r.right===".")d=Li(e,["mclose"]);else{var h=r.rightColor?e.withColor(r.rightColor):e;d=gr.leftRightDelim(r.right,n,i,h,r.mode,["mclose"])}return t.push(d),R.makeSpan(["minner"],t,e)},mathmlBuilder:(r,e)=>{pp(r);var t=ft(r.body,e);if(r.left!=="."){var n=new _.MathNode("mo",[Nt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var i=new _.MathNode("mo",[Nt(r.right,r.mode)]);i.setAttribute("fence","true"),r.rightColor&&i.setAttribute("mathcolor",r.rightColor),t.push(i)}return Ll(t)}}),Z({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=po(e[0],r);if(!r.parser.leftrightDepth)throw new U("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=Li(e,[]);else{t=gr.sizedDelim(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Nt("|","text"):Nt(r.delim,r.mode),n=new _.MathNode("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var Jl=(r,e)=>{var t=R.wrapFragment(be(r.body,e),e),n=r.label.slice(1),i=e.sizeMultiplier,s,o=0,a=xe.isCharacterBox(r.body);if(n==="sout")s=R.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=ze({number:.6,unit:"pt"},e),c=ze({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var d=t.height+t.depth+l+c;t.style.paddingLeft=G(d/2+l);var h=Math.floor(1e3*d*i),f=Sv(h),m=new dr([new jr("phase",f)],{width:"400em",height:G(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});s=R.makeSvgSpan(["hide-tail"],[m],e),s.style.height=G(d),o=t.depth+l+c}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var y=0,v=0,x=0;/box/.test(n)?(x=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),y=e.fontMetrics().fboxsep+(n==="colorbox"?0:x),v=y):n==="angl"?(x=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),y=4*x,v=Math.max(0,.25-t.depth)):(y=a?.2:0,v=y),s=mr.encloseSpan(t,n,y,v,e),/fbox|boxed|fcolorbox/.test(n)?(s.style.borderStyle="solid",s.style.borderWidth=G(x)):n==="angl"&&x!==.049&&(s.style.borderTopWidth=G(x),s.style.borderRightWidth=G(x)),o=t.depth+v,r.backgroundColor&&(s.style.backgroundColor=r.backgroundColor,r.borderColor&&(s.style.borderColor=r.borderColor))}var T;if(r.backgroundColor)T=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var D=/cancel|phase/.test(n)?["svg-align"]:[];T=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:D}]},e)}return/cancel/.test(n)&&(T.height=t.height,T.depth=t.depth),/cancel/.test(n)&&!a?R.makeSpan(["mord","cancel-lap"],[T],e):R.makeSpan(["mord"],[T],e)},Xl=(r,e)=>{var t=0,n=new _.MathNode(r.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Te(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(r.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};Z({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=fe(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=fe(e[0],"color-token").color,o=fe(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}}),Z({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"enclose",mode:t.mode,label:n,body:i}},htmlBuilder:Jl,mathmlBuilder:Xl}),Z({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var mp={};function Gt(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<t.length;++l)mp[t[l]]=a;s&&(so[e]=s),o&&(oo[e]=o)}var gp={};function S(r,e){gp[r]=e}function yp(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}var mo=r=>{var e=r.parser.settings;if(!e.displayMode)throw new U("{"+r.envName+"} can be used only in display mode.")};function Yl(r){if(r.indexOf("ed")===-1)return r.indexOf("*")===-1}function Gr(r,e,t){var{hskipBeforeAndAfter:n,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:h}=e;if(r.gullet.beginGroup(),c||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var f=r.gullet.expandMacroAsText("\\arraystretch");if(f==null)o=1;else if(o=parseFloat(f),!o||o<0)throw new U("Invalid \\arraystretch: "+f)}r.gullet.beginGroup();var m=[],y=[m],v=[],x=[],T=l!=null?[]:void 0;function D(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function P(){T&&(r.gullet.macros.get("\\df@tag")?(T.push(r.subparse([new bt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(D(),x.push(yp(r));;){var E=r.parseExpression(!1,c?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup(),E={type:"ordgroup",mode:r.mode,body:E},t&&(E={type:"styling",mode:r.mode,style:t,body:[E]}),m.push(E);var N=r.fetch().text;if(N==="&"){if(d&&m.length===d){if(c||a)throw new U("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(N==="\\end"){P(),m.length===1&&E.type==="styling"&&E.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),x.length<y.length+1&&x.push([]);break}else if(N==="\\\\"){r.consume();var O=void 0;r.gullet.future().text!==" "&&(O=r.parseSizeGroup(!0)),v.push(O?O.value:null),P(),x.push(yp(r)),m=[],y.push(m),D()}else throw new U("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:i,arraystretch:o,body:y,cols:s,rowGaps:v,hskipBeforeAndAfter:n,hLinesBeforeRow:x,colSeparationType:a,tags:T,leqno:h}}function Zl(r){return r.slice(0,1)==="d"?"display":"text"}var Kt=function(e,t){var n,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],u=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var f=t.havingStyle(ae.SCRIPT).sizeMultiplier;h=.2778*(f/t.sizeMultiplier)}var m=e.colSeparationType==="CD"?ze({number:3,unit:"ex"},t):12*d,y=3*d,v=e.arraystretch*m,x=.7*v,T=.3*v,D=0;function P(je){for(var Sn=0;Sn<je.length;++Sn)Sn>0&&(D+=.25),c.push({pos:D,isDashed:je[Sn]})}for(P(o[0]),n=0;n<e.body.length;++n){var E=e.body[n],N=x,O=T;a<E.length&&(a=E.length);var $=new Array(E.length);for(i=0;i<E.length;++i){var F=be(E[i],t);O<F.depth&&(O=F.depth),N<F.height&&(N=F.height),$[i]=F}var q=e.rowGaps[n],te=0;q&&(te=ze(q,t),te>0&&(te+=T,O<te&&(O=te),te=0)),e.addJot&&(O+=y),$.height=N,$.depth=O,D+=N,$.pos=D,D+=O+te,l[n]=$,P(o[n+1])}var Y=D/2+t.fontMetrics().axisHeight,he=e.cols||[],Q=[],W,ne,ve=[];if(e.tags&&e.tags.some(je=>je))for(n=0;n<s;++n){var ge=l[n],Ae=ge.pos-Y,C=e.tags[n],w=void 0;C===!0?w=R.makeSpan(["eqn-num"],[],t):C===!1?w=R.makeSpan([],[],t):w=R.makeSpan([],_e(C,t,!0),t),w.depth=ge.depth,w.height=ge.height,ve.push({type:"elem",elem:w,shift:Ae})}for(i=0,ne=0;i<a||ne<he.length;++i,++ne){for(var I=he[ne]||{},L=!0;I.type==="separator";){if(L||(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(t.fontMetrics().doubleRuleSep),Q.push(W)),I.separator==="|"||I.separator===":"){var B=I.separator==="|"?"solid":"dashed",K=R.makeSpan(["vertical-separator"],[],t);K.style.height=G(D),K.style.borderRightWidth=G(u),K.style.borderRightStyle=B,K.style.margin="0 "+G(-u/2);var re=D-Y;re&&(K.style.verticalAlign=G(-re)),Q.push(K)}else throw new U("Invalid separator type: "+I.separator);ne++,I=he[ne]||{},L=!1}if(!(i>=a)){var j=void 0;(i>0||e.hskipBeforeAndAfter)&&(j=xe.deflt(I.pregap,h),j!==0&&(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(j),Q.push(W)));var ie=[];for(n=0;n<s;++n){var me=l[n],Ce=me[i];if(Ce){var zt=me.pos-Y;Ce.depth=me.depth,Ce.height=me.height,ie.push({type:"elem",elem:Ce,shift:zt})}}ie=R.makeVList({positionType:"individualShift",children:ie},t),ie=R.makeSpan(["col-align-"+(I.align||"c")],[ie]),Q.push(ie),(i<a-1||e.hskipBeforeAndAfter)&&(j=xe.deflt(I.postgap,h),j!==0&&(W=R.makeSpan(["arraycolsep"],[]),W.style.width=G(j),Q.push(W)))}}if(l=R.makeSpan(["mtable"],Q),c.length>0){for(var It=R.makeLineSpan("hline",t,u),Ne=R.makeLineSpan("hdashline",t,u),ct=[{type:"elem",elem:l,shift:0}];c.length>0;){var Xr=c.pop(),xn=Xr.pos-Y;Xr.isDashed?ct.push({type:"elem",elem:Ne,shift:xn}):ct.push({type:"elem",elem:It,shift:xn})}l=R.makeVList({positionType:"individualShift",children:ct},t)}if(ve.length===0)return R.makeSpan(["mord"],[l],t);var wn=R.makeVList({positionType:"individualShift",children:ve},t);return wn=R.makeSpan(["tag"],[wn],t),R.makeFragment([l,wn])},D8={c:"center ",l:"left ",r:"right "},Jt=function(e,t){for(var n=[],i=new _.MathNode("mtd",[],["mtr-glue"]),s=new _.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],c=0;c<a.length;c++)l.push(new _.MathNode("mtd",[Te(a[c],t)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),n.push(new _.MathNode("mtr",l))}var u=new _.MathNode("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",G(d));var h="",f="";if(e.cols&&e.cols.length>0){var m=e.cols,y="",v=!1,x=0,T=m.length;m[0].type==="separator"&&(h+="top ",x=1),m[m.length-1].type==="separator"&&(h+="bottom ",T-=1);for(var D=x;D<T;D++)m[D].type==="align"?(f+=D8[m[D].align],v&&(y+="none "),v=!0):m[D].type==="separator"&&v&&(y+=m[D].separator==="|"?"solid ":"dashed ",v=!1);u.setAttribute("columnalign",f.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(e.colSeparationType==="align"){for(var P=e.cols||[],E="",N=1;N<P.length;N++)E+=N%2?"0em ":"1em ";u.setAttribute("columnspacing",E.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var O="",$=e.hLinesBeforeRow;h+=$[0].length>0?"left ":"",h+=$[$.length-1].length>0?"right ":"";for(var F=1;F<$.length-1;F++)O+=$[F].length===0?"none ":$[F][0]?"dashed ":"solid ";return/[sd]/.test(O)&&u.setAttribute("rowlines",O.trim()),h!==""&&(u=new _.MathNode("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new _.MathNode("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},vp=function(e,t){e.envName.indexOf("ed")===-1&&mo(e);var n=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=Gr(e.parser,{cols:n,addJot:!0,autoTag:s?void 0:Yl(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var u="",d=0;d<t[0].body.length;d++){var h=fe(t[0].body[d],"textord");u+=h.text}a=Number(u),l=a*2}var f=!l;o.body.forEach(function(x){for(var T=1;T<x.length;T+=2){var D=fe(x[T],"styling"),P=fe(D.body[0],"ordgroup");P.body.unshift(c)}if(f)l<x.length&&(l=x.length);else{var E=x.length/2;if(a<E)throw new U("Too many math in a row: "+("expected "+a+", but got "+E),x[0])}});for(var m=0;m<l;++m){var y="r",v=0;m%2===1?y="l":m>0&&f&&(v=1),n[m]={type:"align",align:y,pregap:v,postgap:0}}return o.colSeparationType=f?"align":"alignat",o};Gt({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=co(e[0]),n=t?[e[0]]:fe(e[0],"ordgroup").body,i=n.map(function(o){var a=$l(o),l=a.text;if("lcr".indexOf(l)!==-1)return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new U("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Gr(r.parser,s,Zl(r.envName))},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var i=r.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new U("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:t}]}}var s=Gr(r.parser,n,Zl(r.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=Gr(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=co(e[0]),n=t?[e[0]]:fe(e[0],"ordgroup").body,i=n.map(function(o){var a=$l(o),l=a.text;if("lc".indexOf(l)!==-1)return{type:"align",align:l};throw new U("Unknown column alignment: "+l,o)});if(i.length>1)throw new U("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Gr(r.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new U("{subarray} can contain only one column");return s},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Gr(r.parser,e,Zl(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.indexOf("r")>-1?".":"\\{",right:r.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:vp,htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){["gather","gather*"].includes(r.envName)&&mo(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Yl(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return Gr(r.parser,e,"display")},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:vp,htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){mo(r);var e={autoTag:Yl(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return Gr(r.parser,e,"display")},htmlBuilder:Kt,mathmlBuilder:Jt}),Gt({type:"array",names:["CD"],props:{numArgs:0},handler(r){return mo(r),y8(r.parser)},htmlBuilder:Kt,mathmlBuilder:Jt}),S("\\nonumber","\\gdef\\@eqnsw{0}"),S("\\notag","\\nonumber"),Z({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new U(r.funcName+" valid only within array environment")}});var bp=mp;Z({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];if(i.type!=="ordgroup")throw new U("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=fe(i.body[o],"textord").text;if(n==="\\begin"){if(!bp.hasOwnProperty(s))throw new U("No such environment: "+s,i);var a=bp[s],{args:l,optArgs:c}=t.parseArguments("\\begin{"+s+"}",a),u={mode:t.mode,envName:s,parser:t},d=a.handler(u,l,c);t.expect("\\end",!1);var h=t.nextToken,f=fe(t.parseFunction(),"environment");if(f.name!==s)throw new U("Mismatch: \\begin{"+s+"} matched by \\end{"+f.name+"}",h);return d}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var xp=(r,e)=>{var t=r.font,n=e.withFont(t);return be(r.body,n)},wp=(r,e)=>{var t=r.font,n=e.withFont(t);return Te(r.body,n)},Sp={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Z({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=ao(e[0]),s=n;return s in Sp&&(s=Sp[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:xp,mathmlBuilder:wp}),Z({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0],i=xe.isCharacterBox(n);return{type:"mclass",mode:t.mode,mclass:ho(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}}),Z({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:i}=r,{mode:s}=t,o=t.parseExpression(!0,i),a="math"+n.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:xp,mathmlBuilder:wp});var kp=(r,e)=>{var t=e;return r==="display"?t=t.id>=ae.SCRIPT.id?t.text():ae.DISPLAY:r==="text"&&t.size===ae.DISPLAY.size?t=ae.TEXT:r==="script"?t=ae.SCRIPT:r==="scriptscript"&&(t=ae.SCRIPTSCRIPT),t},Ql=(r,e)=>{var t=kp(r.size,e.style),n=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(n);var o=be(r.numer,s,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var c=be(r.denom,s,e),u,d,h;r.hasBarLine?(r.barSize?(d=ze(r.barSize,e),u=R.makeLineSpan("frac-line",e,d)):u=R.makeLineSpan("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var f,m,y;t.size===ae.DISPLAY.size||r.size==="display"?(f=e.fontMetrics().num1,d>0?m=3*h:m=7*h,y=e.fontMetrics().denom1):(d>0?(f=e.fontMetrics().num2,m=h):(f=e.fontMetrics().num3,m=3*h),y=e.fontMetrics().denom2);var v;if(u){var T=e.fontMetrics().axisHeight;f-o.depth-(T+.5*d)<m&&(f+=m-(f-o.depth-(T+.5*d))),T-.5*d-(c.height-y)<m&&(y+=m-(T-.5*d-(c.height-y)));var D=-(T-.5*d);v=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:D},{type:"elem",elem:o,shift:-f}]},e)}else{var x=f-o.depth-(c.height-y);x<m&&(f+=.5*(m-x),y+=.5*(m-x)),v=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-f}]},e)}s=e.havingStyle(t),v.height*=s.sizeMultiplier/e.sizeMultiplier,v.depth*=s.sizeMultiplier/e.sizeMultiplier;var P;t.size===ae.DISPLAY.size?P=e.fontMetrics().delim1:t.size===ae.SCRIPTSCRIPT.size?P=e.havingStyle(ae.SCRIPT).fontMetrics().delim2:P=e.fontMetrics().delim2;var E,N;return r.leftDelim==null?E=Li(e,["mopen"]):E=gr.customSizedDelim(r.leftDelim,P,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?N=R.makeSpan([]):r.rightDelim==null?N=Li(e,["mclose"]):N=gr.customSizedDelim(r.rightDelim,P,!0,e.havingStyle(t),r.mode,["mclose"]),R.makeSpan(["mord"].concat(s.sizingClasses(e)),[E,R.makeSpan(["mfrac"],[v]),N],e)},e0=(r,e)=>{var t=new _.MathNode("mfrac",[Te(r.numer,e),Te(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=ze(r.barSize,e);t.setAttribute("linethickness",G(n))}var i=kp(r.size,e.style);if(i.size!==e.style.size){t=new _.MathNode("mstyle",[t]);var s=i.size===ae.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(r.leftDelim!=null||r.rightDelim!=null){var o=[];if(r.leftDelim!=null){var a=new _.MathNode("mo",[new _.TextNode(r.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}if(o.push(t),r.rightDelim!=null){var l=new _.MathNode("mo",[new _.TextNode(r.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}return Ll(o)}return t};Z({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1],o,a=null,l=null,c="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:a,rightDelim:l,size:c,barSize:null}},htmlBuilder:Ql,mathmlBuilder:e0}),Z({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Z({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});var Mp=["display","text","script","scriptscript"],Tp=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};Z({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],i=e[5],s=ao(e[0]),o=s.type==="atom"&&s.family==="open"?Tp(s.text):null,a=ao(e[1]),l=a.type==="atom"&&a.family==="close"?Tp(a.text):null,c=fe(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h="auto",f=e[3];if(f.type==="ordgroup"){if(f.body.length>0){var m=fe(f.body[0],"textord");h=Mp[Number(m.text)]}}else f=fe(f,"textord"),h=Mp[Number(f.text)];return{type:"genfrac",mode:t.mode,numer:n,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l,size:h}},htmlBuilder:Ql,mathmlBuilder:e0}),Z({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:i}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:fe(e[0],"size").value,token:i}}}),Z({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=av(fe(e[1],"infix").size),o=e[2],a=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Ql,mathmlBuilder:e0});var Cp=(r,e)=>{var t=e.style,n,i;r.type==="supsub"?(n=r.sup?be(r.sup,e.havingStyle(t.sup()),e):be(r.sub,e.havingStyle(t.sub()),e),i=fe(r.base,"horizBrace")):i=fe(r,"horizBrace");var s=be(i.base,e.havingBaseStyle(ae.DISPLAY)),o=mr.svgSpan(i,e),a;if(i.isOver?(a=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),a.children[0].children[0].children[1].classes.push("svg-align")):(a=R.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=R.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},e):a=R.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return R.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e)},z8=(r,e)=>{var t=mr.mathMLnode(r.label);return new _.MathNode(r.isOver?"mover":"munder",[Te(r.base,e),t])};Z({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:/^\\over/.test(n),base:e[0]}},htmlBuilder:Cp,mathmlBuilder:z8}),Z({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],i=fe(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:$e(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=_e(r.body,e,!1);return R.makeAnchor(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=Wr(r.body,e);return t instanceof wt||(t=new wt("mrow",[t])),t.setAttribute("href",r.href),t}}),Z({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=fe(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:n,body:$e(a)}}}),Z({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:$e(e[0])}},htmlBuilder(r,e){var t=_e(r.body,e,!1);return R.makeFragment(t)},mathmlBuilder(r,e){return new _.MathNode("mrow",ft(r.body,e))}}),Z({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:i}=r,s=fe(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var d=c[u],h=d.indexOf("=");if(h<0)throw new U("\\htmlData key/value '"+d+"' missing equals sign");var f=d.slice(0,h),m=d.slice(h+1);l["data-"+f.trim()]=m}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:$e(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=_e(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var i=R.makeSpan(n,t,e);for(var s in r.attributes)s!=="class"&&r.attributes.hasOwnProperty(s)&&i.setAttribute(s,r.attributes[s]);return i},mathmlBuilder:(r,e)=>Wr(r.body,e)}),Z({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:$e(e[0]),mathml:$e(e[1])}},htmlBuilder:(r,e)=>{var t=_e(r.html,e,!1);return R.makeFragment(t)},mathmlBuilder:(r,e)=>Wr(r.mathml,e)});var t0=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 U("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Af(n))throw new U("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Z({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=fe(t[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":a=h;break;case"width":i=t0(h);break;case"height":s=t0(h);break;case"totalheight":o=t0(h);break;default:throw new U("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var f=fe(e[0],"url").url;return a===""&&(a=f,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:f})?{type:"includegraphics",mode:n.mode,alt:a,width:i,height:s,totalheight:o,src:f}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=ze(r.height,e),n=0;r.totalheight.number>0&&(n=ze(r.totalheight,e)-t);var i=0;r.width.number>0&&(i=ze(r.width,e));var s={height:G(t+n)};i>0&&(s.width=G(i)),n>0&&(s.verticalAlign=G(-n));var o=new zv(r.src,r.alt,s);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mglyph",[]);t.setAttribute("alt",r.alt);var n=ze(r.height,e),i=0;if(r.totalheight.number>0&&(i=ze(r.totalheight,e)-n,t.setAttribute("valign",G(-i))),t.setAttribute("height",G(n+i)),r.width.number>0){var s=ze(r.width,e);t.setAttribute("width",G(s))}return t.setAttribute("src",r.src),t}}),Z({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=fe(e[0],"size");if(t.settings.strict){var s=n[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(r,e){return R.makeGlue(r.dimension,e)},mathmlBuilder(r,e){var t=ze(r.dimension,e);return new _.SpaceNode(t)}}),Z({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:i}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=R.makeSpan([],[be(r.body,e)]),t=R.makeSpan(["inner"],[t],e)):t=R.makeSpan(["inner"],[be(r.body,e)]);var n=R.makeSpan(["fix"],[]),i=R.makeSpan([r.alignment],[t,n],e),s=R.makeSpan(["strut"]);return s.style.height=G(i.height+i.depth),i.depth&&(s.style.verticalAlign=G(-i.depth)),i.children.unshift(s),i=R.makeSpan(["thinbox"],[i],e),R.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mpadded",[Te(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}}),Z({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,i=n.mode;n.switchMode("math");var s=t==="\\("?"\\)":"$",o=n.parseExpression(!1,s);return n.expect(s),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:o}}}),Z({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new U("Mismatched "+r.funcName)}});var Ep=(r,e)=>{switch(e.style.size){case ae.DISPLAY.size:return r.display;case ae.TEXT.size:return r.text;case ae.SCRIPT.size:return r.script;case ae.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};Z({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:$e(e[0]),text:$e(e[1]),script:$e(e[2]),scriptscript:$e(e[3])}},htmlBuilder:(r,e)=>{var t=Ep(r,e),n=_e(t,e,!1);return R.makeFragment(n)},mathmlBuilder:(r,e)=>{var t=Ep(r,e);return Wr(t,e)}});var Ap=(r,e,t,n,i,s,o)=>{r=R.makeSpan([],[r]);var a=t&&xe.isCharacterBox(t),l,c;if(e){var u=be(e,n.havingStyle(i.sup()),n);c={elem:u,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-u.depth)}}if(t){var d=be(t,n.havingStyle(i.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var f=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;h=R.makeVList({positionType:"bottom",positionData:f,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:G(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:G(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(l){var m=r.height-o;h=R.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:G(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r}]},n)}else if(c){var y=r.depth+o;h=R.makeVList({positionType:"bottom",positionData:y,children:[{type:"elem",elem:r},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:G(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return r;var v=[h];if(l&&s!==0&&!a){var x=R.makeSpan(["mspace"],[],n);x.style.marginRight=G(s),v.unshift(x)}return R.makeSpan(["mop","op-limits"],v,n)},Op=["\\smallint"],Un=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=fe(r.base,"op"),i=!0):s=fe(r,"op");var o=e.style,a=!1;o.size===ae.DISPLAY.size&&s.symbol&&!Op.includes(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",u="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(u=s.name.slice(1),s.name=u==="oiint"?"\\iint":"\\iiint"),l=R.makeSymbol(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),u.length>0){var d=l.italic,h=R.staticSvg(u+"Size"+(a?"2":"1"),e);l=R.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:a?.08:0}]},e),s.name="\\"+u,l.classes.unshift("mop"),l.italic=d}}else if(s.body){var f=_e(s.body,e,!0);f.length===1&&f[0]instanceof Ot?(l=f[0],l.classes[0]="mop"):l=R.makeSpan(["mop"],f,e)}else{for(var m=[],y=1;y<s.name.length;y++)m.push(R.mathsym(s.name[y],s.mode,e));l=R.makeSpan(["mop"],m,e)}var v=0,x=0;return(l instanceof Ot||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(v=(l.height-l.depth)/2-e.fontMetrics().axisHeight,x=l.italic),i?Ap(l,t,n,e,o,x,v):(v&&(l.style.position="relative",l.style.top=G(v)),l)},$i=(r,e)=>{var t;if(r.symbol)t=new wt("mo",[Nt(r.name,r.mode)]),Op.includes(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new wt("mo",ft(r.body,e));else{t=new wt("mi",[new Wt(r.name.slice(1))]);var n=new wt("mo",[Nt("⁡","text")]);r.parentIsSupSub?t=new wt("mrow",[t,n]):t=Wf([t,n])}return t},I8={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Z({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=n;return i.length===1&&(i=I8[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:$e(n)}},htmlBuilder:Un,mathmlBuilder:$i});var R8={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Z({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"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Un,mathmlBuilder:$i}),Z({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=R8[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Un,mathmlBuilder:$i});var Np=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=fe(r.base,"operatorname"),i=!0):s=fe(r,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(d=>{var h=d.text;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=_e(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof Ot&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=R.makeSpan(["mop"],l,e)}else o=R.makeSpan(["mop"],[],e);return i?Ap(o,t,n,e,e.style,0,0):o},P8=(r,e)=>{for(var t=ft(r.body,e.withFont("mathrm")),n=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof _.SpaceNode))if(s instanceof _.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof _.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(u=>u.toText()).join("");t=[new _.TextNode(a)]}var l=new _.MathNode("mi",t);l.setAttribute("mathvariant","normal");var c=new _.MathNode("mo",[Nt("⁡","text")]);return r.parentIsSupSub?new _.MathNode("mrow",[l,c]):_.newDocumentFragment([l,c])};Z({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"operatorname",mode:t.mode,body:$e(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Np,mathmlBuilder:P8}),S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),bn({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?R.makeFragment(_e(r.body,e,!1)):R.makeSpan(["mord"],_e(r.body,e,!0),e)},mathmlBuilder(r,e){return Wr(r.body,e,!0)}}),Z({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=be(r.body,e.havingCrampedStyle()),n=R.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},e);return R.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(r,e){var t=new _.MathNode("mo",[new _.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new _.MathNode("mover",[Te(r.body,e),t]);return n.setAttribute("accent","true"),n}}),Z({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:$e(n)}},htmlBuilder:(r,e)=>{var t=_e(r.body,e.withPhantom(),!1);return R.makeFragment(t)},mathmlBuilder:(r,e)=>{var t=ft(r.body,e);return new _.MathNode("mphantom",t)}}),Z({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"hphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=R.makeSpan([],[be(r.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var n=0;n<t.children.length;n++)t.children[n].height=0,t.children[n].depth=0;return t=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),R.makeSpan(["mord"],[t],e)},mathmlBuilder:(r,e)=>{var t=ft($e(r.body),e),n=new _.MathNode("mphantom",t),i=new _.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),Z({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=R.makeSpan(["inner"],[be(r.body,e.withPhantom())]),n=R.makeSpan(["fix"],[]);return R.makeSpan(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=ft($e(r.body),e),n=new _.MathNode("mphantom",t),i=new _.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}}),Z({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=fe(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:i}},htmlBuilder(r,e){var t=be(r.body,e),n=ze(r.dy,e);return R.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){var t=new _.MathNode("mpadded",[Te(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}}),Z({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}}),Z({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,i=t[0],s=fe(e[0],"size"),o=fe(e[1],"size");return{type:"rule",mode:n.mode,shift:i&&fe(i,"size").value,width:s.value,height:o.value}},htmlBuilder(r,e){var t=R.makeSpan(["mord","rule"],[],e),n=ze(r.width,e),i=ze(r.height,e),s=r.shift?ze(r.shift,e):0;return t.style.borderRightWidth=G(n),t.style.borderTopWidth=G(i),t.style.bottom=G(s),t.width=n,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=ze(r.width,e),n=ze(r.height,e),i=r.shift?ze(r.shift,e):0,s=e.color&&e.getColor()||"black",o=new _.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",G(t)),o.setAttribute("height",G(n));var a=new _.MathNode("mpadded",[o]);return i>=0?a.setAttribute("height",G(i)):(a.setAttribute("height",G(i)),a.setAttribute("depth",G(-i))),a.setAttribute("voffset",G(i)),a}});function Dp(r,e,t){for(var n=_e(r,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<n.length;s++){var o=n[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[s].classes,e.sizingClasses(t)):n[s].classes[o+1]==="reset-size"+e.size&&(n[s].classes[o+1]="reset-size"+t.size),n[s].height*=i,n[s].depth*=i}return R.makeFragment(n)}var zp=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],L8=(r,e)=>{var t=e.havingSize(r.size);return Dp(r.body,t,e)};Z({type:"sizing",names:zp,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:zp.indexOf(n)+1,body:s}},htmlBuilder:L8,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=ft(r.body,t),i=new _.MathNode("mstyle",n);return i.setAttribute("mathsize",G(t.sizeMultiplier)),i}}),Z({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,i=!1,s=!1,o=t[0]&&fe(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var c=o.body[l];if(a=c.text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:n.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(r,e)=>{var t=R.makeSpan([],[be(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0,t.children))for(var n=0;n<t.children.length;n++)t.children[n].height=0;if(r.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return R.makeSpan(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new _.MathNode("mpadded",[Te(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}}),Z({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,i=t[0],s=e[0];return{type:"sqrt",mode:n.mode,body:s,index:i}},htmlBuilder(r,e){var t=be(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=R.wrapFragment(t,e);var n=e.fontMetrics(),i=n.defaultRuleThickness,s=i;e.style.id<ae.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=t.height+t.depth+o+i,{span:l,ruleWidth:c,advanceWidth:u}=gr.sqrtImage(a,e),d=l.height-c;d>t.height+t.depth+o&&(o=(o+d-t.height-t.depth)/2);var h=l.height-t.height-o-c;t.style.paddingLeft=G(u);var f=R.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+h)},{type:"elem",elem:l},{type:"kern",size:c}]},e);if(r.index){var m=e.havingStyle(ae.SCRIPTSCRIPT),y=be(r.index,m,e),v=.6*(f.height-f.depth),x=R.makeVList({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]},e),T=R.makeSpan(["root"],[x]);return R.makeSpan(["mord","sqrt"],[T,f],e)}else return R.makeSpan(["mord","sqrt"],[f],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new _.MathNode("mroot",[Te(t,e),Te(n,e)]):new _.MathNode("msqrt",[Te(t,e)])}});var Ip={display:ae.DISPLAY,text:ae.TEXT,script:ae.SCRIPT,scriptscript:ae.SCRIPTSCRIPT};Z({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(r,e){var t=Ip[r.style],n=e.havingStyle(t).withFont("");return Dp(r.body,n,e)},mathmlBuilder(r,e){var t=Ip[r.style],n=e.havingStyle(t),i=ft(r.body,n),s=new _.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var B8=function(e,t){var n=e.base;if(n)if(n.type==="op"){var i=n.limits&&(t.style.size===ae.DISPLAY.size||n.alwaysHandleSupSub);return i?Un:null}else if(n.type==="operatorname"){var s=n.alwaysHandleSupSub&&(t.style.size===ae.DISPLAY.size||n.limits);return s?Np:null}else{if(n.type==="accent")return xe.isCharacterBox(n.base)?Hl:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?Cp:null}else return null}else return null};bn({type:"supsub",htmlBuilder(r,e){var t=B8(r,e);if(t)return t(r,e);var{base:n,sup:i,sub:s}=r,o=be(n,e),a,l,c=e.fontMetrics(),u=0,d=0,h=n&&xe.isCharacterBox(n);if(i){var f=e.havingStyle(e.style.sup());a=be(i,f,e),h||(u=o.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(s){var m=e.havingStyle(e.style.sub());l=be(s,m,e),h||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/e.sizeMultiplier)}var y;e.style===ae.DISPLAY?y=c.sup1:e.style.cramped?y=c.sup3:y=c.sup2;var v=e.sizeMultiplier,x=G(.5/c.ptPerEm/v),T=null;if(l){var D=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof Ot||D)&&(T=G(-o.italic))}var P;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var E=c.defaultRuleThickness,N=4*E;if(u-a.depth-(l.height-d)<N){d=N-(u-a.depth)+l.height;var O=.8*c.xHeight-(u-a.depth);O>0&&(u+=O,d-=O)}var $=[{type:"elem",elem:l,shift:d,marginRight:x,marginLeft:T},{type:"elem",elem:a,shift:-u,marginRight:x}];P=R.makeVList({positionType:"individualShift",children:$},e)}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var F=[{type:"elem",elem:l,marginLeft:T,marginRight:x}];P=R.makeVList({positionType:"shift",positionData:d,children:F},e)}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),P=R.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:x}]},e);else throw new Error("supsub must have either sup or sub.");var q=Rl(o,"right")||"mord";return R.makeSpan([q],[o,R.makeSpan(["msupsub"],[P])],e)},mathmlBuilder(r,e){var t=!1,n,i;r.base&&r.base.type==="horizBrace"&&(i=!!r.sup,i===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var s=[Te(r.base,e)];r.sub&&s.push(Te(r.sub,e)),r.sup&&s.push(Te(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var c=r.base;c&&c.type==="op"&&c.limits&&e.style===ae.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===ae.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===ae.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===ae.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===ae.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===ae.DISPLAY)?o="mover":o="msup"}return new _.MathNode(o,s)}}),bn({type:"atom",htmlBuilder(r,e){return R.mathsym(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new _.MathNode("mo",[Nt(r.text,r.mode)]);if(r.family==="bin"){var n=Bl(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var Rp={mi:"italic",mn:"normal",mtext:"normal"};bn({type:"mathord",htmlBuilder(r,e){return R.makeOrd(r,e,"mathord")},mathmlBuilder(r,e){var t=new _.MathNode("mi",[Nt(r.text,r.mode,e)]),n=Bl(r,e)||"italic";return n!==Rp[t.type]&&t.setAttribute("mathvariant",n),t}}),bn({type:"textord",htmlBuilder(r,e){return R.makeOrd(r,e,"textord")},mathmlBuilder(r,e){var t=Nt(r.text,r.mode,e),n=Bl(r,e)||"normal",i;return r.mode==="text"?i=new _.MathNode("mtext",[t]):/[0-9]/.test(r.text)?i=new _.MathNode("mn",[t]):r.text==="\\prime"?i=new _.MathNode("mo",[t]):i=new _.MathNode("mi",[t]),n!==Rp[i.type]&&i.setAttribute("mathvariant",n),i}});var r0={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},n0={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};bn({type:"spacing",htmlBuilder(r,e){if(n0.hasOwnProperty(r.text)){var t=n0[r.text].className||"";if(r.mode==="text"){var n=R.makeOrd(r,e,"textord");return n.classes.push(t),n}else return R.makeSpan(["mspace",t],[R.mathsym(r.text,r.mode,e)],e)}else{if(r0.hasOwnProperty(r.text))return R.makeSpan(["mspace",r0[r.text]],[],e);throw new U('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(n0.hasOwnProperty(r.text))t=new _.MathNode("mtext",[new _.TextNode(" ")]);else{if(r0.hasOwnProperty(r.text))return new _.MathNode("mspace");throw new U('Unknown type of space "'+r.text+'"')}return t}});var Pp=()=>{var r=new _.MathNode("mtd",[]);return r.setAttribute("width","50%"),r};bn({type:"tag",mathmlBuilder(r,e){var t=new _.MathNode("mtable",[new _.MathNode("mtr",[Pp(),new _.MathNode("mtd",[Wr(r.body,e)]),Pp(),new _.MathNode("mtd",[Wr(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var Lp={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Bp={"\\textbf":"textbf","\\textmd":"textmd"},F8={"\\textit":"textit","\\textup":"textup"},Fp=(r,e)=>{var t=r.font;if(t){if(Lp[t])return e.withTextFontFamily(Lp[t]);if(Bp[t])return e.withTextFontWeight(Bp[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(F8[t])};Z({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"text",mode:t.mode,body:$e(i),font:n}},htmlBuilder(r,e){var t=Fp(r,e),n=_e(r.body,t,!0);return R.makeSpan(["mord","text"],n,t)},mathmlBuilder(r,e){var t=Fp(r,e);return Wr(r.body,t)}}),Z({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=be(r.body,e),n=R.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=R.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return R.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(r,e){var t=new _.MathNode("mo",[new _.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new _.MathNode("munder",[Te(r.body,e),t]);return n.setAttribute("accentunder","true"),n}}),Z({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=be(r.body,e),n=e.fontMetrics().axisHeight,i=.5*(t.height-n-(t.depth+n));return R.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){return new _.MathNode("mpadded",[Te(r.body,e)],["vcenter"])}}),Z({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new U("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=$p(r),n=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),n.push(R.makeSymbol(o,"Typewriter-Regular",r.mode,i,["mord","texttt"]))}return R.makeSpan(["mord","text"].concat(i.sizingClasses(e)),R.tryCombineChars(n),i)},mathmlBuilder(r,e){var t=new _.TextNode($p(r)),n=new _.MathNode("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});var $p=r=>r.body.replace(/ /g,r.star?"␣":" "),Kr=_f,Hp=`[ \r
382
+ ]`,$8="\\\\[a-zA-Z@]+",H8="\\\\[^\uD800-\uDFFF]",V8="("+$8+")"+Hp+"*",q8=`\\\\(
383
383
  |[ \r ]+
384
- ?)[ \r ]*`,i0="[̀-ͯ]",_8=new RegExp(i0+"+$"),j8="("+$p+"+)|"+(q8+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(i0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(i0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+V8)+("|"+H8+")");class Hp{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(j8,"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 bt("EOF",new dt(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new U("Unexpected character: '"+e[t]+"'",new bt(e[t],new dt(this,t,t+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
385
- `,this.tokenRegex.lastIndex);return s===-1?(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=s+1,this.lex()}return new bt(i,new dt(this,t,this.tokenRegex.lastIndex))}}class U8{constructor(e,t){e===void 0&&(e={}),t===void 0&&(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(this.undefStack.length===0)throw new U("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)&&(e[t]==null?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){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var W8=mp;S("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}}),S("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}}),S("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}}),S("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}}),S("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),S("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Vp={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(r){var e=r.popToken(),t,n="";if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new U("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=Vp[e.text],n==null||n>=t)throw new U("Invalid base-"+t+" digit "+e.text);for(var i;(i=Vp[r.future().text])!=null&&i<t;)n*=t,n+=i,r.popToken()}return"\\@char{"+n+"}"});var s0=(r,e,t,n)=>{var i=r.consumeArg().tokens;if(i.length!==1)throw new U("\\newcommand's first argument must be a macro name");var s=i[0].text,o=r.isDefined(s);if(o&&!e)throw new U("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new U("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=r.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=r.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new U("Invalid number of arguments: "+l);a=parseInt(l),i=r.consumeArg().tokens}return o&&n||r.macros.set(s,{tokens:i,numArgs:a}),""};S("\\newcommand",r=>s0(r,!1,!0,!1)),S("\\renewcommand",r=>s0(r,!0,!1,!1)),S("\\providecommand",r=>s0(r,!0,!0,!0)),S("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""}),S("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""}),S("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),Kr[t],Ee.math[t],Ee.text[t]),""}),S("\\bgroup","{"),S("\\egroup","}"),S("~","\\nobreakspace"),S("\\lq","`"),S("\\rq","'"),S("\\aa","\\r a"),S("\\AA","\\r A"),S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),S("ℬ","\\mathscr{B}"),S("ℰ","\\mathscr{E}"),S("ℱ","\\mathscr{F}"),S("ℋ","\\mathscr{H}"),S("ℐ","\\mathscr{I}"),S("ℒ","\\mathscr{L}"),S("ℳ","\\mathscr{M}"),S("ℛ","\\mathscr{R}"),S("ℭ","\\mathfrak{C}"),S("ℌ","\\mathfrak{H}"),S("ℨ","\\mathfrak{Z}"),S("\\Bbbk","\\Bbb{k}"),S("·","\\cdotp"),S("\\llap","\\mathllap{\\textrm{#1}}"),S("\\rlap","\\mathrlap{\\textrm{#1}}"),S("\\clap","\\mathclap{\\textrm{#1}}"),S("\\mathstrut","\\vphantom{(}"),S("\\underbar","\\underline{\\text{#1}}"),S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),S("\\ne","\\neq"),S("≠","\\neq"),S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),S("∉","\\notin"),S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),S("⟂","\\perp"),S("‼","\\mathclose{!\\mkern-0.8mu!}"),S("∌","\\notni"),S("⌜","\\ulcorner"),S("⌝","\\urcorner"),S("⌞","\\llcorner"),S("⌟","\\lrcorner"),S("©","\\copyright"),S("®","\\textregistered"),S("️","\\textregistered"),S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),S("⋮","\\vdots"),S("\\varGamma","\\mathit{\\Gamma}"),S("\\varDelta","\\mathit{\\Delta}"),S("\\varTheta","\\mathit{\\Theta}"),S("\\varLambda","\\mathit{\\Lambda}"),S("\\varXi","\\mathit{\\Xi}"),S("\\varPi","\\mathit{\\Pi}"),S("\\varSigma","\\mathit{\\Sigma}"),S("\\varUpsilon","\\mathit{\\Upsilon}"),S("\\varPhi","\\mathit{\\Phi}"),S("\\varPsi","\\mathit{\\Psi}"),S("\\varOmega","\\mathit{\\Omega}"),S("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),S("\\boxed","\\fbox{$\\displaystyle{#1}$}"),S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),S("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var qp={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};S("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in qp?e=qp[t]:(t.slice(0,4)==="\\not"||t in Ee.math&&["bin","rel"].includes(Ee.math[t].group))&&(e="\\dotsb"),e});var o0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(r){var e=r.future().text;return e in o0?"\\ldots\\,":"\\ldots"}),S("\\dotsc",function(r){var e=r.future().text;return e in o0&&e!==","?"\\ldots\\,":"\\ldots"}),S("\\cdots",function(r){var e=r.future().text;return e in o0?"\\@cdots\\,":"\\@cdots"}),S("\\dotsb","\\cdots"),S("\\dotsm","\\cdots"),S("\\dotsi","\\!\\cdots"),S("\\dotsx","\\ldots\\,"),S("\\DOTSI","\\relax"),S("\\DOTSB","\\relax"),S("\\DOTSX","\\relax"),S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),S("\\,","\\tmspace+{3mu}{.1667em}"),S("\\thinspace","\\,"),S("\\>","\\mskip{4mu}"),S("\\:","\\tmspace+{4mu}{.2222em}"),S("\\medspace","\\:"),S("\\;","\\tmspace+{5mu}{.2777em}"),S("\\thickspace","\\;"),S("\\!","\\tmspace-{3mu}{.1667em}"),S("\\negthinspace","\\!"),S("\\negmedspace","\\tmspace-{4mu}{.2222em}"),S("\\negthickspace","\\tmspace-{5mu}{.277em}"),S("\\enspace","\\kern.5em "),S("\\enskip","\\hskip.5em\\relax"),S("\\quad","\\hskip1em\\relax"),S("\\qquad","\\hskip2em\\relax"),S("\\tag","\\@ifstar\\tag@literal\\tag@paren"),S("\\tag@paren","\\tag@literal{({#1})}"),S("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new U("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),S("\\newline","\\\\\\relax"),S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var _p=G(Ut["Main-Regular"][84][1]-.7*Ut["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+_p+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}"),S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+_p+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}"),S("\\hspace","\\@ifstar\\@hspacer\\@hspace"),S("\\@hspace","\\hskip #1\\relax"),S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),S("\\ordinarycolon",":"),S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),S("∷","\\dblcolon"),S("∹","\\eqcolon"),S("≔","\\coloneqq"),S("≕","\\eqqcolon"),S("⩴","\\Coloneqq"),S("\\ratio","\\vcentcolon"),S("\\coloncolon","\\dblcolon"),S("\\colonequals","\\coloneqq"),S("\\coloncolonequals","\\Coloneqq"),S("\\equalscolon","\\eqqcolon"),S("\\equalscoloncolon","\\Eqqcolon"),S("\\colonminus","\\coloneq"),S("\\coloncolonminus","\\Coloneq"),S("\\minuscolon","\\eqcolon"),S("\\minuscoloncolon","\\Eqcolon"),S("\\coloncolonapprox","\\Colonapprox"),S("\\coloncolonsim","\\Colonsim"),S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),S("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),S("\\imath","\\html@mathml{\\@imath}{ı}"),S("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),S("⟦","\\llbracket"),S("⟧","\\rrbracket"),S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),S("⦃","\\lBrace"),S("⦄","\\rBrace"),S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),S("⦵","\\minuso"),S("\\darr","\\downarrow"),S("\\dArr","\\Downarrow"),S("\\Darr","\\Downarrow"),S("\\lang","\\langle"),S("\\rang","\\rangle"),S("\\uarr","\\uparrow"),S("\\uArr","\\Uparrow"),S("\\Uarr","\\Uparrow"),S("\\N","\\mathbb{N}"),S("\\R","\\mathbb{R}"),S("\\Z","\\mathbb{Z}"),S("\\alef","\\aleph"),S("\\alefsym","\\aleph"),S("\\Alpha","\\mathrm{A}"),S("\\Beta","\\mathrm{B}"),S("\\bull","\\bullet"),S("\\Chi","\\mathrm{X}"),S("\\clubs","\\clubsuit"),S("\\cnums","\\mathbb{C}"),S("\\Complex","\\mathbb{C}"),S("\\Dagger","\\ddagger"),S("\\diamonds","\\diamondsuit"),S("\\empty","\\emptyset"),S("\\Epsilon","\\mathrm{E}"),S("\\Eta","\\mathrm{H}"),S("\\exist","\\exists"),S("\\harr","\\leftrightarrow"),S("\\hArr","\\Leftrightarrow"),S("\\Harr","\\Leftrightarrow"),S("\\hearts","\\heartsuit"),S("\\image","\\Im"),S("\\infin","\\infty"),S("\\Iota","\\mathrm{I}"),S("\\isin","\\in"),S("\\Kappa","\\mathrm{K}"),S("\\larr","\\leftarrow"),S("\\lArr","\\Leftarrow"),S("\\Larr","\\Leftarrow"),S("\\lrarr","\\leftrightarrow"),S("\\lrArr","\\Leftrightarrow"),S("\\Lrarr","\\Leftrightarrow"),S("\\Mu","\\mathrm{M}"),S("\\natnums","\\mathbb{N}"),S("\\Nu","\\mathrm{N}"),S("\\Omicron","\\mathrm{O}"),S("\\plusmn","\\pm"),S("\\rarr","\\rightarrow"),S("\\rArr","\\Rightarrow"),S("\\Rarr","\\Rightarrow"),S("\\real","\\Re"),S("\\reals","\\mathbb{R}"),S("\\Reals","\\mathbb{R}"),S("\\Rho","\\mathrm{P}"),S("\\sdot","\\cdot"),S("\\sect","\\S"),S("\\spades","\\spadesuit"),S("\\sub","\\subset"),S("\\sube","\\subseteq"),S("\\supe","\\supseteq"),S("\\Tau","\\mathrm{T}"),S("\\thetasym","\\vartheta"),S("\\weierp","\\wp"),S("\\Zeta","\\mathrm{Z}"),S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),S("\\bra","\\mathinner{\\langle{#1}|}"),S("\\ket","\\mathinner{|{#1}\\rangle}"),S("\\braket","\\mathinner{\\langle{#1}\\rangle}"),S("\\Bra","\\left\\langle#1\\right|"),S("\\Ket","\\left|#1\\right\\rangle");var jp=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{r&&(h.macros.set("|",o),i.length&&h.macros.set("\\|",a));var f=d;if(!d&&i.length){var m=h.future();m.text==="|"&&(h.popToken(),f=!0)}return{tokens:f?i:n,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...t]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};S("\\bra@ket",jp(!1)),S("\\bra@set",jp(!0)),S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),S("\\angln","{\\angl n}"),S("\\blue","\\textcolor{##6495ed}{#1}"),S("\\orange","\\textcolor{##ffa500}{#1}"),S("\\pink","\\textcolor{##ff00af}{#1}"),S("\\red","\\textcolor{##df0030}{#1}"),S("\\green","\\textcolor{##28ae7b}{#1}"),S("\\gray","\\textcolor{gray}{#1}"),S("\\purple","\\textcolor{##9d38bd}{#1}"),S("\\blueA","\\textcolor{##ccfaff}{#1}"),S("\\blueB","\\textcolor{##80f6ff}{#1}"),S("\\blueC","\\textcolor{##63d9ea}{#1}"),S("\\blueD","\\textcolor{##11accd}{#1}"),S("\\blueE","\\textcolor{##0c7f99}{#1}"),S("\\tealA","\\textcolor{##94fff5}{#1}"),S("\\tealB","\\textcolor{##26edd5}{#1}"),S("\\tealC","\\textcolor{##01d1c1}{#1}"),S("\\tealD","\\textcolor{##01a995}{#1}"),S("\\tealE","\\textcolor{##208170}{#1}"),S("\\greenA","\\textcolor{##b6ffb0}{#1}"),S("\\greenB","\\textcolor{##8af281}{#1}"),S("\\greenC","\\textcolor{##74cf70}{#1}"),S("\\greenD","\\textcolor{##1fab54}{#1}"),S("\\greenE","\\textcolor{##0d923f}{#1}"),S("\\goldA","\\textcolor{##ffd0a9}{#1}"),S("\\goldB","\\textcolor{##ffbb71}{#1}"),S("\\goldC","\\textcolor{##ff9c39}{#1}"),S("\\goldD","\\textcolor{##e07d10}{#1}"),S("\\goldE","\\textcolor{##a75a05}{#1}"),S("\\redA","\\textcolor{##fca9a9}{#1}"),S("\\redB","\\textcolor{##ff8482}{#1}"),S("\\redC","\\textcolor{##f9685d}{#1}"),S("\\redD","\\textcolor{##e84d39}{#1}"),S("\\redE","\\textcolor{##bc2612}{#1}"),S("\\maroonA","\\textcolor{##ffbde0}{#1}"),S("\\maroonB","\\textcolor{##ff92c6}{#1}"),S("\\maroonC","\\textcolor{##ed5fa6}{#1}"),S("\\maroonD","\\textcolor{##ca337c}{#1}"),S("\\maroonE","\\textcolor{##9e034e}{#1}"),S("\\purpleA","\\textcolor{##ddd7ff}{#1}"),S("\\purpleB","\\textcolor{##c6b9fc}{#1}"),S("\\purpleC","\\textcolor{##aa87ff}{#1}"),S("\\purpleD","\\textcolor{##7854ab}{#1}"),S("\\purpleE","\\textcolor{##543b78}{#1}"),S("\\mintA","\\textcolor{##f5f9e8}{#1}"),S("\\mintB","\\textcolor{##edf2df}{#1}"),S("\\mintC","\\textcolor{##e0e5cc}{#1}"),S("\\grayA","\\textcolor{##f6f7f7}{#1}"),S("\\grayB","\\textcolor{##f0f1f2}{#1}"),S("\\grayC","\\textcolor{##e3e5e6}{#1}"),S("\\grayD","\\textcolor{##d6d8da}{#1}"),S("\\grayE","\\textcolor{##babec2}{#1}"),S("\\grayF","\\textcolor{##888d93}{#1}"),S("\\grayG","\\textcolor{##626569}{#1}"),S("\\grayH","\\textcolor{##3b3e40}{#1}"),S("\\grayI","\\textcolor{##21242c}{#1}"),S("\\kaBlue","\\textcolor{##314453}{#1}"),S("\\kaGreen","\\textcolor{##71B307}{#1}");var Up={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class G8{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new U8(W8,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new Hp(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:t,end:n}=this.consumeArg());return this.pushToken(new bt("EOF",n.loc)),this.pushTokens(i),new bt("",dt.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new U("Extra }",s)}else if(s.text==="EOF")throw new U("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",s);if(e&&n)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new U("The length of delimiters doesn't match the number of args!");for(var n=t[0],i=0;i<n.length;i++){var s=this.popToken();if(n[i]!==s.text)throw new U("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new U("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,i=t.noexpand?null:this._getExpansion(n);if(i==null||e&&i.unexpandable){if(e&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new U("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new U("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new U("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new bt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var a=new Hp(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||Kr.hasOwnProperty(e)||Ee.math.hasOwnProperty(e)||Ee.text.hasOwnProperty(e)||Up.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Kr.hasOwnProperty(e)&&!Kr[e].primitive}}var Wp=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,go=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),a0={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Gp={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class yo{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new G8(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new U("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new bt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(yo.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&Kr[i.text]&&Kr[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;n.push(s)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new U("only one infix operator per group",e[i].token);t=i,n=e[i].replaceWith}if(t!==-1&&n){var s,o,a=e.slice(0,t),l=e.slice(t+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var c;return n==="\\\\abovefrac"?c=this.callFunction(n,[s,e[t],o],[]):c=this.callFunction(n,[s,o],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new U("Expected group after '"+n+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new U("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(n)throw new U("Double superscript",s);n=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new U("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(n)throw new U("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(go[s.text]){var c=Wp.test(s.text),u=[];for(u.push(new bt(go[s.text])),this.consume();;){var d=this.fetch().text;if(!go[d]||Wp.test(d)!==c)break;u.unshift(new bt(go[d])),this.consume()}var h=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:h}:n={type:"ordgroup",mode:"math",body:h}}else break}return n||i?{type:"supsub",mode:this.mode,base:t,sup:n,sub:i}:t}parseFunction(e,t){var n=this.fetch(),i=n.text,s=Kr[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new U("Got function '"+i+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!s.allowedInText)throw new U("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&s.allowedInMath===!1)throw new U("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,n,e)}callFunction(e,t,n,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=Kr[e];if(a&&a.handler)return a.handler(o,t,n);throw new U("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;(t.primitive&&a==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new U("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",n);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new U("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new U("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new U("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n=this.fetch(),i=n,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new U("Invalid "+t+": '"+n.text+"'",n);return n.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new U("Invalid color: '"+t.text+"'",t);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new U("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!Ef(s))throw new U("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var n=this.fetch(),i=n.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:dt.range(n,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!Up.hasOwnProperty(i)){if(this.settings.throwOnError)throw new U("Undefined control sequence: "+i,n);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var i=e[n],s=i.text;s==="-"&&e[n+1].text==="-"&&(n+1<t&&e[n+2].text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:dt.range(i,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:dt.range(i,e[n+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[n+1].text===s&&(e.splice(n,2,{type:"textord",mode:"text",loc:dt.range(i,e[n+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new U(`\\verb assertion failed --
386
- please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}Gp.hasOwnProperty(t[0])&&!Ee[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Gp[t[0]]+t.slice(1));var s=_8.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(Ee[this.mode][t]){this.settings.strict&&this.mode==="math"&&Dl.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ee[this.mode][t].group,l=dt.range(e),c;if(Pv.hasOwnProperty(a)){var u=a;c={type:"atom",mode:this.mode,family:u,loc:l,text:t}}else c={type:a,mode:this.mode,loc:l,text:t};o=c}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Sf(t.charCodeAt(0))?this.mode==="math"&&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:dt.range(e),text:t};else return null;if(this.consume(),s)for(var d=0;d<s[0].length;d++){var h=s[0][d];if(!a0[h])throw new U("Unknown accent ' "+h+"'",e);var f=a0[h][this.mode]||a0[h].text;if(!f)throw new U("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:dt.range(e),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}}yo.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var l0=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new yo(e,t);delete n.gullet.macros.current["\\df@tag"];var i=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 U("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new bt("\\df@tag")])}]}return i},Kp=function(e,t,n){t.textContent="";var i=c0(e,n).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Kp=function(){throw new U("KaTeX doesn't work in quirks mode.")});var K8=function(e,t){var n=c0(e,t).toMarkup();return n},J8=function(e,t){var n=new xl(t);return l0(e,n)},Jp=function(e,t,n){if(n.throwOnError||!(e instanceof U))throw e;var i=R.makeSpan(["katex-error"],[new Ot(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+n.errorColor),i},c0=function(e,t){var n=new xl(t);try{var i=l0(e,n);return i8(i,e,n)}catch(s){return Jp(s,e,n)}},X8=function(e,t){var n=new xl(t);try{var i=l0(e,n);return s8(i,e,n)}catch(s){return Jp(s,e,n)}},Y8="0.16.27",Z8={Span:Pi,Anchor:Cl,SymbolNode:Ot,SvgNode:dr,PathNode:jr,LineNode:El},Wn={version:Y8,render:Kp,renderToString:K8,ParseError:U,SETTINGS_SCHEMA:Ks,__parse:J8,__renderToDomTree:c0,__renderToHTMLTree:X8,__setFontMetrics:Ev,__defineSymbol:p,__defineFunction:Z,__defineMacro:S,__domTree:Z8};const Q8=we.create({name:"m",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"m"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"inlineMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("span");t.classList.add("node-view","math"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<m>"+r.textContent+"</m>",i.contentEditable="true",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),eb=we.create({name:"me",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"me"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view","math"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.contentEditable="true",i.innerHTML="<md>"+r.textContent+"</md>",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),tb=we.create({name:"md",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"md"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view","math"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",i.contentEditable="true",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),rb=we.create({name:"ptxdoc",content:"title? (BasicBlock|block|rawptx|division)*",group:"root",selectable:!1,draggable:!1,defining:!1,parseHTML(){return[{tag:"ptxdoc"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"ptxdoc",label:"ptxdoc"},r),0]}}),nb=we.create({name:"introduction",content:"(BasicBlock|block|rawptx)*",group:"division introduction",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"introduction"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"introduction",label:"introduction"},r),0]},addInputRules(){return[it({find:new RegExp("^#intro\\s$"),type:this.type})]}}),ib=we.create({name:"part",content:"title ((introduction?|chapter+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"part"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"part",ptxtag:"part"},r),0]},addInputRules(){return[it({find:new RegExp("^#part\\s$"),type:this.type})]}}),sb=we.create({name:"chapter",content:"title ((introduction?|section+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"chapter"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"chapter",ptxtag:"chapter"},r),0]},addInputRules(){return[it({find:new RegExp("^#ch\\s$"),type:this.type})]}}),ob=we.create({name:"section",content:"title ((introduction?|subsection+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"section"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"section",ptxtag:"section"},r),0]},addInputRules(){return[it({find:new RegExp("^#sec\\s$"),type:this.type})]}}),ab=we.create({name:"subsection",content:"title (BasicBlock|block|rawptx)+",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"subsection"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",ye({class:"subsection",ptxtag:"subsection"},r),0]},addInputRules(){return[it({find:new RegExp("^#subsec\\s$"),type:this.type})]}}),lb=we.create({name:"worksheet",content:"title? ((introduction?)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"worksheet"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",ye({class:"worksheet",ptxtag:"worksheet"},r),0]},addInputRules(){return[it({find:new RegExp("^#ws\\s$"),type:this.type})]}}),cb=Se.create({name:"divisions",addExtensions(){return[nb,ib,sb,ob,ab,lb,rb]}});var ub=we.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),db=we.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",ye(this.options.HTMLAttributes,r)]},renderText(){return`
384
+ ?)[ \r ]*`,i0="[̀-ͯ]",_8=new RegExp(i0+"+$"),j8="("+Hp+"+)|"+(q8+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(i0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(i0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+V8)+("|"+H8+")");class Vp{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(j8,"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 bt("EOF",new dt(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new U("Unexpected character: '"+e[t]+"'",new bt(e[t],new dt(this,t,t+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
385
+ `,this.tokenRegex.lastIndex);return s===-1?(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=s+1,this.lex()}return new bt(i,new dt(this,t,this.tokenRegex.lastIndex))}}class U8{constructor(e,t){e===void 0&&(e={}),t===void 0&&(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(this.undefStack.length===0)throw new U("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)&&(e[t]==null?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){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var W8=gp;S("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}}),S("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}}),S("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}}),S("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}}),S("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),S("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var qp={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(r){var e=r.popToken(),t,n="";if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new U("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=qp[e.text],n==null||n>=t)throw new U("Invalid base-"+t+" digit "+e.text);for(var i;(i=qp[r.future().text])!=null&&i<t;)n*=t,n+=i,r.popToken()}return"\\@char{"+n+"}"});var s0=(r,e,t,n)=>{var i=r.consumeArg().tokens;if(i.length!==1)throw new U("\\newcommand's first argument must be a macro name");var s=i[0].text,o=r.isDefined(s);if(o&&!e)throw new U("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new U("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=r.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=r.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new U("Invalid number of arguments: "+l);a=parseInt(l),i=r.consumeArg().tokens}return o&&n||r.macros.set(s,{tokens:i,numArgs:a}),""};S("\\newcommand",r=>s0(r,!1,!0,!1)),S("\\renewcommand",r=>s0(r,!0,!1,!1)),S("\\providecommand",r=>s0(r,!0,!0,!0)),S("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""}),S("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""}),S("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),Kr[t],Ee.math[t],Ee.text[t]),""}),S("\\bgroup","{"),S("\\egroup","}"),S("~","\\nobreakspace"),S("\\lq","`"),S("\\rq","'"),S("\\aa","\\r a"),S("\\AA","\\r A"),S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),S("ℬ","\\mathscr{B}"),S("ℰ","\\mathscr{E}"),S("ℱ","\\mathscr{F}"),S("ℋ","\\mathscr{H}"),S("ℐ","\\mathscr{I}"),S("ℒ","\\mathscr{L}"),S("ℳ","\\mathscr{M}"),S("ℛ","\\mathscr{R}"),S("ℭ","\\mathfrak{C}"),S("ℌ","\\mathfrak{H}"),S("ℨ","\\mathfrak{Z}"),S("\\Bbbk","\\Bbb{k}"),S("·","\\cdotp"),S("\\llap","\\mathllap{\\textrm{#1}}"),S("\\rlap","\\mathrlap{\\textrm{#1}}"),S("\\clap","\\mathclap{\\textrm{#1}}"),S("\\mathstrut","\\vphantom{(}"),S("\\underbar","\\underline{\\text{#1}}"),S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),S("\\ne","\\neq"),S("≠","\\neq"),S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),S("∉","\\notin"),S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),S("⟂","\\perp"),S("‼","\\mathclose{!\\mkern-0.8mu!}"),S("∌","\\notni"),S("⌜","\\ulcorner"),S("⌝","\\urcorner"),S("⌞","\\llcorner"),S("⌟","\\lrcorner"),S("©","\\copyright"),S("®","\\textregistered"),S("️","\\textregistered"),S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),S("⋮","\\vdots"),S("\\varGamma","\\mathit{\\Gamma}"),S("\\varDelta","\\mathit{\\Delta}"),S("\\varTheta","\\mathit{\\Theta}"),S("\\varLambda","\\mathit{\\Lambda}"),S("\\varXi","\\mathit{\\Xi}"),S("\\varPi","\\mathit{\\Pi}"),S("\\varSigma","\\mathit{\\Sigma}"),S("\\varUpsilon","\\mathit{\\Upsilon}"),S("\\varPhi","\\mathit{\\Phi}"),S("\\varPsi","\\mathit{\\Psi}"),S("\\varOmega","\\mathit{\\Omega}"),S("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),S("\\boxed","\\fbox{$\\displaystyle{#1}$}"),S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),S("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var _p={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};S("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in _p?e=_p[t]:(t.slice(0,4)==="\\not"||t in Ee.math&&["bin","rel"].includes(Ee.math[t].group))&&(e="\\dotsb"),e});var o0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(r){var e=r.future().text;return e in o0?"\\ldots\\,":"\\ldots"}),S("\\dotsc",function(r){var e=r.future().text;return e in o0&&e!==","?"\\ldots\\,":"\\ldots"}),S("\\cdots",function(r){var e=r.future().text;return e in o0?"\\@cdots\\,":"\\@cdots"}),S("\\dotsb","\\cdots"),S("\\dotsm","\\cdots"),S("\\dotsi","\\!\\cdots"),S("\\dotsx","\\ldots\\,"),S("\\DOTSI","\\relax"),S("\\DOTSB","\\relax"),S("\\DOTSX","\\relax"),S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),S("\\,","\\tmspace+{3mu}{.1667em}"),S("\\thinspace","\\,"),S("\\>","\\mskip{4mu}"),S("\\:","\\tmspace+{4mu}{.2222em}"),S("\\medspace","\\:"),S("\\;","\\tmspace+{5mu}{.2777em}"),S("\\thickspace","\\;"),S("\\!","\\tmspace-{3mu}{.1667em}"),S("\\negthinspace","\\!"),S("\\negmedspace","\\tmspace-{4mu}{.2222em}"),S("\\negthickspace","\\tmspace-{5mu}{.277em}"),S("\\enspace","\\kern.5em "),S("\\enskip","\\hskip.5em\\relax"),S("\\quad","\\hskip1em\\relax"),S("\\qquad","\\hskip2em\\relax"),S("\\tag","\\@ifstar\\tag@literal\\tag@paren"),S("\\tag@paren","\\tag@literal{({#1})}"),S("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new U("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),S("\\newline","\\\\\\relax"),S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var jp=G(Ut["Main-Regular"][84][1]-.7*Ut["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+jp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}"),S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+jp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}"),S("\\hspace","\\@ifstar\\@hspacer\\@hspace"),S("\\@hspace","\\hskip #1\\relax"),S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),S("\\ordinarycolon",":"),S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),S("∷","\\dblcolon"),S("∹","\\eqcolon"),S("≔","\\coloneqq"),S("≕","\\eqqcolon"),S("⩴","\\Coloneqq"),S("\\ratio","\\vcentcolon"),S("\\coloncolon","\\dblcolon"),S("\\colonequals","\\coloneqq"),S("\\coloncolonequals","\\Coloneqq"),S("\\equalscolon","\\eqqcolon"),S("\\equalscoloncolon","\\Eqqcolon"),S("\\colonminus","\\coloneq"),S("\\coloncolonminus","\\Coloneq"),S("\\minuscolon","\\eqcolon"),S("\\minuscoloncolon","\\Eqcolon"),S("\\coloncolonapprox","\\Colonapprox"),S("\\coloncolonsim","\\Colonsim"),S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),S("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),S("\\imath","\\html@mathml{\\@imath}{ı}"),S("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),S("⟦","\\llbracket"),S("⟧","\\rrbracket"),S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),S("⦃","\\lBrace"),S("⦄","\\rBrace"),S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),S("⦵","\\minuso"),S("\\darr","\\downarrow"),S("\\dArr","\\Downarrow"),S("\\Darr","\\Downarrow"),S("\\lang","\\langle"),S("\\rang","\\rangle"),S("\\uarr","\\uparrow"),S("\\uArr","\\Uparrow"),S("\\Uarr","\\Uparrow"),S("\\N","\\mathbb{N}"),S("\\R","\\mathbb{R}"),S("\\Z","\\mathbb{Z}"),S("\\alef","\\aleph"),S("\\alefsym","\\aleph"),S("\\Alpha","\\mathrm{A}"),S("\\Beta","\\mathrm{B}"),S("\\bull","\\bullet"),S("\\Chi","\\mathrm{X}"),S("\\clubs","\\clubsuit"),S("\\cnums","\\mathbb{C}"),S("\\Complex","\\mathbb{C}"),S("\\Dagger","\\ddagger"),S("\\diamonds","\\diamondsuit"),S("\\empty","\\emptyset"),S("\\Epsilon","\\mathrm{E}"),S("\\Eta","\\mathrm{H}"),S("\\exist","\\exists"),S("\\harr","\\leftrightarrow"),S("\\hArr","\\Leftrightarrow"),S("\\Harr","\\Leftrightarrow"),S("\\hearts","\\heartsuit"),S("\\image","\\Im"),S("\\infin","\\infty"),S("\\Iota","\\mathrm{I}"),S("\\isin","\\in"),S("\\Kappa","\\mathrm{K}"),S("\\larr","\\leftarrow"),S("\\lArr","\\Leftarrow"),S("\\Larr","\\Leftarrow"),S("\\lrarr","\\leftrightarrow"),S("\\lrArr","\\Leftrightarrow"),S("\\Lrarr","\\Leftrightarrow"),S("\\Mu","\\mathrm{M}"),S("\\natnums","\\mathbb{N}"),S("\\Nu","\\mathrm{N}"),S("\\Omicron","\\mathrm{O}"),S("\\plusmn","\\pm"),S("\\rarr","\\rightarrow"),S("\\rArr","\\Rightarrow"),S("\\Rarr","\\Rightarrow"),S("\\real","\\Re"),S("\\reals","\\mathbb{R}"),S("\\Reals","\\mathbb{R}"),S("\\Rho","\\mathrm{P}"),S("\\sdot","\\cdot"),S("\\sect","\\S"),S("\\spades","\\spadesuit"),S("\\sub","\\subset"),S("\\sube","\\subseteq"),S("\\supe","\\supseteq"),S("\\Tau","\\mathrm{T}"),S("\\thetasym","\\vartheta"),S("\\weierp","\\wp"),S("\\Zeta","\\mathrm{Z}"),S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),S("\\bra","\\mathinner{\\langle{#1}|}"),S("\\ket","\\mathinner{|{#1}\\rangle}"),S("\\braket","\\mathinner{\\langle{#1}\\rangle}"),S("\\Bra","\\left\\langle#1\\right|"),S("\\Ket","\\left|#1\\right\\rangle");var Up=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{r&&(h.macros.set("|",o),i.length&&h.macros.set("\\|",a));var f=d;if(!d&&i.length){var m=h.future();m.text==="|"&&(h.popToken(),f=!0)}return{tokens:f?i:n,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...t]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};S("\\bra@ket",Up(!1)),S("\\bra@set",Up(!0)),S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),S("\\angln","{\\angl n}"),S("\\blue","\\textcolor{##6495ed}{#1}"),S("\\orange","\\textcolor{##ffa500}{#1}"),S("\\pink","\\textcolor{##ff00af}{#1}"),S("\\red","\\textcolor{##df0030}{#1}"),S("\\green","\\textcolor{##28ae7b}{#1}"),S("\\gray","\\textcolor{gray}{#1}"),S("\\purple","\\textcolor{##9d38bd}{#1}"),S("\\blueA","\\textcolor{##ccfaff}{#1}"),S("\\blueB","\\textcolor{##80f6ff}{#1}"),S("\\blueC","\\textcolor{##63d9ea}{#1}"),S("\\blueD","\\textcolor{##11accd}{#1}"),S("\\blueE","\\textcolor{##0c7f99}{#1}"),S("\\tealA","\\textcolor{##94fff5}{#1}"),S("\\tealB","\\textcolor{##26edd5}{#1}"),S("\\tealC","\\textcolor{##01d1c1}{#1}"),S("\\tealD","\\textcolor{##01a995}{#1}"),S("\\tealE","\\textcolor{##208170}{#1}"),S("\\greenA","\\textcolor{##b6ffb0}{#1}"),S("\\greenB","\\textcolor{##8af281}{#1}"),S("\\greenC","\\textcolor{##74cf70}{#1}"),S("\\greenD","\\textcolor{##1fab54}{#1}"),S("\\greenE","\\textcolor{##0d923f}{#1}"),S("\\goldA","\\textcolor{##ffd0a9}{#1}"),S("\\goldB","\\textcolor{##ffbb71}{#1}"),S("\\goldC","\\textcolor{##ff9c39}{#1}"),S("\\goldD","\\textcolor{##e07d10}{#1}"),S("\\goldE","\\textcolor{##a75a05}{#1}"),S("\\redA","\\textcolor{##fca9a9}{#1}"),S("\\redB","\\textcolor{##ff8482}{#1}"),S("\\redC","\\textcolor{##f9685d}{#1}"),S("\\redD","\\textcolor{##e84d39}{#1}"),S("\\redE","\\textcolor{##bc2612}{#1}"),S("\\maroonA","\\textcolor{##ffbde0}{#1}"),S("\\maroonB","\\textcolor{##ff92c6}{#1}"),S("\\maroonC","\\textcolor{##ed5fa6}{#1}"),S("\\maroonD","\\textcolor{##ca337c}{#1}"),S("\\maroonE","\\textcolor{##9e034e}{#1}"),S("\\purpleA","\\textcolor{##ddd7ff}{#1}"),S("\\purpleB","\\textcolor{##c6b9fc}{#1}"),S("\\purpleC","\\textcolor{##aa87ff}{#1}"),S("\\purpleD","\\textcolor{##7854ab}{#1}"),S("\\purpleE","\\textcolor{##543b78}{#1}"),S("\\mintA","\\textcolor{##f5f9e8}{#1}"),S("\\mintB","\\textcolor{##edf2df}{#1}"),S("\\mintC","\\textcolor{##e0e5cc}{#1}"),S("\\grayA","\\textcolor{##f6f7f7}{#1}"),S("\\grayB","\\textcolor{##f0f1f2}{#1}"),S("\\grayC","\\textcolor{##e3e5e6}{#1}"),S("\\grayD","\\textcolor{##d6d8da}{#1}"),S("\\grayE","\\textcolor{##babec2}{#1}"),S("\\grayF","\\textcolor{##888d93}{#1}"),S("\\grayG","\\textcolor{##626569}{#1}"),S("\\grayH","\\textcolor{##3b3e40}{#1}"),S("\\grayI","\\textcolor{##21242c}{#1}"),S("\\kaBlue","\\textcolor{##314453}{#1}"),S("\\kaGreen","\\textcolor{##71B307}{#1}");var Wp={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class G8{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new U8(W8,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new Vp(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:t,end:n}=this.consumeArg());return this.pushToken(new bt("EOF",n.loc)),this.pushTokens(i),new bt("",dt.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new U("Extra }",s)}else if(s.text==="EOF")throw new U("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",s);if(e&&n)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new U("The length of delimiters doesn't match the number of args!");for(var n=t[0],i=0;i<n.length;i++){var s=this.popToken();if(n[i]!==s.text)throw new U("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new U("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,i=t.noexpand?null:this._getExpansion(n);if(i==null||e&&i.unexpandable){if(e&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new U("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new U("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new U("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new bt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var a=new Vp(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||Kr.hasOwnProperty(e)||Ee.math.hasOwnProperty(e)||Ee.text.hasOwnProperty(e)||Wp.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Kr.hasOwnProperty(e)&&!Kr[e].primitive}}var Gp=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,go=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),a0={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Kp={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class yo{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new G8(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new U("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new bt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(yo.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&Kr[i.text]&&Kr[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;n.push(s)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new U("only one infix operator per group",e[i].token);t=i,n=e[i].replaceWith}if(t!==-1&&n){var s,o,a=e.slice(0,t),l=e.slice(t+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var c;return n==="\\\\abovefrac"?c=this.callFunction(n,[s,e[t],o],[]):c=this.callFunction(n,[s,o],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new U("Expected group after '"+n+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new U("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(n)throw new U("Double superscript",s);n=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new U("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(n)throw new U("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(go[s.text]){var c=Gp.test(s.text),u=[];for(u.push(new bt(go[s.text])),this.consume();;){var d=this.fetch().text;if(!go[d]||Gp.test(d)!==c)break;u.unshift(new bt(go[d])),this.consume()}var h=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:h}:n={type:"ordgroup",mode:"math",body:h}}else break}return n||i?{type:"supsub",mode:this.mode,base:t,sup:n,sub:i}:t}parseFunction(e,t){var n=this.fetch(),i=n.text,s=Kr[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new U("Got function '"+i+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!s.allowedInText)throw new U("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&s.allowedInMath===!1)throw new U("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,n,e)}callFunction(e,t,n,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=Kr[e];if(a&&a.handler)return a.handler(o,t,n);throw new U("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;(t.primitive&&a==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new U("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",n);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new U("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new U("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new U("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n=this.fetch(),i=n,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new U("Invalid "+t+": '"+n.text+"'",n);return n.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new U("Invalid color: '"+t.text+"'",t);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new U("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!Af(s))throw new U("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var n=this.fetch(),i=n.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:dt.range(n,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!Wp.hasOwnProperty(i)){if(this.settings.throwOnError)throw new U("Undefined control sequence: "+i,n);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var i=e[n],s=i.text;s==="-"&&e[n+1].text==="-"&&(n+1<t&&e[n+2].text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:dt.range(i,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:dt.range(i,e[n+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[n+1].text===s&&(e.splice(n,2,{type:"textord",mode:"text",loc:dt.range(i,e[n+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new U(`\\verb assertion failed --
386
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}Kp.hasOwnProperty(t[0])&&!Ee[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Kp[t[0]]+t.slice(1));var s=_8.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(Ee[this.mode][t]){this.settings.strict&&this.mode==="math"&&Dl.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ee[this.mode][t].group,l=dt.range(e),c;if(Pv.hasOwnProperty(a)){var u=a;c={type:"atom",mode:this.mode,family:u,loc:l,text:t}}else c={type:a,mode:this.mode,loc:l,text:t};o=c}else if(t.charCodeAt(0)>=128)this.settings.strict&&(kf(t.charCodeAt(0))?this.mode==="math"&&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:dt.range(e),text:t};else return null;if(this.consume(),s)for(var d=0;d<s[0].length;d++){var h=s[0][d];if(!a0[h])throw new U("Unknown accent ' "+h+"'",e);var f=a0[h][this.mode]||a0[h].text;if(!f)throw new U("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:dt.range(e),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}}yo.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var l0=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new yo(e,t);delete n.gullet.macros.current["\\df@tag"];var i=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 U("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new bt("\\df@tag")])}]}return i},Jp=function(e,t,n){t.textContent="";var i=c0(e,n).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Jp=function(){throw new U("KaTeX doesn't work in quirks mode.")});var K8=function(e,t){var n=c0(e,t).toMarkup();return n},J8=function(e,t){var n=new xl(t);return l0(e,n)},Xp=function(e,t,n){if(n.throwOnError||!(e instanceof U))throw e;var i=R.makeSpan(["katex-error"],[new Ot(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+n.errorColor),i},c0=function(e,t){var n=new xl(t);try{var i=l0(e,n);return i8(i,e,n)}catch(s){return Xp(s,e,n)}},X8=function(e,t){var n=new xl(t);try{var i=l0(e,n);return s8(i,e,n)}catch(s){return Xp(s,e,n)}},Y8="0.16.27",Z8={Span:Pi,Anchor:Cl,SymbolNode:Ot,SvgNode:dr,PathNode:jr,LineNode:El},Wn={version:Y8,render:Jp,renderToString:K8,ParseError:U,SETTINGS_SCHEMA:Ks,__parse:J8,__renderToDomTree:c0,__renderToHTMLTree:X8,__setFontMetrics:Ev,__defineSymbol:p,__defineFunction:Z,__defineMacro:S,__domTree:Z8};const Q8=we.create({name:"m",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"m"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"inlineMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("span");t.classList.add("node-view","math"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<m>"+r.textContent+"</m>",i.contentEditable="true",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),eb=we.create({name:"me",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"me"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view","math"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.contentEditable="true",i.innerHTML="<md>"+r.textContent+"</md>",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),tb=we.create({name:"md",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"md"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view","math"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.classList.add("katex-rendered"),n.innerHTML=Wn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",n.style.pointerEvents="none",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",i.contentEditable="true",i.draggable=!1,new MutationObserver(()=>{const a=i.textContent||"";n.innerHTML=Wn.renderToString(a,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),i.addEventListener("focus",()=>{t.classList.add("has-focus")}),i.addEventListener("blur",()=>{t.classList.remove("has-focus")}),t.appendChild(i),t.appendChild(n),{dom:t,contentDOM:i}}}}),rb=we.create({name:"ptxdoc",content:"title? (BasicBlock|block|rawptx|division)*",group:"root",selectable:!1,draggable:!1,defining:!1,parseHTML(){return[{tag:"ptxdoc"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"ptxdoc",label:"ptxdoc"},r),0]}}),nb=we.create({name:"introduction",content:"(BasicBlock|block|rawptx)*",group:"division introduction",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"introduction"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"introduction",label:"introduction"},r),0]},addInputRules(){return[it({find:new RegExp("^#intro\\s$"),type:this.type})]}}),ib=we.create({name:"part",content:"title ((introduction?|chapter+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"part"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"part",ptxtag:"part"},r),0]},addInputRules(){return[it({find:new RegExp("^#part\\s$"),type:this.type})]}}),sb=we.create({name:"chapter",content:"title ((introduction?|section+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"chapter"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"chapter",ptxtag:"chapter"},r),0]},addInputRules(){return[it({find:new RegExp("^#ch\\s$"),type:this.type})]}}),ob=we.create({name:"section",content:"title ((introduction?|subsection+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"section"}]},renderHTML({HTMLAttributes:r}){return["section",ye({class:"section",ptxtag:"section"},r),0]},addInputRules(){return[it({find:new RegExp("^#sec\\s$"),type:this.type})]}}),ab=we.create({name:"subsection",content:"title (BasicBlock|block|rawptx)+",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"subsection"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",ye({class:"subsection",ptxtag:"subsection"},r),0]},addInputRules(){return[it({find:new RegExp("^#subsec\\s$"),type:this.type})]}}),lb=we.create({name:"worksheet",content:"title? ((introduction?)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"worksheet"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",ye({class:"worksheet",ptxtag:"worksheet"},r),0]},addInputRules(){return[it({find:new RegExp("^#ws\\s$"),type:this.type})]}}),cb=Se.create({name:"divisions",addExtensions(){return[nb,ib,sb,ob,ab,lb,rb]}});var ub=we.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),db=we.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",ye(this.options.HTMLAttributes,r)]},renderText(){return`
387
387
  `},renderMarkdown:()=>`
388
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(h=>a.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const hb=ub.extend({}),fb=db.extend({}),pb=Ni.create({name:"term",group:"inline",parseHTML(){return[{tag:"term"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"term"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<term>(.*?)<\/term>)$/,type:this.type}),$r({find:/(?:^|\s)(_(.*?)_)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<term>(.*?)<\/term>)/g,type:this.type})]}}),mb=Ni.create({name:"em",group:"inline",parseHTML(){return[{tag:"em"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"em"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<em>(.*?)<\/em>)$/,type:this.type}),$r({find:/(?:^|\s)(\*(.*?)\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<em>(.*?)<\/em>)/g,type:this.type})]}}),gb=Ni.create({name:"alert",group:"inline",parseHTML(){return[{tag:"alert"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"alert"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<alert>(.*?)<\/alert>)$/,type:this.type}),$r({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<alert>(.*?)<\/alert>)/g,type:this.type})]}}),yb=Ni.create({name:"c",group:"inline",parseHTML(){return[{tag:"c"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"c"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<c>(.*?)<\/c>)$/,type:this.type}),$r({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<c>(.*?)<\/c>)/g,type:this.type})]}}),vb=Se.create({name:"myinline",addExtensions(){return[hb,fb,pb,mb,gb,yb]}}),Hi=r=>{const e=r.node.type.name.charAt(0).toUpperCase()+r.node.type.name.slice(1);return J.jsxs(nf,{className:"block-component",ptxtag:r.node.type.name,children:[J.jsxs("div",{className:"block-title",children:[e,"."]}),J.jsx(rf,{className:"thm-component-content"})]})},Xp=()=>J.jsxs(nf,{className:"proof",ptxtag:"proof",children:[J.jsx("div",{className:"block-title",children:"Proof."}),J.jsx(rf,{className:"thm-component-content"})]});var u0,Yp;function bb(){if(Yp)return u0;Yp=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(C,w)=>{for(var I in w)r(C,I,{get:w[I],enumerable:!0})},s=(C,w,I,L)=>{if(w&&typeof w=="object"||typeof w=="function")for(let B of t(w))!n.call(C,B)&&B!==I&&r(C,B,{get:()=>w[B],enumerable:!(L=e(w,B))||L.enumerable});return C},o=C=>s(r({},"__esModule",{value:!0}),C),a={};i(a,{XmlCdata:()=>$,XmlComment:()=>F,XmlDeclaration:()=>q,XmlDocument:()=>Y,XmlDocumentType:()=>he,XmlElement:()=>te,XmlError:()=>Q,XmlNode:()=>O,XmlProcessingInstruction:()=>W,XmlText:()=>A,parseXml:()=>Ae}),u0=o(a);var l="",c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=class{constructor(C){if(this.k=this.u(C,!0),this.d=0,this.length=C.length,this.l=this.k!==this.length,this.h=C,this.l){let w=[];for(let I=0,L=0;L<this.k;++L)w[L]=I,I+=C.codePointAt(I)>65535?2:1;this.A=w}}get B(){return this.d>=this.k}u(C,w=this.l){return w?C.replace(c,"_").length:C.length}p(C=1){this.d=Math.min(this.k,this.d+C)}f(C=this.d){var w;return this.l?(w=this.A[C])!=null?w:1/0:C}G(C=1){let w=this.m(C);return this.p(C),w}v(C){let w=this.f(),I=this.h.slice(w,w+C);return this.p(this.u(I)),I}w(C){let{length:w,l:I,h:L}=this,B=this.f(),K=B;if(I)for(;K<w;){let re=L[K],j=re>="\uD800"&&re<="\uDBFF";if(j&&(re+=L[K+1]),!C(re))break;K+=j?2:1}else for(;K<w&&C(L[K]);)++K;return this.v(K-B)}b(C){let{length:w}=C,I=this.f();return C===this.h.slice(I,I+w)?(this.p(w===1?1:this.u(C)),C):l}x(C){let w=this.h.slice(this.f()).search(C);return w>0?this.v(w):l}s(C){let w=this.f(),I=this.h.indexOf(C,w);return I>0?this.v(I-w):l}m(C=1){let{d:w,h:I}=this;return this.l?I.slice(this.f(w),this.f(w+C)):I.slice(w,w+C)}n(C=0){this.d=C>=0?Math.min(this.k,C):Math.max(0,this.d+C)}},d=/["&<]/,h=/['&<]/,f=/\r\n|[\n\r\t]/g,m=/<|&|]]>/,y=Object.freeze(Object.assign(Object.create(null),{amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}));function v(C){let w=C.codePointAt(0);return w>=97&&w<=122||w>=65&&w<=90||w>=48&&w<=57||w===45||w===46||w===183||w>=768&&w<=879||w===8255||w===8256||x(C,w)}function x(C,w=C.codePointAt(0)){return w>=97&&w<=122||w>=65&&w<=90||w===58||w===95||w>=192&&w<=214||w>=216&&w<=246||w>=248&&w<=767||w>=880&&w<=893||w>=895&&w<=8191||w===8204||w===8205||w>=8304&&w<=8591||w>=11264&&w<=12271||w>=12289&&w<=55295||w>=63744&&w<=64975||w>=65008&&w<=65533||w>=65536&&w<=983039}function T(C){return C==="#"||v(C)}function D(C){let w=C.codePointAt(0);return w===32||w===9||w===10||w===13}function P(C){return C>=32&&C<=55295||C===10||C===9||C===13||C>=57344&&C<=65533||C>=65536&&C<=1114111}var N=class b1{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){var w,I;return(I=(w=this.parent)==null?void 0:w.document)!=null?I:null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===b1.TYPE_ELEMENT}get preserveWhitespace(){var w;return!!((w=this.parent)!=null&&w.preserveWhitespace)}get type(){return""}toJSON(){let w={type:this.type};return this.isRootNode&&(w.isRootNode=!0),this.preserveWhitespace&&(w.preserveWhitespace=!0),this.start!==-1&&(w.start=this.start,w.end=this.end),w}};N.TYPE_CDATA="cdata",N.TYPE_COMMENT="comment",N.TYPE_DOCUMENT="document",N.TYPE_DOCUMENT_TYPE="doctype",N.TYPE_ELEMENT="element",N.TYPE_PROCESSING_INSTRUCTION="pi",N.TYPE_TEXT="text",N.TYPE_XML_DECLARATION="xmldecl";var O=N,A=class extends O{constructor(C=""){super(),this.text=C}get type(){return O.TYPE_TEXT}toJSON(){return Object.assign(O.prototype.toJSON.call(this),{text:this.text})}},$=class extends A{get type(){return O.TYPE_CDATA}},F=class extends O{constructor(C=""){super(),this.content=C}get type(){return O.TYPE_COMMENT}toJSON(){return Object.assign(O.prototype.toJSON.call(this),{content:this.content})}},q=class extends O{constructor(C,w,I){super(),this.version=C,this.encoding=w??null,this.standalone=I??null}get type(){return O.TYPE_XML_DECLARATION}toJSON(){let C=O.prototype.toJSON.call(this);C.version=this.version;for(let w of["encoding","standalone"])this[w]!==null&&(C[w]=this[w]);return C}},te=class x1 extends O{constructor(w,I=Object.create(null),L=[]){super(),this.name=w,this.attributes=I,this.children=L}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let w=this;for(;w instanceof x1;){if("xml:space"in w.attributes)return w.attributes["xml:space"]==="preserve";w=w.parent}return!1}get text(){return this.children.map(w=>"text"in w?w.text:"").join("")}get type(){return O.TYPE_ELEMENT}toJSON(){return Object.assign(O.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(w=>w.toJSON())})}},Y=class extends O{constructor(C=[]){super(),this.children=C}get document(){return this}get root(){for(let C of this.children)if(C instanceof te)return C;return null}get text(){return this.children.map(C=>"text"in C?C.text:"").join("")}get type(){return O.TYPE_DOCUMENT}toJSON(){return Object.assign(O.prototype.toJSON.call(this),{children:this.children.map(C=>C.toJSON())})}},he=class extends O{constructor(C,w,I,L){super(),this.name=C,this.publicId=w??null,this.systemId=I??null,this.internalSubset=L??null}get type(){return O.TYPE_DOCUMENT_TYPE}toJSON(){let C=O.prototype.toJSON.call(this);C.name=this.name;for(let w of["publicId","systemId","internalSubset"])this[w]!==null&&(C[w]=this[w]);return C}},Q=class extends Error{constructor(C,w,I){let L=1,B="",K=1;for(let ie=0;ie<w;++ie){let me=I[ie];me===`
388
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(h=>a.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const hb=ub.extend({}),fb=db.extend({}),pb=Ni.create({name:"term",group:"inline",parseHTML(){return[{tag:"term"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"term"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<term>(.*?)<\/term>)$/,type:this.type}),$r({find:/(?:^|\s)(_(.*?)_)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<term>(.*?)<\/term>)/g,type:this.type})]}}),mb=Ni.create({name:"em",group:"inline",parseHTML(){return[{tag:"em"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"em"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<em>(.*?)<\/em>)$/,type:this.type}),$r({find:/(?:^|\s)(\*(.*?)\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<em>(.*?)<\/em>)/g,type:this.type})]}}),gb=Ni.create({name:"alert",group:"inline",parseHTML(){return[{tag:"alert"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"alert"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<alert>(.*?)<\/alert>)$/,type:this.type}),$r({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<alert>(.*?)<\/alert>)/g,type:this.type})]}}),yb=Ni.create({name:"c",group:"inline",parseHTML(){return[{tag:"c"}]},renderHTML({HTMLAttributes:r}){return["span",ye({class:"c"},r),0]},addInputRules(){return[$r({find:/(?:^|\s)(<c>(.*?)<\/c>)$/,type:this.type}),$r({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[Hs({find:/(?:^|\s)(<c>(.*?)<\/c>)/g,type:this.type})]}}),vb=Se.create({name:"myinline",addExtensions(){return[hb,fb,pb,mb,gb,yb]}}),Hi=r=>{const e=r.node.type.name.charAt(0).toUpperCase()+r.node.type.name.slice(1);return J.jsxs(sf,{className:"block-component",ptxtag:r.node.type.name,children:[J.jsxs("div",{className:"block-title",children:[e,"."]}),J.jsx(nf,{className:"thm-component-content"})]})},Yp=()=>J.jsxs(sf,{className:"proof",ptxtag:"proof",children:[J.jsx("div",{className:"block-title",children:"Proof."}),J.jsx(nf,{className:"thm-component-content"})]});var u0,Zp;function bb(){if(Zp)return u0;Zp=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(C,w)=>{for(var I in w)r(C,I,{get:w[I],enumerable:!0})},s=(C,w,I,L)=>{if(w&&typeof w=="object"||typeof w=="function")for(let B of t(w))!n.call(C,B)&&B!==I&&r(C,B,{get:()=>w[B],enumerable:!(L=e(w,B))||L.enumerable});return C},o=C=>s(r({},"__esModule",{value:!0}),C),a={};i(a,{XmlCdata:()=>$,XmlComment:()=>F,XmlDeclaration:()=>q,XmlDocument:()=>Y,XmlDocumentType:()=>he,XmlElement:()=>te,XmlError:()=>Q,XmlNode:()=>N,XmlProcessingInstruction:()=>W,XmlText:()=>O,parseXml:()=>Ae}),u0=o(a);var l="",c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=class{constructor(C){if(this.k=this.u(C,!0),this.d=0,this.length=C.length,this.l=this.k!==this.length,this.h=C,this.l){let w=[];for(let I=0,L=0;L<this.k;++L)w[L]=I,I+=C.codePointAt(I)>65535?2:1;this.A=w}}get B(){return this.d>=this.k}u(C,w=this.l){return w?C.replace(c,"_").length:C.length}p(C=1){this.d=Math.min(this.k,this.d+C)}f(C=this.d){var w;return this.l?(w=this.A[C])!=null?w:1/0:C}G(C=1){let w=this.m(C);return this.p(C),w}v(C){let w=this.f(),I=this.h.slice(w,w+C);return this.p(this.u(I)),I}w(C){let{length:w,l:I,h:L}=this,B=this.f(),K=B;if(I)for(;K<w;){let re=L[K],j=re>="\uD800"&&re<="\uDBFF";if(j&&(re+=L[K+1]),!C(re))break;K+=j?2:1}else for(;K<w&&C(L[K]);)++K;return this.v(K-B)}b(C){let{length:w}=C,I=this.f();return C===this.h.slice(I,I+w)?(this.p(w===1?1:this.u(C)),C):l}x(C){let w=this.h.slice(this.f()).search(C);return w>0?this.v(w):l}s(C){let w=this.f(),I=this.h.indexOf(C,w);return I>0?this.v(I-w):l}m(C=1){let{d:w,h:I}=this;return this.l?I.slice(this.f(w),this.f(w+C)):I.slice(w,w+C)}n(C=0){this.d=C>=0?Math.min(this.k,C):Math.max(0,this.d+C)}},d=/["&<]/,h=/['&<]/,f=/\r\n|[\n\r\t]/g,m=/<|&|]]>/,y=Object.freeze(Object.assign(Object.create(null),{amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}));function v(C){let w=C.codePointAt(0);return w>=97&&w<=122||w>=65&&w<=90||w>=48&&w<=57||w===45||w===46||w===183||w>=768&&w<=879||w===8255||w===8256||x(C,w)}function x(C,w=C.codePointAt(0)){return w>=97&&w<=122||w>=65&&w<=90||w===58||w===95||w>=192&&w<=214||w>=216&&w<=246||w>=248&&w<=767||w>=880&&w<=893||w>=895&&w<=8191||w===8204||w===8205||w>=8304&&w<=8591||w>=11264&&w<=12271||w>=12289&&w<=55295||w>=63744&&w<=64975||w>=65008&&w<=65533||w>=65536&&w<=983039}function T(C){return C==="#"||v(C)}function D(C){let w=C.codePointAt(0);return w===32||w===9||w===10||w===13}function P(C){return C>=32&&C<=55295||C===10||C===9||C===13||C>=57344&&C<=65533||C>=65536&&C<=1114111}var E=class b1{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){var w,I;return(I=(w=this.parent)==null?void 0:w.document)!=null?I:null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===b1.TYPE_ELEMENT}get preserveWhitespace(){var w;return!!((w=this.parent)!=null&&w.preserveWhitespace)}get type(){return""}toJSON(){let w={type:this.type};return this.isRootNode&&(w.isRootNode=!0),this.preserveWhitespace&&(w.preserveWhitespace=!0),this.start!==-1&&(w.start=this.start,w.end=this.end),w}};E.TYPE_CDATA="cdata",E.TYPE_COMMENT="comment",E.TYPE_DOCUMENT="document",E.TYPE_DOCUMENT_TYPE="doctype",E.TYPE_ELEMENT="element",E.TYPE_PROCESSING_INSTRUCTION="pi",E.TYPE_TEXT="text",E.TYPE_XML_DECLARATION="xmldecl";var N=E,O=class extends N{constructor(C=""){super(),this.text=C}get type(){return N.TYPE_TEXT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{text:this.text})}},$=class extends O{get type(){return N.TYPE_CDATA}},F=class extends N{constructor(C=""){super(),this.content=C}get type(){return N.TYPE_COMMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{content:this.content})}},q=class extends N{constructor(C,w,I){super(),this.version=C,this.encoding=w??null,this.standalone=I??null}get type(){return N.TYPE_XML_DECLARATION}toJSON(){let C=N.prototype.toJSON.call(this);C.version=this.version;for(let w of["encoding","standalone"])this[w]!==null&&(C[w]=this[w]);return C}},te=class x1 extends N{constructor(w,I=Object.create(null),L=[]){super(),this.name=w,this.attributes=I,this.children=L}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let w=this;for(;w instanceof x1;){if("xml:space"in w.attributes)return w.attributes["xml:space"]==="preserve";w=w.parent}return!1}get text(){return this.children.map(w=>"text"in w?w.text:"").join("")}get type(){return N.TYPE_ELEMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(w=>w.toJSON())})}},Y=class extends N{constructor(C=[]){super(),this.children=C}get document(){return this}get root(){for(let C of this.children)if(C instanceof te)return C;return null}get text(){return this.children.map(C=>"text"in C?C.text:"").join("")}get type(){return N.TYPE_DOCUMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{children:this.children.map(C=>C.toJSON())})}},he=class extends N{constructor(C,w,I,L){super(),this.name=C,this.publicId=w??null,this.systemId=I??null,this.internalSubset=L??null}get type(){return N.TYPE_DOCUMENT_TYPE}toJSON(){let C=N.prototype.toJSON.call(this);C.name=this.name;for(let w of["publicId","systemId","internalSubset"])this[w]!==null&&(C[w]=this[w]);return C}},Q=class extends Error{constructor(C,w,I){let L=1,B="",K=1;for(let ie=0;ie<w;++ie){let me=I[ie];me===`
389
389
  `?(L=1,B="",K+=1):(L+=1,B+=me)}let re=I.indexOf(`
390
390
  `,w);B+=re===-1?I.slice(w):I.slice(w,re);let j=0;B.length>50&&(L<40?B=B.slice(0,50):(j=L-20,B=B.slice(j,L+30))),super(`${C} (line ${K}, column ${L})
391
391
  ${B}
392
392
  `+" ".repeat(L-j+1)+`^
393
- `),this.column=L,this.excerpt=B,this.line=K,this.name="XmlError",this.pos=w}},W=class extends O{constructor(C,w=""){super(),this.name=C,this.content=w}get type(){return O.TYPE_PROCESSING_INSTRUCTION}toJSON(){return Object.assign(O.prototype.toJSON.call(this),{name:this.name,content:this.content})}},ne="",ve=class{constructor(C,w={}){let I=this.document=new Y;this.j=I,this.g=w,this.c=new u(C),this.g.includeOffsets&&(I.start=0,I.end=C.length),this.parse()}i(C,w){return C.parent=this.j,this.g.includeOffsets&&(C.start=this.c.f(w),C.end=this.c.f()),this.j.children.push(C),!0}y(C,w){let{children:I}=this.j,{length:L}=I;if(C=ge(C),L>0){let B=I[L-1];if(B?.type===O.TYPE_TEXT){let K=B;return K.text+=C,this.g.includeOffsets&&(K.end=this.c.f()),!0}}return this.i(new A(C),w)}H(){let C=Object.create(null);for(;this.e();){let w=this.q();if(!w)break;let I=this.t()&&this.I();if(I===!1)throw this.a("Attribute value expected");if(w in C)throw this.a(`Duplicate attribute: ${w}`);if(w==="xml:space"&&I!=="default"&&I!=="preserve")throw this.a('Value of the `xml:space` attribute must be "default" or "preserve"');C[w]=I}if(this.g.sortAttributes){let w=Object.keys(C).sort(),I=Object.create(null);for(let L=0;L<w.length;++L){let B=w[L];I[B]=C[B]}C=I}return C}I(){let{c:C}=this,w=C.m();if(w!=='"'&&w!=="'")return!1;C.p();let I,L=!1,B=ne,K=w==='"'?d:h;e:for(;!C.B;)switch(I=C.x(K),I&&(this.o(I),B+=I.replace(f," ")),C.m()){case w:L=!0;break e;case"&":B+=this.C();continue;case"<":throw this.a("Unescaped `<` is not allowed in an attribute value");default:break e}if(!L)throw this.a("Unclosed attribute");return C.p(),B}J(){let{c:C}=this,w=C.d;if(!C.b("<![CDATA["))return!1;let I=C.s("]]>");if(this.o(I),!C.b("]]>"))throw this.a("Unclosed CDATA section");return this.g.preserveCdata?this.i(new $(ge(I)),w):this.y(I,w)}K(){let{c:C}=this,w=C.d,I=C.x(m);if(!I)return!1;if(this.o(I),C.m(3)==="]]>")throw this.a("Element content may not contain the CDATA section close delimiter `]]>`");return this.y(I,w)}D(){let{c:C}=this,w=C.d;if(!C.b("<!--"))return!1;let I=C.s("--");if(this.o(I),!C.b("-->"))throw C.m(2)==="--"?this.a("The string `--` isn't allowed inside a comment"):this.a("Unclosed comment");return this.g.preserveComments?this.i(new F(ge(I)),w):!0}L(){let C=this.c.d,w=this.C();return w?this.y(w,C):!1}M(){let{c:C}=this,w=C.d;if(!C.b("<!DOCTYPE"))return!1;let I=this.e()&&this.q();if(!I)throw this.a("Expected a name");let L,B;if(this.e()){if(C.b("PUBLIC")){if(L=this.e()&&this.N(),L===!1)throw this.a("Expected a public identifier");this.e()}if(L!==void 0||C.b("SYSTEM")){if(this.e(),B=this.r(),B===!1)throw this.a("Expected a system identifier");this.e()}}let K;if(C.b("[")){if(K=C.x(/\][\x20\t\r\n]*>/),!C.b("]"))throw this.a("Unclosed internal subset");this.e()}if(!C.b(">"))throw this.a("Unclosed doctype declaration");return this.g.preserveDocumentType?this.i(new he(I,L,B,K),w):!0}E(){let{c:C}=this,w=C.d;if(!C.b("<"))return!1;let I=this.q();if(!I)return C.n(w),!1;let L=this.H(),B=!!C.b("/>"),K=new te(I,L);if(K.parent=this.j,!B){if(!C.b(">"))throw this.a(`Unclosed start tag for element \`${I}\``);this.j=K;do this.K();while(this.E()||this.L()||this.J()||this.F()||this.D());let re=C.d,j;if(!C.b("</")||!(j=this.q())||j!==I)throw C.n(re),this.a(`Missing end tag for element ${I}`);if(this.e(),!C.b(">"))throw this.a(`Unclosed end tag for element ${I}`);this.j=K.parent}return this.i(K,w)}t(){return this.e(),this.c.b("=")?(this.e(),!0):!1}z(){return this.D()||this.F()||this.e()}q(){return x(this.c.m())?this.c.w(v):ne}F(){let{c:C}=this,w=C.d;if(!C.b("<?"))return!1;let I=this.q();if(I){if(I.toLowerCase()==="xml")throw C.n(w),this.a("XML declaration isn't allowed here")}else throw this.a("Invalid processing instruction");if(!this.e()){if(C.b("?>"))return this.i(new W(I),w);throw this.a("Whitespace is required after a processing instruction name")}let L=C.s("?>");if(this.o(L),!C.b("?>"))throw this.a("Unterminated processing instruction");return this.i(new W(I,ge(L)),w)}O(){let{c:C}=this,w=C.d;for(this.P();this.z(););if(this.M())for(;this.z(););return w<C.d}N(){let C=this.c.d,w=this.r();if(w!==!1&&!/^[-\x20\r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*$/.test(w))throw this.c.n(C),this.a("Invalid character in public identifier");return w}C(){let{c:C}=this;if(!C.b("&"))return!1;let w=C.w(T);if(C.G()!==";")throw this.a("Unterminated reference (a reference must end with `;`)");let I;if(w[0]==="#"){let L=w[1]==="x"?parseInt(w.slice(2),16):parseInt(w.slice(1),10);if(isNaN(L))throw this.a("Invalid character reference");if(!P(L))throw this.a("Character reference resolves to an invalid character");I=String.fromCodePoint(L)}else if(I=y[w],I===void 0){let{ignoreUndefinedEntities:L,resolveUndefinedEntity:B}=this.g,K=`&${w};`;if(B){let re=B(K);if(re!=null){let j=typeof re;if(j!=="string")throw new TypeError(`\`resolveUndefinedEntity()\` must return a string, \`null\`, or \`undefined\`, but returned a value of type ${j}`);return re}}if(L)return K;throw C.n(-K.length),this.a(`Named entity isn't defined: ${K}`)}return I}r(){let{c:C}=this,w=C.b('"')||C.b("'");if(!w)return!1;let I=C.s(w);if(this.o(I),!C.b(w))throw this.a("Missing end quote");return I}e(){return!!this.c.w(D)}P(){let{c:C}=this,w=C.d;if(!C.b("<?xml"))return!1;if(!this.e())throw this.a("Invalid XML declaration");let I=!!C.b("version")&&this.t()&&this.r();if(I===!1)throw this.a("XML version is missing or invalid");if(!/^1\.[0-9]+$/.test(I))throw this.a("Invalid character in version number");let L,B;if(this.e()){if(L=!!C.b("encoding")&&this.t()&&this.r(),L){if(!/^[A-Za-z][\w.-]*$/.test(L))throw this.a("Invalid character in encoding name");this.e()}if(B=!!C.b("standalone")&&this.t()&&this.r(),B){if(B!=="yes"&&B!=="no")throw this.a('Only "yes" and "no" are permitted as values of `standalone`');this.e()}}if(!C.b("?>"))throw this.a("Invalid or unclosed XML declaration");return this.g.preserveXmlDeclaration?this.i(new q(I,L||void 0,B||void 0),w):!0}a(C){let{c:w}=this;return new Q(C,w.d,w.h)}parse(){if(this.c.b("\uFEFF"),this.O(),!this.E())throw this.a("Root element is missing or invalid");for(;this.z(););if(!this.c.B)throw this.a("Extra content at the end of the document")}o(C){let{length:w}=C;for(let I=0;I<w;++I){let L=C.codePointAt(I);if(!P(L))throw this.c.n(-([...C].length-I)),this.a("Invalid character");L>65535&&(I+=1)}}};function ge(C){let w=0;for(;(w=C.indexOf("\r",w))!==-1;)C=C[w+1]===`
393
+ `),this.column=L,this.excerpt=B,this.line=K,this.name="XmlError",this.pos=w}},W=class extends N{constructor(C,w=""){super(),this.name=C,this.content=w}get type(){return N.TYPE_PROCESSING_INSTRUCTION}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,content:this.content})}},ne="",ve=class{constructor(C,w={}){let I=this.document=new Y;this.j=I,this.g=w,this.c=new u(C),this.g.includeOffsets&&(I.start=0,I.end=C.length),this.parse()}i(C,w){return C.parent=this.j,this.g.includeOffsets&&(C.start=this.c.f(w),C.end=this.c.f()),this.j.children.push(C),!0}y(C,w){let{children:I}=this.j,{length:L}=I;if(C=ge(C),L>0){let B=I[L-1];if(B?.type===N.TYPE_TEXT){let K=B;return K.text+=C,this.g.includeOffsets&&(K.end=this.c.f()),!0}}return this.i(new O(C),w)}H(){let C=Object.create(null);for(;this.e();){let w=this.q();if(!w)break;let I=this.t()&&this.I();if(I===!1)throw this.a("Attribute value expected");if(w in C)throw this.a(`Duplicate attribute: ${w}`);if(w==="xml:space"&&I!=="default"&&I!=="preserve")throw this.a('Value of the `xml:space` attribute must be "default" or "preserve"');C[w]=I}if(this.g.sortAttributes){let w=Object.keys(C).sort(),I=Object.create(null);for(let L=0;L<w.length;++L){let B=w[L];I[B]=C[B]}C=I}return C}I(){let{c:C}=this,w=C.m();if(w!=='"'&&w!=="'")return!1;C.p();let I,L=!1,B=ne,K=w==='"'?d:h;e:for(;!C.B;)switch(I=C.x(K),I&&(this.o(I),B+=I.replace(f," ")),C.m()){case w:L=!0;break e;case"&":B+=this.C();continue;case"<":throw this.a("Unescaped `<` is not allowed in an attribute value");default:break e}if(!L)throw this.a("Unclosed attribute");return C.p(),B}J(){let{c:C}=this,w=C.d;if(!C.b("<![CDATA["))return!1;let I=C.s("]]>");if(this.o(I),!C.b("]]>"))throw this.a("Unclosed CDATA section");return this.g.preserveCdata?this.i(new $(ge(I)),w):this.y(I,w)}K(){let{c:C}=this,w=C.d,I=C.x(m);if(!I)return!1;if(this.o(I),C.m(3)==="]]>")throw this.a("Element content may not contain the CDATA section close delimiter `]]>`");return this.y(I,w)}D(){let{c:C}=this,w=C.d;if(!C.b("<!--"))return!1;let I=C.s("--");if(this.o(I),!C.b("-->"))throw C.m(2)==="--"?this.a("The string `--` isn't allowed inside a comment"):this.a("Unclosed comment");return this.g.preserveComments?this.i(new F(ge(I)),w):!0}L(){let C=this.c.d,w=this.C();return w?this.y(w,C):!1}M(){let{c:C}=this,w=C.d;if(!C.b("<!DOCTYPE"))return!1;let I=this.e()&&this.q();if(!I)throw this.a("Expected a name");let L,B;if(this.e()){if(C.b("PUBLIC")){if(L=this.e()&&this.N(),L===!1)throw this.a("Expected a public identifier");this.e()}if(L!==void 0||C.b("SYSTEM")){if(this.e(),B=this.r(),B===!1)throw this.a("Expected a system identifier");this.e()}}let K;if(C.b("[")){if(K=C.x(/\][\x20\t\r\n]*>/),!C.b("]"))throw this.a("Unclosed internal subset");this.e()}if(!C.b(">"))throw this.a("Unclosed doctype declaration");return this.g.preserveDocumentType?this.i(new he(I,L,B,K),w):!0}E(){let{c:C}=this,w=C.d;if(!C.b("<"))return!1;let I=this.q();if(!I)return C.n(w),!1;let L=this.H(),B=!!C.b("/>"),K=new te(I,L);if(K.parent=this.j,!B){if(!C.b(">"))throw this.a(`Unclosed start tag for element \`${I}\``);this.j=K;do this.K();while(this.E()||this.L()||this.J()||this.F()||this.D());let re=C.d,j;if(!C.b("</")||!(j=this.q())||j!==I)throw C.n(re),this.a(`Missing end tag for element ${I}`);if(this.e(),!C.b(">"))throw this.a(`Unclosed end tag for element ${I}`);this.j=K.parent}return this.i(K,w)}t(){return this.e(),this.c.b("=")?(this.e(),!0):!1}z(){return this.D()||this.F()||this.e()}q(){return x(this.c.m())?this.c.w(v):ne}F(){let{c:C}=this,w=C.d;if(!C.b("<?"))return!1;let I=this.q();if(I){if(I.toLowerCase()==="xml")throw C.n(w),this.a("XML declaration isn't allowed here")}else throw this.a("Invalid processing instruction");if(!this.e()){if(C.b("?>"))return this.i(new W(I),w);throw this.a("Whitespace is required after a processing instruction name")}let L=C.s("?>");if(this.o(L),!C.b("?>"))throw this.a("Unterminated processing instruction");return this.i(new W(I,ge(L)),w)}O(){let{c:C}=this,w=C.d;for(this.P();this.z(););if(this.M())for(;this.z(););return w<C.d}N(){let C=this.c.d,w=this.r();if(w!==!1&&!/^[-\x20\r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*$/.test(w))throw this.c.n(C),this.a("Invalid character in public identifier");return w}C(){let{c:C}=this;if(!C.b("&"))return!1;let w=C.w(T);if(C.G()!==";")throw this.a("Unterminated reference (a reference must end with `;`)");let I;if(w[0]==="#"){let L=w[1]==="x"?parseInt(w.slice(2),16):parseInt(w.slice(1),10);if(isNaN(L))throw this.a("Invalid character reference");if(!P(L))throw this.a("Character reference resolves to an invalid character");I=String.fromCodePoint(L)}else if(I=y[w],I===void 0){let{ignoreUndefinedEntities:L,resolveUndefinedEntity:B}=this.g,K=`&${w};`;if(B){let re=B(K);if(re!=null){let j=typeof re;if(j!=="string")throw new TypeError(`\`resolveUndefinedEntity()\` must return a string, \`null\`, or \`undefined\`, but returned a value of type ${j}`);return re}}if(L)return K;throw C.n(-K.length),this.a(`Named entity isn't defined: ${K}`)}return I}r(){let{c:C}=this,w=C.b('"')||C.b("'");if(!w)return!1;let I=C.s(w);if(this.o(I),!C.b(w))throw this.a("Missing end quote");return I}e(){return!!this.c.w(D)}P(){let{c:C}=this,w=C.d;if(!C.b("<?xml"))return!1;if(!this.e())throw this.a("Invalid XML declaration");let I=!!C.b("version")&&this.t()&&this.r();if(I===!1)throw this.a("XML version is missing or invalid");if(!/^1\.[0-9]+$/.test(I))throw this.a("Invalid character in version number");let L,B;if(this.e()){if(L=!!C.b("encoding")&&this.t()&&this.r(),L){if(!/^[A-Za-z][\w.-]*$/.test(L))throw this.a("Invalid character in encoding name");this.e()}if(B=!!C.b("standalone")&&this.t()&&this.r(),B){if(B!=="yes"&&B!=="no")throw this.a('Only "yes" and "no" are permitted as values of `standalone`');this.e()}}if(!C.b("?>"))throw this.a("Invalid or unclosed XML declaration");return this.g.preserveXmlDeclaration?this.i(new q(I,L||void 0,B||void 0),w):!0}a(C){let{c:w}=this;return new Q(C,w.d,w.h)}parse(){if(this.c.b("\uFEFF"),this.O(),!this.E())throw this.a("Root element is missing or invalid");for(;this.z(););if(!this.c.B)throw this.a("Extra content at the end of the document")}o(C){let{length:w}=C;for(let I=0;I<w;++I){let L=C.codePointAt(I);if(!P(L))throw this.c.n(-([...C].length-I)),this.a("Invalid character");L>65535&&(I+=1)}}};function ge(C){let w=0;for(;(w=C.indexOf("\r",w))!==-1;)C=C[w+1]===`
394
394
  `?C.slice(0,w)+C.slice(w+1):C.slice(0,w)+`
395
- `+C.slice(w+1);return C}function Ae(C,w){return new ve(C,w).document}return u0}var xb=bb();function wb(r){const e=String(r),t=[];return{toOffset:i,toPoint:n};function n(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=t[o];if(a===void 0){const l=Zp(e,t[o-1]);a=l===-1?e.length+1:l+1,t[o]=a}if(a>s)return{line:o+1,column:s-(o>0?t[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;t.length<s.line;){const a=t[t.length-1],l=Zp(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;t.push(c)}const o=(s.line>1?t[s.line-2]:0)+s.column-1;if(o<t[s.line-1])return o}}}function Zp(r,e){const t=r.indexOf("\r",e),n=r.indexOf(`
396
- `,e);return n===-1?t:t===-1||t+1===n?n:t<n?t:n}function Sb(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?Qp(r.position):"start"in r||"end"in r?Qp(r):"line"in r||"column"in r?d0(r):""}function d0(r){return em(r&&r.line)+":"+em(r&&r.column)}function Qp(r){return d0(r&&r.start)+"-"+d0(r&&r.end)}function em(r){return r&&typeof r=="number"?r:1}class pt extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Sb(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pt.prototype.file="",pt.prototype.name="",pt.prototype.reason="",pt.prototype.message="",pt.prototype.stack="",pt.prototype.column=void 0,pt.prototype.line=void 0,pt.prototype.ancestors=void 0,pt.prototype.cause=void 0,pt.prototype.fatal=void 0,pt.prototype.place=void 0,pt.prototype.ruleId=void 0,pt.prototype.source=void 0;function kb(r){const e=wb(r);let t;try{t=xb.parseXml(String(r),{includeOffsets:!0,preserveCdata:!0,preserveComments:!0,preserveDocumentType:!0,preserveXmlDeclaration:!0})}catch(s){const o=s,a=e.toPoint(o.pos),l=new pt("Could not parse XML with `@rgrove/parse-xml`",{cause:o,place:a,ruleId:"error",source:"xast-util-from-xml"});throw l.fatal=!0,l.url="https://github.com/syntax-tree/xast-util-from-xml#throws",l}const n={location:e},i=Cb(t,n);return rm(t,i,n),i}function Mb(r){return{type:"cdata",value:r.text}}function Tb(r){return{type:"comment",value:r.content}}function Cb(r,e){return{type:"root",children:tm(r.children,e)}}function Eb(r){return{type:"doctype",name:r.name,public:r.publicId||void 0,system:r.systemId||void 0}}function Ab(r,e){const t=tm(r.children,e);return{type:"element",name:r.name,attributes:{...r.attributes},children:t}}function Ob(r){return{type:"instruction",name:r.name,value:r.content}}function Nb(r){return{type:"text",value:r.text}}function Db(r){const e=[];return r.version&&e.push('version="'+r.version+'"'),r.encoding&&e.push('encoding="'+r.encoding+'"'),r.standalone&&e.push('standalone="'+r.standalone+'"'),{type:"instruction",name:"xml",value:e.join(" ")}}function tm(r,e){const t=[];let n=-1;for(;++n<r.length;){const i=r[n];let s;i.type==="cdata"?s=Mb(i):i.type==="comment"?s=Tb(i):i.type==="doctype"?s=Eb(i):i.type==="element"?s=Ab(i,e):i.type==="pi"?s=Ob(i):i.type==="text"?s=Nb(i):i.type==="xmldecl"&&(s=Db(i)),s&&(rm(i,s,e),t.push(s))}return t}function rm(r,e,t){const n=r.start===-1?void 0:t.location.toPoint(r.start),i=r.end===-1?void 0:t.location.toPoint(r.end);n&&i&&(e.position={start:n,end:i})}const zb=/["&'<>`]/g,Ib=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Rb=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Pb=/[|\\{}()[\]^$+*?.]/g,nm=new WeakMap;function Lb(r,e){if(r=r.replace(e.subset?Bb(e.subset):zb,n),e.subset||e.escapeOnly)return r;return r.replace(Ib,t).replace(Rb,n);function t(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function n(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function Bb(r){let e=nm.get(r);return e||(e=Fb(r),nm.set(r,e)),e}function Fb(r){const e=[];let t=-1;for(;++t<r.length;)e.push(r[t].replace(Pb,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function $b(r){return"&#x"+r.toString(16).toUpperCase()+";"}function Hb(r,e){return Lb(r,Object.assign({format:$b},e))}const Vb=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Gn(r,e,t){const n=qb(r);return t?n.replace(t,i):i(n);function i(s){return Hb(s,{subset:e})}}function qb(r){return String(r||"").replace(Vb,"")}const _b=/]]>/g,jb=[">"];function Ub(r){return"<![CDATA["+Gn(r.value,jb,_b)+"]]>"}function Wb(r){return"<!--"+Gn(r.value,["-"])+"-->"}const Gb=[" ",`
397
- `," ",'"',"&","'","/","<","=",">"];function vo(r){return Gn(r,Gb)}function im(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function h0(r,e){const t=String(r);let n=e.options.quote||'"';if(e.options.quoteSmart){const i=n==='"'?"'":'"';im(t,n)>im(t,i)&&(n=i)}return n+Gn(t,["<","&",n])+n}function Kb(r,e){const t=vo(r.name),n=r.public,i=r.system;let s="<!DOCTYPE";return t!==""&&(s+=" "+t),n?s+=" PUBLIC "+h0(n,e):i&&(s+=" SYSTEM"),i&&(s+=" "+h0(i,e)),s+">"}const Jb={}.hasOwnProperty;function Xb(r,e){const t=vo(r.name),n=lm(r,e),i=r.attributes||{},s=n?!1:e.options.closeEmptyElements,o=[];let a;for(a in i)if(Jb.call(i,a)){const l=i[a];l!=null&&o.push(vo(a)+"="+h0(l,e))}return"<"+t+(o.length===0?"":" "+o.join(" "))+(s?(e.options.tightClose?"":" ")+"/":"")+">"+n+(s?"":"</"+t+">")}const Yb=/\?>/g,Zb=[">"];function Qb(r){const e=vo(r.name)||"x",t=Gn(r.value,Zb,Yb);return"<?"+e+(t?" "+t:"")+"?>"}const e9=["&","<"];function sm(r){return Gn(r.value,e9)}function t9(r,e){return e.options.allowDangerousXml?r.value:sm(r)}const r9={}.hasOwnProperty,om={cdata:Ub,comment:Wb,doctype:Kb,element:Xb,instruction:Qb,raw:t9,root:lm,text:sm};function am(r,e){const t=r&&r.type;if(!t)throw new Error("Expected node, not `"+r+"`");if(!r9.call(om,t))throw new Error("Cannot compile unknown node `"+t+"`");const n=om[t];return n(r,e)}function lm(r,e){const t=r&&r.children||[];let n=-1;const i=[];for(;++n<t.length;)i[n]=am(t[n],e);return i.join("")}function cm(r,e){const t={options:{}};if(typeof t.options.quote=="string"&&t.options.quote!=='"'&&t.options.quote!=="'")throw new Error("Invalid quote `"+t.options.quote+"`, expected `'` or `\"`");const n=Array.isArray(r)?{type:"root",children:r}:r;return am(n,t)}const um=(function(r){if(r==null)return o9;if(typeof r=="function")return bo(r);if(typeof r=="object")return Array.isArray(r)?n9(r):i9(r);if(typeof r=="string")return s9(r);throw new Error("Expected function, string, or object as test")});function n9(r){const e=[];let t=-1;for(;++t<r.length;)e[t]=um(r[t]);return bo(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function i9(r){const e=r;return bo(t);function t(n){const i=n;let s;for(s in r)if(i[s]!==e[s])return!1;return!0}}function s9(r){return bo(e);function e(t){return t&&t.type===r}}function bo(r){return e;function e(t,n,i){return!!(a9(t)&&r.call(this,t,typeof n=="number"?n:void 0,i||void 0))}}function o9(){return!0}function a9(r){return r!==null&&typeof r=="object"&&"type"in r}function sw(r){return r}const dm=[],l9=!0,hm=!1,fm="skip";function c9(r,e,t,n){let i;typeof e=="function"&&typeof t!="function"?(n=t,t=e):i=e;const s=um(i),o=n?-1:1;a(r,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=dm,m,y,v;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=u9(t(l,u)),f[0]===hm))return f;if("children"in l&&l.children){const x=l;if(x.children&&f[0]!==fm)for(y=(n?x.children.length:-1)+o,v=u.concat(x);y>-1&&y<x.children.length;){const T=x.children[y];if(m=a(T,y,v)(),m[0]===hm)return m;y=typeof m[1]=="number"?m[1]:y+o}}return f}}}function u9(r){return Array.isArray(r)?r:typeof r=="number"?[l9,r]:r==null?dm:[r]}function d9(r,e,t,n){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=n),c9(r,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const h9=["theorem","lemma","corollary","proposition","claim","fact","proof"],f9=["convention","insight","note","observation","remark","warning"],p9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],m9=["introduction","part","chapter","section","subsection","worksheet"],g9=["example","question","problem"],y9=["solution","answer","hint"],v9=["ptxdoc","p","m","me","md","ol","ul","li",...m9,"title","definition","statement",...h9,...p9,...f9,...g9,...y9,"term","em","alert","c","pre","url"];function b9(r){let e=r.trim();if(e.startsWith("<?xml")){const i=e.indexOf("?>");i!==-1&&(e=e.slice(i+2).trim())}e=`<ptxdoc>
395
+ `+C.slice(w+1);return C}function Ae(C,w){return new ve(C,w).document}return u0}var xb=bb();function wb(r){const e=String(r),t=[];return{toOffset:i,toPoint:n};function n(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=t[o];if(a===void 0){const l=Qp(e,t[o-1]);a=l===-1?e.length+1:l+1,t[o]=a}if(a>s)return{line:o+1,column:s-(o>0?t[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;t.length<s.line;){const a=t[t.length-1],l=Qp(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;t.push(c)}const o=(s.line>1?t[s.line-2]:0)+s.column-1;if(o<t[s.line-1])return o}}}function Qp(r,e){const t=r.indexOf("\r",e),n=r.indexOf(`
396
+ `,e);return n===-1?t:t===-1||t+1===n?n:t<n?t:n}function Sb(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?em(r.position):"start"in r||"end"in r?em(r):"line"in r||"column"in r?d0(r):""}function d0(r){return tm(r&&r.line)+":"+tm(r&&r.column)}function em(r){return d0(r&&r.start)+"-"+d0(r&&r.end)}function tm(r){return r&&typeof r=="number"?r:1}class pt extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Sb(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pt.prototype.file="",pt.prototype.name="",pt.prototype.reason="",pt.prototype.message="",pt.prototype.stack="",pt.prototype.column=void 0,pt.prototype.line=void 0,pt.prototype.ancestors=void 0,pt.prototype.cause=void 0,pt.prototype.fatal=void 0,pt.prototype.place=void 0,pt.prototype.ruleId=void 0,pt.prototype.source=void 0;function kb(r){const e=wb(r);let t;try{t=xb.parseXml(String(r),{includeOffsets:!0,preserveCdata:!0,preserveComments:!0,preserveDocumentType:!0,preserveXmlDeclaration:!0})}catch(s){const o=s,a=e.toPoint(o.pos),l=new pt("Could not parse XML with `@rgrove/parse-xml`",{cause:o,place:a,ruleId:"error",source:"xast-util-from-xml"});throw l.fatal=!0,l.url="https://github.com/syntax-tree/xast-util-from-xml#throws",l}const n={location:e},i=Cb(t,n);return nm(t,i,n),i}function Mb(r){return{type:"cdata",value:r.text}}function Tb(r){return{type:"comment",value:r.content}}function Cb(r,e){return{type:"root",children:rm(r.children,e)}}function Eb(r){return{type:"doctype",name:r.name,public:r.publicId||void 0,system:r.systemId||void 0}}function Ab(r,e){const t=rm(r.children,e);return{type:"element",name:r.name,attributes:{...r.attributes},children:t}}function Ob(r){return{type:"instruction",name:r.name,value:r.content}}function Nb(r){return{type:"text",value:r.text}}function Db(r){const e=[];return r.version&&e.push('version="'+r.version+'"'),r.encoding&&e.push('encoding="'+r.encoding+'"'),r.standalone&&e.push('standalone="'+r.standalone+'"'),{type:"instruction",name:"xml",value:e.join(" ")}}function rm(r,e){const t=[];let n=-1;for(;++n<r.length;){const i=r[n];let s;i.type==="cdata"?s=Mb(i):i.type==="comment"?s=Tb(i):i.type==="doctype"?s=Eb(i):i.type==="element"?s=Ab(i,e):i.type==="pi"?s=Ob(i):i.type==="text"?s=Nb(i):i.type==="xmldecl"&&(s=Db(i)),s&&(nm(i,s,e),t.push(s))}return t}function nm(r,e,t){const n=r.start===-1?void 0:t.location.toPoint(r.start),i=r.end===-1?void 0:t.location.toPoint(r.end);n&&i&&(e.position={start:n,end:i})}const zb=/["&'<>`]/g,Ib=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Rb=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Pb=/[|\\{}()[\]^$+*?.]/g,im=new WeakMap;function Lb(r,e){if(r=r.replace(e.subset?Bb(e.subset):zb,n),e.subset||e.escapeOnly)return r;return r.replace(Ib,t).replace(Rb,n);function t(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function n(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function Bb(r){let e=im.get(r);return e||(e=Fb(r),im.set(r,e)),e}function Fb(r){const e=[];let t=-1;for(;++t<r.length;)e.push(r[t].replace(Pb,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function $b(r){return"&#x"+r.toString(16).toUpperCase()+";"}function Hb(r,e){return Lb(r,Object.assign({format:$b},e))}const Vb=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Gn(r,e,t){const n=qb(r);return t?n.replace(t,i):i(n);function i(s){return Hb(s,{subset:e})}}function qb(r){return String(r||"").replace(Vb,"")}const _b=/]]>/g,jb=[">"];function Ub(r){return"<![CDATA["+Gn(r.value,jb,_b)+"]]>"}function Wb(r){return"<!--"+Gn(r.value,["-"])+"-->"}const Gb=[" ",`
397
+ `," ",'"',"&","'","/","<","=",">"];function vo(r){return Gn(r,Gb)}function sm(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function h0(r,e){const t=String(r);let n=e.options.quote||'"';if(e.options.quoteSmart){const i=n==='"'?"'":'"';sm(t,n)>sm(t,i)&&(n=i)}return n+Gn(t,["<","&",n])+n}function Kb(r,e){const t=vo(r.name),n=r.public,i=r.system;let s="<!DOCTYPE";return t!==""&&(s+=" "+t),n?s+=" PUBLIC "+h0(n,e):i&&(s+=" SYSTEM"),i&&(s+=" "+h0(i,e)),s+">"}const Jb={}.hasOwnProperty;function Xb(r,e){const t=vo(r.name),n=cm(r,e),i=r.attributes||{},s=n?!1:e.options.closeEmptyElements,o=[];let a;for(a in i)if(Jb.call(i,a)){const l=i[a];l!=null&&o.push(vo(a)+"="+h0(l,e))}return"<"+t+(o.length===0?"":" "+o.join(" "))+(s?(e.options.tightClose?"":" ")+"/":"")+">"+n+(s?"":"</"+t+">")}const Yb=/\?>/g,Zb=[">"];function Qb(r){const e=vo(r.name)||"x",t=Gn(r.value,Zb,Yb);return"<?"+e+(t?" "+t:"")+"?>"}const e9=["&","<"];function om(r){return Gn(r.value,e9)}function t9(r,e){return e.options.allowDangerousXml?r.value:om(r)}const r9={}.hasOwnProperty,am={cdata:Ub,comment:Wb,doctype:Kb,element:Xb,instruction:Qb,raw:t9,root:cm,text:om};function lm(r,e){const t=r&&r.type;if(!t)throw new Error("Expected node, not `"+r+"`");if(!r9.call(am,t))throw new Error("Cannot compile unknown node `"+t+"`");const n=am[t];return n(r,e)}function cm(r,e){const t=r&&r.children||[];let n=-1;const i=[];for(;++n<t.length;)i[n]=lm(t[n],e);return i.join("")}function um(r,e){const t={options:{}};if(typeof t.options.quote=="string"&&t.options.quote!=='"'&&t.options.quote!=="'")throw new Error("Invalid quote `"+t.options.quote+"`, expected `'` or `\"`");const n=Array.isArray(r)?{type:"root",children:r}:r;return lm(n,t)}const dm=(function(r){if(r==null)return o9;if(typeof r=="function")return bo(r);if(typeof r=="object")return Array.isArray(r)?n9(r):i9(r);if(typeof r=="string")return s9(r);throw new Error("Expected function, string, or object as test")});function n9(r){const e=[];let t=-1;for(;++t<r.length;)e[t]=dm(r[t]);return bo(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function i9(r){const e=r;return bo(t);function t(n){const i=n;let s;for(s in r)if(i[s]!==e[s])return!1;return!0}}function s9(r){return bo(e);function e(t){return t&&t.type===r}}function bo(r){return e;function e(t,n,i){return!!(a9(t)&&r.call(this,t,typeof n=="number"?n:void 0,i||void 0))}}function o9(){return!0}function a9(r){return r!==null&&typeof r=="object"&&"type"in r}function sw(r){return r}const hm=[],l9=!0,fm=!1,pm="skip";function c9(r,e,t,n){let i;typeof e=="function"&&typeof t!="function"?(n=t,t=e):i=e;const s=dm(i),o=n?-1:1;a(r,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=hm,m,y,v;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=u9(t(l,u)),f[0]===fm))return f;if("children"in l&&l.children){const x=l;if(x.children&&f[0]!==pm)for(y=(n?x.children.length:-1)+o,v=u.concat(x);y>-1&&y<x.children.length;){const T=x.children[y];if(m=a(T,y,v)(),m[0]===fm)return m;y=typeof m[1]=="number"?m[1]:y+o}}return f}}}function u9(r){return Array.isArray(r)?r:typeof r=="number"?[l9,r]:r==null?hm:[r]}function d9(r,e,t,n){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=n),c9(r,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const h9=["theorem","lemma","corollary","proposition","claim","fact","proof"],f9=["convention","insight","note","observation","remark","warning"],p9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],m9=["introduction","part","chapter","section","subsection","worksheet"],g9=["example","question","problem"],y9=["solution","answer","hint"],v9=["ptxdoc","p","m","me","md","ol","ul","li",...m9,"title","definition","statement",...h9,...p9,...f9,...g9,...y9,"term","em","alert","c","pre","url"];function b9(r){let e=r.trim();if(e.startsWith("<?xml")){const i=e.indexOf("?>");i!==-1&&(e=e.slice(i+2).trim())}e=`<ptxdoc>
398
398
  ${e}
399
- </ptxdoc>`;const t=kb(e);return console.log("xast before: ",t),d9(t,(i,s,o)=>{if(i.type==="element"&&!v9.includes(i.name)){const a={type:"element",name:"rawptx",attributes:{},children:[{type:"text",value:cm(i)}]};return typeof s!="number"||!o?void 0:(o.children.splice(s,1,a),fm)}}),console.log("xast after: ",t),cm(t)}function x9(){return{label:{parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")},component:{parseHTML:r=>r.getAttribute("component")}}}function yr(r,e){return[it({find:new RegExp(`^#${r}\\s$`,"i"),type:e}),it({find:new RegExp(`(?:^)(<${r}>(\\s))$`,"i"),type:e}),it({find:new RegExp(`(?:^)(${r}:(\\s))$`,"i"),type:e})]}const w9=["theorem","lemma","corollary","proposition","claim","fact"],S9=Se.create({name:"theoremLike",addExtensions(){const r=[];for(const e of w9)r.push(we.create({name:e,content:"title? statement proof*",group:"block theoremLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return x9()},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));return r.push(we.create({name:"proof",content:"title? BasicBlock+",group:"block",selectable:!0,draggable:!0,parseHTML(){return[{tag:"proof"}]},renderHTML({HTMLAttributes:e}){return["article",ye({class:"proof",ptxtag:"proof"},e),0]},addNodeView(){return gn(Xp)},addInputRules(){return yr("proof",this.type)}})),r}}),k9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],M9=Se.create({name:"axiomLike",addExtensions(){const r=[];for(const e of k9)r.push(we.create({name:e,content:"title? statement",group:"block axiomLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:e}]},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} axiom-like`,label:e},t),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));return r}}),T9=we.create({name:"statement",content:"BasicBlock+",group:"blockContent",parseHTML(){return[{tag:"statement"}]},renderHTML(){return["div",{class:"statement",ptxtag:"statement"},0]},addInputRules(){return yr("statement",this.type)}}),C9=["example","question","problem"],E9=Se.create({name:"exampleLike",addExtensions(){const r=[];for(const e of C9)r.push(we.create({name:e,content:"title? (BasicBlock*|(statement hint* answer* solution*))",group:"block exampleLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));for(const e of["hint","answer","solution"])r.push(we.create({name:e,content:"title? BasicBlock+",group:"block solutionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",ye({class:"proof",ptxtag:"proof"},t),0]},addNodeView(){return gn(Xp)},addInputRules(){return yr("proof",this.type)}}));return r}}),A9=["convention","insight","note","observation","remark","warning"],O9=Se.create({name:"remarkLike",addExtensions(){return A9.map(r=>we.create({name:r,content:"title? BasicBlock+",group:"block remarkLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:r}]},renderHTML({HTMLAttributes:e}){return["article",ye({class:`${r} remark-like`,label:r},e),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr(r,this.type)}}))}}),N9=we.create({name:"p",content:"inline*",group:"BasicBlock paragraph",draggable:!0,defining:!1,priority:1e3,parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"p",ptxtag:"p"},r),0]},addInputRules(){return[it({find:new RegExp("^#p\\s$"),type:this.type})]}}),D9=Se.create({name:"blocks",addExtensions(){return[N9,S9,E9,M9,O9,T9]}});var f0=4,z9=/^```([a-z]+)?[\s\n]$/,I9=/^~~~([a-z]+)?[\s\n]$/,R9=we.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:f0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",ye(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let n="";const i=((t=r.attrs)==null?void 0:t.language)||"";return r.content?n=[`\`\`\`${i}`,e.renderChildren(r.content),"```"].join(`
399
+ </ptxdoc>`;const t=kb(e);return console.log("xast before: ",t),d9(t,(i,s,o)=>{if(i.type==="element"&&!v9.includes(i.name)){const a={type:"element",name:"rawptx",attributes:{},children:[{type:"text",value:um(i)}]};return typeof s!="number"||!o?void 0:(o.children.splice(s,1,a),pm)}}),console.log("xast after: ",t),um(t)}function x9(){return{label:{parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")},component:{parseHTML:r=>r.getAttribute("component")}}}function yr(r,e){return[it({find:new RegExp(`^#${r}\\s$`,"i"),type:e}),it({find:new RegExp(`(?:^)(<${r}>(\\s))$`,"i"),type:e}),it({find:new RegExp(`(?:^)(${r}:(\\s))$`,"i"),type:e})]}const w9=["theorem","lemma","corollary","proposition","claim","fact"],S9=Se.create({name:"theoremLike",addExtensions(){const r=[];for(const e of w9)r.push(we.create({name:e,content:"title? statement proof*",group:"block theoremLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return x9()},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));return r.push(we.create({name:"proof",content:"title? BasicBlock+",group:"block",selectable:!0,draggable:!0,parseHTML(){return[{tag:"proof"}]},renderHTML({HTMLAttributes:e}){return["article",ye({class:"proof",ptxtag:"proof"},e),0]},addNodeView(){return gn(Yp)},addInputRules(){return yr("proof",this.type)}})),r}}),k9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],M9=Se.create({name:"axiomLike",addExtensions(){const r=[];for(const e of k9)r.push(we.create({name:e,content:"title? statement",group:"block axiomLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:e}]},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} axiom-like`,label:e},t),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));return r}}),T9=we.create({name:"statement",content:"BasicBlock+",group:"blockContent",parseHTML(){return[{tag:"statement"}]},renderHTML(){return["div",{class:"statement",ptxtag:"statement"},0]},addInputRules(){return yr("statement",this.type)}}),C9=["example","question","problem"],E9=Se.create({name:"exampleLike",addExtensions(){const r=[];for(const e of C9)r.push(we.create({name:e,content:"title? (BasicBlock*|(statement hint* answer* solution*))",group:"block exampleLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",ye({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return gn(Hi)},addInputRules(){return yr(e,this.type)}}));for(const e of["hint","answer","solution"])r.push(we.create({name:e,content:"title? BasicBlock+",group:"block solutionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",ye({class:"proof",ptxtag:"proof"},t),0]},addNodeView(){return gn(Yp)},addInputRules(){return yr("proof",this.type)}}));return r}}),A9=["convention","insight","note","observation","remark","warning"],O9=Se.create({name:"remarkLike",addExtensions(){return A9.map(r=>we.create({name:r,content:"title? BasicBlock+",group:"block remarkLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:r}]},renderHTML({HTMLAttributes:e}){return["article",ye({class:`${r} remark-like`,label:r},e),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr(r,this.type)}}))}}),N9=we.create({name:"p",content:"inline*",group:"BasicBlock paragraph",draggable:!0,defining:!1,priority:1e3,parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"p",ptxtag:"p"},r),0]},addInputRules(){return[it({find:new RegExp("^#p\\s$"),type:this.type})]}}),D9=Se.create({name:"blocks",addExtensions(){return[N9,S9,E9,M9,O9,T9]}});var f0=4,z9=/^```([a-z]+)?[\s\n]$/,I9=/^~~~([a-z]+)?[\s\n]$/,R9=we.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:f0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",ye(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let n="";const i=((t=r.attrs)==null?void 0:t.language)||"";return r.content?n=[`\`\`\`${i}`,e.renderChildren(r.content),"```"].join(`
400
400
  `):n=`\`\`\`${i}
401
401
 
402
402
  \`\`\``,n},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:r,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!r||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:r})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:f0,{state:n}=r,{selection:i}=n,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?r.commands.insertContent(a):r.commands.command(({tr:l})=>{const{from:c,to:u}=i,f=n.doc.textBetween(c,u,`
@@ -406,19 +406,19 @@ ${e}
406
406
  `);return l.replaceWith(c,u,n.schema.text(f)),!0})},"Shift-Tab":({editor:r})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:f0,{state:n}=r,{selection:i}=n,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?r.commands.command(({tr:a})=>{var l;const{pos:c}=s,u=s.start(),d=s.end(),f=n.doc.textBetween(u,d,`
407
407
  `,`
408
408
  `).split(`
409
- `);let m=0,y=0;const v=c-u;for(let O=0;O<f.length;O+=1){if(y+f[O].length>=v){m=O;break}y+=f[O].length+1}const T=((l=f[m].match(/^ */))==null?void 0:l[0])||"",D=Math.min(T.length,t);if(D===0)return!0;let P=u;for(let O=0;O<m;O+=1)P+=f[O].length+1;return a.delete(P,P+D),c-P<=D&&a.setSelection(de.create(a.doc,P)),!0}):r.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=n.doc.textBetween(l,c,`
409
+ `);let m=0,y=0;const v=c-u;for(let N=0;N<f.length;N+=1){if(y+f[N].length>=v){m=N;break}y+=f[N].length+1}const T=((l=f[m].match(/^ */))==null?void 0:l[0])||"",D=Math.min(T.length,t);if(D===0)return!0;let P=u;for(let N=0;N<m;N+=1)P+=f[N].length+1;return a.delete(P,P+D),c-P<=D&&a.setSelection(de.create(a.doc,P)),!0}):r.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=n.doc.textBetween(l,c,`
410
410
  `,`
411
411
  `).split(`
412
412
  `).map(f=>{var m;const y=((m=f.match(/^ */))==null?void 0:m[0])||"",v=Math.min(y.length,t);return f.slice(v)}).join(`
413
413
  `);return a.replaceWith(l,c,n.schema.text(h)),!0})},Enter:({editor:r})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=r,{selection:t}=e,{$from:n,empty:i}=t;if(!i||n.parent.type!==this.type)return!1;const s=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith(`
414
414
 
415
415
  `);return!s||!o?!1:r.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:n}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:n.nodeAt(a)?r.commands.command(({tr:c})=>(c.setSelection(ce.near(n.resolve(a))),!0)):r.commands.exitCode()}}},addInputRules(){return[rl({find:z9,type:this.type,getAttributes:r=>({language:r[1]})}),rl({find:I9,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new Pe({key:new Fe("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=r.state,l=a.text(t.replace(/\r\n?/g,`
416
- `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(de.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),r.dispatch(o),!0}}})]}}),P9=R9;const L9=we.create({name:"title",content:"text*",parseHTML(){return[{tag:"title"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"title",ptxtag:"title"},r),0]},addInputRules(){return[rl({find:new RegExp("#t\\s$"),type:this.type}),...yr("title",this.type)]}}),B9=we.create({name:"definition",content:"title? statement",group:"block definitionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"definition"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"definition definition-like",label:"definition"},r),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr("definition",this.type)}}),F9=we.create({name:"url",content:"text*",group:"inline",inline:!0,atom:!1,parseHTML(){return[{tag:"url"}]},addAttributes(){return{href:{parseHTML:r=>r.getAttribute("href")}}},renderHTML({HTMLAttributes:r}){return["a",ye({ptxtag:"url"},r),0]}}),$9=we.create({name:"rawptx",content:"text*",marks:"",selectable:!0,draggable:!0,defining:!0,code:!0,whitespace:"pre",parseHTML(){return[{tag:"rawptx",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:r}){return["pre",ye({class:"rawptx",ptxtag:"rawptx"},r),0]}}),xo={para:"p",bulletList:"ul",orderedList:"ol",listItem:"li",italic:"em"};function pm(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H9(r){let e="";return r.type!=="ptxFragment"?(console.log("Top level node is not a ptxFragment"),""):r.content?r.content.length!==1?(console.log("More than one child in json.content"),""):(e+=mm(r.content[0]),e=e.replace(/^<ptxdoc>\s*/,`
417
- `).replace(/\s*<\/ptxdoc>/,""),e):(console.log("No content in json"),"")}function mm(r){let e="";if(r.content){const t=r.type in xo?xo[r.type]:r.type,n=r.attrs;if(t==="rawptx")for(const i of r.content)i.type!=="text"&&console.log("Unexpected non-text node inside rawptx: "+JSON.stringify(i)),e=e+i.text;else{if(e=e+"<"+t,n)for(const[i,s]of Object.entries(n))s!==null&&(e=e+" "+i+'="'+s+'"');e=e+`>
418
- `;for(const i of r.content)e=e+mm(i);e=e+`
416
+ `));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(de.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),r.dispatch(o),!0}}})]}}),P9=R9;const L9=we.create({name:"title",content:"text*",parseHTML(){return[{tag:"title"}]},renderHTML({HTMLAttributes:r}){return["div",ye({class:"title",ptxtag:"title"},r),0]},addInputRules(){return[rl({find:new RegExp("#t\\s$"),type:this.type}),...yr("title",this.type)]}}),B9=we.create({name:"definition",content:"title? statement",group:"block definitionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"definition"}]},renderHTML({HTMLAttributes:r}){return["article",ye({class:"definition definition-like",label:"definition"},r),0]},addNodeView(){return gn(Hi)},addInputRules(){return yr("definition",this.type)}}),F9=we.create({name:"url",content:"text*",group:"inline",inline:!0,atom:!1,parseHTML(){return[{tag:"url"}]},addAttributes(){return{href:{parseHTML:r=>r.getAttribute("href")}}},renderHTML({HTMLAttributes:r}){return["a",ye({ptxtag:"url"},r),0]}}),$9=we.create({name:"rawptx",content:"text*",marks:"",selectable:!0,draggable:!0,defining:!0,code:!0,whitespace:"pre",parseHTML(){return[{tag:"rawptx",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:r}){return["pre",ye({class:"rawptx",ptxtag:"rawptx"},r),0]}}),xo={para:"p",bulletList:"ul",orderedList:"ol",listItem:"li",italic:"em"};function mm(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H9(r){let e="";return r.type!=="ptxFragment"?(console.log("Top level node is not a ptxFragment"),""):r.content?r.content.length!==1?(console.log("More than one child in json.content"),""):(e+=gm(r.content[0]),e=e.replace(/^<ptxdoc>\s*/,`
417
+ `).replace(/\s*<\/ptxdoc>/,""),e):(console.log("No content in json"),"")}function gm(r){let e="";if(r.content){const t=r.type in xo?xo[r.type]:r.type,n=r.attrs;if(t==="rawptx")for(const i of r.content)i.type!=="text"&&console.log("Unexpected non-text node inside rawptx: "+JSON.stringify(i)),e=e+i.text;else{if(e=e+"<"+t,n)for(const[i,s]of Object.entries(n))s!==null&&(e=e+" "+i+'="'+s+'"');e=e+`>
418
+ `;for(const i of r.content)e=e+gm(i);e=e+`
419
419
  </`+t+`>
420
- `}}else if(r.type==="text")if(r.marks){const t=r.marks[0].type in xo?xo[r.marks[0].type]:r.marks[0].type;e=e+"<"+t+">"+pm(r.text)+"</"+t+">"}else e=e+pm(r.text);else r.type==="hardBreak"?e=e+`
421
- `:e=e+"<!-- Something is missing; got "+JSON.stringify(r)+" -->";return e}const gm=["top","right","bottom","left"],ym=["start","end"],vm=gm.reduce((r,e)=>r.concat(e,e+"-"+ym[0],e+"-"+ym[1]),[]),Xt=Math.min,lt=Math.max,wo=Math.round,Yt=r=>({x:r,y:r}),V9={left:"right",right:"left",bottom:"top",top:"bottom"},q9={start:"end",end:"start"};function p0(r,e,t){return lt(r,Xt(e,t))}function vr(r,e){return typeof r=="function"?r(e):r}function Dt(r){return r.split("-")[0]}function Ft(r){return r.split("-")[1]}function bm(r){return r==="x"?"y":"x"}function m0(r){return r==="y"?"height":"width"}const _9=new Set(["top","bottom"]);function Zt(r){return _9.has(Dt(r))?"y":"x"}function g0(r){return bm(Zt(r))}function xm(r,e,t){t===void 0&&(t=!1);const n=Ft(r),i=g0(r),s=m0(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ko(o)),[o,ko(o)]}function j9(r){const e=ko(r);return[So(r),e,So(e)]}function So(r){return r.replace(/start|end/g,e=>q9[e])}const wm=["left","right"],Sm=["right","left"],U9=["top","bottom"],W9=["bottom","top"];function G9(r,e,t){switch(r){case"top":case"bottom":return t?e?Sm:wm:e?wm:Sm;case"left":case"right":return e?U9:W9;default:return[]}}function K9(r,e,t,n){const i=Ft(r);let s=G9(Dt(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(So)))),s}function ko(r){return r.replace(/left|right|bottom|top/g,e=>V9[e])}function J9(r){return{top:0,right:0,bottom:0,left:0,...r}}function y0(r){return typeof r!="number"?J9(r):{top:r,right:r,bottom:r,left:r}}function Kn(r){const{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function km(r,e,t){let{reference:n,floating:i}=r;const s=Zt(e),o=g0(e),a=m0(o),l=Dt(e),c=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-i.width,y:d};break;default:f={x:n.x,y:n.y}}switch(Ft(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}const X9=async(r,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:u,y:d}=km(c,n,l),h=n,f={},m=0;for(let y=0;y<a.length;y++){const{name:v,fn:x}=a[y],{x:T,y:D,data:P,reset:N}=await x({x:u,y:d,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:o,elements:{reference:r,floating:e}});u=T??u,d=D??d,f={...f,[v]:{...f[v],...P}},N&&m<=50&&(m++,typeof N=="object"&&(N.placement&&(h=N.placement),N.rects&&(c=N.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):N.rects),{x:u,y:d}=km(c,h,l)),y=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function Jn(r,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=vr(e,r),m=y0(f),v=a[h?d==="floating"?"reference":"floating":d],x=Kn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(v)))==null||t?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),T=d==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,D=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),P=await(s.isElement==null?void 0:s.isElement(D))?await(s.getScale==null?void 0:s.getScale(D))||{x:1,y:1}:{x:1,y:1},N=Kn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:T,offsetParent:D,strategy:l}):T);return{top:(x.top-N.top+m.top)/P.y,bottom:(N.bottom-x.bottom+m.bottom)/P.y,left:(x.left-N.left+m.left)/P.x,right:(N.right-x.right+m.right)/P.x}}const Y9=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=vr(r,e)||{};if(c==null)return{};const d=y0(u),h={x:t,y:n},f=g0(i),m=m0(f),y=await o.getDimensions(c),v=f==="y",x=v?"top":"left",T=v?"bottom":"right",D=v?"clientHeight":"clientWidth",P=s.reference[m]+s.reference[f]-h[f]-s.floating[m],N=h[f]-s.reference[f],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let A=O?O[D]:0;(!A||!await(o.isElement==null?void 0:o.isElement(O)))&&(A=a.floating[D]||s.floating[m]);const $=P/2-N/2,F=A/2-y[m]/2-1,q=Xt(d[x],F),te=Xt(d[T],F),Y=q,he=A-y[m]-te,Q=A/2-y[m]/2+$,W=p0(Y,Q,he),ne=!l.arrow&&Ft(i)!=null&&Q!==W&&s.reference[m]/2-(Q<Y?q:te)-y[m]/2<0,ve=ne?Q<Y?Q-Y:Q-he:0;return{[f]:h[f]+ve,data:{[f]:W,centerOffset:Q-W-ve,...ne&&{alignmentOffset:ve}},reset:ne}}});function Z9(r,e,t){return(r?[...t.filter(i=>Ft(i)===r),...t.filter(i=>Ft(i)!==r)]:t.filter(i=>Dt(i)===i)).filter(i=>r?Ft(i)===r||(e?So(i)!==i:!1):!0)}const Q9=function(r){return r===void 0&&(r={}),{name:"autoPlacement",options:r,async fn(e){var t,n,i;const{rects:s,middlewareData:o,placement:a,platform:l,elements:c}=e,{crossAxis:u=!1,alignment:d,allowedPlacements:h=vm,autoAlignment:f=!0,...m}=vr(r,e),y=d!==void 0||h===vm?Z9(d||null,f,h):h,v=await Jn(e,m),x=((t=o.autoPlacement)==null?void 0:t.index)||0,T=y[x];if(T==null)return{};const D=xm(T,s,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==T)return{reset:{placement:y[0]}};const P=[v[Dt(T)],v[D[0]],v[D[1]]],N=[...((n=o.autoPlacement)==null?void 0:n.overflows)||[],{placement:T,overflows:P}],O=y[x+1];if(O)return{data:{index:x+1,overflows:N},reset:{placement:O}};const A=N.map(q=>{const te=Ft(q.placement);return[q.placement,te&&u?q.overflows.slice(0,2).reduce((Y,he)=>Y+he,0):q.overflows[0],q.overflows]}).sort((q,te)=>q[1]-te[1]),F=((i=A.filter(q=>q[2].slice(0,Ft(q[0])?2:3).every(te=>te<=0))[0])==null?void 0:i[0])||A[0][0];return F!==a?{data:{index:x+1,overflows:N},reset:{placement:F}}:{}}}},ex=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...v}=vr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const x=Dt(i),T=Zt(a),D=Dt(a)===a,P=await(l.isRTL==null?void 0:l.isRTL(c.floating)),N=h||(D||!y?[ko(a)]:j9(a)),O=m!=="none";!h&&O&&N.push(...K9(a,y,m,P));const A=[a,...N],$=await Jn(e,v),F=[];let q=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&F.push($[x]),d){const Q=xm(i,o,P);F.push($[Q[0]],$[Q[1]])}if(q=[...q,{placement:i,overflows:F}],!F.every(Q=>Q<=0)){var te,Y;const Q=(((te=s.flip)==null?void 0:te.index)||0)+1,W=A[Q];if(W&&(!(d==="alignment"?T!==Zt(W):!1)||q.every(ge=>Zt(ge.placement)===T?ge.overflows[0]>0:!0)))return{data:{index:Q,overflows:q},reset:{placement:W}};let ne=(Y=q.filter(ve=>ve.overflows[0]<=0).sort((ve,ge)=>ve.overflows[1]-ge.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(f){case"bestFit":{var he;const ve=(he=q.filter(ge=>{if(O){const Ae=Zt(ge.placement);return Ae===T||Ae==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Ae=>Ae>0).reduce((Ae,C)=>Ae+C,0)]).sort((ge,Ae)=>ge[1]-Ae[1])[0])==null?void 0:he[0];ve&&(ne=ve);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};function Mm(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Tm(r){return gm.some(e=>r[e]>=0)}const tx=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){const{rects:t}=e,{strategy:n="referenceHidden",...i}=vr(r,e);switch(n){case"referenceHidden":{const s=await Jn(e,{...i,elementContext:"reference"}),o=Mm(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Tm(o)}}}case"escaped":{const s=await Jn(e,{...i,altBoundary:!0}),o=Mm(s,t.floating);return{data:{escapedOffsets:o,escaped:Tm(o)}}}default:return{}}}}};function Cm(r){const e=Xt(...r.map(s=>s.left)),t=Xt(...r.map(s=>s.top)),n=lt(...r.map(s=>s.right)),i=lt(...r.map(s=>s.bottom));return{x:e,y:t,width:n-e,height:i-t}}function rx(r){const e=r.slice().sort((i,s)=>i.y-s.y),t=[];let n=null;for(let i=0;i<e.length;i++){const s=e[i];!n||s.y-n.y>n.height/2?t.push([s]):t[t.length-1].push(s),n=s}return t.map(i=>Kn(Cm(i)))}const nx=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:n,rects:i,platform:s,strategy:o}=e,{padding:a=2,x:l,y:c}=vr(r,e),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=rx(u),h=Kn(Cm(u)),f=y0(a);function m(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(v=>l>v.left-f.left&&l<v.right+f.right&&c>v.top-f.top&&c<v.bottom+f.bottom)||h;if(d.length>=2){if(Zt(t)==="y"){const q=d[0],te=d[d.length-1],Y=Dt(t)==="top",he=q.top,Q=te.bottom,W=Y?q.left:te.left,ne=Y?q.right:te.right,ve=ne-W,ge=Q-he;return{top:he,bottom:Q,left:W,right:ne,width:ve,height:ge,x:W,y:he}}const v=Dt(t)==="left",x=lt(...d.map(q=>q.right)),T=Xt(...d.map(q=>q.left)),D=d.filter(q=>v?q.left===T:q.right===x),P=D[0].top,N=D[D.length-1].bottom,O=T,A=x,$=A-O,F=N-P;return{top:P,bottom:N,left:O,right:A,width:$,height:F,x:O,y:P}}return h}const y=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:o});return i.reference.x!==y.reference.x||i.reference.y!==y.reference.y||i.reference.width!==y.reference.width||i.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},ix=new Set(["left","top"]);async function sx(r,e){const{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Dt(t),a=Ft(t),l=Zt(t)==="y",c=ix.has(o)?-1:1,u=s&&l?-1:1,d=vr(e,r);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(f=a==="end"?m*-1:m),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const ox=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await sx(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},ax=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x,y:T}=v;return{x,y:T}}},...l}=vr(r,e),c={x:t,y:n},u=await Jn(e,l),d=Zt(Dt(i)),h=bm(d);let f=c[h],m=c[d];if(s){const v=h==="y"?"top":"left",x=h==="y"?"bottom":"right",T=f+u[v],D=f-u[x];f=p0(T,f,D)}if(o){const v=d==="y"?"top":"left",x=d==="y"?"bottom":"right",T=m+u[v],D=m-u[x];m=p0(T,m,D)}const y=a.fn({...e,[h]:f,[d]:m});return{...y,data:{x:y.x-t,y:y.y-n,enabled:{[h]:s,[d]:o}}}}}},lx=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(e){var t,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=vr(r,e),u=await Jn(e,c),d=Dt(i),h=Ft(i),f=Zt(i)==="y",{width:m,height:y}=s.floating;let v,x;d==="top"||d==="bottom"?(v=d,x=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,v=h==="end"?"top":"bottom");const T=y-u.top-u.bottom,D=m-u.left-u.right,P=Xt(y-u[v],T),N=Xt(m-u[x],D),O=!e.middlewareData.shift;let A=P,$=N;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&($=D),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(A=T),O&&!h){const q=lt(u.left,0),te=lt(u.right,0),Y=lt(u.top,0),he=lt(u.bottom,0);f?$=m-2*(q!==0||te!==0?q+te:lt(u.left,u.right)):A=y-2*(Y!==0||he!==0?Y+he:lt(u.top,u.bottom))}await l({...e,availableWidth:$,availableHeight:A});const F=await o.getDimensions(a.floating);return m!==F.width||y!==F.height?{reset:{rects:!0}}:{}}}};function Mo(){return typeof window<"u"}function Xn(r){return Em(r)?(r.nodeName||"").toLowerCase():"#document"}function St(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function br(r){var e;return(e=(Em(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Em(r){return Mo()?r instanceof Node||r instanceof St(r).Node:!1}function $t(r){return Mo()?r instanceof Element||r instanceof St(r).Element:!1}function Qt(r){return Mo()?r instanceof HTMLElement||r instanceof St(r).HTMLElement:!1}function Am(r){return!Mo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof St(r).ShadowRoot}const cx=new Set(["inline","contents"]);function Vi(r){const{overflow:e,overflowX:t,overflowY:n,display:i}=Ht(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!cx.has(i)}const ux=new Set(["table","td","th"]);function dx(r){return ux.has(Xn(r))}const hx=[":popover-open",":modal"];function To(r){return hx.some(e=>{try{return r.matches(e)}catch{return!1}})}const fx=["transform","translate","scale","rotate","perspective"],px=["transform","translate","scale","rotate","perspective","filter"],mx=["paint","layout","strict","content"];function v0(r){const e=b0(),t=$t(r)?Ht(r):r;return fx.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||px.some(n=>(t.willChange||"").includes(n))||mx.some(n=>(t.contain||"").includes(n))}function gx(r){let e=Jr(r);for(;Qt(e)&&!Yn(e);){if(v0(e))return e;if(To(e))return null;e=Jr(e)}return null}function b0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yx=new Set(["html","body","#document"]);function Yn(r){return yx.has(Xn(r))}function Ht(r){return St(r).getComputedStyle(r)}function Co(r){return $t(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Jr(r){if(Xn(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Am(r)&&r.host||br(r);return Am(e)?e.host:e}function Om(r){const e=Jr(r);return Yn(e)?r.ownerDocument?r.ownerDocument.body:r.body:Qt(e)&&Vi(e)?e:Om(e)}function Nm(r,e,t){var n;e===void 0&&(e=[]);const i=Om(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=St(i);return s?(x0(o),e.concat(o,o.visualViewport||[],Vi(i)?i:[],[])):e.concat(i,Nm(i,[]))}function x0(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Dm(r){const e=Ht(r);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=Qt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=wo(t)!==s||wo(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function zm(r){return $t(r)?r:r.contextElement}function Zn(r){const e=zm(r);if(!Qt(e))return Yt(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Dm(e);let o=(s?wo(t.width):t.width)/n,a=(s?wo(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const vx=Yt(0);function Im(r){const e=St(r);return!b0()||!e.visualViewport?vx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bx(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==St(r)?!1:e}function qi(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=zm(r);let o=Yt(1);e&&(n?$t(n)&&(o=Zn(n)):o=Zn(r));const a=bx(s,t,n)?Im(s):Yt(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const h=St(s),f=n&&$t(n)?St(n):n;let m=h,y=x0(m);for(;y&&n&&f!==m;){const v=Zn(y),x=y.getBoundingClientRect(),T=Ht(y),D=x.left+(y.clientLeft+parseFloat(T.paddingLeft))*v.x,P=x.top+(y.clientTop+parseFloat(T.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=D,c+=P,m=St(y),y=x0(m)}}return Kn({width:u,height:d,x:l,y:c})}function Eo(r,e){const t=Co(r).scrollLeft;return e?e.left+t:qi(br(r)).left+t}function Rm(r,e){const t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Eo(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function xx(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r;const s=i==="fixed",o=br(n),a=e?To(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Yt(1);const u=Yt(0),d=Qt(n);if((d||!d&&!s)&&((Xn(n)!=="body"||Vi(o))&&(l=Co(n)),Qt(n))){const f=qi(n);c=Zn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const h=o&&!d&&!s?Rm(o,l):Yt(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function wx(r){return Array.from(r.getClientRects())}function Sx(r){const e=br(r),t=Co(r),n=r.ownerDocument.body,i=lt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=lt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+Eo(r);const a=-t.scrollTop;return Ht(n).direction==="rtl"&&(o+=lt(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Pm=25;function kx(r,e){const t=St(r),n=br(r),i=t.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=b0();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=Eo(n);if(c<=0){const u=n.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-f);m<=Pm&&(s-=m)}else c<=Pm&&(s+=c);return{width:s,height:o,x:a,y:l}}const Mx=new Set(["absolute","fixed"]);function Tx(r,e){const t=qi(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Qt(r)?Zn(r):Yt(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function Lm(r,e,t){let n;if(e==="viewport")n=kx(r,t);else if(e==="document")n=Sx(br(r));else if($t(e))n=Tx(e,t);else{const i=Im(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Kn(n)}function Bm(r,e){const t=Jr(r);return t===e||!$t(t)||Yn(t)?!1:Ht(t).position==="fixed"||Bm(t,e)}function Cx(r,e){const t=e.get(r);if(t)return t;let n=Nm(r,[]).filter(a=>$t(a)&&Xn(a)!=="body"),i=null;const s=Ht(r).position==="fixed";let o=s?Jr(r):r;for(;$t(o)&&!Yn(o);){const a=Ht(o),l=v0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Mx.has(i.position)||Vi(o)&&!l&&Bm(r,o))?n=n.filter(u=>u!==o):i=a,o=Jr(o)}return e.set(r,n),n}function Ex(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r;const o=[...t==="clippingAncestors"?To(e)?[]:Cx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{const d=Lm(e,u,i);return c.top=lt(d.top,c.top),c.right=Xt(d.right,c.right),c.bottom=Xt(d.bottom,c.bottom),c.left=lt(d.left,c.left),c},Lm(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ax(r){const{width:e,height:t}=Dm(r);return{width:e,height:t}}function Ox(r,e,t){const n=Qt(e),i=br(e),s=t==="fixed",o=qi(r,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Yt(0);function c(){l.x=Eo(i)}if(n||!n&&!s)if((Xn(e)!=="body"||Vi(i))&&(a=Co(e)),n){const f=qi(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!n&&i&&c();const u=i&&!n&&!s?Rm(i,a):Yt(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function w0(r){return Ht(r).position==="static"}function Fm(r,e){if(!Qt(r)||Ht(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return br(r)===t&&(t=t.ownerDocument.body),t}function $m(r,e){const t=St(r);if(To(r))return t;if(!Qt(r)){let i=Jr(r);for(;i&&!Yn(i);){if($t(i)&&!w0(i))return i;i=Jr(i)}return t}let n=Fm(r,e);for(;n&&dx(n)&&w0(n);)n=Fm(n,e);return n&&Yn(n)&&w0(n)&&!v0(n)?t:n||gx(r)||t}const Nx=async function(r){const e=this.getOffsetParent||$m,t=this.getDimensions,n=await t(r.floating);return{reference:Ox(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Dx(r){return Ht(r).direction==="rtl"}const zx={convertOffsetParentRelativeRectToViewportRelativeRect:xx,getDocumentElement:br,getClippingRect:Ex,getOffsetParent:$m,getElementRects:Nx,getClientRects:wx,getDimensions:Ax,getScale:Zn,isElement:$t,isRTL:Dx},Hm=ox,Vm=Q9,qm=ax,_m=ex,jm=lx,Um=tx,Wm=Y9,Gm=nx,Km=(r,e,t)=>{const n=new Map,i={platform:zx,...t},s={...i.platform,_c:n};return X9(r,e,{...i,platform:s})};let S0,k0;if(typeof WeakMap<"u"){let r=new WeakMap;S0=e=>r.get(e),k0=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;S0=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},k0=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var xr=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,c)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return S0(r)||k0(r,Ix(r))}};function Ix(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=Rx(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)n[c]=0;for(let c=0,u=0;c<t;c++){const d=r.child(c);u++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const y=d.child(m),{colspan:v,rowspan:x,colwidth:T}=y.attrs;for(let D=0;D<x;D++){if(D+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:x-D});break}const P=i+D*e;for(let N=0;N<v;N++){n[P+N]==0?n[P+N]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:v-N});const O=T&&T[N];if(O){const A=(P+N)%e*2,$=o[A];$==null||$!=O&&o[A+1]==1?(o[A]=O,o[A+1]=1):$==O&&o[A+1]++}}}i+=v,u+=y.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)n[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new xr(e,t,n,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&Px(a,o,r),a}function Rx(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>n&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function Px(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%r.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Lx(l)))[c]=u)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function Lx(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function M0(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}new Fe("selectingCells");function Bx(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function Jm(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Fx(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Bx(e.$head)||$x(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function $x(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function Xm(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function Ym(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function Zm(r,e,t){const n=r.node(-1),i=xr.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function Qm(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}var er=class wr extends ce{constructor(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=t.pos-s);l.unshift(t.pos-s);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new hu(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Xm(n)&&Xm(i)&&Ym(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?wr.rowSelection(n,i):s&&this.isColSelection()?wr.colSelection(n,i):new wr(n,i)}return de.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=xr.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*t.width+i.left,d=i.left;d<i.right;d++,u++){const h=t.map[u];if(s[h])continue;s[h]=!0;const f=t.findCell(h);let m=e.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=i.left-f.left,v=f.right-i.right;if(y>0||v>0){let x=m.attrs;if(y>0&&(x=Qm(x,0,y)),v>0&&(x=Qm(x,x.colspan-v,v)),f.left<i.left){if(m=m.type.createAndFill(x),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else m=m.type.create(x,m.content)}if(f.top<i.top||f.bottom>i.bottom){const x={...m.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?m=m.type.createAndFill(x):m=m.type.create(x,m.content)}c.push(m)}o.push(e.child(l).copy(H.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new X(H.from(a),1,1)}replace(e,t=X.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),o?X.empty:t)}const s=ce.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new X(H.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=xr.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new wr(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=xr.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof wr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new wr(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new wr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new wr(e.resolve(t),e.resolve(n))}getBookmark(){return new Hx(this.$anchorCell.pos,this.$headCell.pos)}};er.prototype.visible=!1,ce.jsonID("cell",er);var Hx=class w1{constructor(e,t){this.anchor=e,this.head=t}map(e){return new w1(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&Ym(t,n)?new er(t,n):ce.near(n,1)}};new Fe("fix-tables");function e1(r){const e=r.selection,t=Fx(r),n=t.node(-1),i=t.start(-1),s=xr.get(n);return{...e instanceof er?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function Vx(r){return function(e,t){if(!Jm(e))return!1;if(t){const n=M0(e.schema),i=e1(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function t1(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function T0(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Vx(r):function(t,n){if(!Jm(t))return!1;if(n){const i=M0(t.schema),s=e1(t),o=t.tr,a=t1("row",s,i),l=t1("column",s,i),c=(r==="column"?a:r==="row"&&l)?1:0,u=r=="column"?{left:0,top:c,right:1,bottom:s.map.height}:r=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,m=o.doc.nodeAt(f);m&&o.setNodeMarkup(f,d,m.attrs)}),n(o)}return!0}}T0("row",{useDeprecatedLogic:!0}),T0("column",{useDeprecatedLogic:!0}),T0("cell",{useDeprecatedLogic:!0});function Ao(r,e){const t=r.selection;if(!(t instanceof er))return!1;if(e){const n=r.tr,i=M0(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new X(i,0,0))}),n.docChanged&&e(n)}return!0}Ha({ArrowLeft:No("horiz",-1),ArrowRight:No("horiz",1),ArrowUp:No("vert",-1),ArrowDown:No("vert",1),"Shift-ArrowLeft":Do("horiz",-1),"Shift-ArrowRight":Do("horiz",1),"Shift-ArrowUp":Do("vert",-1),"Shift-ArrowDown":Do("vert",1),Backspace:Ao,"Mod-Backspace":Ao,Delete:Ao,"Mod-Delete":Ao});function Oo(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function No(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof er)return Oo(t,n,ce.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=r1(i,r,e);if(o==null)return!1;if(r=="horiz")return Oo(t,n,ce.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=Zm(a,r,e);let c;return l?c=ce.near(l,1):e<0?c=ce.near(t.doc.resolve(a.before(-1)),-1):c=ce.near(t.doc.resolve(a.after(-1)),1),Oo(t,n,c)}}}function Do(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof er)o=s;else{const l=r1(i,r,e);if(l==null)return!1;o=new er(t.doc.resolve(l))}const a=Zm(o.$headCell,r,e);return a?Oo(t,n,new er(o.$anchorCell,a)):!1}}function r1(r,e,t){if(!(r.state.selection instanceof de))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}new Fe("tableColumnResizing");function qx(r,e){const t=Math.min(r.top,e.top),n=Math.max(r.bottom,e.bottom),i=Math.min(r.left,e.left),o=Math.max(r.right,e.right)-i,a=n-t,l=i,c=t;return new DOMRect(l,c,o,a)}var _x=class{constructor({editor:r,element:e,view:t,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:a,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:h,to:f})=>{const{doc:m,selection:y}=d,{empty:v}=y,x=!m.textBetween(h,f).length&&ja(d.selection),T=this.element.contains(document.activeElement);return!(!(u.hasFocus()||T)||v||x||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const h=!d?.selection.eq(u.state.selection),f=!d?.doc.eq(u.state.doc);!h&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,h,f,d)},this.updateDelay))},this.updateHandler=(u,d,h,f)=>{const{composing:m}=u;if(m||!d&&!h)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{u.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=r,this.element=e,this.view=t,this.updateDelay=n,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(c=l?.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(_m(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(qm(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Hm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Wm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(jm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Vm(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Um(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(Gm(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}get virtualElement(){var r;const{selection:e}=this.editor.state,t=(r=this.getReferencedVirtualElement)==null?void 0:r.call(this);if(t)return t;const n=mh(this.view,e.from,e.to);let i={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof se){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof er){const{$anchorCell:s,$headCell:o}=e,a=s?s.pos:o.pos,l=o?o.pos:s.pos,c=this.view.nodeDOM(a),u=this.view.nodeDOM(l);if(!c||!u)return;const d=c===u?c.getBoundingClientRect():qx(c.getBoundingClientRect(),u.getBoundingClientRect());i={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}return i}updatePosition(){const r=this.virtualElement;r&&Km(r,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n})=>{this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const{state:t}=r,n=t.selection.from!==t.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(r,e);return}const i=!e?.selection.eq(r.state.selection),s=!e?.doc.eq(r.state.doc);this.updateHandler(r,i,s,e)}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:r,from:s,to:o}))||!1}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},n1=r=>new Pe({key:typeof r.pluginKey=="string"?new Fe(r.pluginKey):r.pluginKey,view:e=>new _x({view:e,...r})});Se.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[n1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var jx=class{constructor({editor:r,element:e,view:t,options:n,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,d=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!o.hasFocus()||!u||!d||!h||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,a,l,c)=>{const{composing:u}=o;if(u||!a&&!l)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=r,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...n},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(r){return uh(r,{textSerializers:Ja(this.editor.schema)})}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(_m(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(qm(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Hm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Wm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(jm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Vm(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Um(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(Gm(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:r,from:s,to:o})}updatePosition(){const{selection:r}=this.editor.state,e=mh(this.view,r.from,r.to);Km({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const t=!e?.selection.eq(r.state.selection),n=!e?.doc.eq(r.state.doc);this.updateHandler(r,t,n,e)}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},i1=r=>new Pe({key:typeof r.pluginKey=="string"?new Fe(r.pluginKey):r.pluginKey,view:e=>new jx({view:e,...r})});Se.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[i1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var Ux=z.forwardRef(({pluginKey:r="bubbleMenu",editor:e,updateDelay:t,resizeDelay:n,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:a,children:l,...c},u)=>{const d=z.useRef(document.createElement("div"));typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:h}=Qh(),f=e||h,m={updateDelay:t,resizeDelay:n,appendTo:i,pluginKey:r,shouldShow:s,getReferencedVirtualElement:o,options:a},y=z.useRef(m);return y.current=m,z.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=d.current;v.style.visibility="hidden",v.style.position="absolute";const x=n1({...y.current,editor:f,element:v});f.registerPlugin(x);const T=y.current.pluginKey;return()=>{f.unregisterPlugin(T),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[f]),ji.createPortal(J.jsx("div",{...c,children:l}),d.current)});z.forwardRef(({pluginKey:r="floatingMenu",editor:e,appendTo:t,shouldShow:n=null,options:i,children:s,...o},a)=>{const l=z.useRef(document.createElement("div"));typeof a=="function"?a(l.current):a&&(a.current=l.current);const{editor:c}=Qh();return z.useEffect(()=>{const u=l.current;if(u.style.visibility="hidden",u.style.position="absolute",e?.isDestroyed||c?.isDestroyed)return;const d=e||c;if(!d){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const h=i1({editor:d,element:u,pluginKey:r,appendTo:t,shouldShow:n,options:i});return d.registerPlugin(h),()=>{d.unregisterPlugin(r),window.requestAnimationFrame(()=>{u.parentNode&&u.parentNode.removeChild(u)})}},[e,c,t,r,n,i]),ji.createPortal(J.jsx("div",{...o,children:s}),l.current)});const Wx=({editor:r})=>{if(!r)return null;const[e]=z.useState(!0),[t]=z.useState(!0);z.useEffect(()=>{r&&r.setEditable(t)},[t,r]);const n=Xh({editor:r,selector:i=>({isTerm:i.editor.isActive("term"),canTerm:i.editor.can().chain().focus().toggleMark("term").run(),isEm:i.editor.isActive("em"),canEm:i.editor.can().chain().focus().toggleMark("em").run(),isAlert:i.editor.isActive("alert"),canAlert:i.editor.can().chain().focus().toggleMark("alert").run()})});return J.jsx(J.Fragment,{children:r&&e&&J.jsx(Ux,{shouldShow:null,editor:r,options:{placement:"bottom",autoPlacement:!0,offset:8},children:J.jsxs("div",{className:"button-group",children:[J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("em").run(),disabled:!n.canEm,className:n.isEm?"is-active":"",children:"<em>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("term").run(),disabled:!n.canTerm,className:n.isTerm?"is-active":"",children:"<term>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("alert").run(),disabled:!n.canAlert,className:n.isAlert?"is-active":"",children:"<alert>"})]})})})},s1=["abstract","acknowledgement","affiliation","appendix","article","author","backmatter","biography","book","chapter","colophon","contributor","contributors","copyright","credit","dedication","docinfo","editor","feedback","frontmatter","google","html","index","macros","mathbook","preface","pretext","references","search","shortlicense","solutions","subsection","titlepage","website"],o1=["assemblage","chapter","conclusion","introduction","objectives","outcomes","paragraphs","part","postlude","prelude","reading-questions","sbsgroup","section","stack","subsection","subsubsection","task","technology","worksheet"],a1=["activity","algorithm","answer","axiom","biblio","blockquote","case","choice","choices","claim","conjecture","console","corollary","definition","demonstration","description","example","exercise","exploration","fact","hint","image","images","insight","investigation","lemma","list","listing","note","openconjecture","openproblem","openquestion","page","poem","principle","problem","program","project","proof","proposition","question","remark","shortdescription","solution","stanza","statement","subtask","table","tabular","theorem","warning","webwork"],Gx=["address","attribution","caption","cd","cell","cline","date","department","description","edition","entity","holder","idx","institution","journal","line","location","minilicense","mrow","personname","pg-macros","pubtitle","row","subtitle","support","title","usage","volume","year","xi:include"],Kx=["me","men","md","mdn"],l1=["ul","ol","li","p","task","figure","sidebyside","notation","row"],zo=["latex-image-preamble","latex-image","latex-preamble","slate","sage","sageplot","asymptote","macros","prefigure","program","input","output","prompt","pre","pg-code","tikzpicture","tikz","code","c"],Jx=[...s1,...o1,...a1,...l1,"xi:include"],C0=[...s1,...o1,...a1,...l1,...Kx];function Xx(r){let e=!1,t=r.split(/\r\n|\r|\n/g),n=[t[0].trim()];t.length>1&&n.push(t[1].trim());for(let i=2;i<t.length;i++){let s=/^<(\w\S*?)(\s.*?|>)$/.exec(t[i].trim()),o=/^<\/(\w\S*?)(\s.*?|>)(.?)$/.exec(t[i].trim());if(s&&zo.includes(s[1]))n.push(t[i]),e=!0;else if(o&&zo.includes(o[1]))n.push(t[i]),e=!1;else if(e)n.push(t[i]);else{t[i]=t[i].trim();let a=n.pop();a?n.push(a.trim()+" "+t[i]):n.push(t[i])}}return n.join(`
420
+ `}}else if(r.type==="text")if(r.marks){const t=r.marks[0].type in xo?xo[r.marks[0].type]:r.marks[0].type;e=e+"<"+t+">"+mm(r.text)+"</"+t+">"}else e=e+mm(r.text);else r.type==="hardBreak"?e=e+`
421
+ `:e=e+"<!-- Something is missing; got "+JSON.stringify(r)+" -->";return e}const ym=["top","right","bottom","left"],vm=["start","end"],bm=ym.reduce((r,e)=>r.concat(e,e+"-"+vm[0],e+"-"+vm[1]),[]),Xt=Math.min,lt=Math.max,wo=Math.round,Yt=r=>({x:r,y:r}),V9={left:"right",right:"left",bottom:"top",top:"bottom"},q9={start:"end",end:"start"};function p0(r,e,t){return lt(r,Xt(e,t))}function vr(r,e){return typeof r=="function"?r(e):r}function Dt(r){return r.split("-")[0]}function Ft(r){return r.split("-")[1]}function xm(r){return r==="x"?"y":"x"}function m0(r){return r==="y"?"height":"width"}const _9=new Set(["top","bottom"]);function Zt(r){return _9.has(Dt(r))?"y":"x"}function g0(r){return xm(Zt(r))}function wm(r,e,t){t===void 0&&(t=!1);const n=Ft(r),i=g0(r),s=m0(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ko(o)),[o,ko(o)]}function j9(r){const e=ko(r);return[So(r),e,So(e)]}function So(r){return r.replace(/start|end/g,e=>q9[e])}const Sm=["left","right"],km=["right","left"],U9=["top","bottom"],W9=["bottom","top"];function G9(r,e,t){switch(r){case"top":case"bottom":return t?e?km:Sm:e?Sm:km;case"left":case"right":return e?U9:W9;default:return[]}}function K9(r,e,t,n){const i=Ft(r);let s=G9(Dt(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(So)))),s}function ko(r){return r.replace(/left|right|bottom|top/g,e=>V9[e])}function J9(r){return{top:0,right:0,bottom:0,left:0,...r}}function y0(r){return typeof r!="number"?J9(r):{top:r,right:r,bottom:r,left:r}}function Kn(r){const{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Mm(r,e,t){let{reference:n,floating:i}=r;const s=Zt(e),o=g0(e),a=m0(o),l=Dt(e),c=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-i.width,y:d};break;default:f={x:n.x,y:n.y}}switch(Ft(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}const X9=async(r,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:u,y:d}=Mm(c,n,l),h=n,f={},m=0;for(let y=0;y<a.length;y++){const{name:v,fn:x}=a[y],{x:T,y:D,data:P,reset:E}=await x({x:u,y:d,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:o,elements:{reference:r,floating:e}});u=T??u,d=D??d,f={...f,[v]:{...f[v],...P}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):E.rects),{x:u,y:d}=Mm(c,h,l)),y=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function Jn(r,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=vr(e,r),m=y0(f),v=a[h?d==="floating"?"reference":"floating":d],x=Kn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(v)))==null||t?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),T=d==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,D=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),P=await(s.isElement==null?void 0:s.isElement(D))?await(s.getScale==null?void 0:s.getScale(D))||{x:1,y:1}:{x:1,y:1},E=Kn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:T,offsetParent:D,strategy:l}):T);return{top:(x.top-E.top+m.top)/P.y,bottom:(E.bottom-x.bottom+m.bottom)/P.y,left:(x.left-E.left+m.left)/P.x,right:(E.right-x.right+m.right)/P.x}}const Y9=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=vr(r,e)||{};if(c==null)return{};const d=y0(u),h={x:t,y:n},f=g0(i),m=m0(f),y=await o.getDimensions(c),v=f==="y",x=v?"top":"left",T=v?"bottom":"right",D=v?"clientHeight":"clientWidth",P=s.reference[m]+s.reference[f]-h[f]-s.floating[m],E=h[f]-s.reference[f],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=N?N[D]:0;(!O||!await(o.isElement==null?void 0:o.isElement(N)))&&(O=a.floating[D]||s.floating[m]);const $=P/2-E/2,F=O/2-y[m]/2-1,q=Xt(d[x],F),te=Xt(d[T],F),Y=q,he=O-y[m]-te,Q=O/2-y[m]/2+$,W=p0(Y,Q,he),ne=!l.arrow&&Ft(i)!=null&&Q!==W&&s.reference[m]/2-(Q<Y?q:te)-y[m]/2<0,ve=ne?Q<Y?Q-Y:Q-he:0;return{[f]:h[f]+ve,data:{[f]:W,centerOffset:Q-W-ve,...ne&&{alignmentOffset:ve}},reset:ne}}});function Z9(r,e,t){return(r?[...t.filter(i=>Ft(i)===r),...t.filter(i=>Ft(i)!==r)]:t.filter(i=>Dt(i)===i)).filter(i=>r?Ft(i)===r||(e?So(i)!==i:!1):!0)}const Q9=function(r){return r===void 0&&(r={}),{name:"autoPlacement",options:r,async fn(e){var t,n,i;const{rects:s,middlewareData:o,placement:a,platform:l,elements:c}=e,{crossAxis:u=!1,alignment:d,allowedPlacements:h=bm,autoAlignment:f=!0,...m}=vr(r,e),y=d!==void 0||h===bm?Z9(d||null,f,h):h,v=await Jn(e,m),x=((t=o.autoPlacement)==null?void 0:t.index)||0,T=y[x];if(T==null)return{};const D=wm(T,s,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==T)return{reset:{placement:y[0]}};const P=[v[Dt(T)],v[D[0]],v[D[1]]],E=[...((n=o.autoPlacement)==null?void 0:n.overflows)||[],{placement:T,overflows:P}],N=y[x+1];if(N)return{data:{index:x+1,overflows:E},reset:{placement:N}};const O=E.map(q=>{const te=Ft(q.placement);return[q.placement,te&&u?q.overflows.slice(0,2).reduce((Y,he)=>Y+he,0):q.overflows[0],q.overflows]}).sort((q,te)=>q[1]-te[1]),F=((i=O.filter(q=>q[2].slice(0,Ft(q[0])?2:3).every(te=>te<=0))[0])==null?void 0:i[0])||O[0][0];return F!==a?{data:{index:x+1,overflows:E},reset:{placement:F}}:{}}}},ex=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...v}=vr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const x=Dt(i),T=Zt(a),D=Dt(a)===a,P=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(D||!y?[ko(a)]:j9(a)),N=m!=="none";!h&&N&&E.push(...K9(a,y,m,P));const O=[a,...E],$=await Jn(e,v),F=[];let q=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&F.push($[x]),d){const Q=wm(i,o,P);F.push($[Q[0]],$[Q[1]])}if(q=[...q,{placement:i,overflows:F}],!F.every(Q=>Q<=0)){var te,Y;const Q=(((te=s.flip)==null?void 0:te.index)||0)+1,W=O[Q];if(W&&(!(d==="alignment"?T!==Zt(W):!1)||q.every(ge=>Zt(ge.placement)===T?ge.overflows[0]>0:!0)))return{data:{index:Q,overflows:q},reset:{placement:W}};let ne=(Y=q.filter(ve=>ve.overflows[0]<=0).sort((ve,ge)=>ve.overflows[1]-ge.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(f){case"bestFit":{var he;const ve=(he=q.filter(ge=>{if(N){const Ae=Zt(ge.placement);return Ae===T||Ae==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Ae=>Ae>0).reduce((Ae,C)=>Ae+C,0)]).sort((ge,Ae)=>ge[1]-Ae[1])[0])==null?void 0:he[0];ve&&(ne=ve);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};function Tm(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Cm(r){return ym.some(e=>r[e]>=0)}const tx=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){const{rects:t}=e,{strategy:n="referenceHidden",...i}=vr(r,e);switch(n){case"referenceHidden":{const s=await Jn(e,{...i,elementContext:"reference"}),o=Tm(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Cm(o)}}}case"escaped":{const s=await Jn(e,{...i,altBoundary:!0}),o=Tm(s,t.floating);return{data:{escapedOffsets:o,escaped:Cm(o)}}}default:return{}}}}};function Em(r){const e=Xt(...r.map(s=>s.left)),t=Xt(...r.map(s=>s.top)),n=lt(...r.map(s=>s.right)),i=lt(...r.map(s=>s.bottom));return{x:e,y:t,width:n-e,height:i-t}}function rx(r){const e=r.slice().sort((i,s)=>i.y-s.y),t=[];let n=null;for(let i=0;i<e.length;i++){const s=e[i];!n||s.y-n.y>n.height/2?t.push([s]):t[t.length-1].push(s),n=s}return t.map(i=>Kn(Em(i)))}const nx=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:n,rects:i,platform:s,strategy:o}=e,{padding:a=2,x:l,y:c}=vr(r,e),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=rx(u),h=Kn(Em(u)),f=y0(a);function m(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(v=>l>v.left-f.left&&l<v.right+f.right&&c>v.top-f.top&&c<v.bottom+f.bottom)||h;if(d.length>=2){if(Zt(t)==="y"){const q=d[0],te=d[d.length-1],Y=Dt(t)==="top",he=q.top,Q=te.bottom,W=Y?q.left:te.left,ne=Y?q.right:te.right,ve=ne-W,ge=Q-he;return{top:he,bottom:Q,left:W,right:ne,width:ve,height:ge,x:W,y:he}}const v=Dt(t)==="left",x=lt(...d.map(q=>q.right)),T=Xt(...d.map(q=>q.left)),D=d.filter(q=>v?q.left===T:q.right===x),P=D[0].top,E=D[D.length-1].bottom,N=T,O=x,$=O-N,F=E-P;return{top:P,bottom:E,left:N,right:O,width:$,height:F,x:N,y:P}}return h}const y=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:o});return i.reference.x!==y.reference.x||i.reference.y!==y.reference.y||i.reference.width!==y.reference.width||i.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},ix=new Set(["left","top"]);async function sx(r,e){const{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Dt(t),a=Ft(t),l=Zt(t)==="y",c=ix.has(o)?-1:1,u=s&&l?-1:1,d=vr(e,r);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(f=a==="end"?m*-1:m),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const ox=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await sx(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},ax=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x,y:T}=v;return{x,y:T}}},...l}=vr(r,e),c={x:t,y:n},u=await Jn(e,l),d=Zt(Dt(i)),h=xm(d);let f=c[h],m=c[d];if(s){const v=h==="y"?"top":"left",x=h==="y"?"bottom":"right",T=f+u[v],D=f-u[x];f=p0(T,f,D)}if(o){const v=d==="y"?"top":"left",x=d==="y"?"bottom":"right",T=m+u[v],D=m-u[x];m=p0(T,m,D)}const y=a.fn({...e,[h]:f,[d]:m});return{...y,data:{x:y.x-t,y:y.y-n,enabled:{[h]:s,[d]:o}}}}}},lx=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(e){var t,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=vr(r,e),u=await Jn(e,c),d=Dt(i),h=Ft(i),f=Zt(i)==="y",{width:m,height:y}=s.floating;let v,x;d==="top"||d==="bottom"?(v=d,x=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,v=h==="end"?"top":"bottom");const T=y-u.top-u.bottom,D=m-u.left-u.right,P=Xt(y-u[v],T),E=Xt(m-u[x],D),N=!e.middlewareData.shift;let O=P,$=E;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&($=D),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(O=T),N&&!h){const q=lt(u.left,0),te=lt(u.right,0),Y=lt(u.top,0),he=lt(u.bottom,0);f?$=m-2*(q!==0||te!==0?q+te:lt(u.left,u.right)):O=y-2*(Y!==0||he!==0?Y+he:lt(u.top,u.bottom))}await l({...e,availableWidth:$,availableHeight:O});const F=await o.getDimensions(a.floating);return m!==F.width||y!==F.height?{reset:{rects:!0}}:{}}}};function Mo(){return typeof window<"u"}function Xn(r){return Am(r)?(r.nodeName||"").toLowerCase():"#document"}function St(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function br(r){var e;return(e=(Am(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Am(r){return Mo()?r instanceof Node||r instanceof St(r).Node:!1}function $t(r){return Mo()?r instanceof Element||r instanceof St(r).Element:!1}function Qt(r){return Mo()?r instanceof HTMLElement||r instanceof St(r).HTMLElement:!1}function Om(r){return!Mo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof St(r).ShadowRoot}const cx=new Set(["inline","contents"]);function Vi(r){const{overflow:e,overflowX:t,overflowY:n,display:i}=Ht(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!cx.has(i)}const ux=new Set(["table","td","th"]);function dx(r){return ux.has(Xn(r))}const hx=[":popover-open",":modal"];function To(r){return hx.some(e=>{try{return r.matches(e)}catch{return!1}})}const fx=["transform","translate","scale","rotate","perspective"],px=["transform","translate","scale","rotate","perspective","filter"],mx=["paint","layout","strict","content"];function v0(r){const e=b0(),t=$t(r)?Ht(r):r;return fx.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||px.some(n=>(t.willChange||"").includes(n))||mx.some(n=>(t.contain||"").includes(n))}function gx(r){let e=Jr(r);for(;Qt(e)&&!Yn(e);){if(v0(e))return e;if(To(e))return null;e=Jr(e)}return null}function b0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yx=new Set(["html","body","#document"]);function Yn(r){return yx.has(Xn(r))}function Ht(r){return St(r).getComputedStyle(r)}function Co(r){return $t(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Jr(r){if(Xn(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Om(r)&&r.host||br(r);return Om(e)?e.host:e}function Nm(r){const e=Jr(r);return Yn(e)?r.ownerDocument?r.ownerDocument.body:r.body:Qt(e)&&Vi(e)?e:Nm(e)}function Dm(r,e,t){var n;e===void 0&&(e=[]);const i=Nm(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=St(i);return s?(x0(o),e.concat(o,o.visualViewport||[],Vi(i)?i:[],[])):e.concat(i,Dm(i,[]))}function x0(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function zm(r){const e=Ht(r);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=Qt(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=wo(t)!==s||wo(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function Im(r){return $t(r)?r:r.contextElement}function Zn(r){const e=Im(r);if(!Qt(e))return Yt(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:s}=zm(e);let o=(s?wo(t.width):t.width)/n,a=(s?wo(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const vx=Yt(0);function Rm(r){const e=St(r);return!b0()||!e.visualViewport?vx:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bx(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==St(r)?!1:e}function qi(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=Im(r);let o=Yt(1);e&&(n?$t(n)&&(o=Zn(n)):o=Zn(r));const a=bx(s,t,n)?Rm(s):Yt(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const h=St(s),f=n&&$t(n)?St(n):n;let m=h,y=x0(m);for(;y&&n&&f!==m;){const v=Zn(y),x=y.getBoundingClientRect(),T=Ht(y),D=x.left+(y.clientLeft+parseFloat(T.paddingLeft))*v.x,P=x.top+(y.clientTop+parseFloat(T.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=D,c+=P,m=St(y),y=x0(m)}}return Kn({width:u,height:d,x:l,y:c})}function Eo(r,e){const t=Co(r).scrollLeft;return e?e.left+t:qi(br(r)).left+t}function Pm(r,e){const t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-Eo(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function xx(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r;const s=i==="fixed",o=br(n),a=e?To(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Yt(1);const u=Yt(0),d=Qt(n);if((d||!d&&!s)&&((Xn(n)!=="body"||Vi(o))&&(l=Co(n)),Qt(n))){const f=qi(n);c=Zn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const h=o&&!d&&!s?Pm(o,l):Yt(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:t.y*c.y-l.scrollTop*c.y+u.y+h.y}}function wx(r){return Array.from(r.getClientRects())}function Sx(r){const e=br(r),t=Co(r),n=r.ownerDocument.body,i=lt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=lt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+Eo(r);const a=-t.scrollTop;return Ht(n).direction==="rtl"&&(o+=lt(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Lm=25;function kx(r,e){const t=St(r),n=br(r),i=t.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=b0();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=Eo(n);if(c<=0){const u=n.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-f);m<=Lm&&(s-=m)}else c<=Lm&&(s+=c);return{width:s,height:o,x:a,y:l}}const Mx=new Set(["absolute","fixed"]);function Tx(r,e){const t=qi(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=Qt(r)?Zn(r):Yt(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function Bm(r,e,t){let n;if(e==="viewport")n=kx(r,t);else if(e==="document")n=Sx(br(r));else if($t(e))n=Tx(e,t);else{const i=Rm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Kn(n)}function Fm(r,e){const t=Jr(r);return t===e||!$t(t)||Yn(t)?!1:Ht(t).position==="fixed"||Fm(t,e)}function Cx(r,e){const t=e.get(r);if(t)return t;let n=Dm(r,[]).filter(a=>$t(a)&&Xn(a)!=="body"),i=null;const s=Ht(r).position==="fixed";let o=s?Jr(r):r;for(;$t(o)&&!Yn(o);){const a=Ht(o),l=v0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Mx.has(i.position)||Vi(o)&&!l&&Fm(r,o))?n=n.filter(u=>u!==o):i=a,o=Jr(o)}return e.set(r,n),n}function Ex(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r;const o=[...t==="clippingAncestors"?To(e)?[]:Cx(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,u)=>{const d=Bm(e,u,i);return c.top=lt(d.top,c.top),c.right=Xt(d.right,c.right),c.bottom=Xt(d.bottom,c.bottom),c.left=lt(d.left,c.left),c},Bm(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ax(r){const{width:e,height:t}=zm(r);return{width:e,height:t}}function Ox(r,e,t){const n=Qt(e),i=br(e),s=t==="fixed",o=qi(r,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Yt(0);function c(){l.x=Eo(i)}if(n||!n&&!s)if((Xn(e)!=="body"||Vi(i))&&(a=Co(e)),n){const f=qi(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!n&&i&&c();const u=i&&!n&&!s?Pm(i,a):Yt(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function w0(r){return Ht(r).position==="static"}function $m(r,e){if(!Qt(r)||Ht(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return br(r)===t&&(t=t.ownerDocument.body),t}function Hm(r,e){const t=St(r);if(To(r))return t;if(!Qt(r)){let i=Jr(r);for(;i&&!Yn(i);){if($t(i)&&!w0(i))return i;i=Jr(i)}return t}let n=$m(r,e);for(;n&&dx(n)&&w0(n);)n=$m(n,e);return n&&Yn(n)&&w0(n)&&!v0(n)?t:n||gx(r)||t}const Nx=async function(r){const e=this.getOffsetParent||Hm,t=this.getDimensions,n=await t(r.floating);return{reference:Ox(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Dx(r){return Ht(r).direction==="rtl"}const zx={convertOffsetParentRelativeRectToViewportRelativeRect:xx,getDocumentElement:br,getClippingRect:Ex,getOffsetParent:Hm,getElementRects:Nx,getClientRects:wx,getDimensions:Ax,getScale:Zn,isElement:$t,isRTL:Dx},Vm=ox,qm=Q9,_m=ax,jm=ex,Um=lx,Wm=tx,Gm=Y9,Km=nx,Jm=(r,e,t)=>{const n=new Map,i={platform:zx,...t},s={...i.platform,_c:n};return X9(r,e,{...i,platform:s})};let S0,k0;if(typeof WeakMap<"u"){let r=new WeakMap;S0=e=>r.get(e),k0=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;S0=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},k0=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var xr=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,c)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return S0(r)||k0(r,Ix(r))}};function Ix(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=Rx(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)n[c]=0;for(let c=0,u=0;c<t;c++){const d=r.child(c);u++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const y=d.child(m),{colspan:v,rowspan:x,colwidth:T}=y.attrs;for(let D=0;D<x;D++){if(D+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:x-D});break}const P=i+D*e;for(let E=0;E<v;E++){n[P+E]==0?n[P+E]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:v-E});const N=T&&T[E];if(N){const O=(P+E)%e*2,$=o[O];$==null||$!=N&&o[O+1]==1?(o[O]=N,o[O+1]=1):$==N&&o[O+1]++}}}i+=v,u+=y.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)n[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new xr(e,t,n,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&Px(a,o,r),a}function Rx(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>n&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function Px(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%r.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Lx(l)))[c]=u)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function Lx(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function M0(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}new Fe("selectingCells");function Bx(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function Xm(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Fx(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Bx(e.$head)||$x(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function $x(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function Ym(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function Zm(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function Qm(r,e,t){const n=r.node(-1),i=xr.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function e1(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}var er=class wr extends ce{constructor(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=t.pos-s);l.unshift(t.pos-s);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new fu(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Ym(n)&&Ym(i)&&Zm(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?wr.rowSelection(n,i):s&&this.isColSelection()?wr.colSelection(n,i):new wr(n,i)}return de.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=xr.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*t.width+i.left,d=i.left;d<i.right;d++,u++){const h=t.map[u];if(s[h])continue;s[h]=!0;const f=t.findCell(h);let m=e.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=i.left-f.left,v=f.right-i.right;if(y>0||v>0){let x=m.attrs;if(y>0&&(x=e1(x,0,y)),v>0&&(x=e1(x,x.colspan-v,v)),f.left<i.left){if(m=m.type.createAndFill(x),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else m=m.type.create(x,m.content)}if(f.top<i.top||f.bottom>i.bottom){const x={...m.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?m=m.type.createAndFill(x):m=m.type.create(x,m.content)}c.push(m)}o.push(e.child(l).copy(H.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new X(H.from(a),1,1)}replace(e,t=X.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),o?X.empty:t)}const s=ce.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new X(H.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=xr.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new wr(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=xr.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof wr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=xr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new wr(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new wr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new wr(e.resolve(t),e.resolve(n))}getBookmark(){return new Hx(this.$anchorCell.pos,this.$headCell.pos)}};er.prototype.visible=!1,ce.jsonID("cell",er);var Hx=class w1{constructor(e,t){this.anchor=e,this.head=t}map(e){return new w1(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&Zm(t,n)?new er(t,n):ce.near(n,1)}};new Fe("fix-tables");function t1(r){const e=r.selection,t=Fx(r),n=t.node(-1),i=t.start(-1),s=xr.get(n);return{...e instanceof er?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function Vx(r){return function(e,t){if(!Xm(e))return!1;if(t){const n=M0(e.schema),i=t1(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function r1(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function T0(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Vx(r):function(t,n){if(!Xm(t))return!1;if(n){const i=M0(t.schema),s=t1(t),o=t.tr,a=r1("row",s,i),l=r1("column",s,i),c=(r==="column"?a:r==="row"&&l)?1:0,u=r=="column"?{left:0,top:c,right:1,bottom:s.map.height}:r=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,m=o.doc.nodeAt(f);m&&o.setNodeMarkup(f,d,m.attrs)}),n(o)}return!0}}T0("row",{useDeprecatedLogic:!0}),T0("column",{useDeprecatedLogic:!0}),T0("cell",{useDeprecatedLogic:!0});function Ao(r,e){const t=r.selection;if(!(t instanceof er))return!1;if(e){const n=r.tr,i=M0(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new X(i,0,0))}),n.docChanged&&e(n)}return!0}Ha({ArrowLeft:No("horiz",-1),ArrowRight:No("horiz",1),ArrowUp:No("vert",-1),ArrowDown:No("vert",1),"Shift-ArrowLeft":Do("horiz",-1),"Shift-ArrowRight":Do("horiz",1),"Shift-ArrowUp":Do("vert",-1),"Shift-ArrowDown":Do("vert",1),Backspace:Ao,"Mod-Backspace":Ao,Delete:Ao,"Mod-Delete":Ao});function Oo(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function No(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof er)return Oo(t,n,ce.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=n1(i,r,e);if(o==null)return!1;if(r=="horiz")return Oo(t,n,ce.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=Qm(a,r,e);let c;return l?c=ce.near(l,1):e<0?c=ce.near(t.doc.resolve(a.before(-1)),-1):c=ce.near(t.doc.resolve(a.after(-1)),1),Oo(t,n,c)}}}function Do(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof er)o=s;else{const l=n1(i,r,e);if(l==null)return!1;o=new er(t.doc.resolve(l))}const a=Qm(o.$headCell,r,e);return a?Oo(t,n,new er(o.$anchorCell,a)):!1}}function n1(r,e,t){if(!(r.state.selection instanceof de))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}new Fe("tableColumnResizing");function qx(r,e){const t=Math.min(r.top,e.top),n=Math.max(r.bottom,e.bottom),i=Math.min(r.left,e.left),o=Math.max(r.right,e.right)-i,a=n-t,l=i,c=t;return new DOMRect(l,c,o,a)}var _x=class{constructor({editor:r,element:e,view:t,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:a,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:h,to:f})=>{const{doc:m,selection:y}=d,{empty:v}=y,x=!m.textBetween(h,f).length&&ja(d.selection),T=this.element.contains(document.activeElement);return!(!(u.hasFocus()||T)||v||x||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const h=!d?.selection.eq(u.state.selection),f=!d?.doc.eq(u.state.doc);!h&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,h,f,d)},this.updateDelay))},this.updateHandler=(u,d,h,f)=>{const{composing:m}=u;if(m||!d&&!h)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{u.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=r,this.element=e,this.view=t,this.updateDelay=n,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(c=l?.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(_m(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Vm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Gm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Um(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(qm(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Wm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(Km(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}get virtualElement(){var r;const{selection:e}=this.editor.state,t=(r=this.getReferencedVirtualElement)==null?void 0:r.call(this);if(t)return t;const n=gh(this.view,e.from,e.to);let i={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof se){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof er){const{$anchorCell:s,$headCell:o}=e,a=s?s.pos:o.pos,l=o?o.pos:s.pos,c=this.view.nodeDOM(a),u=this.view.nodeDOM(l);if(!c||!u)return;const d=c===u?c.getBoundingClientRect():qx(c.getBoundingClientRect(),u.getBoundingClientRect());i={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}return i}updatePosition(){const r=this.virtualElement;r&&Jm(r,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n})=>{this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const{state:t}=r,n=t.selection.from!==t.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(r,e);return}const i=!e?.selection.eq(r.state.selection),s=!e?.doc.eq(r.state.doc);this.updateHandler(r,i,s,e)}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:r,from:s,to:o}))||!1}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},i1=r=>new Pe({key:typeof r.pluginKey=="string"?new Fe(r.pluginKey):r.pluginKey,view:e=>new _x({view:e,...r})});Se.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[i1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var jx=class{constructor({editor:r,element:e,view:t,options:n,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,d=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!o.hasFocus()||!u||!d||!h||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,a,l,c)=>{const{composing:u}=o;if(u||!a&&!l)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=r,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...n},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(r){return dh(r,{textSerializers:Ja(this.editor.schema)})}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(_m(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Vm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Gm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Um(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(qm(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Wm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(Km(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:r,from:s,to:o})}updatePosition(){const{selection:r}=this.editor.state,e=gh(this.view,r.from,r.to);Jm({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const t=!e?.selection.eq(r.state.selection),n=!e?.doc.eq(r.state.doc);this.updateHandler(r,t,n,e)}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},s1=r=>new Pe({key:typeof r.pluginKey=="string"?new Fe(r.pluginKey):r.pluginKey,view:e=>new jx({view:e,...r})});Se.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[s1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var Ux=z.forwardRef(({pluginKey:r="bubbleMenu",editor:e,updateDelay:t,resizeDelay:n,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:a,children:l,...c},u)=>{const d=z.useRef(document.createElement("div"));typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:h}=ef(),f=e||h,m={updateDelay:t,resizeDelay:n,appendTo:i,pluginKey:r,shouldShow:s,getReferencedVirtualElement:o,options:a},y=z.useRef(m);return y.current=m,z.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=d.current;v.style.visibility="hidden",v.style.position="absolute";const x=i1({...y.current,editor:f,element:v});f.registerPlugin(x);const T=y.current.pluginKey;return()=>{f.unregisterPlugin(T),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[f]),ji.createPortal(J.jsx("div",{...c,children:l}),d.current)});z.forwardRef(({pluginKey:r="floatingMenu",editor:e,appendTo:t,shouldShow:n=null,options:i,children:s,...o},a)=>{const l=z.useRef(document.createElement("div"));typeof a=="function"?a(l.current):a&&(a.current=l.current);const{editor:c}=ef();return z.useEffect(()=>{const u=l.current;if(u.style.visibility="hidden",u.style.position="absolute",e?.isDestroyed||c?.isDestroyed)return;const d=e||c;if(!d){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const h=s1({editor:d,element:u,pluginKey:r,appendTo:t,shouldShow:n,options:i});return d.registerPlugin(h),()=>{d.unregisterPlugin(r),window.requestAnimationFrame(()=>{u.parentNode&&u.parentNode.removeChild(u)})}},[e,c,t,r,n,i]),ji.createPortal(J.jsx("div",{...o,children:s}),l.current)});const Wx=({editor:r})=>{if(!r)return null;const[e]=z.useState(!0),[t]=z.useState(!0);z.useEffect(()=>{r&&r.setEditable(t)},[t,r]);const n=Yh({editor:r,selector:i=>({isTerm:i.editor.isActive("term"),canTerm:i.editor.can().chain().focus().toggleMark("term").run(),isEm:i.editor.isActive("em"),canEm:i.editor.can().chain().focus().toggleMark("em").run(),isAlert:i.editor.isActive("alert"),canAlert:i.editor.can().chain().focus().toggleMark("alert").run()})});return J.jsx(J.Fragment,{children:r&&e&&J.jsx(Ux,{shouldShow:null,editor:r,options:{placement:"bottom",autoPlacement:!0,offset:8},children:J.jsxs("div",{className:"button-group",children:[J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("em").run(),disabled:!n.canEm,className:n.isEm?"is-active":"",children:"<em>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("term").run(),disabled:!n.canTerm,className:n.isTerm?"is-active":"",children:"<term>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("alert").run(),disabled:!n.canAlert,className:n.isAlert?"is-active":"",children:"<alert>"})]})})})},o1=["abstract","acknowledgement","affiliation","appendix","article","author","backmatter","biography","book","chapter","colophon","contributor","contributors","copyright","credit","dedication","docinfo","editor","feedback","frontmatter","google","html","index","macros","mathbook","preface","pretext","references","search","shortlicense","solutions","subsection","titlepage","website"],a1=["assemblage","chapter","conclusion","introduction","objectives","outcomes","paragraphs","part","postlude","prelude","reading-questions","sbsgroup","section","stack","subsection","subsubsection","task","technology","worksheet"],l1=["activity","algorithm","answer","axiom","biblio","blockquote","case","choice","choices","claim","conjecture","console","corollary","definition","demonstration","description","example","exercise","exploration","fact","hint","image","images","insight","investigation","lemma","list","listing","note","openconjecture","openproblem","openquestion","page","poem","principle","problem","program","project","proof","proposition","question","remark","shortdescription","solution","stanza","statement","subtask","table","tabular","theorem","warning","webwork"],Gx=["address","attribution","caption","cd","cell","cline","date","department","description","edition","entity","holder","idx","institution","journal","line","location","minilicense","mrow","personname","pg-macros","pubtitle","row","subtitle","support","title","usage","volume","year","xi:include"],Kx=["me","men","md","mdn"],c1=["ul","ol","li","p","task","figure","sidebyside","notation","row"],zo=["latex-image-preamble","latex-image","latex-preamble","slate","sage","sageplot","asymptote","macros","prefigure","program","input","output","prompt","pre","pg-code","tikzpicture","tikz","code","c"],Jx=[...o1,...a1,...l1,...c1,"xi:include"],C0=[...o1,...a1,...l1,...c1,...Kx];function Xx(r){let e=!1,t=r.split(/\r\n|\r|\n/g),n=[t[0].trim()];t.length>1&&n.push(t[1].trim());for(let i=2;i<t.length;i++){let s=/^<(\w\S*?)(\s.*?|>)$/.exec(t[i].trim()),o=/^<\/(\w\S*?)(\s.*?|>)(.?)$/.exec(t[i].trim());if(s&&zo.includes(s[1]))n.push(t[i]),e=!0;else if(o&&zo.includes(o[1]))n.push(t[i]),e=!1;else if(e)n.push(t[i]);else{t[i]=t[i].trim();let a=n.pop();a?n.push(a.trim()+" "+t[i]):n.push(t[i])}}return n.join(`
422
422
  `)}function Yx(r,e){const n="some";let i=Xx(r);console.log("Getting ready to start formatting.");for(let u of C0)if(i.includes("<"+u)){let d=new RegExp("<"+u+"(>|(\\s[^\\/]*?)>|(.*xmlns.*?)>)","g"),h=new RegExp("<\\/"+u+">([\\s\\S]*?[.,!?;:]?)","g");i=i.replace(d,`
423
423
  $&
424
424
  `),i=i.replace(h,`
@@ -431,7 +431,7 @@ $&`),i=i.replace(h,`$&
431
431
  `);else c[u].trim().startsWith("<title>")&&(c[u]+=`
432
432
  `);break;case"many":for(let u=0;u<c.length-1;u++)(c[u].trim().startsWith("</")||c[u].trim().startsWith("<")&&c[u+1].trim().startsWith("<"))&&(c[u]+=`
433
433
  `);break}return i=c.join(`
434
- `),i}const Zx=we.create({name:"ptxFragment",topNode:!0,content:"ptxdoc"}),Qx=[P9.configure({defaultLanguage:"xml"}),Zx,vb,cf,xf,uf,D9,cb,L9,B9,F9,$9,Q8,eb,tb,D7.configure({mode:"deepest"}),I7,z7],c1=({content:r,onChange:e})=>{const t=z.useRef(null),n=z.useRef(!1),i=Py({extensions:Qx,content:r,onContentError(l){console.log("Content error: ",l.error),l.disableCollaboration(),l.editor.setEditable(!1,!1)},enableContentCheck:!0,onUpdate:({editor:l})=>{console.log("Editor update detected."),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{n.current&&e(Yx(H9(l.getJSON())))},500)}});z.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]);const s=z.useRef(!0);z.useEffect(()=>{if(i&&r!==i.getHTML()&&s.current){const l=r;if(i)try{i.commands.setContent(b9(l),{emitUpdate:!1}),console.log("External content set in visual editor.")}catch(c){console.error("Error setting content: ",c)}}},[r,i]),z.useEffect(()=>{if(!i)return;const l=()=>{s.current=!1};return i.on("update",l),()=>{i.off("update",l)}},[i]),z.useEffect(()=>{s.current=!0},[r]);const[o,a]=z.useState(!1);return z.useEffect(()=>{n.current=o,i&&i.setEditable(o,!1)},[i,o]),J.jsxs("div",{className:"pretext-plus-editor__visual-editor",children:[J.jsxs("div",{className:"pretext-plus-editor__visual-editor-header",children:[J.jsx("p",{className:"pretext-plus-editor__visual-editor-title",children:"Simple Preview"}),J.jsxs("label",{className:"pretext-plus-editor__edit-toggle",children:[J.jsx("input",{className:"pretext-plus-editor__edit-checkbox",type:"checkbox",checked:o,onChange:()=>a(!o)}),"Edit"]})]}),J.jsx("div",{className:(o?"editable":"read-only")+" ptx-page",children:J.jsx(Ny,{editor:i})}),J.jsx(Wx,{editor:i})]})},u1=(r,e,t)=>{const n=document.createElement("form");n.method="POST",n.action=r,n.target=t,n.style.display="none";for(const i in e)if(Object.hasOwnProperty.call(e,i)){const s=document.createElement("input");s.type="hidden",s.name=i,s.value=e[i],n.appendChild(s)}document.body.appendChild(n),n.submit(),n.remove()},d1=({content:r,title:e,onRebuild:t})=>{const[n,i]=z.useState(!1),s=z.useRef(null),o=z.useRef(null),a=z.useCallback(()=>{const c=r,u=e||"Document Title";try{const d=s.current?.contentWindow;d&&(o.current={x:d.scrollX,y:d.scrollY})}catch{o.current=null}if(i(!0),t){t(c,u,(h,f)=>{u1(h,f,"fullPreview")});return}},[r,e,t]);z.useEffect(()=>{a()},[]);const l=()=>{if(i(!1),o.current){try{s.current?.contentWindow?.scrollTo(o.current.x,o.current.y)}catch{}o.current=null}};return J.jsxs("div",{className:"pretext-plus-editor__full-preview",children:[J.jsxs("div",{className:"pretext-plus-editor__preview-header",children:[J.jsx("p",{className:"pretext-plus-editor__preview-title",children:"Full Preview"}),J.jsx("button",{className:"pretext-plus-editor__rebuild-button",onClick:()=>a(),children:"Rebuild"})]}),J.jsxs("div",{className:"pretext-plus-editor__preview-container",children:[n&&J.jsx("div",{className:"pretext-plus-editor__rebuilding-overlay",children:J.jsxs("div",{className:"pretext-plus-editor__rebuilding-popup",children:[J.jsx("div",{className:"pretext-plus-editor__spinner"}),J.jsx("p",{className:"pretext-plus-editor__rebuilding-text",children:"Rebuilding..."})]})}),J.jsx("iframe",{ref:s,className:"pretext-plus-editor__preview-iframe",name:"fullPreview",onLoad:l})]})]})},ew=r=>{let e;return r.showPreviewModeToggle===!1?e=null:e=J.jsxs("label",{className:"pretext-plus-editor__preview-toggle",children:[J.jsx("input",{type:"checkbox",checked:!r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"}),J.jsxs("div",{className:"pretext-plus-editor__preview-toggle-container",children:[J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Simple"}),J.jsx("span",{className:`pretext-plus-editor__preview-toggle-slider ${r.isChecked?"pretext-plus-editor__preview-toggle-slider--active":""}`,children:J.jsx("span",{className:`pretext-plus-editor__preview-toggle-dot ${r.isChecked?"pretext-plus-editor__preview-toggle-dot--active":""}`})}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Full"})]}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-caption",children:"Preview Mode"}),J.jsx("input",{type:"checkbox",checked:r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"})]}),J.jsxs("div",{className:"pretext-plus-editor__menu-bar",children:[J.jsx("div",{className:"pretext-plus-editor__menu-left",children:r.title!==void 0&&r.onTitleChange&&J.jsxs("label",{className:"pretext-plus-editor__title-label",children:["Title"," ",J.jsx("input",{className:"pretext-plus-editor__title-input",type:"text",value:r.title,onChange:t=>r.onTitleChange?.(t.target.value)})]})}),J.jsxs("div",{className:"pretext-plus-editor__menu-right",children:[r.onSaveButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--save",onClick:r.onSaveButton,children:r.saveButtonLabel||"Save"}),r.onCancelButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--cancel",onClick:r.onCancelButton,children:r.cancelButtonLabel||"Cancel"}),e]})]})},tw=`
434
+ `),i}const Zx=we.create({name:"ptxFragment",topNode:!0,content:"ptxdoc"}),Qx=[P9.configure({defaultLanguage:"xml"}),Zx,vb,uf,wf,df,D9,cb,L9,B9,F9,$9,Q8,eb,tb,D7.configure({mode:"deepest"}),I7,z7],u1=({content:r,onChange:e})=>{const t=z.useRef(null),n=z.useRef(!1),i=Py({extensions:Qx,content:r,onContentError(l){console.log("Content error: ",l.error),l.disableCollaboration(),l.editor.setEditable(!1,!1)},enableContentCheck:!0,onUpdate:({editor:l})=>{console.log("Editor update detected."),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{n.current&&e(Yx(H9(l.getJSON())))},500)}});z.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]);const s=z.useRef(!0);z.useEffect(()=>{if(i&&r!==i.getHTML()&&s.current){const l=r;if(i)try{i.commands.setContent(b9(l),{emitUpdate:!1}),console.log("External content set in visual editor.")}catch(c){console.error("Error setting content: ",c)}}},[r,i]),z.useEffect(()=>{if(!i)return;const l=()=>{s.current=!1};return i.on("update",l),()=>{i.off("update",l)}},[i]),z.useEffect(()=>{s.current=!0},[r]);const[o,a]=z.useState(!1);return z.useEffect(()=>{n.current=o,i&&i.setEditable(o,!1)},[i,o]),J.jsxs("div",{className:"pretext-plus-editor__visual-editor",children:[J.jsxs("div",{className:"pretext-plus-editor__visual-editor-header",children:[J.jsx("p",{className:"pretext-plus-editor__visual-editor-title",children:"Simple Preview"}),J.jsxs("label",{className:"pretext-plus-editor__edit-toggle",children:[J.jsx("input",{className:"pretext-plus-editor__edit-checkbox",type:"checkbox",checked:o,onChange:()=>a(!o)}),"Edit"]})]}),J.jsx("div",{className:(o?"editable":"read-only")+" ptx-page",children:J.jsx(Ny,{editor:i})}),J.jsx(Wx,{editor:i})]})},d1=(r,e,t)=>{const n=document.createElement("form");n.method="POST",n.action=r,n.target=t,n.style.display="none";for(const i in e)if(Object.hasOwnProperty.call(e,i)){const s=document.createElement("input");s.type="hidden",s.name=i,s.value=e[i],n.appendChild(s)}document.body.appendChild(n),n.submit(),n.remove()},E0=z.forwardRef(({content:r,title:e,onRebuild:t},n)=>{const[i,s]=z.useState(!1),o=z.useRef(null),a=z.useRef(null),l=z.useCallback(()=>{const u=r,d=e||"Document Title";try{const h=o.current?.contentWindow;h&&(a.current={x:h.scrollX,y:h.scrollY})}catch{a.current=null}if(s(!0),t){t(u,d,(f,m)=>{d1(f,m,"fullPreview")});return}},[r,e,t]);z.useEffect(()=>{l()},[]),z.useImperativeHandle(n,()=>({rebuild:l}),[l]);const c=()=>{if(s(!1),a.current){try{o.current?.contentWindow?.scrollTo(a.current.x,a.current.y)}catch{}a.current=null}};return J.jsxs("div",{className:"pretext-plus-editor__full-preview",children:[J.jsxs("div",{className:"pretext-plus-editor__preview-header",children:[J.jsx("p",{className:"pretext-plus-editor__preview-title",children:"Full Preview"}),J.jsx("button",{className:"pretext-plus-editor__rebuild-button",onClick:()=>l(),children:"Rebuild"})]}),J.jsxs("div",{className:"pretext-plus-editor__preview-container",children:[i&&J.jsx("div",{className:"pretext-plus-editor__rebuilding-overlay",children:J.jsxs("div",{className:"pretext-plus-editor__rebuilding-popup",children:[J.jsx("div",{className:"pretext-plus-editor__spinner"}),J.jsx("p",{className:"pretext-plus-editor__rebuilding-text",children:"Rebuilding..."})]})}),J.jsx("iframe",{ref:o,className:"pretext-plus-editor__preview-iframe",name:"fullPreview",onLoad:c})]})]})});E0.displayName="FullPreview";const ew=r=>{let e;return r.showPreviewModeToggle===!1?e=null:e=J.jsxs("label",{className:"pretext-plus-editor__preview-toggle",children:[J.jsx("input",{type:"checkbox",checked:!r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"}),J.jsxs("div",{className:"pretext-plus-editor__preview-toggle-container",children:[J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Simple"}),J.jsx("span",{className:`pretext-plus-editor__preview-toggle-slider ${r.isChecked?"pretext-plus-editor__preview-toggle-slider--active":""}`,children:J.jsx("span",{className:`pretext-plus-editor__preview-toggle-dot ${r.isChecked?"pretext-plus-editor__preview-toggle-dot--active":""}`})}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Full"})]}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-caption",children:"Preview Mode"}),J.jsx("input",{type:"checkbox",checked:r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"})]}),J.jsxs("div",{className:"pretext-plus-editor__menu-bar",children:[J.jsx("div",{className:"pretext-plus-editor__menu-left",children:r.title!==void 0&&r.onTitleChange&&J.jsxs("label",{className:"pretext-plus-editor__title-label",children:["Title"," ",J.jsx("input",{className:"pretext-plus-editor__title-input",type:"text",value:r.title,onChange:t=>r.onTitleChange?.(t.target.value)})]})}),J.jsxs("div",{className:"pretext-plus-editor__menu-right",children:[r.onSaveButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--save",onClick:r.onSaveButton,children:r.saveButtonLabel||"Save"}),r.onCancelButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--cancel",onClick:r.onCancelButton,children:r.cancelButtonLabel||"Cancel"}),e]})]})},tw=`
435
435
  <?xml version="1.0" encoding="UTF-8"?>
436
436
  <section>
437
437
  <title>My Section</title>
@@ -511,5 +511,5 @@ $&`),i=i.replace(h,`$&
511
511
 
512
512
  <p> And that's the end of the demo. Thanks for coming!</p>
513
513
  </section>
514
- `,rw=r=>{const[e,t]=z.useState(r.content||tw),[n,i]=z.useState(r.title||"Document Title"),[s,o]=z.useState(!0),[a,l]=z.useState(window.innerWidth<800),[c,u]=z.useState("editor"),d="pretext-plus-tab-editor",h="pretext-plus-tab-preview",f="pretext-plus-tabpanel";z.useEffect(()=>{const x=()=>{l(window.innerWidth<800)};return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const m=J.jsx(wc,{content:e,onChange:x=>{t(x||""),r.onContentChange(x)}});let y;s&&r.onPreviewRebuild?y=J.jsx(d1,{content:e,title:n,onRebuild:r.onPreviewRebuild}):y=J.jsx(c1,{content:e,onChange:x=>{t(x||""),r.onContentChange(x)}});let v;return a?v=J.jsxs("div",{className:"pretext-plus-editor__tabs",children:[J.jsxs("div",{className:"pretext-plus-editor__tab-list",role:"tablist",children:[J.jsx("button",{type:"button",id:d,role:"tab","aria-controls":f,"aria-selected":c==="editor",tabIndex:c==="editor"?0:-1,className:`pretext-plus-editor__tab-button ${c==="editor"?"is-active":""}`,onClick:()=>u("editor"),children:"Editor"}),J.jsx("button",{type:"button",id:h,role:"tab","aria-controls":f,"aria-selected":c==="preview",tabIndex:c==="preview"?0:-1,className:`pretext-plus-editor__tab-button ${c==="preview"?"is-active":""}`,onClick:()=>u("preview"),children:"Preview"})]}),J.jsx("div",{id:f,className:"pretext-plus-editor__tab-panel",role:"tabpanel","aria-labelledby":c==="editor"?d:h,children:J.jsx("div",{style:{height:"60vh"},children:c==="editor"?m:y})})]}):v=J.jsxs(sc,{direction:"horizontal",className:"pretext-plus-editor__splitter",children:[J.jsx(Po,{className:"pretext-plus-editor__editor-panel",children:m}),J.jsx(oc,{className:"pretext-plus-editor__resize-handle",children:J.jsx("div",{className:"pretext-plus-editor__resize-dots"})}),J.jsx(Po,{className:"pretext-plus-editor__preview-panel",children:y})]}),J.jsxs("div",{className:"pretext-plus-editor",children:[J.jsx(ew,{isChecked:s,onChange:()=>o(!s),title:n,onTitleChange:x=>{i(x),r.onTitleChange?.(x)},onSaveButton:r.onSaveButton,saveButtonLabel:r.saveButtonLabel,onCancelButton:r.onCancelButton,cancelButtonLabel:r.cancelButtonLabel,showPreviewModeToggle:r.onPreviewRebuild!==void 0}),v]})};kt.CodeEditor=wc,kt.Editors=rw,kt.FullPreview=d1,kt.VisualEditor=c1,kt.postToIframe=u1,Object.defineProperty(kt,Symbol.toStringTag,{value:"Module"})}));
514
+ `,rw=r=>{const[e,t]=z.useState(r.content||tw),[n,i]=z.useState(r.title||"Document Title"),[s,o]=z.useState(!0),[a,l]=z.useState(window.innerWidth<800),[c,u]=z.useState("editor"),d="pretext-plus-tab-editor",h="pretext-plus-tab-preview",f="pretext-plus-tabpanel",m=z.useRef(null),y=()=>{m.current?.rebuild()},v=()=>{r.onSave?.(),m.current?.rebuild()},x=E=>{const N=E.ctrlKey||E.metaKey;N&&E.key==="Enter"&&r.onPreviewRebuild?(E.preventDefault(),y()):N&&E.key==="s"&&(E.preventDefault(),v())};z.useEffect(()=>{const E=()=>{l(window.innerWidth<800)};return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]);const T=J.jsx(Sc,{content:e,onChange:E=>{t(E||""),r.onContentChange(E)},onRebuild:r.onPreviewRebuild?y:void 0,onSave:v});let D;s&&r.onPreviewRebuild?D=J.jsx(E0,{ref:m,content:e,title:n,onRebuild:r.onPreviewRebuild}):D=J.jsx(u1,{content:e,onChange:E=>{t(E||""),r.onContentChange(E)}});let P;return a?P=J.jsxs("div",{className:"pretext-plus-editor__tabs",children:[J.jsxs("div",{className:"pretext-plus-editor__tab-list",role:"tablist",children:[J.jsx("button",{type:"button",id:d,role:"tab","aria-controls":f,"aria-selected":c==="editor",tabIndex:c==="editor"?0:-1,className:`pretext-plus-editor__tab-button ${c==="editor"?"is-active":""}`,onClick:()=>u("editor"),children:"Editor"}),J.jsx("button",{type:"button",id:h,role:"tab","aria-controls":f,"aria-selected":c==="preview",tabIndex:c==="preview"?0:-1,className:`pretext-plus-editor__tab-button ${c==="preview"?"is-active":""}`,onClick:()=>u("preview"),children:"Preview"})]}),J.jsx("div",{id:f,className:"pretext-plus-editor__tab-panel",role:"tabpanel","aria-labelledby":c==="editor"?d:h,children:J.jsx("div",{style:{height:"60vh"},children:c==="editor"?T:D})})]}):P=J.jsxs(oc,{direction:"horizontal",className:"pretext-plus-editor__splitter",children:[J.jsx(Po,{className:"pretext-plus-editor__editor-panel",children:T}),J.jsx(ac,{className:"pretext-plus-editor__resize-handle",children:J.jsx("div",{className:"pretext-plus-editor__resize-dots"})}),J.jsx(Po,{className:"pretext-plus-editor__preview-panel",children:D})]}),J.jsxs("div",{className:"pretext-plus-editor",onKeyDown:x,children:[J.jsx(ew,{isChecked:s,onChange:()=>o(!s),title:n,onTitleChange:E=>{i(E),r.onTitleChange?.(E)},onSaveButton:r.onSaveButton,saveButtonLabel:r.saveButtonLabel,onCancelButton:r.onCancelButton,cancelButtonLabel:r.cancelButtonLabel,showPreviewModeToggle:r.onPreviewRebuild!==void 0}),P]})};kt.CodeEditor=Sc,kt.Editors=rw,kt.FullPreview=E0,kt.VisualEditor=u1,kt.postToIframe=d1,Object.defineProperty(kt,Symbol.toStringTag,{value:"Module"})}));
515
515
  //# sourceMappingURL=index.js.map