@pretextbook/web-editor 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/AssetManagerModal.d.ts +1 -1
- package/dist/components/ConvertToPretextDialog.d.ts +3 -3
- package/dist/components/Editors.d.ts +1 -1
- package/dist/components/toc/SectionEditForm.d.ts +1 -1
- package/dist/components/toc/types.d.ts +6 -0
- package/dist/contentConversion.d.ts +6 -5
- package/dist/index.es.js +2124 -1912
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +29 -16
- package/dist/types/editor.d.ts +21 -20
- package/dist/types/sections.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -434,7 +434,7 @@ $0`,documentation:`To add a watermark to the document`}},Qa=`alert.angles.articl
|
|
|
434
434
|
`+e),e}let i=fs(n,t);return r&&(i=r+`
|
|
435
435
|
|
|
436
436
|
`+i),i}function ms(e,t,n,r){switch(e.type){case`instruction`:t.push(`<?${e.name}${e.value?` `+e.value:``}?>`);break;case`doctype`:t.push(`<!DOCTYPE ${e.name}>`);break;case`comment`:t.push(`${r.ind.repeat(n)}<!--${e.value}-->`);break;case`cdata`:t.push(`${r.ind.repeat(n)}<![CDATA[${e.value}]]>`);break;case`text`:{let i=e.value.trim();i&&t.push(`${r.ind.repeat(n)}${Is(i)}`);break}case`element`:hs(e,t,n,r);break}}function hs(e,t,n,r){let i=e.name;as.includes(i)?gs(e,t,n,r):us.includes(i)?vs(e,t,n,r):ts.includes(i)?_s(e,t,n,r):ls.includes(i)&&!Fs(e)?ys(e,t,n,r):ls.includes(i)?bs(e,t,n,r):xs(e,t,n,r)}function gs(e,t,n,r){if(e.children.some(e=>e.type===`element`)){xs(e,t,n,r);return}let i=r.ind.repeat(n);if(Ms(e)){t.push(`${i}${Os(e)}`);return}let a=e.children.map(e=>e.type===`text`?Is(e.value):e.type===`cdata`?`<![CDATA[${e.value}]]>`:``).join(``);if(/\n[ \t]*$/.test(a)){let n=a.replace(/\n[ \t]*$/,`
|
|
437
|
-
`);t.push(`${i}${Ds(e)}${n}${i}</${e.name}>`)}else t.push(`${i}${Ds(e)}${a}</${e.name}>`)}function _s(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(`${i}${Os(e)}`);return}let a=Cs(e.children);t.push(`${i}${Ds(e)}${a}</${e.name}>`)}function vs(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(`${i}${Os(e)}`);return}if(Fs(e)){bs(e,t,n,r);return}let a=Ts(e.children),o=r.ind.repeat(n+1),s=`${i}${Ds(e)}${a.join(` `)}</${e.name}>`;if(r.printWidth===0||s.length<=r.printWidth){t.push(s);return}t.push(`${i}${Ds(e)}`);for(let e of Es(a,r.printWidth,o.length,r.breakSentences))t.push(`${o}${e}`);t.push(`${i}</${e.name}>`)}function ys(e,t,n,r){let i=r.ind.repeat(n),a=r.ind.repeat(n+1);if(Ms(e)){t.push(`${i}${Os(e)}`);return}t.push(`${i}${Ds(e)}`);let o=Ts(e.children);for(let e of Es(o,r.printWidth,a.length,r.breakSentences))t.push(`${a}${e}`);t.push(`${i}</${e.name}>`)}function bs(e,t,n,r){let i=r.ind.repeat(n),a=r.ind.repeat(n+1);if(Ms(e)){t.push(`${i}${Os(e)}`);return}t.push(`${i}${Ds(e)}`);let o=Ns(e),s=0;for(;s<o.length;)if(Ps(o[s])){let e=o[s];s++;let i=``;if(s<o.length&&o[s].type===`text`){let e=o[s].value,t=/^(\s*)([.,;:!?])/.exec(e);if(t){i=t[2];let n=e.slice(t[0].length);o[s].value=n,n.trim()||s++}}let a=[];hs(e,a,n+1,r),i&&a.length>0&&(a[a.length-1]+=i),t.push(...a)}else{let e=[];for(;s<o.length&&!Ps(o[s]);)e.push(o[s]),s++;let n=Ts(e);if(n.length>0)for(let e of Es(n,r.printWidth,a.length,r.breakSentences))t.push(`${a}${e}`)}t.push(`${i}</${e.name}>`)}function xs(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(...js(e,n,r,!0));return}let a=Ns(e);if(a.length===1&&a[0].type===`element`&&a[0].name===`xi:include`){let o=a[0],s=js(e,n,r);if(s.length===1){let n=Ms(o)?Os(o):`${Ds(o)}${Cs(o.children)}</${o.name}>`;t.push(`${s[0]}${n}</${e.name}>`);return}t.push(...s),ms(o,t,n+1,r),t.push(`${i}</${e.name}>`);return}t.push(...js(e,n,r));for(let i of Ns(e))ms(i,t,n+1,r);t.push(`${i}</${e.name}>`)}function Ss(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].trim(),a=r<e.length-1?e[r+1].trim():null;if(n.push(e[r]),r===0&&/^<\?xml(?:\s|\?>)/.test(i)){n.push(``);continue}if(t.blankLines!==`few`)if(t.blankLines===`some`)if(i.startsWith(`</`)&&a!==null&&a.startsWith(`<`)){let e=/^<([^\s>/]+)/.exec(a)?.[1];e&&ss.includes(e)&&n.push(``)}else /^<title[\s>]/.test(i)&&i.includes(`</title>`)&&n.push(``);else t.blankLines===`many`&&(i.startsWith(`</`)||i.startsWith(`<`)&&a!==null&&a.startsWith(`<`))&&n.push(``)}return n}function Cs(e){return e.map(e=>e.type===`text`?Is(e.value):e.type===`element`?ws(e):e.type===`comment`?`<!--${e.value}-->`:e.type===`cdata`?`<![CDATA[${e.value}]]>`:``).join(``)}function ws(e){return Ms(e)?Os(e):`${Ds(e)}${Cs(e.children)}</${e.name}>`}function Ts(e){let t=[];for(let n of e)if(n.type===`text`){let e=n.value.split(/\s+/).filter(e=>e.length>0);for(let n=0;n<e.length;n++){let r=Is(e[n]);n===0&&t.length>0&&/^[.,;:!?\-]/.test(r)?t[t.length-1]+=r:t.push(r)}}else n.type===`element`?t.push(ws(n)):n.type===`comment`&&t.push(`<!--${n.value}-->`);return t}function Es(e,t,n,r){if(e.length===0)return[];let i=t===0?1/0:Math.max(20,t-n),a=[],o=``;for(let t=0;t<e.length;t++){let n=e[t];o===``?o=n:o.length+1+n.length<=i?o+=` `+n:(a.push(o),o=n),r&&/[.!?]$/.test(n)&&t<e.length-1&&(a.push(o),o=``)}return o&&a.push(o),a}function Ds(e){let t=ks(e);return t?`<${e.name} ${t}>`:`<${e.name}>`}function Os(e){let t=ks(e);return t?`<${e.name} ${t}/>`:`<${e.name}/>`}function ks(e){return As(e).join(` `)}function As(e){return Object.entries(e.attributes||{}).map(([e,t])=>t==null?e:`${e}="${Ls(t)}"`)}function js(e,t,n,r=!1){let i=n.ind.repeat(t),a=As(e),o=r?`/>`:`>`;if(a.length===0)return[`${i}<${e.name}${o}`];let s=`${i}<${e.name} ${a.join(` `)}${o}`;if(!n.breakLongAttributes||n.printWidth===0||s.length<=n.printWidth)return[s];let c=`${i}${` `.repeat(e.name.length+2)}`,l=[`${i}<${e.name} ${a[0]}`];for(let e of a.slice(1))l.push(`${c}${e}`);return l[l.length-1]+=o,l}function Ms(e){return e.children.every(e=>e.type===`text`&&e.value.trim()===``)}function Ns(e){return e.children.filter(e=>!(e.type===`text`&&e.value.trim()===``))}function Ps(e){if(e.type!==`element`)return!1;let t=e.name;return t===`c`?!1:(cs.includes(t)||as.includes(t))&&!ts.includes(t)}function Fs(e){return e.children.some(e=>Ps(e))}function Is(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Ls(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`)}var Rs=6,zs=({actions:e})=>{let r=(0,n.useRef)(null),i=(0,n.useRef)(null),a=(0,n.useRef)(null),o=(0,n.useRef)([]),s=(0,n.useRef)(0),[c,l]=(0,n.useState)(e.length),[u,d]=(0,n.useState)(!1),f=(0,n.useCallback)(()=>{let e=r.current,t=o.current;if(!e||t.length===0)return;let n=e.clientWidth,i=t.length>0?Rs*(t.length-1):0;if(t.reduce((e,t)=>e+t,0)+i<=n){l(t.length);return}let a=s.current,c=0;for(let e=0;e<t.length;e++){let r=a+t[e]+Rs;if(r<=n)a=r,c++;else break}l(c)},[]);(0,n.useLayoutEffect)(()=>{let e=i.current;if(!e)return;o.current=Array.from(e.querySelectorAll(`[data-measure-btn]`)).map(e=>e.offsetWidth);let t=e.querySelector(`[data-measure-more]`);s.current=t?t.offsetWidth+Rs:0,f()},[e.map(e=>`${e.key}:${e.label}:${+!!e.disabled}`).join(`|`),f]),(0,n.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>f());return t.observe(e),()=>t.disconnect()},[f]),(0,n.useEffect)(()=>{if(!u)return;let e=e=>{a.current?.contains(e.target)||d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[u]);let p=e.slice(0,c),m=e.slice(c);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-actions`,ref:r,children:[p.map(e=>(0,t.jsx)(`button`,{className:`pretext-plus-editor__menu-button ${e.className??``}`,onClick:e.onClick,disabled:e.disabled,title:e.title,children:e.label},e.key)),m.length>0&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-dropdown`,ref:a,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__menu-button`,onClick:()=>d(e=>!e),"aria-haspopup":`menu`,"aria-expanded":u,title:`More actions`,children:`More ▾`}),u&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__menu-dropdown-list`,role:`menu`,children:m.map(e=>(0,t.jsx)(`button`,{type:`button`,role:`menuitem`,className:`pretext-plus-editor__menu-dropdown-item`,onClick:()=>{d(!1),e.onClick()},disabled:e.disabled,title:e.title,children:e.label},e.key))})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-measure`,ref:i,"aria-hidden":!0,children:[e.map(e=>(0,t.jsx)(`button`,{"data-measure-btn":!0,className:`pretext-plus-editor__menu-button ${e.className??``}`,tabIndex:-1,children:e.label},e.key)),(0,t.jsx)(`button`,{"data-measure-more":!0,className:`pretext-plus-editor__menu-button`,tabIndex:-1,children:`More ▾`})]})]})},Bs=({content:e,sourceFormat:n,onContentChange:r,onOpenLatexImport:i,onOpenDocinfoEditor:a,onConvertToPretext:o,canConvertToPretext:s,onOpenAssets:c,onShowFullSource:l})=>{let u=()=>{try{r(ps(e))}catch(e){console.error(`Error formatting:`,e),alert(`Error formatting XML`)}},d={key:`full-source`,label:`Display Full Source`,onClick:l,title:`Show the full assembled PreTeXt source for the project`},f;return f=n===`latex`?[...o?[{key:`convert`,label:`Convert to PreTeXt`,onClick:o,title:`Create a new project copy using the converted PreTeXt source`,className:`pretext-plus-editor__menu-button--convert`,disabled:s===!1}]:[],{key:`preamble`,label:`Edit Preamble`,onClick:a,title:`Edit Preamble`},d]:n===`markdown`?[...o?[{key:`convert`,label:`Convert to PreTeXt`,onClick:o,title:`Create a new project copy using the converted PreTeXt source`,className:`pretext-plus-editor__menu-button--convert`,disabled:s===!1}]:[],{key:`macros`,label:`Edit Macros`,onClick:a,title:`Edit Macros`},d]:[{key:`format`,label:`Format PreTeXt`,onClick:u,title:`Format the PreTeXt source`},{key:`import-latex`,label:`Import LaTeX`,onClick:i,title:`Import LaTeX`},{key:`macros`,label:`Edit Macros`,onClick:a,title:`Edit Macros`},...c?[{key:`assets`,label:`Assets`,onClick:c,title:`Manage assets`}]:[],d],(0,t.jsxs)(`div`,{className:`pretext-plus-editor__code-editor-menu`,children:[(0,t.jsx)(zs,{actions:f}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__code-editor-source-badge pretext-plus-editor__code-editor-source-badge--right`,children:n===`latex`?`LaTeX`:n===`markdown`?`Markdown`:`PreTeXt`})]})};function Vs(e){let t=e.getLineCount();if(t<2||!/^\s*<title\b/.test(e.getLineContent(2)))return 1;let n=2;for(;n<=t&&!/<\/title\s*>/.test(e.getLineContent(n));)n++;return n<=t?n:1}function Hs(e,t){let n=e.getLineCount();if(t===`pretext`){if(n<3)return null;let t=Vs(e);if(t>=n-1)return null;let r=[];for(let e=1;e<=t;e++)r.push(e);return r.push(n),{editableRange:[t+1,1,n-1,e.getLineMaxColumn(n-1)],lockedLines:r,leadingLockedLines:t}}if(t===`markdown`){if(e.getLineContent(1).trim()!==`---`)return null;let t=-1;for(let r=2;r<=n;r++)if(e.getLineContent(r).trim()===`---`){t=r;break}if(t===-1)return null;let r=t,i=t+1;for(;i<=n&&e.getLineContent(i).trim()===``;)i++;if(i<=n&&/^#{1,6}[ \t]+\S/.test(e.getLineContent(i))&&(r=i),r>=n)return null;let a=[];for(let e=1;e<=r;e++)a.push(e);return{editableRange:[r+1,1,n,e.getLineMaxColumn(n)],lockedLines:a,leadingLockedLines:r}}return t===`latex`?n<2||!/^\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{/.test(e.getLineContent(1))?null:{editableRange:[2,1,n,e.getLineMaxColumn(n)],lockedLines:[1],leadingLockedLines:1}:null}var Us={automaticLayout:!0,minimap:{enabled:!1},acceptSuggestionOnCommitCharacter:!1,quickSuggestions:!1,wordWrap:`on`,insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},Ws=(0,n.forwardRef)(({content:e,sourceFormat:r,onChange:i,onRebuild:a,onSave:o,onOpenLatexImport:s,onOpenDocinfoEditor:c,onOpenConvertToPretext:l,canConvertToPretext:u,onOpenAssets:d,onShowFullSource:f,onRequestWrapperEdit:p},m)=>{let h=(0,n.useRef)(null),g=(0,n.useRef)(null),_=(0,n.useRef)(null),v=(0,n.useRef)(null),y=(0,n.useRef)(!1),b=(0,n.useRef)(0),x=(0,n.useRef)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(p),w=(0,n.useRef)(null),T=(0,n.useRef)(null),E=(0,n.useRef)(!1),[D,O]=(0,n.useState)(!1),[k,A]=(0,n.useState)(!1),ee=(0,n.useRef)(a),te=(0,n.useRef)(o);(0,n.useImperativeHandle)(m,()=>({insertAtCursor:e=>{let t=h.current;if(!t)return;let n=t.getSelection();n&&(t.executeEdits(`insert-asset`,[{range:n,text:e,forceMoveMarkers:!0}]),t.focus())},focus:()=>{h.current?.focus()}}),[]),(0,n.useEffect)(()=>{ee.current=a},[a]),(0,n.useEffect)(()=>{te.current=o},[o]),(0,n.useEffect)(()=>{C.current=p},[p]),(0,n.useEffect)(()=>{w.current?.dispose?.();let e=ko[r];w.current=g.current?e.registerMonacoExtensions?.(g.current)??null:null,ne()},[r]),(0,n.useEffect)(()=>()=>{x.current?.dispose?.(),w.current?.dispose?.(),S.current?.dispose?.(),_.current?.disposeConstrainer?.(),T.current&&clearTimeout(T.current)},[]);let j=(e,t,n)=>{if(r!==`pretext`)return;let i=t.getLineCount();if(i<2)return;let a=t.getLineContent(1).trim();if(!a.startsWith(`<`)||a.startsWith(`</`)||a.endsWith(`/>`))return;let o=Vs(t);if(i!==o+1)return;let s=t.getLineContent(i).trim();if(!/^<\/[A-Za-z][\w.:-]*\s*>$/.test(s))return;E.current=!0;let c=t.getLineMaxColumn(o);e.executeEdits(`ensure-body-line`,[{range:new n.Range(o,c,o,c),text:`
|
|
437
|
+
`);t.push(`${i}${Ds(e)}${n}${i}</${e.name}>`)}else t.push(`${i}${Ds(e)}${a}</${e.name}>`)}function _s(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(`${i}${Os(e)}`);return}let a=Cs(e.children);t.push(`${i}${Ds(e)}${a}</${e.name}>`)}function vs(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(`${i}${Os(e)}`);return}if(Fs(e)){bs(e,t,n,r);return}let a=Ts(e.children),o=r.ind.repeat(n+1),s=`${i}${Ds(e)}${a.join(` `)}</${e.name}>`;if(r.printWidth===0||s.length<=r.printWidth){t.push(s);return}t.push(`${i}${Ds(e)}`);for(let e of Es(a,r.printWidth,o.length,r.breakSentences))t.push(`${o}${e}`);t.push(`${i}</${e.name}>`)}function ys(e,t,n,r){let i=r.ind.repeat(n),a=r.ind.repeat(n+1);if(Ms(e)){t.push(`${i}${Os(e)}`);return}t.push(`${i}${Ds(e)}`);let o=Ts(e.children);for(let e of Es(o,r.printWidth,a.length,r.breakSentences))t.push(`${a}${e}`);t.push(`${i}</${e.name}>`)}function bs(e,t,n,r){let i=r.ind.repeat(n),a=r.ind.repeat(n+1);if(Ms(e)){t.push(`${i}${Os(e)}`);return}t.push(`${i}${Ds(e)}`);let o=Ns(e),s=0;for(;s<o.length;)if(Ps(o[s])){let e=o[s];s++;let i=``;if(s<o.length&&o[s].type===`text`){let e=o[s].value,t=/^(\s*)([.,;:!?])/.exec(e);if(t){i=t[2];let n=e.slice(t[0].length);o[s].value=n,n.trim()||s++}}let a=[];hs(e,a,n+1,r),i&&a.length>0&&(a[a.length-1]+=i),t.push(...a)}else{let e=[];for(;s<o.length&&!Ps(o[s]);)e.push(o[s]),s++;let n=Ts(e);if(n.length>0)for(let e of Es(n,r.printWidth,a.length,r.breakSentences))t.push(`${a}${e}`)}t.push(`${i}</${e.name}>`)}function xs(e,t,n,r){let i=r.ind.repeat(n);if(Ms(e)){t.push(...js(e,n,r,!0));return}let a=Ns(e);if(a.length===1&&a[0].type===`element`&&a[0].name===`xi:include`){let o=a[0],s=js(e,n,r);if(s.length===1){let n=Ms(o)?Os(o):`${Ds(o)}${Cs(o.children)}</${o.name}>`;t.push(`${s[0]}${n}</${e.name}>`);return}t.push(...s),ms(o,t,n+1,r),t.push(`${i}</${e.name}>`);return}t.push(...js(e,n,r));for(let i of Ns(e))ms(i,t,n+1,r);t.push(`${i}</${e.name}>`)}function Ss(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].trim(),a=r<e.length-1?e[r+1].trim():null;if(n.push(e[r]),r===0&&/^<\?xml(?:\s|\?>)/.test(i)){n.push(``);continue}if(t.blankLines!==`few`)if(t.blankLines===`some`)if(i.startsWith(`</`)&&a!==null&&a.startsWith(`<`)){let e=/^<([^\s>/]+)/.exec(a)?.[1];e&&ss.includes(e)&&n.push(``)}else /^<title[\s>]/.test(i)&&i.includes(`</title>`)&&n.push(``);else t.blankLines===`many`&&(i.startsWith(`</`)||i.startsWith(`<`)&&a!==null&&a.startsWith(`<`))&&n.push(``)}return n}function Cs(e){return e.map(e=>e.type===`text`?Is(e.value):e.type===`element`?ws(e):e.type===`comment`?`<!--${e.value}-->`:e.type===`cdata`?`<![CDATA[${e.value}]]>`:``).join(``)}function ws(e){return Ms(e)?Os(e):`${Ds(e)}${Cs(e.children)}</${e.name}>`}function Ts(e){let t=[];for(let n of e)if(n.type===`text`){let e=n.value.split(/\s+/).filter(e=>e.length>0);for(let n=0;n<e.length;n++){let r=Is(e[n]);n===0&&t.length>0&&/^[.,;:!?\-]/.test(r)?t[t.length-1]+=r:t.push(r)}}else n.type===`element`?t.push(ws(n)):n.type===`comment`&&t.push(`<!--${n.value}-->`);return t}function Es(e,t,n,r){if(e.length===0)return[];let i=t===0?1/0:Math.max(20,t-n),a=[],o=``;for(let t=0;t<e.length;t++){let n=e[t];o===``?o=n:o.length+1+n.length<=i?o+=` `+n:(a.push(o),o=n),r&&/[.!?]$/.test(n)&&t<e.length-1&&(a.push(o),o=``)}return o&&a.push(o),a}function Ds(e){let t=ks(e);return t?`<${e.name} ${t}>`:`<${e.name}>`}function Os(e){let t=ks(e);return t?`<${e.name} ${t}/>`:`<${e.name}/>`}function ks(e){return As(e).join(` `)}function As(e){return Object.entries(e.attributes||{}).map(([e,t])=>t==null?e:`${e}="${Ls(t)}"`)}function js(e,t,n,r=!1){let i=n.ind.repeat(t),a=As(e),o=r?`/>`:`>`;if(a.length===0)return[`${i}<${e.name}${o}`];let s=`${i}<${e.name} ${a.join(` `)}${o}`;if(!n.breakLongAttributes||n.printWidth===0||s.length<=n.printWidth)return[s];let c=`${i}${` `.repeat(e.name.length+2)}`,l=[`${i}<${e.name} ${a[0]}`];for(let e of a.slice(1))l.push(`${c}${e}`);return l[l.length-1]+=o,l}function Ms(e){return e.children.every(e=>e.type===`text`&&e.value.trim()===``)}function Ns(e){return e.children.filter(e=>!(e.type===`text`&&e.value.trim()===``))}function Ps(e){if(e.type!==`element`)return!1;let t=e.name;return t===`c`?!1:(cs.includes(t)||as.includes(t))&&!ts.includes(t)}function Fs(e){return e.children.some(e=>Ps(e))}function Is(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Ls(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`)}var Rs=6,zs=({actions:e})=>{let r=(0,n.useRef)(null),i=(0,n.useRef)(null),a=(0,n.useRef)(null),o=(0,n.useRef)([]),s=(0,n.useRef)(0),[c,l]=(0,n.useState)(e.length),[u,d]=(0,n.useState)(!1),f=(0,n.useCallback)(()=>{let e=r.current,t=o.current;if(!e||t.length===0)return;let n=e.clientWidth,i=t.length>0?Rs*(t.length-1):0;if(t.reduce((e,t)=>e+t,0)+i<=n){l(t.length);return}let a=s.current,c=0;for(let e=0;e<t.length;e++){let r=a+t[e]+Rs;if(r<=n)a=r,c++;else break}l(c)},[]);(0,n.useLayoutEffect)(()=>{let e=i.current;if(!e)return;o.current=Array.from(e.querySelectorAll(`[data-measure-btn]`)).map(e=>e.offsetWidth);let t=e.querySelector(`[data-measure-more]`);s.current=t?t.offsetWidth+Rs:0,f()},[e.map(e=>`${e.key}:${e.label}:${+!!e.disabled}`).join(`|`),f]),(0,n.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>f());return t.observe(e),()=>t.disconnect()},[f]),(0,n.useEffect)(()=>{if(!u)return;let e=e=>{a.current?.contains(e.target)||d(!1)},t=e=>{e.key===`Escape`&&d(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[u]);let p=e.slice(0,c),m=e.slice(c);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-actions`,ref:r,children:[p.map(e=>(0,t.jsx)(`button`,{className:`pretext-plus-editor__menu-button ${e.className??``}`,onClick:e.onClick,disabled:e.disabled,title:e.title,children:e.label},e.key)),m.length>0&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-dropdown`,ref:a,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__menu-button`,onClick:()=>d(e=>!e),"aria-haspopup":`menu`,"aria-expanded":u,title:`More actions`,children:`More ▾`}),u&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__menu-dropdown-list`,role:`menu`,children:m.map(e=>(0,t.jsx)(`button`,{type:`button`,role:`menuitem`,className:`pretext-plus-editor__menu-dropdown-item`,onClick:()=>{d(!1),e.onClick()},disabled:e.disabled,title:e.title,children:e.label},e.key))})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-measure`,ref:i,"aria-hidden":!0,children:[e.map(e=>(0,t.jsx)(`button`,{"data-measure-btn":!0,className:`pretext-plus-editor__menu-button ${e.className??``}`,tabIndex:-1,children:e.label},e.key)),(0,t.jsx)(`button`,{"data-measure-more":!0,className:`pretext-plus-editor__menu-button`,tabIndex:-1,children:`More ▾`})]})]})},Bs=({content:e,sourceFormat:n,onContentChange:r,onOpenLatexImport:i,onOpenDocinfoEditor:a,onConvertToPretext:o,canConvertToPretext:s,onOpenAssets:c,onShowFullSource:l})=>{let u=()=>{try{r(ps(e))}catch(e){console.error(`Error formatting:`,e),alert(`Error formatting XML`)}},d={key:`full-source`,label:`Display Full Source`,onClick:l,title:`Show the full assembled PreTeXt source for the project`},f;return f=n===`latex`?[...o?[{key:`convert`,label:`Convert to PreTeXt`,onClick:o,title:`Create a new project copy using the converted PreTeXt source`,className:`pretext-plus-editor__menu-button--convert`,disabled:s===!1}]:[],{key:`preamble`,label:`Edit Preamble`,onClick:a,title:`Edit Preamble`},d]:n===`markdown`?[...o?[{key:`convert`,label:`Convert to PreTeXt`,onClick:o,title:`Create a new project copy using the converted PreTeXt source`,className:`pretext-plus-editor__menu-button--convert`,disabled:s===!1}]:[],{key:`macros`,label:`Edit Macros`,onClick:a,title:`Edit Macros`},d]:[{key:`format`,label:`Format PreTeXt`,onClick:u,title:`Format the PreTeXt source`},{key:`import-latex`,label:`Import LaTeX`,onClick:i,title:`Import LaTeX`},{key:`macros`,label:`Edit Macros`,onClick:a,title:`Edit Macros`},...c?[{key:`assets`,label:`Assets`,onClick:c,title:`Manage assets`}]:[],d],(0,t.jsxs)(`div`,{className:`pretext-plus-editor__code-editor-menu`,children:[(0,t.jsx)(zs,{actions:f}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__code-editor-source-badge pretext-plus-editor__code-editor-source-badge--right`,children:n===`latex`?`LaTeX`:n===`markdown`?`Markdown`:`PreTeXt`})]})};function Vs(e){let t=e.getLineCount();if(t<2||!/^\s*<title\b/.test(e.getLineContent(2)))return 1;let n=2;for(;n<=t&&!/<\/title\s*>/.test(e.getLineContent(n));)n++;return n<=t?n:1}function Hs(e,t){let n=e.getLineCount();if(t===`pretext`){if(n<3)return null;let t=Vs(e);if(t>=n-1)return null;let r=[];for(let e=1;e<=t;e++)r.push(e);return r.push(n),{editableRange:[t+1,1,n-1,e.getLineMaxColumn(n-1)],lockedLines:r,leadingLockedLines:t}}if(t===`markdown`){if(e.getLineContent(1).trim()!==`---`)return null;let t=-1;for(let r=2;r<=n;r++)if(e.getLineContent(r).trim()===`---`){t=r;break}if(t===-1||t>=n)return null;let r=[];for(let e=1;e<=t;e++)r.push(e);return{editableRange:[t+1,1,n,e.getLineMaxColumn(n)],lockedLines:r,leadingLockedLines:t}}return t===`latex`?n<2||!/^\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{/.test(e.getLineContent(1))?null:{editableRange:[2,1,n,e.getLineMaxColumn(n)],lockedLines:[1],leadingLockedLines:1}:null}var Us={automaticLayout:!0,minimap:{enabled:!1},acceptSuggestionOnCommitCharacter:!1,quickSuggestions:!1,wordWrap:`on`,insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},Ws=(0,n.forwardRef)(({content:e,sourceFormat:r,onChange:i,onRebuild:a,onSave:o,onOpenLatexImport:s,onOpenDocinfoEditor:c,onOpenConvertToPretext:l,canConvertToPretext:u,onOpenAssets:d,onShowFullSource:f,onRequestWrapperEdit:p},m)=>{let h=(0,n.useRef)(null),g=(0,n.useRef)(null),_=(0,n.useRef)(null),v=(0,n.useRef)(null),y=(0,n.useRef)(!1),b=(0,n.useRef)(0),x=(0,n.useRef)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(p),w=(0,n.useRef)(null),T=(0,n.useRef)(null),E=(0,n.useRef)(!1),[D,O]=(0,n.useState)(!1),[k,A]=(0,n.useState)(!1),ee=(0,n.useRef)(a),te=(0,n.useRef)(o);(0,n.useImperativeHandle)(m,()=>({insertAtCursor:e=>{let t=h.current;if(!t)return;let n=t.getSelection();n&&(t.executeEdits(`insert-asset`,[{range:n,text:e,forceMoveMarkers:!0}]),t.focus())},focus:()=>{h.current?.focus()}}),[]),(0,n.useEffect)(()=>{ee.current=a},[a]),(0,n.useEffect)(()=>{te.current=o},[o]),(0,n.useEffect)(()=>{C.current=p},[p]),(0,n.useEffect)(()=>{w.current?.dispose?.();let e=ko[r];w.current=g.current?e.registerMonacoExtensions?.(g.current)??null:null,ne()},[r]),(0,n.useEffect)(()=>()=>{x.current?.dispose?.(),w.current?.dispose?.(),S.current?.dispose?.(),_.current?.disposeConstrainer?.(),T.current&&clearTimeout(T.current)},[]);let j=(e,t,n)=>{if(r!==`pretext`)return;let i=t.getLineCount();if(i<2)return;let a=t.getLineContent(1).trim();if(!a.startsWith(`<`)||a.startsWith(`</`)||a.endsWith(`/>`))return;let o=Vs(t);if(i!==o+1)return;let s=t.getLineContent(i).trim();if(!/^<\/[A-Za-z][\w.:-]*\s*>$/.test(s))return;E.current=!0;let c=t.getLineMaxColumn(o);e.executeEdits(`ensure-body-line`,[{range:new n.Range(o,c,o,c),text:`
|
|
438
438
|
`,forceMoveMarkers:!0}]),queueMicrotask(()=>{E.current=!1})},M=(e,t,n)=>{if(r!==`pretext`)return;let i=t.getLineCount();if(i<2||t.getLineContent(i).trim()!==``)return;let a=i-1;for(;a>1&&t.getLineContent(a).trim()===``;)a--;let o=t.getLineContent(a).trim();/^<\/[A-Za-z][\w.:-]*\s*>$/.test(o)&&(E.current=!0,e.executeEdits(`trim-trailing-blank-lines`,[{range:new n.Range(a,t.getLineMaxColumn(a),i,t.getLineMaxColumn(i)),text:``,forceMoveMarkers:!0}]),queueMicrotask(()=>{E.current=!1}))},ne=()=>{let e=h.current,t=g.current,n=_.current;if(!e||!t||!n)return;let i=e.getModel();if(!i)return;typeof i.disposeRestrictions==`function`&&i.disposeRestrictions(),M(e,i,t),j(e,i,t);let a=Hs(i,r);if(y.current=a!==null,b.current=a?.leadingLockedLines??0,a&&n.addRestrictionsTo(i,[{range:a.editableRange,allowMultiline:!0}]),typeof e.createDecorationsCollection==`function`)if(v.current||=e.createDecorationsCollection(),!a)v.current.clear();else{let e={isWholeLine:!0,className:`pretext-plus-editor__locked-line`,inlineClassName:`pretext-plus-editor__locked-line-text`,stickiness:t.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,hoverMessage:{value:`These properties are structural — edit them from the Table of Contents.`}};v.current.set(a.lockedLines.map(n=>({range:new t.Range(n,1,n,i.getLineMaxColumn(n)),options:e})))}},N=(e,t)=>{e.getValue()!==t&&(E.current=!0,typeof e.disposeRestrictions==`function`&&e.disposeRestrictions(),e.setValue(t),ne(),queueMicrotask(()=>{E.current=!1}))};(0,n.useEffect)(()=>{let t=h.current;if(!t)return;let n=t.getModel();if(n&&n.getValue()!==e){let r=t.getPosition(),i=t.getSelections();N(n,e),r&&t.setPosition(r),i&&t.setSelections(i)}},[e]);let re=(t,n)=>{h.current=t,g.current=n,_.current=tr(n),_.current.initializeIn(t);let i=t.getModel();i&&i.getValue()!==e&&N(i,e),x.current?.dispose?.(),x.current=t.onDidChangeModelContent(()=>{ie()}),ie(),S.current?.dispose?.(),S.current=t.onMouseDown(e=>{let t=e?.target?.position?.lineNumber;y.current&&typeof t==`number`&&t<=b.current&&C.current?.()}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,()=>{ee.current?.()}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,()=>{te.current?.()}),w.current?.dispose?.(),w.current=ko[r].registerMonacoExtensions?.(n)??null,ne()},ie=()=>{let e=h.current?.getModel?.();if(e&&typeof e.canUndo==`function`&&typeof e.canRedo==`function`)try{O(e.canUndo()),A(e.canRedo());return}catch{}let t=!!h.current;O(t),A(t)},ae=e=>{i(e)};return(0,t.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,t.jsx)(Bs,{content:e,sourceFormat:r,onContentChange:ae,onOpenLatexImport:s,onOpenDocinfoEditor:c,onUndo:()=>{h.current?.trigger(``,`undo`),ie()},onRedo:()=>{h.current?.trigger(``,`redo`),ie()},canUndo:D,canRedo:k,onConvertToPretext:l,canConvertToPretext:u,onOpenAssets:d,onShowFullSource:f}),(0,t.jsx)(`div`,{style:{flex:1},children:(0,t.jsx)(Yn,{options:Us,height:`100%`,language:ko[r].language,defaultValue:e,onMount:re,onChange:(e,t)=>{t?.isFlush||E.current||(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{ae(e||``)},500))}})})]})});Ws.displayName=`CodeEditor`;function Gs(e){this.content=e}Gs.prototype={constructor:Gs,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Gs(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Gs(n)},addToStart:function(e,t){return new Gs([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Gs(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Gs(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Gs.from(e),e.size?new Gs(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Gs.from(e),e.size?new Gs(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Gs.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Gs.from=function(e){if(e instanceof Gs)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Gs(t)};function Ks(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Ys(e.charCodeAt(r-1))&&Js(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Ks(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function qs(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Ys(e.charCodeAt(i-1))&&Js(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=qs(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Js(e){return e>=56320&&e<57344}function Ys(e){return e>=55296&&e<56320}var Xs=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 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 r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ks(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return qs(this,e,t,n)}findIndex(e){if(e==0)return Qs(0,e);if(e==this.size)return Qs(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Qs(t+1,i):Qs(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Xs.empty=new Xs([],0);var Zs={index:0,offset:0};function Qs(e,t){return Zs.index=e,Zs.offset=t,Zs}function $s(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!$s(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!$s(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var ec=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return 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&&$s(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}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(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};ec.none=[];var tc=class extends Error{},nc=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=ic(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(rc(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Xs.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};nc.empty=new nc(Xs.empty,0,0);function rc(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(rc(a.content,t-i-1,n-i-1)))}function ic(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=ic(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function ac(e,t,n){if(n.openStart>e.depth)throw new tc(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new tc(`Inconsistent open depths`);return oc(e,t,n,0)}function oc(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=oc(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return dc(a,pc(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return dc(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=mc(n,e);return dc(a,fc(e,i,o,t,r))}}function sc(e,t){if(!t.type.compatibleContent(e.type))throw new tc(`Cannot join `+t.type.name+` onto `+e.type.name)}function cc(e,t,n){let r=e.node(n);return sc(r,t.node(n)),r}function lc(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function uc(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(lc(e.nodeAfter,r),a++));for(let e=a;e<o;e++)lc(i.child(e),r);t&&t.depth==n&&t.textOffset&&lc(t.nodeBefore,r)}function dc(e,t){if(!e.type.validContent(t))throw new tc(`Invalid content for node `+e.type.name);return e.copy(t)}function fc(e,t,n,r,i){let a=e.depth>i&&cc(e,t,i+1),o=r.depth>i&&cc(n,r,i+1),s=[];return uc(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(sc(a,o),lc(dc(a,fc(e,t,n,r,i+1)),s)):(a&&lc(dc(a,pc(e,t,i+1)),s),uc(t,n,i,s),o&&lc(dc(o,pc(n,r,i+1)),s)),uc(r,null,i,s),new Xs(s)}function pc(e,t,n){let r=[];return uc(null,e,n,r),e.depth>n&&lc(dc(cc(e,t,n+1),pc(e,t,n+1)),r),uc(t,null,n,r),new Xs(r)}function mc(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Xs.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var hc=class e{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 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 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],r=e.child(t);return n?e.child(t).cut(n):r}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],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ec.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].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 yc(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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=vc.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else vc.set(t,r=new gc);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%_c,i}},gc=class{constructor(){this.elts=[],this.i=0}},_c=12,vc=new WeakMap,yc=class{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)}},bc=Object.create(null),xc=class e{constructor(e,t,n,r=ec.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Xs.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,r=0){this.content.nodesBetween(e,t,n,r,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,r){return this.content.textBetween(e,t,n,r)}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&&$s(this.attrs,t||e.defaultAttrs||bc)&&ec.sameSet(this.marks,n||ec.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}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 nc.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new nc(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ac(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+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 r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return hc.resolveCached(this,e)}resolveNoCache(e){return hc.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),Cc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Xs.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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=ec.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(!ec.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Xs.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};xc.prototype.text=void 0;var Sc=class e extends xc{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cc(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,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 Cc(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var wc=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Tc(t,n);if(r.next==null)return e.empty;let i=Ec(r);r.next&&r.err(`Unexpected trailing text`);let a=Ic(Nc(i));return Lc(a,r),a}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 r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Xs.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+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 r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw 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 r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
439
439
|
`)}};wc.empty=new wc(!0);var Tc=class{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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ec(e){let t=[];do t.push(Dc(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Dc(e){let t=[];do t.push(Oc(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Oc(e){let t=Mc(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Ac(e,t);else break;return t}function kc(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Ac(e,t){let n=kc(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:kc(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function jc(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Mc(e){if(e.eat(`(`)){let t=Ec(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=jc(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Nc(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Pc(e,t){return t-e}function Fc(e,t){let n=[];return r(t),n.sort(Pc);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Ic(e){let t=Object.create(null);return n(Fc(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Fc(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new wc(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Pc);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Lc(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Rc(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function zc(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Bc(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Vc(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Wc(e,r,t[r]);return n}var Hc=class e{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=Vc(e,n.attrs),this.defaultAttrs=Rc(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==wc.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:zc(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new xc(this,this.computeAttrs(e),Xs.from(t),ec.setFrom(n))}createChecked(e=null,t,n){return t=Xs.from(t),this.checkContent(t),new xc(this,this.computeAttrs(e),t,ec.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Xs.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Xs.empty,!0);return i?new xc(this,e,t.append(i),ec.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw 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||=e.slice(0,n);return t?t.length?t:ec.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Uc(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Wc=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Uc(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Gc=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Vc(e,r.attrs),this.excluded=null;let i=Rc(this.attrs);this.instance=i?new ec(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ec(this,zc(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}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}},Kc=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Gs.from(e.nodes),t.marks=Gs.from(e.marks||{}),this.nodes=Hc.compile(this.spec.nodes,this),this.marks=Gc.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=wc.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?qc(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:qc(this,n.split(` `))}this.nodeFromJSON=e=>xc.fromJSON(this,e),this.markFromJSON=e=>ec.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Hc))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Sc(n,n.defaultAttrs,e,ec.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 RangeError(`Unknown node type: `+e);return t}};function qc(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Jc(e){return e.tag!=null}function Yc(e){return e.style!=null}var Xc=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Jc(e))this.tags.push(e);else if(Yc(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new al(this,t,!1);return n.addAll(e,ec.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new al(this,t,!0);return n.addAll(e,ec.none,t.from,t.to),nc.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(sl(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=cl(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=cl(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Zc={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},Qc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$c={ol:!0,ul:!0},el=1,tl=2,nl=4;function rl(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?el:0)|(t===`full`?tl:0)}var il=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=ec.none,this.match=i||(a&nl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Xs.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&el)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=Xs.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Xs.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&&!Zc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},al=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=rl(null,t.preserveWhitespace,0)|(n?nl:0);i=r?new il(r.type,r.attrs,ec.none,!0,t.topMatch||r.type.contentMatch,a):n?new il(null,null,ec.none,!0,null,a):new il(e.schema.topNodeType,null,ec.none,!0,null,a),this.nodes=[i],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,r=this.top,i=r.options&tl?`full`:this.localPreserveWS||(r.options&el)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
440
440
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;$c.hasOwnProperty(a)&&this.parser.normalizeLists&&ol(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Qc.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Zc.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
@@ -1050,44 +1050,44 @@ Expected it to be ${r}.`}var lW=class extends Error{name=`InvalidDocError`;const
|
|
|
1050
1050
|
`,i);e&&(l.write(e),o.length>0&&(a+=kG(e)));break}case HU:for(let t=d.length-1;t>=0;t--)o.push({indent:e,mode:u,doc:d[t]});break;case UU:l.markPosition();break;case WU:o.push({indent:zG(e,t),mode:u,doc:d.contents});break;case GU:o.push({indent:RG(e,d.n,t),mode:u,doc:d.contents});break;case KU:a-=l.trim();break;case qU:{let t=(function(){if(u===WG&&!s)return{indent:e,mode:d.break?UG:WG,doc:d.contents};s=!1;let t=r-a,i=c.length>0,l={indent:e,mode:WG,doc:d.contents};if(!d.break&&KG(l,o,t,i,n))return l;if(!d.expandedStates)return{indent:e,mode:UG,doc:d.contents};if(!d.break)for(let r=1;r<d.expandedStates.length-1;r++){let a={indent:e,mode:WG,doc:d.expandedStates[r]};if(KG(a,o,t,i,n))return a}return{indent:e,mode:UG,doc:zU(0,d.expandedStates,-1)}})();o.push(t),d.id&&(n[d.id]=t.mode);break}case JU:{let t=r-a,i=d[GG]??0,{parts:s}=d,l=s.length-i;if(l===0)break;let f=s[i+0],p=s[i+1],m={indent:e,mode:WG,doc:f},h={indent:e,mode:UG,doc:f},g=KG(m,[],t,c.length>0,n,!0);if(l===1){g?o.push(m):o.push(h);break}let _={indent:e,mode:WG,doc:p},v={indent:e,mode:UG,doc:p};if(l===2){g?o.push(_,m):o.push(v,h);break}let y=s[i+2],b={indent:e,mode:u,doc:{...d,[GG]:i+2}},x=KG({indent:e,mode:WG,doc:[f,p,y]},[],t,c.length>0,n,!0);o.push(b),x?o.push(_,m):g?o.push(v,m):o.push(v,h);break}case YU:case XU:{let t=d.groupId?n[d.groupId]:u;if(t===UG){let t=d.type===YU?d.breakContents:d.negate?d.contents:NW(d.contents);t&&o.push({indent:e,mode:u,doc:t})}if(t===WG){let t=d.type===YU?d.flatContents:d.negate?NW(d.contents):d.contents;t&&o.push({indent:e,mode:u,doc:t})}break}case ZU:c.push({indent:e,mode:u,doc:d.contents});break;case QU:c.length>0&&o.push({indent:e,mode:u,doc:XW});break;case $U:switch(u){case WG:if(!d.hard){d.soft||(l.write(` `),a+=1);break}s=!0;case UG:if(c.length>0){o.push({indent:e,mode:u,doc:d},...c.reverse()),c.length=0;break}d.literal?(l.write(i),a=0,e.root&&(e.root.value&&l.write(e.root.value),a=e.root.length)):(l.trim(),l.write(i+e.value),a=e.length);break}break;case eW:o.push({indent:e,mode:u,doc:d.contents});break;case tW:break;default:throw new lW(d)}o.length===0&&c.length>0&&(o.push(...c.reverse()),c.length=0)}let{text:u,positions:d}=l.finish();if(d.length!==2)return{formatted:u};let[f,p]=d;return{formatted:u,cursorNodeStart:f,cursorNodeText:u.slice(f,p)}}var JG={join:KW,line:JW,softline:YW,hardline:ZW,literalline:$W,group:HW,conditionalGroup:UW,fill:VW,lineSuffix:eG,lineSuffixBoundary:tG,cursor:BW,breakParent:zW,ifBreak:WW,trim:nG,indent:NW,indentIfBreak:GW,align:PW,addAlignmentToDoc:RW,markAsRoot:IW,dedentToRoot:FW,dedent:LW,hardlineWithoutBreakParent:XW,literallineWithoutBreakParent:QW,label:qW,concat:e=>e},YG={printDocToString:qG},XG={willBreak:gW,traverseDoc:fW,findInDoc:mW,mapDoc:pW,removeLines:bW,stripTrailingHardline:CW,replaceEndOfLine:EW,canBreak:OW};function ZG(){return{isChar:(e,t)=>Q.string(e,t),isComma:e=>Q.string(e,`,`),isEquals:e=>Q.string(e,`=`),isWhitespace:e=>Q.whitespace(e),isParbreak:e=>Q.parbreak(e),isSameLineComment:e=>Q.comment(e)&&e.sameline,isOwnLineComment:e=>Q.comment(e)&&!e.sameline}}function QG(e,t){if(!Array.isArray(e))throw Error(`You must pass an array of nodes`);let{allowParenGroups:n=!1}=t||{};return e=aV([...e]),yV.parse(e,{...ZG(),allowParenGroups:n})}function $G(e,t){return{isRowSep:Q.createMacroMatcher(e),isColSep:e=>t.some(t=>Q.string(e,t)),isWhitespace:e=>Q.whitespace(e),isSameLineComment:e=>Q.comment(e)&&e.sameline,isOwnLineComment:e=>Q.comment(e)&&!e.sameline}}function eK(e,t=[`&`],n=[`\\`,`hline`,`cr`]){if(!Array.isArray(e))throw Error(`You must pass an array of nodes`);return e=aV([...e]),_V.parse(e,$G(n,t))}function tK(e){let t=tB(e.env);return{envName:t,start:`\\begin{`+t+`}`,end:`\\end{`+t+`}`}}function nK(e){return e==null||typeof e==`string`?!1:Array.isArray(e)?nK(e[0]):e.type===`concat`?nK(e.parts):e.type===`line`}function rK(e){if(e.length===0||e.length===1)return e;let t=[e[0]];for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];!nK(r)&&!nK(i)&&t.push(lK),t.push(i)}return t}function iK(e,t){if(!e)return{renderInfo:{}};let n=e._renderInfo||{},r=t.referenceMap&&t.referenceMap.getPreviousNode(e),i=t.referenceMap&&t.referenceMap.getNextNode(e);return{renderInfo:n,renderCache:t.referenceMap&&t.referenceMap.getRenderCache(e),previousNode:r,nextNode:i,referenceMap:t.referenceMap}}var{group:aK,fill:oK,ifBreak:sK,line:cK,softline:lK,hardline:uK,lineSuffix:dK,lineSuffixBoundary:fK,breakParent:pK,indent:mK,markAsRoot:hK,join:gK}=JG;function _K(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=t[i],{renderInfo:s,referenceMap:c,previousNode:l,nextNode:u}=iK(a,n),d=c&&c.getRenderCache(a);switch(a.type){case`comment`:!a.sameline&&l&&!Q.comment(l)&&!Q.parbreak(l)&&r.push(uK),r.push(o),u&&!a.suffixParbreak&&r.push(uK);break;case`environment`:case`displaymath`:case`mathenv`:l&&l?.type!==`parbreak`&&(r[r.length-1]===cK&&r.pop(),r[r.length-1]!==uK&&r.push(uK)),r.push(o),u?.type===`whitespace`&&(r.push(uK),i++);break;case`macro`:(s.breakBefore||s.breakAround)&&l&&(r[r.length-1]===cK||r[r.length-1]===uK?(r.pop(),r.push(uK)):!Q.comment(l)&&!Q.parbreak(l)&&r.push(uK)),s.inParMode&&!s.hangingIndent&&d?r.push(d.content,...d.rawArgs||[]):r.push(o),(s.breakAfter||s.breakAround)&&u&&(Q.whitespace(u)?(r.push(uK),i++):Q.parbreak(u)||Q.comment(u)||r.push(uK));break;case`parbreak`:r.push(uK,uK);break;default:r.push(o);break}}return r}function vK(e,t){let n=[],r=Math.min(e.length,t.length);for(let i=0;i<r;i++)n.push([e[i],t[i]]);return n}function yK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n),c=(r.escapeToken==null?`\\`:r.escapeToken)+r.content,l=r.args?e.map(t,`args`):[],u=[];for(let[e,t]of vK(r.args||[],l)){let n=s&&s.getRenderCache(e);i.inParMode&&n?u.push(...n):u.push(t)}return s&&s.setRenderCache(r,{rawArgs:u,content:c}),i.hangingIndent?mK(oK([c,...u])):aK([c,...u])}function bK(e,t){let{allowParenGroups:n=!1}=t,r=QG(e,{allowParenGroups:n}),i=[];for(let e of r){let t=e===r[r.length-1];if(e.itemParts){let t=gK(`=`,e.itemParts.map(e=>tB(e,{asArray:!0}).map(e=>e===Qz?uK:e)));i.push(t),e.trailingComma&&i.push(`,`)}if(e.trailingComment){let t=e.itemParts?[` `]:[];e.leadingParbreak&&t.push(uK),i.push(...t,`%`,e.trailingComment.content,pK)}t||i.push(cK)}let a=[``];return t.leadingComment&&(t.leadingComment.leadingWhitespace&&a.push(` `),a.push(`%`+t.leadingComment.content,pK)),aK([t.openMark,...a,i.length>0?mK([lK,...i]):``,lK,t.closeMark])}function xK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n),c=[],l=[...r.content];TB(l);try{let n=RH(l);return n.content.length===0?(c.push(`;`),c):new TK(n,e,t).toDoc()}catch(e){console.warn(`Encountered error when trying to parse tikz argument`,e)}return c.push(`;`),c}function SK(e,t,n){let r=Symbol(),i=t.getNode();if(!i)throw Error("tried to print a fragment, but the current node is `null`");i[r]=e;let a=n(r);return delete i[r],a}function CK(e,t,n){switch(e.type){case`comment`:return SK(e,t,n);case`unknown`:return SK(e.content,t,n);case`coordinate`:return[tB(e.prefix),`(`,tB(e.content),`)`];case`line_to`:return e.command;case`square_brace_group`:return wK(e.content);case`operation`:return e.content.content;case`svg_operation`:{let r=e.comments.map(e=>CK(e,t,n)),i=e.options?wK(e.options):[],a=e.options?[aK(mK([cK,tB(e.content)]))]:[` `,tB(e.content)];return[...r,`svg`,i,...a]}case`curve_to`:{let r=e.comments.map(e=>CK(e,t,n)),i=e.controls.length>1?[CK(e.controls[0],t,n),` `,`and`,cK,CK(e.controls[1],t,n)]:[CK(e.controls[0],t,n)];return[...r,`..`,` `,aK(mK([`controls`,cK,...i,` `,`..`]))]}case`animation`:return[...e.comments.map(e=>CK(e,t,n)),`:`,e.attribute,` `,`=`,` `,aK(mK([bK(e.content,{openMark:`{`,closeMark:`}`})]))];case`foreach`:{let r=e.comments.map(e=>CK(e,t,n)),i=[...e.variables];TB(i);let a=e.list.type===`macro`?SK(e.list,t,n):bK(e.list.content,{openMark:`{`,closeMark:`}`,allowParenGroups:!0}),o=[...r,tB(e.start),` `,tB(i)];e.options&&o.push(` `,mK(wK(e.options))),o.push(` `,`in`,` `,aK(mK(a)));let s=e.command.type;switch(s){case`foreach`:o.push(mK([cK,CK(e.command,t,n)]));break;case`macro`:o.push(mK([cK,SK(e.command,t,n)]));break;case`group`:{let r=[...e.command.content];TB(r),o.push(` `,mK(aK([`{`,mK([lK,...r.map(e=>SK(e,t,n))]),lK,`}`])));break}default:console.warn(`Unhandled command type when printing "foreach": ${s}`)}return mK(o)}}return console.warn(`Encountered unknown type when trying to print tikz PathSpec: "${e.type}"`),[]}function wK(e){return bK(e,{openMark:`[`,closeMark:`]`})}var TK=class{#e;#t;constructor(e,t,n){this.#e=t,this.#t=n,this.nodes=[...e.content]}nodeToDoc(e){return CK(e,this.#e,this.#t)}toDoc(){let e=[],t=this.eatOptionalArg();t.optionalArg&&(e.push(...t.comments.map(e=>SK(e,this.#e,this.#t))),e.push(wK(t.optionalArg.content)));let n=[];e.push(aK([mK(n),`;`]));let r=-1;for(;this.nodes.length>0;){r++;let e=r===0&&!t.optionalArg?` `:cK;switch(this.peek()){case`short_path`:{let[t,r,i]=this.nodes.splice(0,3);n.push(e,this.nodeToDoc(t),` `,this.nodeToDoc(r),` `,this.nodeToDoc(i));continue}case`long_path`:{let[t,r]=this.nodes.splice(0,2);r.type===`operation`?(this.nodes.unshift(r),n.push(e,this.nodeToDoc(t),` `,this.eatOperation())):n.push(e,this.nodeToDoc(t),` `,this.nodeToDoc(r));continue}case`node`:{let e=this.eatNode();if(e){n.push(cK,...e);continue}console.warn("Expected to print a tikz `node` PathSpec but couldn't find the text `node`")}continue;case`operation`:n.push(e,this.eatOperation());continue;case`unknown`:{let t=this.nodes.shift();n.push(e,this.nodeToDoc(t));continue}}this.nodes.shift()}return e}peek(){let[e,t,n,r]=[this.nodes[0],this.nodes[1],this.nodes[2],this.nodes[3]];return e?.type===`coordinate`&&DK(t)?n?.type===`coordinate`&&!(r?.type===`coordinate`||DK(r))?`short_path`:`long_path`:e?.type===`operation`?e.content.content===`node`?`node`:`operation`:`unknown`}eatOptionalArg(){let e=0,t=[],n=null;for(;e<this.nodes.length;e++){let r=this.nodes[e];if(r.type===`square_brace_group`){n=r,e++;break}if(r.type===`comment`){t.push(r);continue}break}return n&&this.nodes.splice(0,e),{optionalArg:n,comments:t}}eatNode(){let e=this.nodes[0];if(e?.type===`operation`&&e.content.content===`node`)this.nodes.shift();else return null;let t=[],n=[],r=[n,`node`,aK(mK(t))],i=!1,a=!1,o=0,s=[],c=[],l=[],u=[],d=[],f=[];for(;o<this.nodes.length&&!a;o++){let e=this.nodes[o];switch(e.type){case`animation`:d.push(this.nodeToDoc(e));continue;case`comment`:{let t={...e,leadingWhitespace:!1};s.push(this.nodeToDoc(t));continue}case`square_brace_group`:c.push(wK(e.content));continue;case`coordinate`:l.push(this.nodeToDoc(e));continue;case`operation`:if(e.content.content===`at`){let e=this.nodes[o+1];if(!e||!(e.type===`coordinate`||e.type===`unknown`&&Q.anyMacro(e.content))){a=!0;continue}u.push([`at`,` `,this.nodeToDoc(e)]),o++;continue}a=!0;continue;case`unknown`:Q.group(e.content)&&(i=!0,f=this.nodeToDoc(e))}break}if(!i)return t;this.nodes.splice(0,o+1);let p=!0,m=!(Array.isArray(l)&&l.length===0);for(let e of s)n.push(e,uK);return c.length>0&&(t.push(gK(` `,c)),p=!1),d.length>0&&(t.push(p?` `:cK),t.push(gK(cK,d)),p=!1),m&&(t.push(p?` `:cK),t.push(l),p=!1),u.length>0&&(t.push(p||m?` `:cK),t.push(gK(cK,u)),p=!1),t.push(cK,f),r}eatOperation(){let e=this.nodes[0];if(e?.type===`operation`)this.nodes.shift();else return[];let t=[];if(e?.type!==`operation`)throw Error("Expecting `operation` node.");let n=this.eatOptionalArg();return t.push(...n.comments.map(e=>SK(e,this.#e,this.#t)),e.content.content),n.optionalArg&&t.push(mK(wK(n.optionalArg.content))),t}},EK=new Set([`rectangle`,`grid`,`sin`,`cos`,`to`]);function DK(e){if(!e)return!1;switch(e.type){case`line_to`:case`curve_to`:return!0;case`operation`:return EK.has(e.content.content)}return!1}function OK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n);if(r.openMark===``&&r.closeMark===``&&r.content.length===0)return[];let{renderInfo:c}=iK(e.getParentNode(),n);if(c.pgfkeysArgs){let e=r.content.length>0&&Q.comment(r.content[0])&&r.content[0].sameline?r.content[0]:null,t=e?r.content.slice(1):r.content;return TB(t),bK(t,{openMark:r.openMark,closeMark:r.closeMark,leadingComment:e})}if(c.tikzPathCommand)return xK(e,t,n);let l=r.openMark,u=r.closeMark,d=e.map(t,`content`);d=_K(r.content,d,n),Q.comment(r.content[r.content.length-1])&&d.push(uK);let f=[l,oK(d),u];return i.inParMode&&(f=[l,...d,u]),s&&s.setRenderCache(r,f),f}function kK(e){return e.some(e=>Q.macro(e,`documentclass`))}function AK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n),c=e.map(t,`content`),l=_K(r.content,c,n);return(kK(r.content)?e=>e:oK)(l)}function jK(e,t,n){let r=e.getNode(),i=``;return r.leadingWhitespace&&r.sameline&&(i=` `),[i,`%`+tB(r.content)]}function MK(e,t,n){let r=e.getNode();if(r.content.length===0)return[`$`,` `,`$`];let i=e.map(t,`content`);return i=_K(r.content,i,n),i=rK(i),r.content[r.content.length-1].type===`comment`&&i.push(uK),oK([`$`,...i,`$`])}function NK(e,t,n){let r=e.getNode(),i=e.map(t,`content`);i=_K(r.content,i,n),i=rK(i);let a=[uK];return(r.content.length===0||r.content[0].type===`comment`&&r.content[0].sameline)&&a.pop(),[`\\[`,mK(oK(a.concat(i))),uK,`\\]`]}function PK(e,t,n){let r=e.getNode(),i=tK(r);return[i.start,r.content,i.end]}function FK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n),c=r.args?e.map(t,`args`):[],l=tK(r),u=e.map(t,`content`);u=_K(r.content,u,n),i.inMathMode&&(u=rK(u));let d=[uK];return(r.content.length===0||r.content[0].type===`comment`&&r.content[0].sameline)&&d.pop(),[l.start,...c,mK(oK(d.concat(u))),uK,l.end]}function IK(e,t,n){let r=e.getNode(),{renderInfo:i,previousNode:a,nextNode:o,referenceMap:s}=iK(r,n),c=r.args?e.map(t,`args`):[],l=tK(r),u=r.content[0]&&r.content[0].type===`comment`&&r.content[0].sameline?r.content[0]:null,{rows:d,rowSeps:f,trailingComments:p}=LK(u?r.content.slice(1):r.content),m=[];for(let e=0;e<d.length;e++){let t=d[e],n=f[e],r=p[e];m.push(t),n&&m.push(tB(n)),n&&r&&m.push(` `),r&&m.push([`%`,tB(r.content)]),(n||r)&&m.push(uK)}return m[m.length-1]===uK&&m.pop(),u?(m.unshift(u.leadingWhitespace?` `:``,`%`+tB(u.content),uK),[l.start,...c,mK(m),uK,l.end]):[l.start,...c,mK([uK,...m]),uK,l.end]}function LK(e){function t(e=1){return` `.repeat(e)}let n=eK(e),r=Math.max(...n.map(e=>e.cells.length)),i=n.map(({rowSep:e})=>tB(e||[])),a=n.map(({trailingComment:e})=>e),o=n.map(({cells:e,colSeps:t})=>({cells:e.map(e=>(TB(e),tB(e))),seps:t.map(e=>tB(e))})),s=[];for(let e=0;e<r;e++)s.push(Math.max(...o.map(({cells:t,seps:n})=>((t[e]||``)+(n[e]||``)).length)));return{rows:o.map(({cells:e,seps:n})=>{if(e.length===1&&e[0]===``)return``;let r=``;for(let i=0;i<e.length;i++){let a=s[i]-(n[i]||``).length;r+=(i===0?``:` `)+e[i]+t(a-e[i].length+1)+(n[i]||``)}return r}),rowSeps:i,trailingComments:a}}var RK=class{constructor(e){this.ast=e,this.map=new Map,SB(this.ast,e=>{for(let t=0;t<e.length;t++)this.map.set(e[t],{previous:e[t-1],next:e[t+1]})},{includeArrays:!0,test:Array.isArray})}setRenderCache(e,t){let n=this.map.get(e)||{};this.map.set(e,{...n,renderCache:t})}getRenderCache(e){return this.map.get(e)?.renderCache}getPreviousNode(e){return(this.map.get(e)||{}).previous}getNextNode(e){return(this.map.get(e)||{}).next}};function zK(e,t,n){let r=e.getValue(),{renderInfo:i}=iK(r,t);if(r==null||typeof r==`string`)return r;switch(r.type){case`root`:return t.referenceMap&&console.warn(`Processing root node, but ReferenceMap already exists. Are there multiple nodes of type 'root'?`),t.referenceMap=new RK(r),AK(e,n,t);case`argument`:return OK(e,n,t);case`comment`:return jK(e,n,t);case`environment`:case`mathenv`:return i.alignContent?IK(e,n,t):FK(e,n,t);case`displaymath`:return NK(e,n,t);case`group`:return[`{`,...tB(r.content,{asArray:!0}).map(e=>e===Qz?uK:e),`}`];case`inlinemath`:return MK(e,n,t);case`macro`:return yK(e,n,t);case`parbreak`:return[uK,uK];case`string`:return r.content;case`verb`:return[`\\`,r.env,r.escape,tB(r.content),r.escape];case`verbatim`:return PK(e,n,t);case`whitespace`:return cK;default:return console.warn(`Printing unknown type ${BK(r)}`,r),tB(r)}}function BK(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e}function VK(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?UK(e.position):`start`in e||`end`in e?UK(e):`line`in e||`column`in e?HK(e):``}function HK(e){return WK(e&&e.line)+`:`+WK(e&&e.column)}function UK(e){return HK(e&&e.start)+`-`+HK(e&&e.end)}function WK(e){return e&&typeof e==`number`?e:1}var GK=class extends Error{constructor(e,t,n){let r=[null,null],i={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof t==`string`&&(n=t,t=void 0),typeof n==`string`){let e=n.indexOf(`:`);e===-1?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}t&&(`type`in t||`position`in t?t.position&&(i=t.position):`start`in t||`end`in t?i=t:(`line`in t||`column`in t)&&(i.start=t)),this.name=VK(t)||`1:1`,this.message=typeof e==`object`?e.message:e,this.stack=``,typeof e==`object`&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=i.start.line,this.column=i.start.column,this.position=i,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}};GK.prototype.file=``,GK.prototype.name=``,GK.prototype.reason=``,GK.prototype.message=``,GK.prototype.stack=``,GK.prototype.fatal=null,GK.prototype.column=null,GK.prototype.line=null,GK.prototype.source=null,GK.prototype.ruleId=null,GK.prototype.position=null;var KK={basename:qK,dirname:JK,extname:YK,join:XK,sep:`/`};function qK(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);$K(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.charCodeAt(i)===t.charCodeAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function JK(e){if($K(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.charCodeAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.charCodeAt(0)===47?`/`:`.`:t===1&&e.charCodeAt(0)===47?`//`:e.slice(0,t)}function YK(e){$K(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.charCodeAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function XK(...e){let t=-1,n;for(;++t<e.length;)$K(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ZK(n)}function ZK(e){$K(e);let t=e.charCodeAt(0)===47,n=QK(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.charCodeAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function QK(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.charCodeAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function $K(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var eq={cwd:tq};function tq(){return`/`}function nq(e){return typeof e==`object`&&!!e&&e.href&&e.origin}function rq(e){if(typeof e==`string`)e=new URL(e);else if(!nq(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return iq(e)}function iq(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.charCodeAt(n)===37&&t.charCodeAt(n+1)===50){let e=t.charCodeAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var aq=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],oq=class{constructor(e){let t;t=e?typeof e==`string`||uq(e)?{value:e}:nq(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=eq.cwd(),this.value,this.stored,this.result,this.map;let n=-1;for(;++n<aq.length;){let e=aq[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)aq.includes(r)||(this[r]=t[r])}get path(){return this.history[this.history.length-1]}set path(e){nq(e)&&(e=rq(e)),cq(e,`path`),this.path!==e&&this.history.push(e)}get dirname(){return typeof this.path==`string`?KK.dirname(this.path):void 0}set dirname(e){lq(this.basename,`dirname`),this.path=KK.join(e||``,this.basename)}get basename(){return typeof this.path==`string`?KK.basename(this.path):void 0}set basename(e){cq(e,`basename`),sq(e,`basename`),this.path=KK.join(this.dirname||``,e)}get extname(){return typeof this.path==`string`?KK.extname(this.path):void 0}set extname(e){if(sq(e,`extname`),lq(this.dirname,`extname`),e){if(e.charCodeAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=KK.join(this.dirname,this.stem+(e||``))}get stem(){return typeof this.path==`string`?KK.basename(this.path,this.extname):void 0}set stem(e){cq(e,`stem`),sq(e,`stem`),this.path=KK.join(this.dirname||``,e+(this.extname||``))}toString(e){return(this.value||``).toString(e||void 0)}message(e,t,n){let r=new GK(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=null,r}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}};function sq(e,t){if(e&&e.includes(KK.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+KK.sep+"`")}function cq(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function lq(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function uq(e){return(0,PR.default)(e)}var dq=pq().freeze(),fq={}.hasOwnProperty;function pq(){let e=mR(),t=[],n={},r,i=-1;return a.data=o,a.Parser=void 0,a.Compiler=void 0,a.freeze=s,a.attachers=t,a.use=c,a.parse=l,a.stringify=u,a.run=d,a.runSync=f,a.process=p,a.processSync=m,a;function a(){let e=pq(),r=-1;for(;++r<t.length;)e.use(...t[r]);return e.data((0,VR.default)(!0,{},n)),e}function o(e,t){return typeof e==`string`?arguments.length===2?(vq(`data`,r),n[e]=t,a):fq.call(n,e)&&n[e]||null:e?(vq(`data`,r),n=e,a):n}function s(){if(r)return a;for(;++i<t.length;){let[n,...r]=t[i];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let o=n.call(a,...r);typeof o==`function`&&e.use(o)}return r=!0,i=1/0,a}function c(e,...i){let o;if(vq(`use`,r),e!=null)if(typeof e==`function`)u(e,...i);else if(typeof e==`object`)Array.isArray(e)?l(e):c(e);else throw TypeError("Expected usable value, not `"+e+"`");return o&&(n.settings=Object.assign(n.settings||{},o)),a;function s(e){if(typeof e==`function`)u(e);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;u(t,...n)}else c(e);else throw TypeError("Expected usable value, not `"+e+"`")}function c(e){l(e.plugins),e.settings&&(o=Object.assign(o||{},e.settings))}function l(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];s(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function u(e,n){let r=-1,i;for(;++r<t.length;)if(t[r][0]===e){i=t[r];break}i?(pR(i[1])&&pR(n)&&(n=(0,VR.default)(!0,i[1],n)),i[1]=n):t.push([...arguments])}}function l(e){a.freeze();let t=xq(e),n=a.Parser;return gq(`parse`,n),mq(n,`parse`)?new n(String(t),t).parse():n(String(t),t)}function u(e,t){a.freeze();let n=xq(t),r=a.Compiler;return _q(`stringify`,r),yq(e),mq(r,`compile`)?new r(e,n).compile():r(e,n)}function d(t,n,r){if(yq(t),a.freeze(),!r&&typeof n==`function`&&(r=n,n=void 0),!r)return new Promise(i);i(null,r);function i(i,a){e.run(t,xq(n),o);function o(e,n,o){n||=t,e?a(e):i?i(n):r(null,n,o)}}}function f(e,t){let n,r;return a.run(e,t,i),bq(`runSync`,`run`,r),n;function i(e,t){uR(e),n=t,r=!0}}function p(e,t){if(a.freeze(),gq(`process`,a.Parser),_q(`process`,a.Compiler),!t)return new Promise(n);n(null,t);function n(n,r){let i=xq(e);a.run(a.parse(i),i,(e,t,n)=>{if(e||!t||!n)o(e);else{let r=a.stringify(t,n);r==null||(Cq(r)?n.value=r:n.result=r),o(e,n)}});function o(e,i){e||!i?r(e):n?n(i):t(null,i)}}}function m(e){let t;a.freeze(),gq(`processSync`,a.Parser),_q(`processSync`,a.Compiler);let n=xq(e);return a.process(n,r),bq(`processSync`,`process`,t),n;function r(e){t=!0,uR(e)}}}function mq(e,t){return typeof e==`function`&&e.prototype&&(hq(e.prototype)||t in e.prototype)}function hq(e){let t;for(t in e)if(fq.call(e,t))return!0;return!1}function gq(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `Parser`")}function _q(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `Compiler`")}function vq(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yq(e){if(!pR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function bq(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xq(e){return Sq(e)?e:new oq(e)}function Sq(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Cq(e){return typeof e==`string`||(0,PR.default)(e)}var wq=g(PU(),1),Tq=function(e){let{pretty:t=!1,printWidth:n=80,useTabs:r=!0,forceNewlineEnding:i=!1}=e||{},a=t=>{let a=wq.default.format(`_`,{useTabs:r,printWidth:n,parser:`latex-dummy-parser`,plugins:[{languages:[{name:`latex`,extensions:[`.tex`],parsers:[`latex-dummy-parser`]}],parsers:{"latex-dummy-parser":{parse:()=>t,astFormat:`latex-ast`,locStart:()=>0,locEnd:()=>1}},printers:{"latex-ast":{print:zK}}}],...e||{}});return i&&!a.endsWith(`
|
|
1051
1051
|
`)&&(a+=`
|
|
1052
1052
|
`),a};Object.assign(this,{Compiler:e=>t?a(e):tB(e)})};dq().use(Tq,{pretty:!0}).freeze();var Eq=e=>HR().use(NU,e).use(Tq,Object.assign({pretty:!0},e)),Dq=(function(e,t,...n){let r=-1,i;if(e==null)i={type:`root`,children:[]},n.unshift(t);else if(typeof e==`string`)if(i={type:`element`,name:e,attributes:{},children:[]},kq(t)){let e;for(e in t)t[e]!==void 0&&t[e]!==null&&(typeof t[e]!=`number`||!Number.isNaN(t[e]))&&(i.attributes[e]=String(t[e]))}else n.unshift(t);else throw TypeError("Expected element name, got `"+e+"`");for(;++r<n.length;)Oq(i.children,n[r]);return i});function Oq(e,t){let n=-1;if(t!=null)if(typeof t==`string`||typeof t==`number`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(;++n<t.length;)Oq(e,t[n]);else if(typeof t==`object`&&`type`in t)t.type===`root`?Oq(e,t.children):e.push(t);else throw TypeError("Expected node, nodes, string, got `"+t+"`")}function kq(e){return!(typeof e!=`object`||!e||Array.isArray(e))}function Aq(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Mq(e.position):`start`in e||`end`in e?Mq(e):`line`in e||`column`in e?jq(e):``}function jq(e){return Nq(e&&e.line)+`:`+Nq(e&&e.column)}function Mq(e){return jq(e&&e.start)+`-`+jq(e&&e.end)}function Nq(e){return e&&typeof e==`number`?e:1}var Pq=class extends Error{constructor(e,t,n){let r=[null,null],i={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof t==`string`&&(n=t,t=void 0),typeof n==`string`){let e=n.indexOf(`:`);e===-1?r[1]=n:(r[0]=n.slice(0,e),r[1]=n.slice(e+1))}t&&(`type`in t||`position`in t?t.position&&(i=t.position):`start`in t||`end`in t?i=t:(`line`in t||`column`in t)&&(i.start=t)),this.name=Aq(t)||`1:1`,this.message=typeof e==`object`?e.message:e,this.stack=``,typeof e==`object`&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=i.start.line,this.column=i.start.column,this.position=i,this.source=r[0],this.ruleId=r[1],this.file,this.actual,this.expected,this.url,this.note}};Pq.prototype.file=``,Pq.prototype.name=``,Pq.prototype.reason=``,Pq.prototype.message=``,Pq.prototype.stack=``,Pq.prototype.fatal=null,Pq.prototype.column=null,Pq.prototype.line=null,Pq.prototype.source=null,Pq.prototype.ruleId=null,Pq.prototype.position=null;var Fq={basename:Iq,dirname:Lq,extname:Rq,join:zq,sep:`/`};function Iq(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Hq(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.charCodeAt(i)===t.charCodeAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Lq(e){if(Hq(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.charCodeAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.charCodeAt(0)===47?`/`:`.`:t===1&&e.charCodeAt(0)===47?`//`:e.slice(0,t)}function Rq(e){Hq(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.charCodeAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function zq(...e){let t=-1,n;for(;++t<e.length;)Hq(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Bq(n)}function Bq(e){Hq(e);let t=e.charCodeAt(0)===47,n=Vq(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.charCodeAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Vq(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.charCodeAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Hq(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Uq={cwd:Wq};function Wq(){return`/`}function Gq(e){return typeof e==`object`&&!!e&&e.href&&e.origin}function Kq(e){if(typeof e==`string`)e=new URL(e);else if(!Gq(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return qq(e)}function qq(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.charCodeAt(n)===37&&t.charCodeAt(n+1)===50){let e=t.charCodeAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Jq=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Yq=class{constructor(e){let t;t=e?typeof e==`string`||$q(e)?{value:e}:Gq(e)?{path:e}:e:{},this.data={},this.messages=[],this.history=[],this.cwd=Uq.cwd(),this.value,this.stored,this.result,this.map;let n=-1;for(;++n<Jq.length;){let e=Jq[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Jq.includes(r)||(this[r]=t[r])}get path(){return this.history[this.history.length-1]}set path(e){Gq(e)&&(e=Kq(e)),Zq(e,`path`),this.path!==e&&this.history.push(e)}get dirname(){return typeof this.path==`string`?Fq.dirname(this.path):void 0}set dirname(e){Qq(this.basename,`dirname`),this.path=Fq.join(e||``,this.basename)}get basename(){return typeof this.path==`string`?Fq.basename(this.path):void 0}set basename(e){Zq(e,`basename`),Xq(e,`basename`),this.path=Fq.join(this.dirname||``,e)}get extname(){return typeof this.path==`string`?Fq.extname(this.path):void 0}set extname(e){if(Xq(e,`extname`),Qq(this.dirname,`extname`),e){if(e.charCodeAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Fq.join(this.dirname,this.stem+(e||``))}get stem(){return typeof this.path==`string`?Fq.basename(this.path,this.extname):void 0}set stem(e){Zq(e,`stem`),Xq(e,`stem`),this.path=Fq.join(this.dirname||``,e+(this.extname||``))}toString(e){return(this.value||``).toString(e||void 0)}message(e,t,n){let r=new Pq(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=null,r}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}};function Xq(e,t){if(e&&e.includes(Fq.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Fq.sep+"`")}function Zq(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Qq(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function $q(e){return(0,PR.default)(e)}var eJ=nJ().freeze(),tJ={}.hasOwnProperty;function nJ(){let e=mR(),t=[],n={},r,i=-1;return a.data=o,a.Parser=void 0,a.Compiler=void 0,a.freeze=s,a.attachers=t,a.use=c,a.parse=l,a.stringify=u,a.run=d,a.runSync=f,a.process=p,a.processSync=m,a;function a(){let e=nJ(),r=-1;for(;++r<t.length;)e.use(...t[r]);return e.data((0,VR.default)(!0,{},n)),e}function o(e,t){return typeof e==`string`?arguments.length===2?(sJ(`data`,r),n[e]=t,a):tJ.call(n,e)&&n[e]||null:e?(sJ(`data`,r),n=e,a):n}function s(){if(r)return a;for(;++i<t.length;){let[n,...r]=t[i];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let o=n.call(a,...r);typeof o==`function`&&e.use(o)}return r=!0,i=1/0,a}function c(e,...i){let o;if(sJ(`use`,r),e!=null)if(typeof e==`function`)u(e,...i);else if(typeof e==`object`)Array.isArray(e)?l(e):c(e);else throw TypeError("Expected usable value, not `"+e+"`");return o&&(n.settings=Object.assign(n.settings||{},o)),a;function s(e){if(typeof e==`function`)u(e);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;u(t,...n)}else c(e);else throw TypeError("Expected usable value, not `"+e+"`")}function c(e){l(e.plugins),e.settings&&(o=Object.assign(o||{},e.settings))}function l(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];s(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function u(e,n){let r=-1,i;for(;++r<t.length;)if(t[r][0]===e){i=t[r];break}i?(pR(i[1])&&pR(n)&&(n=(0,VR.default)(!0,i[1],n)),i[1]=n):t.push([...arguments])}}function l(e){a.freeze();let t=uJ(e),n=a.Parser;return aJ(`parse`,n),rJ(n,`parse`)?new n(String(t),t).parse():n(String(t),t)}function u(e,t){a.freeze();let n=uJ(t),r=a.Compiler;return oJ(`stringify`,r),cJ(e),rJ(r,`compile`)?new r(e,n).compile():r(e,n)}function d(t,n,r){if(cJ(t),a.freeze(),!r&&typeof n==`function`&&(r=n,n=void 0),!r)return new Promise(i);i(null,r);function i(i,a){e.run(t,uJ(n),o);function o(e,n,o){n||=t,e?a(e):i?i(n):r(null,n,o)}}}function f(e,t){let n,r;return a.run(e,t,i),lJ(`runSync`,`run`,r),n;function i(e,t){uR(e),n=t,r=!0}}function p(e,t){if(a.freeze(),aJ(`process`,a.Parser),oJ(`process`,a.Compiler),!t)return new Promise(n);n(null,t);function n(n,r){let i=uJ(e);a.run(a.parse(i),i,(e,t,n)=>{if(e||!t||!n)o(e);else{let r=a.stringify(t,n);r==null||(fJ(r)?n.value=r:n.result=r),o(e,n)}});function o(e,i){e||!i?r(e):n?n(i):t(null,i)}}}function m(e){let t;a.freeze(),aJ(`processSync`,a.Parser),oJ(`processSync`,a.Compiler);let n=uJ(e);return a.process(n,r),lJ(`processSync`,`process`,t),n;function r(e){t=!0,uR(e)}}}function rJ(e,t){return typeof e==`function`&&e.prototype&&(iJ(e.prototype)||t in e.prototype)}function iJ(e){let t;for(t in e)if(tJ.call(e,t))return!0;return!1}function aJ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `Parser`")}function oJ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `Compiler`")}function sJ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cJ(e){if(!pR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function lJ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function uJ(e){return dJ(e)?e:new Yq(e)}function dJ(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function fJ(e){return typeof e==`string`||(0,PR.default)(e)}var pJ=JSON.parse(`[["\\\\-",""],["\\\\. A","Ȧ"],["\\\\. a","ȧ"],["\\\\. B","Ḃ"],["\\\\. b","ḃ"],["\\\\. C","Ċ"],["\\\\. c","ċ"],["\\\\. D","Ḋ"],["\\\\. d","ḋ"],["\\\\. E","Ė"],["\\\\. e","ė"],["\\\\. F","Ḟ"],["\\\\. f","ḟ"],["\\\\. G","Ġ"],["\\\\. g","ġ"],["\\\\. I","İ"],["\\\\. M","Ṁ"],["\\\\. m","ṁ"],["\\\\. O","Ȯ"],["\\\\. o","ȯ"],["\\\\. P","Ṗ"],["\\\\. p","ṗ"],["\\\\. S","Ṡ"],["\\\\. s","ṡ"],["\\\\. T","Ṫ"],["\\\\. t","ṫ"],["\\\\. Z","Ż"],["\\\\. z","ż"],["\\\\\\" \\\\i","ï"],["\\\\\\" A","Ä"],["\\\\\\" a","ä"],["\\\\\\" E","Ë"],["\\\\\\" e","ë"],["\\\\\\" I","Ï"],["\\\\\\" i","ï"],["\\\\\\" O","Ö"],["\\\\\\" o","ö"],["\\\\\\" U","Ü"],["\\\\\\" u","ü"],["\\\\\\" W","Ẅ"],["\\\\\\" w","ẅ"],["\\\\\\" y","ÿ"],["\\\\\\" Y","Ÿ"],["\\\\' A","Á"],["\\\\' a","á"],["\\\\' C","Ć"],["\\\\' c","ć"],["\\\\' E","É"],["\\\\' e","é"],["\\\\' G","Ǵ"],["\\\\' g","ǵ"],["\\\\' I","Í"],["\\\\' i","í"],["\\\\' \\\\i","í"],["\\\\' \\\\j","j́"],["\\\\' K","Ḱ"],["\\\\' k","ḱ"],["\\\\' L","Ĺ"],["\\\\' \\\\L","Ł́"],["\\\\' l","ĺ"],["\\\\' \\\\l","ł́"],["\\\\' M","Ḿ"],["\\\\' m","ḿ"],["\\\\' N","Ń"],["\\\\' n","ń"],["\\\\' O","Ó"],["\\\\' \\\\O","Ǿ"],["\\\\' o","ó"],["\\\\' \\\\o","ǿ"],["\\\\' P","Ṕ"],["\\\\' p","ṕ"],["\\\\' R","Ŕ"],["\\\\' r","ŕ"],["\\\\' S","Ś"],["\\\\' s","ś"],["\\\\' U","Ú"],["\\\\' u","ú"],["\\\\' W","Ẃ"],["\\\\' w","ẃ"],["\\\\' Y","Ý"],["\\\\' y","ý"],["\\\\' Z","Ź"],["\\\\' z","ź"],["\\\\^ \\\\i","î"],["\\\\^ \\\\j","ĵ"],["\\\\^ A","Â"],["\\\\^ a","â"],["\\\\^ C","Ĉ"],["\\\\^ c","ĉ"],["\\\\^ E","Ê"],["\\\\^ e","ê"],["\\\\^ G","Ĝ"],["\\\\^ g","ĝ"],["\\\\^ H","Ĥ"],["\\\\^ h","ĥ"],["\\\\^ I","Î"],["\\\\^ J","Ĵ"],["\\\\^ O","Ô"],["\\\\^ o","ô"],["\\\\^ S","Ŝ"],["\\\\^ s","ŝ"],["\\\\^ U","Û"],["\\\\^ u","û"],["\\\\^ W","Ŵ"],["\\\\^ w","ŵ"],["\\\\^ Y","Ŷ"],["\\\\^ y","ŷ"],["\\\\~ \\\\i","ĩ"],["\\\\~ A","Ã"],["\\\\~ a","ã"],["\\\\~ I","Ĩ"],["\\\\~ N","Ñ"],["\\\\~ n","ñ"],["\\\\~ O","Õ"],["\\\\~ o","õ"],["\\\\~ U","Ũ"],["\\\\~ u","ũ"],["\\\\AE","Æ"],["\\\\ae","æ"],["\\\\c \\\\ ","¸"],["\\\\c C","Ç"],["\\\\c c","ç"],["\\\\c E","Ȩ"],["\\\\c e","ȩ"],["\\\\c G","Ģ"],["\\\\c g","ģ"],["\\\\c K","Ķ"],["\\\\c k","ķ"],["\\\\c L","Ļ"],["\\\\c l","ļ"],["\\\\c N","Ņ"],["\\\\c n","ņ"],["\\\\c R","Ŗ"],["\\\\c r","ŗ"],["\\\\c S","Ş"],["\\\\c s","ş"],["\\\\c T","Ţ"],["\\\\c t","ţ"],["\\\\CYRA","А"],["\\\\cyra","а"],["\\\\CYRABHCH","Ҽ"],["\\\\cyrabhch","ҽ"],["\\\\CYRABHCHDSC","Ҿ"],["\\\\cyrabhchdsc","ҿ"],["\\\\CYRABHDZE","Ӡ"],["\\\\cyrabhdze","ӡ"],["\\\\CYRABHHA","Ҩ"],["\\\\cyrabhha","ҩ"],["\\\\CYRAE","Ӕ"],["\\\\cyrae","ӕ"],["\\\\CYRB","Б"],["\\\\cyrb","б"],["\\\\CYRBYUS","Ѫ"],["\\\\cyrbyus","ѫ"],["\\\\CYRC","Ц"],["\\\\cyrc","ц"],["\\\\CYRCH","Ч"],["\\\\cyrch","ч"],["\\\\CYRCHLDSC","Ӌ"],["\\\\cyrchldsc","ӌ"],["\\\\CYRCHRDSC","Ҷ"],["\\\\cyrchrdsc","ҷ"],["\\\\CYRCHVCRS","Ҹ"],["\\\\cyrchvcrs","ҹ"],["\\\\CYRD","Д"],["\\\\cyrd","д"],["\\\\CYRDJE","Ђ"],["\\\\cyrdje","ђ"],["\\\\CYRDZE","Ѕ"],["\\\\cyrdze","ѕ"],["\\\\CYRDZHE","Џ"],["\\\\cyrdzhe","џ"],["\\\\CYRE","Е"],["\\\\cyre","е"],["\\\\CYREREV","Э"],["\\\\cyrerev","э"],["\\\\CYRERY","Ы"],["\\\\cyrery","ы"],["\\\\CYRF","Ф"],["\\\\cyrf","ф"],["\\\\CYRFITA","Ѳ"],["\\\\cyrfita","ѳ"],["\\\\CYRG","Г"],["\\\\cyrg","г"],["\\\\CYRGHCRS","Ғ"],["\\\\cyrghcrs","ғ"],["\\\\CYRGHK","Ҕ"],["\\\\cyrghk","ҕ"],["\\\\CYRGUP","Ґ"],["\\\\cyrgup","ґ"],["\\\\CYRH","Х"],["\\\\cyrh","х"],["\\\\CYRHDSC","Ҳ"],["\\\\cyrhdsc","ҳ"],["\\\\CYRHRDSN","Ъ"],["\\\\cyrhrdsn","ъ"],["\\\\CYRI","И"],["\\\\cyri","и"],["\\\\CYRIE","Є"],["\\\\cyrie","є"],["\\\\CYRII","І"],["\\\\cyrii","і"],["\\\\CYRISHRT","Й"],["\\\\cyrishrt","й"],["\\\\CYRIZH","Ѵ"],["\\\\cyrizh","ѵ"],["\\\\CYRJE","Ј"],["\\\\cyrje","ј"],["\\\\CYRK","К"],["\\\\cyrk","к"],["\\\\CYRKBEAK","Ҡ"],["\\\\cyrkbeak","ҡ"],["\\\\CYRKDSC","Қ"],["\\\\cyrkdsc","қ"],["\\\\CYRKHCRS","Ҟ"],["\\\\cyrkhcrs","ҟ"],["\\\\CYRKHK","Ӄ"],["\\\\cyrkhk","ӄ"],["\\\\CYRKVCRS","Ҝ"],["\\\\cyrkvcrs","ҝ"],["\\\\CYRL","Л"],["\\\\cyrl","л"],["\\\\CYRLDSC","Ӆ"],["\\\\cyrldsc","ӆ"],["\\\\CYRLJE","Љ"],["\\\\cyrlje","љ"],["\\\\CYRM","М"],["\\\\cyrm","м"],["\\\\CYRMDSC","Ӎ"],["\\\\cyrmdsc","ӎ"],["\\\\CYRN","Н"],["\\\\cyrn","н"],["\\\\CYRNDSC","Ң"],["\\\\cyrndsc","ң"],["\\\\CYRNG","Ҥ"],["\\\\cyrng","ҥ"],["\\\\CYRNHK","Ӈ"],["\\\\cyrnhk","ӈ"],["\\\\CYRNJE","Њ"],["\\\\cyrnje","њ"],["\\\\CYRO","О"],["\\\\cyro","о"],["\\\\CYROTLD","Ө"],["\\\\cyrotld","ө"],["\\\\CYRP","П"],["\\\\cyrp","п"],["\\\\CYRpalochka","Ӏ"],["\\\\CYRPHK","Ҧ"],["\\\\cyrphk","ҧ"],["\\\\CYRR","Р"],["\\\\cyrr","р"],["\\\\CYRRTICK","Ҏ"],["\\\\cyrrtick","ҏ"],["\\\\CYRS","С"],["\\\\cyrs","с"],["\\\\CYRSCHWA","Ә"],["\\\\cyrschwa","ә"],["\\\\CYRSDSC","Ҫ"],["\\\\cyrsdsc","ҫ"],["\\\\CYRSEMISFTSN","Ҍ"],["\\\\cyrsemisftsn","ҍ"],["\\\\CYRSFTSN","Ь"],["\\\\cyrsftsn","ь"],["\\\\CYRSH","Ш"],["\\\\cyrsh","ш"],["\\\\CYRSHCH","Щ"],["\\\\cyrshch","щ"],["\\\\CYRSHHA","Һ"],["\\\\cyrshha","һ"],["\\\\CYRT","Т"],["\\\\cyrt","т"],["\\\\CYRTDSC","Ҭ"],["\\\\cyrtdsc","ҭ"],["\\\\CYRTETSE","Ҵ"],["\\\\cyrtetse","ҵ"],["\\\\CYRTSHE","Ћ"],["\\\\cyrtshe","ћ"],["\\\\CYRU","У"],["\\\\cyru","у"],["\\\\CYRUSHRT","Ў"],["\\\\cyrushrt","ў"],["\\\\CYRV","В"],["\\\\cyrv","в"],["\\\\CYRY","Ү"],["\\\\cyry","ү"],["\\\\CYRYA","Я"],["\\\\cyrya","я"],["\\\\CYRYAT","Ѣ"],["\\\\cyryat","ѣ"],["\\\\CYRYHCRS","Ұ"],["\\\\cyryhcrs","ұ"],["\\\\CYRYI","Ї"],["\\\\cyryi","ї"],["\\\\CYRYO","Ё"],["\\\\cyryo","ё"],["\\\\CYRYU","Ю"],["\\\\cyryu","ю"],["\\\\CYRZ","З"],["\\\\cyrz","з"],["\\\\CYRZDSC","Ҙ"],["\\\\cyrzdsc","ҙ"],["\\\\CYRZH","Ж"],["\\\\cyrzh","ж"],["\\\\CYRZHDSC","Җ"],["\\\\cyrzhdsc","җ"],["\\\\DH","Ð"],["\\\\dh","ð"],["\\\\DJ","Đ"],["\\\\dj","đ"],["\\\\guillemotleft","«"],["\\\\guillemotright","»"],["\\\\guilsinglleft","‹"],["\\\\guilsinglright","›"],["\\\\H O","Ő"],["\\\\H o","ő"],["\\\\H U","Ű"],["\\\\H u","ű"],["\\\\hebalef","א"],["\\\\hebayin","ע"],["\\\\hebbet","ב"],["\\\\hebdalet","ד"],["\\\\hebfinalkaf","ך"],["\\\\hebfinalmem","ם"],["\\\\hebfinalnun","ן"],["\\\\hebfinalpe","ף"],["\\\\hebfinaltsadi","ץ"],["\\\\hebgimel","ג"],["\\\\hebhe","ה"],["\\\\hebhet","ח"],["\\\\hebkaf","כ"],["\\\\heblamed","ל"],["\\\\hebmem","מ"],["\\\\hebnun","נ"],["\\\\hebpe","פ"],["\\\\hebqof","ק"],["\\\\hebresh","ר"],["\\\\hebsamekh","ס"],["\\\\hebshin","ש"],["\\\\hebtav","ת"],["\\\\hebtet","ט"],["\\\\hebtsadi","צ"],["\\\\hebvav","ו"],["\\\\hebyod","י"],["\\\\hebzayin","ז"],["\\\\i","ı"],["\\\\IJ","IJ"],["\\\\ij","ij"],["\\\\j","ȷ"],["\\\\k ","˛"],["\\\\k A","Ą"],["\\\\k a","ą"],["\\\\k E","Ę"],["\\\\k e","ę"],["\\\\k I","Į"],["\\\\k i","į"],["\\\\k U","Ų"],["\\\\k u","ų"],["\\\\L","Ł"],["\\\\l","ł"],["\\\\NG","Ŋ"],["\\\\ng","ŋ"],["\\\\nobreakspace","\xA0"],["\\\\O","Ø"],["\\\\o","ø"],["\\\\OE","Œ"],["\\\\oe","œ"],["\\\\quotedblbase","„"],["\\\\quotesinglbase","‚"],["\\\\r ","˚"],["\\\\r A","Å"],["\\\\r a","å"],["\\\\r U","Ů"],["\\\\r u","ů"],["\\\\ss","ß"],["\\\\textacutedbl","˝"],["\\\\textalpha","α"],["\\\\textapproxequal","≈"],["\\\\textasciiacute","´"],["\\\\textasciibreve","˘"],["\\\\textasciicaron","ˇ"],["\\\\textasciicircum","ˆ"],["\\\\textasciidieresis","¨"],["\\\\textasciigrave","ˋ"],["\\\\textasciimacron","¯"],["\\\\textasciitilde","˜"],["\\\\textasteriskcentered","⁎"],["\\\\textbaht","฿"],["\\\\textbardbl","‖"],["\\\\textbeta","β"],["\\\\textbigcircle","◯"],["\\\\textblacksquare","■"],["\\\\textblank","␢"],["\\\\textblock","█"],["\\\\textbrokenbar","¦"],["\\\\textbullet","•"],["\\\\textbullet","∙"],["\\\\textcap","∧"],["\\\\textcelsius","℃"],["\\\\textcent","¢"],["\\\\textcircledP","℗"],["\\\\textcolonmonetary","₡"],["\\\\textcommabelow S","Ș"],["\\\\textcommabelow s","ș"],["\\\\textcommabelow T","Ț"],["\\\\textcommabelow t","ț"],["\\\\textcompwordmark",""],["\\\\textcontourintegral","∮"],["\\\\textcopyright","©"],["\\\\textcurrency","¤"],["\\\\textdagger","†"],["\\\\textdaggerdbl","‡"],["\\\\textdbllowline","‗"],["\\\\textdegree","°"],["\\\\textdelta","δ"],["\\\\textdiscount","⁒"],["\\\\textdiv","÷"],["\\\\textdkshade","▓"],["\\\\textdnblock","▄"],["\\\\textdong","₫"],["\\\\textdownarrow","↓"],["\\\\textelement","∈"],["\\\\textellipsis","…"],["\\\\textemdash","—"],["\\\\textendash","–"],["\\\\textepsilon","ε"],["\\\\textequivalence","≡"],["\\\\textestimated","℮"],["\\\\texteuro","€"],["\\\\textexclamdown","¡"],["\\\\textflorin","ƒ"],["\\\\textfractionsolidus","⁄"],["\\\\textGamma","Γ"],["\\\\textgreaterequal","≥"],["\\\\texthorizontalbar","―"],["\\\\textincrement","∆"],["\\\\textinfinity","∞"],["\\\\textintegral","∫"],["\\\\textinterrobang","‽"],["\\\\textintersection","∩"],["\\\\textkra","ĸ"],["\\\\textlangle","〈"],["\\\\textleftarrow","←"],["\\\\textlessequal","≤"],["\\\\textlfblock","▌"],["\\\\textlira","₤"],["\\\\textlnot","¬"],["\\\\textlozenge","◊"],["\\\\textltshade","░"],["\\\\textmalteseH","Ħ"],["\\\\textmalteseh","ħ"],["\\\\textmho","℧"],["\\\\textmu","µ"],["\\\\textmusicalnote","♪"],["\\\\textnaira","₦"],["\\\\textnotequal","≠"],["\\\\textnsuperior","ⁿ"],["\\\\textnumero","№"],["\\\\textohm","Ω"],["\\\\textOmega","Ω"],["\\\\textonehalf","½"],["\\\\textonequarter","¼"],["\\\\textonesuperior","¹"],["\\\\textopenbullet","◦"],["\\\\textordfeminine","ª"],["\\\\textordmasculine","º"],["\\\\textparagraph","¶"],["\\\\textpartial","∂"],["\\\\textperiodcentered","·"],["\\\\textpertenthousand","‱"],["\\\\textperthousand","‰"],["\\\\textpeseta","₧"],["\\\\textpeso","₱"],["\\\\textPhi","Φ"],["\\\\textphi","φ"],["\\\\textpi","π"],["\\\\textpm","±"],["\\\\textproduct","∏"],["\\\\textquestiondown","¿"],["\\\\textquotedblleft","“"],["\\\\textquotedblright","”"],["\\\\textquoteleft","‘"],["\\\\textquoteright","’"],["\\\\textrangle","〉"],["\\\\textrecipe","℞"],["\\\\textreferencemark","※"],["\\\\textregistered","®"],["\\\\textrevlogicalnot","⌐"],["\\\\textrightarrow","→"],["\\\\textrtblock","▐"],["\\\\textsection","§"],["\\\\textservicemark","℠"],["\\\\textSFi","┌"],["\\\\textSFii","└"],["\\\\textSFiii","┐"],["\\\\textSFiv","┘"],["\\\\textSFix","┤"],["\\\\textSFl","╘"],["\\\\textSFli","╒"],["\\\\textSFlii","╓"],["\\\\textSFliii","╫"],["\\\\textSFliv","╪"],["\\\\textSFv","┼"],["\\\\textSFvi","┬"],["\\\\textSFvii","┴"],["\\\\textSFviii","├"],["\\\\textSFx","─"],["\\\\textSFxi","│"],["\\\\textSFxix","╡"],["\\\\textSFxl","╩"],["\\\\textSFxli","╦"],["\\\\textSFxlii","╠"],["\\\\textSFxliii","═"],["\\\\textSFxliv","╬"],["\\\\textSFxlix","╙"],["\\\\textSFxlv","╧"],["\\\\textSFxlvi","╨"],["\\\\textSFxlvii","╤"],["\\\\textSFxlviii","╥"],["\\\\textSFxx","╢"],["\\\\textSFxxi","╖"],["\\\\textSFxxii","╕"],["\\\\textSFxxiii","╣"],["\\\\textSFxxiv","║"],["\\\\textSFxxv","╗"],["\\\\textSFxxvi","╝"],["\\\\textSFxxvii","╜"],["\\\\textSFxxviii","╛"],["\\\\textSFxxxix","╔"],["\\\\textSFxxxvi","╞"],["\\\\textSFxxxvii","╟"],["\\\\textSFxxxviii","╚"],["\\\\textshade","▒"],["\\\\textSigma","Σ"],["\\\\textsigma","σ"],["\\\\textsterling","£"],["\\\\textsummation","∑"],["\\\\textsurd","√"],["\\\\texttau","τ"],["\\\\textTheta","Θ"],["\\\\textthreequarters","¾"],["\\\\textthreesuperior","³"],["\\\\texttimes","×"],["\\\\texttrademark","™"],["\\\\textTstroke","Ŧ"],["\\\\texttstroke","ŧ"],["\\\\texttwosuperior","²"],["\\\\textuparrow","↑"],["\\\\textupblock","▀"],["\\\\textvisiblespace","␣"],["\\\\textwon","₩"],["\\\\textyen","¥"],["\\\\TH","Þ"],["\\\\th","þ"],["\\\\u A","Ă"],["\\\\u a","ă"],["\\\\u G","Ğ"],["\\\\u g","ğ"],["\\\\u U","Ŭ"],["\\\\u u","ŭ"],["\\\\v \\\\i","ǐ"],["\\\\v \\\\j","ǰ"],["\\\\v A","Ǎ"],["\\\\v a","ǎ"],["\\\\v C","Č"],["\\\\v c","č"],["\\\\v D","Ď"],["\\\\v d","ď"],["\\\\v E","Ě"],["\\\\v e","ě"],["\\\\v G","Ǧ"],["\\\\v g","ǧ"],["\\\\v I","Ǐ"],["\\\\v K","Ǩ"],["\\\\v k","ǩ"],["\\\\v L","Ľ"],["\\\\v l","ľ"],["\\\\v N","Ň"],["\\\\v n","ň"],["\\\\v O","Ǒ"],["\\\\v o","ǒ"],["\\\\v R","Ř"],["\\\\v r","ř"],["\\\\v S","Š"],["\\\\v s","š"],["\\\\v T","Ť"],["\\\\v t","ť"],["\\\\v U","Ǔ"],["\\\\v u","ǔ"],["\\\\v Z","Ž"],["\\\\v z","ž"],["\\\\´ i","í"],["\\\\´ A","Á"],["\\\\´ a","á"],["\\\\´ C","Ć"],["\\\\´ c","ć"],["\\\\´ E","É"],["\\\\´ e","é"],["\\\\´ G","Ǵ"],["\\\\´ g","ǵ"],["\\\\´ I","Í"],["\\\\´ K","Ḱ"],["\\\\´ k","ḱ"],["\\\\´ L","Ĺ"],["\\\\´ l","ĺ"],["\\\\´ M","Ḿ"],["\\\\´ m","ḿ"],["\\\\´ N","Ń"],["\\\\´ n","ń"],["\\\\´ O","Ó"],["\\\\´ o","ó"],["\\\\´ P","Ṕ"],["\\\\´ p","ṕ"],["\\\\´ R","Ŕ"],["\\\\´ r","ŕ"],["\\\\´ S","Ś"],["\\\\´ s","ś"],["\\\\´ U","Ú"],["\\\\´ u","ú"],["\\\\´ W","Ẃ"],["\\\\´ w","ẃ"],["\\\\´ Y","Ý"],["\\\\´ y","ý"],["\\\\´ Z","Ź"],["\\\\´ z","ź"],["\\\\\` i","ì"],["\\\\\` A","Á"],["\\\\\` a","à"],["\\\\\` E","È"],["\\\\\` e","è"],["\\\\\` I","Ì"],["\\\\\` N","Ǹ"],["\\\\\` n","ǹ"],["\\\\\` O","Ò"],["\\\\\` o","ò"],["\\\\\` U","Ù"],["\\\\\` u","ù"],["\\\\\` W","Ẁ"],["\\\\\` w","ẁ"],["\\\\\` Y","Ỳ"],["\\\\\` y","ỳ"]]`);function mJ(e){return{type:`string`,content:e}}var hJ=pJ.map(([e,t])=>[e,mJ(t)]),gJ=new Map([[`\\,`,mJ(` `)],[`\\thinspace`,mJ(` `)],[`\\:`,mJ(` `)],[`\\>`,mJ(` `)],[`\\medspace`,mJ(` `)],[`\\;`,mJ(` `)],[`\\thickspace`,mJ(` `)],[`\\enspace`,mJ(` `)],[`\\quad`,mJ(` `)],[`\\qquad`,mJ(` `)],[`\\@`,mJ(``)],[`\\/`,mJ(``)],[`~`,mJ(`\xA0`)],[`- - -`,mJ(`—`)],[`- -`,mJ(`–`)],["` `",mJ(`“`)],[`"`,mJ(`”`)],[`' '`,mJ(`”`)],["`",mJ(`‘`)],[`'`,mJ(`’`)],[`< <`,mJ(`«`)],[`> >`,mJ(`»`)],[`\\$`,mJ(`$`)],[`\\%`,mJ(`%`)],[`\\_`,mJ(`_`)],[`\\&`,mJ(`&`)],[`\\#`,mJ(`#`)],[`\\{`,mJ(`{`)],[`\\}`,mJ(`}`)],[`\\P`,mJ(`¶`)],[`\\S`,mJ(`§`)],[`\\dots`,mJ(`…`)],[`\\ldots`,mJ(`…`)],[`\\pounds`,mJ(`£`)],[`\\copyright`,mJ(`©`)],...hJ]);function _J(e){return e.map(e=>Q.macro(e)?`\\${e.content}`:e.content).join(` `)}function vJ(e){return e.some(e=>Q.macro(e)||Q.string(e))}function yJ(e){return vJ(e)?e.length===1&&Q.macro(e[0],` `)&&e[0].escapeToken==null?mJ(` `):gJ.get(_J(e))||null:null}function bJ(){return{isMacro:Q.anyMacro,isWhitespace:Q.whitespace,isRecognized:(e,t=!1)=>{let n=[...e];if(e.length===2&&Q.macro(e[0])){let t=e[1];Q.group(t)&&t.content.length===1&&(n[1]=t.content[0]),e[0].content.length===1&&n[1].type===`whitespace`&&(n.length=1)}return yJ(n)},isSplitable:e=>Q.anyString(e)&&e.content.length>1,split:e=>[{type:`string`,content:e.content.charAt(0)},{type:`string`,content:e.content.slice(1)}]}}function xJ(e){if(!Array.isArray(e))throw Error(`You must pass an array of nodes`);return e=aV([...e]),xV.parse(e,bJ())}function SJ(e){SB(e,(e,t)=>{if(t.context.inMathMode||t.context.hasMathModeAncestor)return;let n=xJ(e);e.length=0,e.push(...n)},{includeArrays:!0,test:Array.isArray})}function CJ(e){return`html-tag:${e}`}function wJ(e){return`html-attr:${e}`}function TJ(e){let t=e.match(/:.*/);if(t)return t[0].slice(1);throw Error(`Could not find tag name in ${e}`)}function EJ(e){let t=e.match(/:.*/);if(t)return t[0].slice(1);throw Error(`Could not find attribute name in ${e}`)}function DJ({tag:e,content:t,attributes:n}){t||=[],t&&!Array.isArray(t)&&(t=[t]),n||={};let r=Object.entries(n).map(([e,t])=>(t=JSON.stringify(t),Yz(wJ(e),Jz(t))));return Yz(CJ(e),Jz(r.concat(t)))}function OJ(e){if(!kJ(e))throw Error(`Attempting to extract html contents from a node that is not html-like.`);let t=e.args||[];if(t.length>1)throw Error(`html-like macros should have 0 or 1 args, but ${t.length} found`);let n=t.length>0?t[0].content:[],r=TJ(e.content),i={},a=0;for(;a<n.length;a++){let e=n[a];if(AJ(e)){let t=EJ(e.content),n=!0;e.args&&e.args.length>0&&(n=JSON.parse(tB(e.args[0].content))),i[t]=n;continue}break}return{tag:r,attributes:i,content:n.slice(a)}}function kJ(e){return Q.macro(e)&&e.content.startsWith(`html-tag:`)}function AJ(e){return Q.macro(e)&&e.content.startsWith(`html-attr:`)}function jJ(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?NJ(e.position):`start`in e||`end`in e?NJ(e):`line`in e||`column`in e?MJ(e):``}function MJ(e){return PJ(e&&e.line)+`:`+PJ(e&&e.column)}function NJ(e){return MJ(e&&e.start)+`-`+MJ(e&&e.end)}function PJ(e){return e&&typeof e==`number`?e:1}var FJ=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=jJ(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};FJ.prototype.file=``,FJ.prototype.name=``,FJ.prototype.reason=``,FJ.prototype.message=``,FJ.prototype.stack=``,FJ.prototype.column=void 0,FJ.prototype.line=void 0,FJ.prototype.ancestors=void 0,FJ.prototype.cause=void 0,FJ.prototype.fatal=void 0,FJ.prototype.place=void 0,FJ.prototype.ruleId=void 0,FJ.prototype.source=void 0;function IJ(e,t){let n=typeof e==`string`?e:e.origin,r=typeof e==`string`?void 0:e.url,i=n.split(`:`),a=i[1]?i[0]:void 0,o=i[1];return Object.defineProperty(s,"name",{value:n}),s;function s(e){let[n,i]=LJ(o,e);if(!n)return;let s=n===2;return(e,n,c)=>{let l=n.messages.length-1;hR(t,e=>{let t=n.messages;if(e&&!t.includes(e))try{n.fail(e)}catch{}for(;++l<t.length;)Object.assign(t[l],{ruleId:o,source:a,fatal:s,url:r});c()})(e,n,i)}}}function LJ(e,t){if(!Array.isArray(t))return[1,t];let[n,...r]=t;switch(n){case!1:case`off`:case 0:return[0,...r];case!0:case`on`:case`warn`:case 1:return[1,...r];case`error`:case 2:return[2,...r];default:if(typeof n!=`number`)return[1,t];throw Error("Incorrect severity `"+n+"` for `"+e+"`, expected 0, 1, or 2")}}var RJ={bf:`bfseries`,it:`itshape`,rm:`rmfamily`,sc:`scshape`,sf:`sffamily`,sl:`slshape`,tt:`ttfamily`},zJ=Q.createMacroMatcher(RJ);`${Object.keys(RJ).map(e=>tB(Yz(e))).join("` `")}`;var BJ=IJ({origin:`unified-latex-lint:no-tex-font-shaping-commands`},(e,t,n)=>{SB(e,(e,r)=>{let i=e.content;t.message(`Replace "${tB(e)}" with "${tB(Yz(RJ[i]))}"`,e),n?.fix&&qB(Yz(RJ[i]),r)},{test:zJ})});function VJ(){return{matchChar:(e,t)=>Q.string(e,t),isWhitespace:Q.whitespace,isGroup:Q.group}}function HJ(e){if(!Array.isArray(e))throw Error(`You must pass an array of nodes`);return e=oV(e),e=aV([...e]),SV.parse(e,VJ())}(function(){typeof globalThis!=`object`&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var UJ=typeof globalThis.structuredClone==`function`?globalThis.structuredClone:e=>JSON.parse(JSON.stringify(e));function WJ(e){return UJ(e)}function GJ(){return{isHash:e=>Q.string(e,`#`),isNumber:e=>Q.string(e)&&0<+e.content.charAt(0),splitNumber:e=>{let t=+e.content.charAt(0);return e.content.length>1?{number:t,rest:{type:`string`,content:e.content.slice(1)}}:{number:t}}}}function KJ(e){if(!Array.isArray(e))throw Error(`You must pass an array of nodes`);return e=aV([...e]),bV.parse(e,GJ())}var qJ=new Set([`newcommand`,`renewcommand`,`providecommand`]),JJ=new Set([`NewDocumentCommand`,`RenewDocumentCommand`,`ProvideDocumentCommand`,`DeclareDocumentCommand`,`NewExpandableDocumentCommand`,`RenewExpandableDocumentCommand`,`ProvideExpandableDocumentCommand`,`DeclareExpandableDocumentCommand`]),YJ=[`starred`,`name`,`numArgs`,`default`,`body`],XJ=[`starred`,null,`name`,`numArgs`,`default`,`body`];function ZJ(e){if(!Array.isArray(e.args))throw Error(`Found a '\\newcommand' macro without any arguments "${JSON.stringify(e)}"`);return GV(e,e.args.length===XJ.length?XJ:YJ)}function QJ(e){if(qJ.has(e.content)){if(!e.args)return console.warn(String.raw`Found a '\newcommand' macro that doesn't have any args`,e),``;let t=ZJ(e);if(t.numArgs==null)return``;let n=+tB(t.numArgs),r=[];return t.default!=null&&(n--,r=[`O{${tB(t.default)}}`]),[...r,...Array.from({length:n}).map(e=>`m`)].join(` `)}return JJ.has(e.content)?e.args?.length?tB(e.args[1]?.content).trim():(console.warn(String.raw`Found a '\NewDocumentCommand' macro that doesn't have any args`,e),``):``}function $J(e){return e=e.trim(),e.startsWith(`\\`)?e.slice(1):e}function eY(e){if(qJ.has(e.content)){if(!e.args?.length)return``;let t=ZJ(e).name;return t?$J(tB(t)):(console.warn(`Could not find macro name defined in`,e),``)}return JJ.has(e.content)&&e.args?.length?e.args[0]?.content[0]?$J(tB(e.args[0].content)):(console.warn(`Could not find macro name defined in`,e),``):``}function tY(e){return qJ.has(e.content)?e.args?.length?ZJ(e).body||(console.warn(`Could not find macro name defined in`,e),[]):[]:JJ.has(e.content)&&e.args?.length&&e.args[2]?.content||[]}function nY(){return Array.from({length:10}).map((e,t)=>({hashNumbers:[],content:[{type:`string`,content:`#${t+1}`}]}))}function rY(e){let t=WJ(e),n=aY(t);return e=>{if(n.length===0)return WJ(t);let r=nY().map((t,r)=>{let i=r+1;if(!n.includes(i))return t;let a=e.args?.[r],o=a?._renderInfo?.defaultArg;if(!a||iY(a)&&o!=null){let e=cY(o);return{content:e,hashNumbers:aY(e)}}return{content:a.content,hashNumbers:[]}}),i=0;for(;lY(r)&&i<r.length;)i++;for(let e of r)e.hashNumbers.length>0&&(e.content=[{type:`string`,content:`-Circular-`}]);let a=WJ(t);return FB(a,e=>{let t=e;if(t.type===`hash_number`)return r[t.number-1].content}),a}}function iY(e){return e.openMark===``&&e.closeMark===``&&e.content.length===0}function aY(e){let t=new Set;return SB(e,e=>{let n=KJ(e);for(let e of n)e.type===`hash_number`&&t.add(e.number);e.length=0,e.push(...n)},{includeArrays:!0,test:Array.isArray}),Array.from(t)}function oY(e){let t=new Set;return SB(e,e=>{let n=e;n.type===`hash_number`&&t.add(n.number)}),Array.from(t)}var sY=new Map;function cY(e){let t=sY.get(e);if(t)return WJ(t);let n=EU(e).content;return sY.set(e,WJ(n)),n}function lY(e){let t=!1;for(let n of e)n.hashNumbers.length!==0&&(FB(n.content,n=>{let r=n;if(r.type===`hash_number`)return t=!0,e[r.number-1].content}),n.hashNumbers=oY(n.content));return t}var uY=Q.createMacroMatcher([...qJ,...JJ]);function dY(e){let t=[];return SB(e,e=>{let n=eY(e),r=QJ(e),i=tY(e);t.push({name:n,signature:r,body:i,definition:e})},{test:uY}),t}function fY(e,t){let n=new Map(t.map(e=>[e.name,rY(e.body)]));FB(e,(e,t)=>{if(!Q.anyMacro(e))return;let r=e.content,i=n.get(r);if(i&&!t.parents.some(e=>uY(e)))return i(e)})}var pY=/["&'<>`]/g,mY=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,hY=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,gY=/[|\\{}()[\]^$+*?.]/g,_Y=new WeakMap;function vY(e,t){if(e=e.replace(t.subset?yY(t.subset):pY,r),t.subset||t.escapeOnly)return e;return e.replace(mY,n).replace(hY,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function yY(e){let t=_Y.get(e);return t||(t=bY(e),_Y.set(e,t)),t}function bY(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(gY,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var xY=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`);function SY(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function CY(e,t){return vY(e,Object.assign({format:SY},t))}var wY=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function TY(e,t,n){let r=EY(e);return n?r.replace(n,i):i(r);function i(e){return CY(e,{subset:t})}}function EY(e){return String(e||``).replace(wY,``)}var DY=/]]>/g,OY=[`>`];function kY(e){return`<![CDATA[`+TY(e.value,OY,DY)+`]]>`}function AY(e){return`<!--`+TY(e.value,[`-`])+`-->`}var jY=[` `,`
|
|
1053
|
-
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function MY(e){return TY(e,jY)}function NY(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function PY(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;NY(n,r)>NY(n,e)&&(r=e)}return r+TY(n,[`<`,`&`,r])+r}function FY(e,t){let n=MY(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+PY(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+PY(i,t)),a+`>`}var IY={}.hasOwnProperty;function LY(e,t){let n=MY(e.name),r=qY(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(IY.call(i,s)){let e=i[s];e!=null&&o.push(MY(s)+`=`+PY(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var RY=/\?>/g,zY=[`>`];function BY(e){let t=MY(e.name)||`x`,n=TY(e.value,zY,RY);return`<?`+t+(n?` `+n:``)+`?>`}var VY=[`&`,`<`];function HY(e){return TY(e.value,VY)}function UY(e,t){return t.options.allowDangerousXml?e.value:HY(e)}var WY={}.hasOwnProperty,GY={cdata:kY,comment:AY,doctype:FY,element:LY,instruction:BY,raw:UY,root:qY,text:HY};function KY(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!WY.call(GY,n))throw Error("Cannot compile unknown node `"+n+"`");let r=GY[n];return r(e,t)}function qY(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=KY(n[r],t);return i.join(``)}function JY(e,t){let n={options:t||{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return KY(Array.isArray(e)?{type:`root`,children:e}:e,n)}function YY(e,t,n){let r=new FJ(t,e);return r.source=`unified-latex-to-pretext:${n}`,r}function XY(e){return(t,n,r)=>{if(r){let n=YY(t,e,`macro-subs`);r.message(n,n.place,`unified-latex-to-pretext:macro-subs`)}return Xz(``)}}function ZY(e){return e.replace(/["'<>&:\s]/g,e=>{switch(e){case`&`:case`:`:return`-`;case` `:case` `:return`_`;default:return``}})}var QY=[[{division:`part`,mappedEnviron:`_part`}],[{division:`chapter`,mappedEnviron:`_chapter`},{division:`preface`,mappedEnviron:`_preface`},{division:`biography`,mappedEnviron:`_biography`},{division:`dedication`,mappedEnviron:`_dedication`},{division:`glossary`,mappedEnviron:`_glossary`},{division:`appendix`,mappedEnviron:`_appendix`},{division:`bibliography`,mappedEnviron:`_bibliography`},{division:`references`,mappedEnviron:`_references`}],[{division:`section`,mappedEnviron:`_section`},{division:`exercises`,mappedEnviron:`_exercises`},{division:`solutions`,mappedEnviron:`_solutions`},{division:`worksheet`,mappedEnviron:`_worksheet`},{division:`handout`,mappedEnviron:`_handout`},{division:`readingquestions`,mappedEnviron:`_readingquestions`,pretextTag:`reading-questions`}],[{division:`subsection`,mappedEnviron:`_subsection`}],[{division:`subsubsection`,mappedEnviron:`_subsubsection`}],[{division:`paragraphs`,mappedEnviron:`_paragraphs`}],[{division:`subparagraph`,mappedEnviron:`_subparagraph`}]],$Y=Q.createEnvironmentMatcher([`parts`,`subparts`,`subsubparts`]),eX=QY.reduce((e,t)=>e.concat(t),[]),tX=new Set([`chapter`,`section`,`subsection`,`subsubsection`]),nX=new Map;for(let e of eX)nX.set(e.division.toLowerCase(),e),e.pretextTag&&nX.set(e.pretextTag.toLowerCase(),e);var rX=Q.createMacroMatcher(eX.map(e=>e.division)),iX=Q.createEnvironmentMatcher(eX.map(e=>e.mappedEnviron));function aX(e){let t={messages:[]};return FB(e,e=>{if(Q.group(e)&&e.content.some(e=>aB(e)&&rX(e)))return t.messages.push(YY(e,`Warning: hoisted out of a group, which might break the LaTeX code.`,`break-on-boundaries`)),e.content}),SB(e,(e,t)=>{!(iB(e)||e.type===`root`||Q.group(e))||t.context.hasMathModeAncestor||iB(e)&&iX(e)||iB(e)&&$Y(e)||(e.content=oX(e.content,0))}),FB(e,(e,t)=>{if(aB(e)&&rX(e))return t.parents.some(e=>iB(e)&&$Y(e))?void 0:null}),t}function oX(e,t){if(t>=QY.length)return e;let n=QY[t],r=MB(e,n.map(e=>e.division));for(let e=0;e<r.segments.length;e++)r.segments[e]=oX(r.segments[e],t+1);return sX(r,n),NB(r)}function sX(e,t){let n=new Map(t.map(e=>[e.division,e.mappedEnviron]));for(let t=1;t<e.segments.length;t++){let r=e.macros[t-1],i=n.get(r.content)??`_unknown`,a=GV(r);if(tX.has(r.content)&&a.tocTitle){let e=tB(a.tocTitle).trim().toLowerCase(),t=nX.get(e);t&&(i=t.mappedEnviron)}let o=a.title,s=[];o&&s.push(Jz(o,{braces:`[]`})),e.segments[t]=[Zz(i,e.segments[t],s)]}}function cX(e){try{return tB(e)}catch{}return JSON.stringify(e)}function lX(e){return e=e.replace(/--/g,`- -`),e.endsWith(`-`)&&(e+=` `),{type:`comment`,value:e}}function uX(e,t){let n=e.position?.start?.offset,r=e.position?.end?.offset;return t&&n!=null&&r!=null?t.slice(n,r):cX(e)}function dX(e,t,n){return Dq(`TODO`,{type:e},[lX(`todo: ${t}`),Dq(`pre`,n)])}function fX(e,t,n){return Dq(`TODO`,{type:e},[lX(`todo: ${t}`),Dq(`c`,n)])}function pX(e,t){return function n(r){let i=r;if(kJ(i)){let e=OJ(i),t=e.attributes;return Dq(e.tag,t,e.content.flatMap(n))}switch(r.type){case`string`:return{type:`text`,value:r.content,position:r.position};case`comment`:{let e=lX(r.content);return e.position=r.position,r.leadingWhitespace||!r.sameline?[{type:`text`,value:` `},e]:e}case`inlinemath`:return Dq(`m`,tB(r.content));case`mathenv`:case`displaymath`:return Dq(`md`,tB(r.content));case`verb`:return Dq(`c`,r.content);case`verbatim`:return Dq(`pre`,r.content);case`whitespace`:return{type:`text`,value:` `,position:r.position};case`parbreak`:return e(`There is no equivalent for parbreak, so it was replaced with an empty string.`,r),{type:`text`,value:``,position:r.position};case`group`:return r.content.flatMap(n);case`environment`:if(iX(r)){let t=eX.find(e=>e.mappedEnviron===r.env);t?.division===`subparagraph`&&e(`Warning: There is no equivalent tag for "subparagraph", "paragraphs" was used as a replacement.`,r);let i=t?.pretextTag??t?.division;i===`subparagraph`&&(i=`paragraphs`);let a={};r._renderInfo?.additionalAttributes&&Object.assign(a,r._renderInfo.additionalAttributes);let o=WV(r)[0];o||e(`Warning: No title was given, so an empty title tag was used.`,r);let s=Dq(`title`,o?.flatMap(n));if(i)return Dq(i,a,[s,...r.content.flatMap(n)])}return e(`Unknown environment when converting to XML \`${cX(r.env)}\``,r),dX(`unknown-environment`,`unknown environment "${tB(r.env)}"`,uX(r,t));case`macro`:return e(`Unknown macro when converting to XML \`${cX(r)}\``,r),fX(`unknown-macro`,`unknown macro "\\${r.content}"`,uX(r,t));case`argument`:return e(`Unknown argument when converting to XML \`${cX(r)}\``,r),{type:`text`,value:tB(r.content),position:r.position};case`root`:return r.content.flatMap(n);default:throw Error(`Unknown node type; cannot convert to XAST ${JSON.stringify(r)}`)}}}function mX(e,t){let n=[],r=[];TB(e);let i=Q.createMacroMatcher(t.macrosThatBreakPars),a=Q.createEnvironmentMatcher(t.environmentsThatDontBreakPars);function o(){if(r.length>0){TB(r);let e=r.some(e=>e.type!==`comment`&&e.type!==`whitespace`);n.push({content:r,wrapInPar:e}),r=[]}}for(let t of e){if(i(t)){o(),n.push({content:[t],wrapInPar:!1});continue}if(Q.anyEnvironment(t)&&!a(t)){o(),n.push({content:[t],wrapInPar:!1});continue}if(Q.parbreak(t)||Q.macro(t,`par`)){o();continue}r.push(t)}return o(),n}function hX(e,t){let{macrosThatBreakPars:n=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`paragraph`,`subparagraph`,`vspace`,`smallskip`,`medskip`,`bigskip`,`hfill`,`includegraphics`,`plus`,`include`,`title`],environmentsThatDontBreakPars:r=[`index`,`itemize`,`enumerate`]}=t||{};return mX(e,{macrosThatBreakPars:n,environmentsThatDontBreakPars:r}).flatMap(e=>e.wrapInPar?DJ({tag:`p`,content:e.content}):e.content)}function gX(e){let t=eK(e.content),n=WV(e),r=[];try{r=HJ(n[1]||[])}catch{}let i={},a=!1,o={},s=t.map(e=>DJ({tag:`row`,content:e.cells.map((e,t)=>{let n=r[t];if(n){let{alignment:e}=n;n.pre_dividers.some(e=>e.type===`vert_divider`)&&(i.left=`minor`),n.post_dividers.some(e=>e.type===`vert_divider`)&&(o[t]=!0),e.alignment!==`left`&&(a=!0)}return TB(e),DJ({tag:`cell`,content:e})})}));if(a||Object.values(o).some(e=>e))for(let e=r.length;e>=0;e--){let t=r[e];if(!t)continue;let n={},{alignment:i}=t;i.alignment!==`left`&&(n.halign=i.alignment),o[e]===!0&&(n.right=`minor`),s.unshift(DJ({tag:`col`,attributes:n}))}return DJ({tag:`tabular`,content:s,attributes:i})}var _X=[`label`],vX=[null,`label`,null];function yX(e){if(!Array.isArray(e.args))throw Error(`Cannot find \\item macros arguments; you must attach the \\item body to the macro before calling this function ${JSON.stringify(e)}`);let t=e.args.length-1===vX.length?vX:_X;return Object.assign({body:e.args[e.args.length-1].content},GV(e,t))}function bX(e=`ol`){return function(t){let n=t.content.filter(e=>Q.macro(e,`item`)),r=!1,i=n.flatMap(e=>{if(!Q.macro(e)||!e.args)return[];let t=yX(e);t.body=hX(t.body),t.label!=null&&(r=!0,t.body.unshift(DJ({tag:`title`,content:t.label})));let n=t.body;return DJ({tag:`li`,content:n})});return DJ({tag:r?`dl`:e,content:i})}}var xX=new Set([`proof`,`hint`,`answer`,`solution`]);function SX(e,t={}){let{requiresStatementTag:n=!1,wrapContentInPars:r=!0,extractTitleFromArgs:i=!0,warningMessage:a=``}=t;return(t,o,s)=>{if(a&&s){let e=YY(t,a,`env-subs`);s.message(e,e.place,e.source)}let c;if(n){let e=[],n=[];for(let r of t.content)kJ(r)&&xX.has(r.content.slice(9))?n.push(r):e.push(r);c=[DJ({tag:`statement`,content:r?hX(e):e}),...n]}else c=r?hX(t.content):t.content;if(i){let e=WV(t);e[0]&&c.unshift(DJ({tag:`title`,content:e[0]||[]}))}let l={};return t._renderInfo?.additionalAttributes&&Object.assign(l,t._renderInfo.additionalAttributes),DJ({tag:e,content:c,attributes:l})}}var CX={enumerate:bX(`ol`),itemize:bX(`ul`),tabular:gX,center:SX(`blockquote`),quote:SX(`blockquote`),figure:SX(`figure`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),table:SX(`table`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),code:e=>DJ({tag:`pre`,content:[{type:`string`,content:tB(e.content)}]}),poem:e=>{let t=WV(e)[0],n=tB(e.content).trim(),r=n.split(/\n[ \t]*\n/).map(e=>e.trim()).filter(e=>e.length>0).map(e=>DJ({tag:`stanza`,content:e.split(/\\\\[ \t]*\n?/).map(e=>e.trim()).filter(e=>e.length>0).map(e=>DJ({tag:`line`,content:[{type:`string`,content:e}]}))}));r.length===0&&r.push(DJ({tag:`stanza`,content:[DJ({tag:`line`,content:[{type:`string`,content:n}]})]}));let i=[];return t&&i.push(DJ({tag:`title`,content:t})),i.push(...r),DJ({tag:`poem`,content:i})},sidebyside:SX(`sidebyside`,{requiresStatementTag:!1,extractTitleFromArgs:!1}),program:e=>{let t=WV(e),n=t[0]?tB(t[0]).trim():void 0;return DJ({tag:`program`,content:[DJ({tag:`input`,content:[{type:`string`,content:tB(e.content).trim()}]})],attributes:n?{language:n}:{}})},console:e=>DJ({tag:`console`,content:[{type:`string`,content:tB(e.content).trim()}]}),sage:e=>DJ({tag:`sage`,content:[DJ({tag:`input`,content:[{type:`string`,content:tB(e.content).trim()}]})]}),webwork:SX(`webwork`,{requiresStatementTag:!1}),preface:SX(`preface`),biography:SX(`biography`),dedication:SX(`dedication`),glossary:SX(`glossary`),biblio:SX(`biblio`),gi:SX(`gi`,{requiresStatementTag:!1}),exercises:SX(`exercises`),exercisegroup:SX(`exercisegroup`),subexercises:SX(`subexercises`),worksheet:SX(`worksheet`),handout:SX(`handout`),"reading-questions":SX(`reading-questions`),readingquestions:SX(`reading-questions`),solutions:SX(`solutions`),introduction:SX(`introduction`),conclusion:SX(`conclusion`),paragraphs:SX(`paragraphs`),objectives:SX(`objectives`),outcomes:SX(`outcomes`),list:SX(`list`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),listing:SX(`listing`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),sbsgroup:SX(`sbsgroup`,{requiresStatementTag:!1}),stack:SX(`stack`,{requiresStatementTag:!1}),...wX()};function wX(){let e=Object.entries({abstract:{requiresStatement:!1,aliases:[`abs`,`abstr`]},acknowledgement:{requiresStatement:!1,aliases:[`ack`]},algorithm:{requiresStatement:!0,aliases:[`algo`,`alg`]},answer:{requiresStatement:!1,aliases:[`ans`]},assumption:{requiresStatement:!0,aliases:[`assu`,`ass`]},axiom:{requiresStatement:!0,aliases:[`axm`]},claim:{requiresStatement:!0,aliases:[`cla`]},conjecture:{requiresStatement:!0,aliases:[`con`,`conj`,`conjec`]},activity:{requiresStatement:!1,aliases:[]},aside:{requiresStatement:!1,aliases:[]},assemblage:{requiresStatement:!1,aliases:[]},biographical:{requiresStatement:!1,aliases:[]},case:{requiresStatement:!1,aliases:[]},computation:{requiresStatement:!1,aliases:[`comp`]},construction:{requiresStatement:!1,aliases:[]},convention:{requiresStatement:!1,aliases:[`conv`]},corollary:{requiresStatement:!0,aliases:[`cor`,`corr`,`coro`,`corol`,`corss`]},definition:{requiresStatement:!0,aliases:[`def`,`defn`,`dfn`,`defi`,`defin`,`de`]},example:{requiresStatement:!0,aliases:[`exam`,`exa`,`eg`,`exmp`,`expl`,`exm`]},exercise:{requiresStatement:!0,aliases:[`exer`,`exers`]},data:{requiresStatement:!1,aliases:[]},exploration:{requiresStatement:!1,aliases:[]},fact:{requiresStatement:!0,aliases:[]},heuristic:{requiresStatement:!0,aliases:[]},hint:{requiresStatement:!1,aliases:[]},historical:{requiresStatement:!1,aliases:[]},hypothesis:{requiresStatement:!0,aliases:[`hyp`]},identity:{requiresStatement:!0,aliases:[`idnty`]},insight:{requiresStatement:!1,aliases:[]},investigation:{requiresStatement:!1,aliases:[]},lemma:{requiresStatement:!0,aliases:[`lem`,`lma`,`lemm`,`lm`]},notation:{requiresStatement:!1,aliases:[`no`,`nota`,`ntn`,`nt`,`notn`,`notat`]},note:{requiresStatement:!1,aliases:[`notes`]},observation:{requiresStatement:!1,aliases:[`obs`]},principle:{requiresStatement:!0,aliases:[]},problem:{requiresStatement:!0,aliases:[`prob`,`prb`]},project:{requiresStatement:!1,aliases:[]},proof:{requiresStatement:!1,aliases:[`pf`,`prf`,`demo`]},proposition:{requiresStatement:!0,aliases:[`prop`,`pro`,`prp`,`props`]},question:{requiresStatement:!0,aliases:[`qu`,`ques`,`quest`,`qsn`]},remark:{requiresStatement:!1,aliases:[`rem`,`rmk`,`rema`,`bem`,`subrem`]},task:{requiresStatement:!0,aliases:[]},technology:{requiresStatement:!1,aliases:[`tech`]},theorem:{requiresStatement:!0,aliases:[`thm`,`theo`,`theor`,`thmss`,`thrm`]},solution:{requiresStatement:!1,aliases:[`sol`]},warning:{requiresStatement:!1,aliases:[`warn`,`wrn`]}}).flatMap(([e,t])=>[[e,SX(e,{requiresStatementTag:t.requiresStatement})],...t.aliases.map(n=>[n,SX(e,{requiresStatementTag:t.requiresStatement})])]);return Object.fromEntries(e)}QB.questions,QB.parts,QB.subparts,QB.subsubparts;var TX=new Set([`question`,`part`,`subpart`,`subsubpart`]);function EX(e){SB(e,e=>{let t=e;if(!TX.has(t.content)||!t.args||t.args.length===0)return;let n=t.args[t.args.length-1];if(t.args.length>=4&&t.args[t.args.length-2].openMark===`{`&&n.openMark===``){let e=t.args[t.args.length-3],r=t.args[t.args.length-2].content,i=n.content;t.args=[e,Jz([...r,...i],{openMark:``,closeMark:``})];return}if(t.args.length!==1||n.openMark!==``)return;let r=[...n.content],{args:i}=zV(r,`o`);t.args=[i[0],Jz(r,{openMark:``,closeMark:``})]},{test:Q.anyMacro})}function DX(e){let t=WV(e)[0];if(t&&t.length>0){let e=tB(t).trim();if(e)return{points:e}}return{}}function OX(e){return!e.args||e.args.length===0?[]:e.args[e.args.length-1].content}function kX(e){return e.type===`whitespace`||e.type===`comment`}function AX(e){return Q.macro(e,`vfill`)||Q.macro(e,`vfil`)}function jX(e){return Q.macro(e,`vspace`)}function MX(e){let t=WV(e);for(let e=t.length-1;e>=0;e--){let n=t[e];if(!n||n.length===0)continue;let r=tB(n).trim();if(r)return r}}function NX(e){let t=[...e];for(;t.length>0&&kX(t[t.length-1]);)t.pop();let n=t[t.length-1];if(!n)return{bodyNodes:t};if(AX(n))return t.pop(),TB(t),{bodyNodes:t,workspace:`1in`};if(jX(n)){let e=MX(n);return e?(t.pop(),TB(t),{bodyNodes:t,workspace:e}):{bodyNodes:t}}if(n.type!==`string`)return{bodyNodes:t};let r=t.length-2;for(;r>=0&&kX(t[r]);)r--;let i=t[r];if(!i||!Q.macro(i,`vskip`))return{bodyNodes:t};let a=n.content.trim();return a?(t.splice(r),TB(t),{bodyNodes:t,workspace:a}):{bodyNodes:t}}function PX(e){let t=DX(e),{bodyNodes:n,workspace:r}=NX(OX(e));return{attributes:r?{...t,workspace:r}:t,bodyNodes:n}}var FX=new Set([`html-tag:solution`,`html-tag:answer`,`html-tag:hint`]);function IX(e){return Q.anyMacro(e)&&FX.has(e.content)}function LX(e){let t=e.findIndex(IX);return t===-1?{statementNodes:e,solutionNodes:[]}:{statementNodes:e.slice(0,t),solutionNodes:e.filter(IX)}}function RX(e){return Q.macro(e,`html-tag:task`)}function zX(e){return Q.macro(e,`newpage`)||Q.macro(e,`clearpage`)}function BX(e){let{attributes:t,bodyNodes:n}=PX(e),r=n.findIndex(RX);if(r===-1){let{statementNodes:e,solutionNodes:r}=LX(n);return DJ({tag:`task`,attributes:t,content:[DJ({tag:`statement`,content:hX(e)}),...r]})}else{let e=n.slice(0,r),i=n.filter(RX),a=[];return TB(e),e.length>0&&a.push(DJ({tag:`introduction`,content:hX(e)})),a.push(...i),DJ({tag:`task`,attributes:t,content:a})}}function VX(e){return e.content.filter(e=>Q.macro(e,`subsubpart`)).reduce((e,t)=>{if(!Q.macro(t)||!t.args)return e;let{attributes:n,bodyNodes:r}=PX(t);return e.push(DJ({tag:`task`,attributes:n,content:[DJ({tag:`statement`,content:hX(r)})]})),e},[])}function HX(e){return e.content.filter(e=>Q.macro(e,`subpart`)).reduce((e,t)=>(!Q.macro(t)||!t.args||e.push(BX(t)),e),[])}function UX(e){return e.content.filter(e=>Q.macro(e,`part`)).reduce((e,t)=>(!Q.macro(t)||!t.args||e.push(BX(t)),e),[])}function WX(e,t){let n=e.content.find(e=>Q.macro(e,`title`))?.args?.find(e=>e.openMark===`{`),r=n&&n.content.length>0?DJ({tag:`title`,content:n.content}):void 0;function i(e){let t=[...e];for(;t.length>0&&kX(t[t.length-1]);)t.pop();let n=t[t.length-1];return!n||!zX(n)?{bodyNodes:t,breakAfter:!1}:(t.pop(),TB(t),{bodyNodes:t,breakAfter:!0})}function a(e){let{attributes:t,bodyNodes:n}=PX(e),{bodyNodes:r,breakAfter:a}=i(n),o=r.findIndex(RX),s;if(o===-1){let{statementNodes:e,solutionNodes:t}=LX(r);s=[DJ({tag:`statement`,content:hX(e)}),...t]}else{let e=r.slice(0,o),t=r.filter(RX);s=[],TB(e),e.length>0&&s.push(DJ({tag:`introduction`,content:hX(e)})),s.push(...t)}return{exercise:DJ({tag:`exercise`,attributes:t,content:s}),breakAfter:a}}let o=e.content.reduce((e,t)=>(!Q.macro(t,`question`)||!t.args||e.push(a(t)),e),[]);if(!o.some(e=>e.breakAfter)){let e=o.map(e=>e.exercise);return DJ({tag:`worksheet`,content:r?[r,...e]:e})}let s=[],c=[],l=()=>{s.push(DJ({tag:`page`,content:c})),c=[]};for(let e of o)c.push(e.exercise),e.breakAfter&&l();return l(),DJ({tag:`worksheet`,content:r?[r,...s]:s})}var GX={questions:WX,parts:UX,subparts:HX,subsubparts:VX},KX={KATEX_MACROS:` (!("(#(&('(*(,(.(:(;(=(>(AA(AE(Alpha(And(Arrowvert(Bbb(Bbbk(Beta(Big(Bigg(Biggl(Biggm(Biggr(Bigl(Bigm(Bigr(Box(Bra(Bumpeq(C(Cap(Chi(Colonapprox(Coloneq(Coloneqq(Colonsim(Complex(Coppa(Cup(Dagger(Darr(DeclareMathOperator(Delta(Diamond(Digamma(Doteq(Downarrow(Epsilon(Eqcolon(Eqqcolon(Eta(Finv(Game(Gamma(H(Harr(Huge(Im(Iota(Join(KaTeX(Kappa(Ket(Koppa(L(LARGE(LaTeX(Lambda(Large(Larr(LeftArrow(Leftarrow(Leftrightarrow(Lleftarrow(Longleftarrow(Longleftrightarrow(Longrightarrow(Lrarr(Lsh(Mu(N(Newextarrow(Nu(O(OE(Omega(Omicron(Overrightarrow(P(Phi(Pi(Pr(Psi(Q(R(Rarr(Re(Reals(Rho(Rightarrow(Rrightarrow(Rsh(Rule(S(Sampi(Sigma(Space(Stigma(Subset(Supset(Tau(TeX(Theta(Tiny(Uarr(Uparrow(Updownarrow(Upsilon(Vdash(Vert(Vvdash(Xi(Z(Zeta(\\(^(_(\`(aa(above(abovewithdelims(acute(add(ae(alef(alefsym(aleph(allowbreak(alpha(amalg(and(ang(angl(angle(angln(approx(approxcolon(approxcoloncolon(approxeq(arccos(arcctg(arcsin(arctan(arctg(arg(argmax(argmin(array(arraystretch(arrowvert(ast(asymp(atop(atopwithdelims(backepsilon(backprime(backsim(backsimeq(backslash(bar(barwedge(bbox(bcancel(because(begin(begingroup(beta(beth(between(bf(bfseries(big(bigcap(bigcirc(bigcup(bigg(biggl(biggm(biggr(bigl(bigm(bigodot(bigominus(bigoplus(bigoslash(bigotimes(bigr(bigsqcap(bigsqcup(bigstar(bigtriangledown(bigtriangleup(biguplus(bigvee(bigwedge(binom(blacklozenge(blacksquare(blacktriangle(blacktriangledown(blacktriangleleft(blacktriangleright(bm(bmod(bold(boldsymbol(bot(bowtie(boxdot(boxed(boxminus(boxplus(boxtimes(bra(brace(bracevert(brack(braket(breve(buildrel(bull(bullet(bumpeq(cal(cancel(cancelto(cap(cases(cdot(cdotp(cdots(ce(cee(centerdot(cf(cfrac(ch(char(check(checkmark(chi(chk(choose(circ(circeq(circlearrowleft(circlearrowright(circledR(circledS(circledast(circledcirc(circleddash(class(cline(clubs(clubsuit(cnums(colon(colonapprox(coloncolon(coloncolonapprox(coloncolonequals(coloncolonminus(coloncolonsim(coloneq(coloneqq(colonequals(colonminus(colonsim(color(colorbox(complement(cong(coppa(coprod(copyright(cos(cosec(cosh(cot(cotg(coth(cr(csc(cssId(ctg(cth(cup(curlyeqprec(curlyeqsucc(curlyvee(curlywedge(curvearrowleft(curvearrowright(dArr(dag(dagger(daleth(darr(dashleftarrow(dashrightarrow(dashv(dbinom(dblcolon(ddag(ddagger(ddddot(dddot(ddot(ddots(def(definecolor(deg(degree(delta(det(dfrac(diagdown(diagup(diamond(diamonds(diamondsuit(digamma(dim(displaylines(displaystyle(div(divideontimes(dot(doteq(doteqdot(dotplus(dots(dotsb(dotsc(dotsi(dotsm(dotso(doublebarwedge(doublecap(doublecup(downarrow(downdownarrows(downharpoonleft(downharpoonright(edef(ell(else(em(emph(empty(emptyset(enclose(end(endgroup(enspace(epsilon(eqalign(eqalignno(eqcirc(eqcolon(eqqcolon(eqref(eqsim(eqslantgtr(eqslantless(equalscolon(equalscoloncolon(equiv(eta(eth(euro(exist(exists(exp(expandafter(fallingdotseq(fbox(fcolorbox(fi(flat(foo(footnotesize(forall(frac(frak(frown(futurelet(gamma(gcd(gdef(ge(geneuro(geneuronarrow(geneurowide(genfrac(geq(geqq(geqslant(gets(gg(ggg(gggtr(gimel(global(gnapprox(gneq(gneqq(gnsim(grave(greet(gt(gtrapprox(gtrdot(gtreqless(gtreqqless(gtrless(gtrsim(gvertneqq(hArr(hail(harr(hat(hbar(hbox(hdashline(hearts(heartsuit(hfil(hfill(hline(hom(hookleftarrow(hookrightarrow(hphantom(href(hskip(hslash(hspace(htmlClass(htmlData(htmlId(htmlStyle(huge(i(iddots(idotsint(if(iff(ifmode(ifx(iiiint(iiint(iint(image(imageof(imath(impliedby(implies(in(includegraphics(inf(infin(infty(injlim(int(intercal(intop(iota(isin(it(itshape(j(jmath(kappa(ker(kern(ket(koppa(l(lArr(lBrace(lVert(label(lambda(land(lang(langle(large(larr(lbrace(lbrack(lceil(ldotp(ldots(le(leadsto(left(leftarrow(leftarrowtail(leftharpoondown(leftharpoonup(leftleftarrows(leftrightarrow(leftrightarrows(leftrightharpoons(leftrightsquigarrow(leftroot(leftthreetimes(leq(leqalignno(leqq(leqslant(lessapprox(lessdot(lesseqgtr(lesseqqgtr(lessgtr(lesssim(let(lfloor(lg(lgroup(lhd(lim(liminf(limits(limsup(ll(llap(llbracket(llcorner(lll(llless(lmoustache(ln(lnapprox(lneq(lneqq(lnot(lnsim(log(long(longleftarrow(longleftrightarrow(longmapsto(longrightarrow(looparrowleft(looparrowright(lor(lower(lozenge(lparen(lq(lrArr(lrarr(lrcorner(lt(ltimes(lvert(lvertneqq(maltese(mapsto(mathbb(mathbf(mathbin(mathcal(mathchoice(mathclap(mathclose(mathellipsis(mathfrak(mathinner(mathit(mathllap(mathnormal(mathop(mathopen(mathord(mathpunct(mathrel(mathring(mathrlap(mathrm(mathscr(mathsf(mathsterling(mathstrut(mathtip(mathtt(matrix(max(mbox(md(mdseries(measuredangle(medspace(mho(mid(middle(min(minuscolon(minuscoloncolon(minuso(mit(mkern(mmlToken(mod(models(moveleft(moveright(mp(mskip(mspace(mu(multicolumn(multimap(nLeftarrow(nLeftrightarrow(nRightarrow(nVDash(nVdash(nabla(natnums(natural(ncong(ne(nearrow(neg(negmedspace(negthickspace(negthinspace(neq(newcommand(newenvironment(newline(nexists(ngeq(ngeqq(ngeqslant(ngtr(ni(nleftarrow(nleftrightarrow(nleq(nleqq(nleqslant(nless(nmid(nobreak(nobreakspace(noexpand(nolimits(nonumber(normalfont(normalsize(not(notag(notin(notni(nparallel(nprec(npreceq(nrightarrow(nshortmid(nshortparallel(nsim(nsubseteq(nsubseteqq(nsucc(nsucceq(nsupseteq(nsupseteqq(ntriangleleft(ntrianglelefteq(ntriangleright(ntrianglerighteq(nu(nvDash(nvdash(nwarrow(o(odot(oe(officialeuro(oiiint(oiint(oint(oldstyle(omega(omicron(ominus(operatorname(operatornamewithlimits(oplus(or(origof(oslash(otimes(over(overbrace(overbracket(overgroup(overleftarrow(overleftharpoon(overleftrightarrow(overline(overlinesegment(overparen(overrightarrow(overrightharpoon(overset(overwithdelims(owns(pagecolor(parallel(part(partial(perp(phantom(phase(phi(pi(pitchfork(plim(plusmn(pm(pmatrix(pmb(pmod(pod(pounds(prec(precapprox(preccurlyeq(preceq(precnapprox(precneqq(precnsim(precsim(prime(prod(projlim(propto(providecommand(psi(pu(qquad(quad(r(rArr(rBrace(rVert(raise(raisebox(rang(rangle(rarr(ratio(rbrace(rbrack(rceil(real(reals(ref(relax(renewcommand(renewenvironment(require(restriction(rfloor(rgroup(rhd(rho(right(rightarrow(rightarrowtail(rightharpoondown(rightharpoonup(rightleftarrows(rightleftharpoons(rightrightarrows(rightsquigarrow(rightthreetimes(risingdotseq(rlap(rm(rmoustache(root(rotatebox(rparen(rq(rrbracket(rtimes(rule(rvert(sampi(sc(scalebox(scr(scriptscriptstyle(scriptsize(scriptstyle(sdot(searrow(sec(sect(setlength(setminus(sf(sh(sharp(shortmid(shortparallel(shoveleft(shoveright(sideset(sigma(sim(simcolon(simcoloncolon(simeq(sin(sinh(sixptsize(skew(skip(sl(small(smallfrown(smallint(smallsetminus(smallsmile(smash(smile(smiley(sout(space(spades(spadesuit(sphericalangle(sqcap(sqcup(sqrt(sqsubset(sqsubseteq(sqsupset(sqsupseteq(square(ss(stackrel(star(stigma(strut(style(sub(sube(subset(subseteq(subseteqq(subsetneq(subsetneqq(substack(succ(succapprox(succcurlyeq(succeq(succnapprox(succneqq(succnsim(succsim(sum(sup(supe(supset(supseteq(supseteqq(supsetneq(supsetneqq(surd(swarrow(tag(tan(tanh(tau(tbinom(text(textasciicircum(textasciitilde(textbackslash(textbar(textbardbl(textbf(textbraceleft(textbraceright(textcircled(textcolor(textdagger(textdaggerdbl(textdegree(textdollar(textellipsis(textemdash(textendash(textgreater(textit(textless(textmd(textnormal(textquotedblleft(textquotedblright(textquoteleft(textquoteright(textregistered(textrm(textsc(textsf(textsl(textsterling(textstyle(texttip(texttt(textunderscore(textup(textvisiblespace(tfrac(tg(th(therefore(theta(thetasym(thickapprox(thicksim(thickspace(thinspace(tilde(times(tiny(to(toggle(top(triangle(triangledown(triangleleft(trianglelefteq(triangleq(triangleright(trianglerighteq(tt(twoheadleftarrow(twoheadrightarrow(u(uArr(uarr(ulcorner(underbar(underbrace(underbracket(undergroup(underleftarrow(underleftrightarrow(underline(underlinesegment(underparen(underrightarrow(underset(unicode(unlhd(unrhd(up(uparrow(updownarrow(upharpoonleft(upharpoonright(uplus(uproot(upshape(upsilon(upuparrows(urcorner(url(utilde(v(vDash(varDelta(varGamma(varLambda(varOmega(varPhi(varPi(varPsi(varSigma(varTheta(varUpsilon(varXi(varcoppa(varepsilon(varinjlim(varkappa(varliminf(varlimsup(varnothing(varphi(varpi(varprojlim(varpropto(varrho(varsigma(varstigma(varsubsetneq(varsubsetneqq(varsupsetneq(varsupsetneqq(vartheta(vartriangle(vartriangleleft(vartriangleright(vcentcolon(vcenter(vdash(vdots(vec(vee(veebar(vert(vfil(vfill(vline(vphantom(wedge(weierp(widecheck(widehat(wideparen(widetilde(wp(wr(xLeftarrow(xLeftrightarrow(xRightarrow(xcancel(xdef(xhookleftarrow(xhookrightarrow(xi(xleftarrow(xleftharpoondown(xleftharpoonup(xleftrightarrow(xleftrightharpoons(xlongequal(xmapsto(xrightarrow(xrightharpoondown(xrightharpoonup(xrightleftharpoons(xtofrom(xtwoheadleftarrow(xtwoheadrightarrow(yen(zeta({(|(}(~`.split(`(`),KATEX_ENVIRONMENTS:`align.align*.alignat.alignat*.aligned.alignedat.array.Bmatrix.bmatrix.Bmatrix*.bmatrix*.cases.CD.darray.dcases.drcases.equation.equation*.gather.gathered.matrix.matrix*.pmatrix.pmatrix*.rcases.smallmatrix.split.Vmatrix.vmatrix.Vmatrix*.vmatrix*`.split(`.`)},qX={type:`macro`,content:`left`},JX={type:`macro`,content:`right`},YX={type:`macro`,content:`{`},XX={type:`string`,content:`.`},ZX={systeme:e=>{try{let t=WV(e),n=t[1]||void 0,r=EH(t[3]||[],{properSpacing:!1,whitelistedVariables:n});if(e?._renderInfo?.sysdelims){let[t,n]=e._renderInfo?.sysdelims;return[qX,...t||[],r,JX,...n||[]]}return[qX,YX,r,JX,XX]}catch{return e}},sysdelim:()=>[]},QX={};function $X(e){DH(e)}var eZ={macros:KX.KATEX_MACROS,environments:KX.KATEX_ENVIRONMENTS};function tZ(e,t=``,n){return(r,i,a)=>{if(!r.args)throw Error(`Found macro to replace but couldn't find content ${tB(r)}`);if(t&&a){let t=YY(r,`Warning: There is no equivalent tag for \"${r.content}\", \"${e}\" was used as a replacement.`,`macro-subs`);a.message(t,t.place,t.source)}let o=WV(r);return DJ({tag:e,content:o[o.length-1]||[],attributes:n})}}function nZ(e,t={}){return n=>{let r=WV(n),i={};return t&&Object.assign(i,t),DJ({tag:e,content:r[r.length-1]||[],attributes:i})}}var rZ={emph:tZ(`em`),textrm:tZ(`em`,`Warning: There is no equivalent tag for "textrm", "em" was used as a replacement.`),textsf:tZ(`em`,`Warning: There is no equivalent tag for "textsf", "em" was used as a replacement.`),texttt:tZ(`em`,`Warning: There is no equivalent tag for "textsf", "em" was used as a replacement.`),textsl:tZ(`em`,`Warning: There is no equivalent tag for "textsl", "em" was used as a replacement.`),textit:tZ(`em`),textbf:tZ(`alert`),term:tZ(`term`),underline:tZ(`em`,`Warning: There is no equivalent tag for "underline", "em" was used as a replacement.`),mbox:XY(`Warning: There is no equivalent tag for "mbox", an empty Ast.String was used as a replacement.`),phantom:XY(`Warning: There is no equivalent tag for "phantom", an empty Ast.String was used as a replacement.`),appendix:nZ(`appendix`),url:e=>{let t=tB(WV(e)[0]||`#`);return DJ({tag:`url`,attributes:{href:t},content:[{type:`string`,content:t}]})},href:e=>{let t=WV(e);return DJ({tag:`url`,attributes:{href:tB(t[1]||`#`)},content:t[2]||[]})},hyperref:e=>{let t=WV(e);return DJ({tag:`url`,attributes:{href:`#`+tB(t[0]||``)},content:t[1]||[]})},ref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),eqref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[0]||``))||``}}),cref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),Cref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),cite:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),index:e=>DJ({tag:`idx`,content:DJ({tag:`h`,content:WV(e)[0]||[]})}),"\\":XY(`Warning: There is no equivalent tag for "\\", an empty Ast.String was used as a replacement.`),vspace:XY(`Warning: There is no equivalent tag for "vspace", an empty Ast.String was used as a replacement.`),hspace:XY(`Warning: There is no equivalent tag for "hspace", an empty Ast.String was used as a replacement.`),textcolor:tZ(`em`,`Warning: There is no equivalent tag for "textcolor", "em" was used as a replacement.`),textsize:XY(`Warning: There is no equivalent tag for "textsize", an empty Ast.String was used as a replacement.`),makebox:XY(`Warning: There is no equivalent tag for "makebox", an empty Ast.String was used as a replacement.`),noindent:XY(`Warning: There is no equivalent tag for "noindent", an empty Ast.String was used as a replacement.`),latex:e=>DJ({tag:`latex`}),latexe:e=>DJ({tag:`latex`}),today:e=>DJ({tag:`today`}),tex:e=>DJ({tag:`tex`}),eg:()=>DJ({tag:`eg`}),ie:()=>DJ({tag:`ie`}),etc:()=>DJ({tag:`etc`}),XeTeX:()=>DJ({tag:`xetex`}),XeLaTeX:()=>DJ({tag:`xelatex`}),LuaTeX:()=>DJ({tag:`luatex`}),PreTeXt:()=>DJ({tag:`pretext`}),PreFigure:()=>DJ({tag:`prefigure`}),AD:()=>DJ({tag:`ad`}),BC:()=>DJ({tag:`bc`}),AM:()=>DJ({tag:`am`}),PM:()=>DJ({tag:`pm`}),nb:()=>DJ({tag:`nb`}),ps:()=>DJ({tag:`ps`}),vs:()=>DJ({tag:`vs`}),viz:()=>DJ({tag:`viz`}),etal:()=>DJ({tag:`etal`}),circa:()=>DJ({tag:`ca`}),ca:()=>DJ({tag:`ca`}),timeofday:()=>DJ({tag:`timeofday`}),code:tZ(`c`),lstinline:tZ(`c`),fn:tZ(`fn`),footnote:tZ(`fn`),q:tZ(`q`),sq:tZ(`sq`),enquote:tZ(`q`),enquotestar:tZ(`sq`),abbr:tZ(`abbr`),ac:tZ(`acro`),acro:tZ(`acro`),init:tZ(`init`),foreign:tZ(`foreign`),foreignlanguage:tZ(`foreign`),booktitle:tZ(`pubtitle`),pubtitle:tZ(`pubtitle`),articletitle:tZ(`articletitle`),xmltag:tZ(`tag`),xmlattr:tZ(`attr`),taxon:tZ(`taxon`),kbd:tZ(`kbd`),icon:tZ(`icon`),fillin:()=>DJ({tag:`fillin`}),sout:tZ(`delete`),insert:tZ(`insert`),stale:tZ(`stale`),mdash:()=>DJ({tag:`mdash`}),ndash:()=>DJ({tag:`ndash`}),nbsp:()=>DJ({tag:`nbsp`}),P:()=>DJ({tag:`pilcrow`}),S:()=>DJ({tag:`section-mark`}),copyright:()=>DJ({tag:`copyright`}),registered:()=>DJ({tag:`registered`}),trademark:()=>DJ({tag:`trademark`}),degree:()=>DJ({tag:`degree`}),textdegree:()=>DJ({tag:`degree`}),dagger:()=>DJ({tag:`dagger`}),ddagger:()=>DJ({tag:`dagger`}),ldots:()=>DJ({tag:`ellipsis`}),dots:()=>DJ({tag:`ellipsis`}),textpm:()=>DJ({tag:`plusminus`}),textregistered:()=>DJ({tag:`registered`}),texttrademark:()=>DJ({tag:`trademark`}),textsection:()=>DJ({tag:`section-mark`}),textpilcrow:()=>DJ({tag:`pilcrow`}),textperiodcentered:()=>DJ({tag:`midpoint`}),texttildelow:()=>DJ({tag:`swungdash`}),textperthousand:()=>DJ({tag:`permille`}),includegraphics:e=>{let t=WV(e);return DJ({tag:`image`,attributes:{source:tB(t[t.length-1]||[])},content:[]})},caption:(e,t)=>{let n=WV(e),r=GV(e).captionText||n[n.length-1]||[];return DJ({tag:t?.parents?.some(e=>e.type===`macro`&&e.content===`html-tag:table`)??!1?`title`:`caption`,content:r})}},iZ=`http://www.w3.org/2001/XInclude`,aZ={plus:{signature:`o m m`,renderInfo:{breakAround:!0}}},oZ=`frontmatter.part.chapter.section.subsection.subsubsection.preface.biography.dedication.glossary.appendix.index.bibliography.references.exercises.solutions.worksheet.handout.reading-questions.paragraphs.introduction.conclusion.backmatter.image.video.audio.interactive.program.listing.doenet.webwork.sageplot.asymptote.latex-image`.split(`.`),sZ=new Set([`width`,`margin`]);function cZ(e){let t={};if(!e)return t;for(let n of tB(e).split(`,`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);if(r===-1){t[e]=`yes`;continue}let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))&&(a=a.slice(1,-1)),a=a.replace(/\\%/g,`%`),sZ.has(i)&&/^\d+(\.\d+)?$/.test(a)&&(a+=`%`),i&&(t[i]=a)}return t}function lZ(e={}){let{format:t=`plus`,resolveHref:n=e=>`${e}.ptx`,resolveType:r,extraTypes:i=[]}=e,a=new Set([...oZ,...i]);function o(e,t,n){if(!t)return;let r=YY(e,n,`plus-subs`);t.message(r,r.place,r.source)}function s(e,r,i,a,s){if(t===`xinclude`){let t=Object.keys(s);return t.length>0&&o(e,r,`Warning: attributes "${t.join(`, `)}" cannot be represented on an <xi:include> element and were dropped.`),DJ({tag:`xi:include`,attributes:{"xmlns:xi":iZ,href:n(a,i)}})}return DJ({tag:`plus:${i}`,attributes:{ref:a,...s}})}return{plus:(e,t,n)=>{let r=WV(e),i=tB(r[1]||[]).trim(),c=ZY(tB(r[2]||[]).trim());return i?(a.has(i)||o(e,n,`Warning: "${i}" is not a recognized type in \\plus{${i}}{${c}}. It was used anyway; pass it in "extraTypes" to suppress this warning.`),s(e,n,i,c,cZ(r[0]))):(o(e,n,`Warning: \\plus is missing its type argument; expected \\plus[attrs]{type}{ref}. The macro was removed.`),Xz(``))},include:(e,t,n)=>{let i=WV(e),a=ZY(tB(i[i.length-1]||[]).trim());return s(e,n,r?.(a)||`include`,a,{})}}}function uZ(e,...t){return(n,r)=>Yz(e,t.map(e=>Jz(e)).concat(Jz(n)))}var dZ={color:$H,bfseries:uZ(`textbf`),itshape:uZ(`textit`),rmfamily:uZ(`textrm`),scshape:uZ(`textsc`),sffamily:uZ(`textsf`),slshape:uZ(`textsl`),ttfamily:uZ(`texttt`),Huge:uZ(`textsize`,`Huge`),huge:uZ(`textsize`,`huge`),LARGE:uZ(`textsize`,`LARGE`),Large:uZ(`textsize`,`Large`),large:uZ(`textsize`,`large`),normalsize:uZ(`textsize`,`normalsize`),small:uZ(`textsize`,`small`),footnotesize:uZ(`textsize`,`footnotesize`),scriptsize:uZ(`textsize`,`scriptsize`),tiny:uZ(`textsize`,`tiny`)},fZ=function(e){let{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}=e||{};return e=>{let r=!1;SB(e,e=>{(Q.environment(e,`document`)||iX(e))&&(Q.environment(e,`document`)&&(r=!0),e.content=hX(e.content,{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}))},{test:Q.anyEnvironment}),r||(e.content=hX(e.content,{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}))}};function pZ(e){let t={messages:[]},n=Q.createMacroMatcher(eZ.macros);return SB(e,(e,r)=>{aB(e)&&r.context.hasMathModeAncestor&&(n(e)||t.messages.push(YY(e,`Warning: \"${e.content}\" is unsupported by Katex.`,`report-unsupported-macro-katex`)))}),t}var mZ=function(e){let t=Object.assign({},rZ,lZ(e?.plusIncludes),e?.macroReplacements||{}),n=Object.assign({},CX,GX,e?.environmentReplacements||{}),r=e?.producePretextFragment?e?.producePretextFragment:!1,i=Q.createMacroMatcher(t),a=Q.createEnvironmentMatcher(n),o=Q.createMacroMatcher(ZX),s=Q.createEnvironmentMatcher(QX);return(e,c)=>{let l=e;vZ(e);let u=eJ().use(BJ,{fix:!0}).use(JB,{replacers:dZ}),d=aX(e);for(let e of d.messages)c.message(e,e.place,`unified-latex-to-pretext:break-on-boundaries`);yZ(e),hZ(e)&&(u=u.use(fZ)),e=u.runSync(e,c),FB(e,(e,t)=>{if(!t.context.hasMathModeAncestor&&a(e))return n[tB(e.env)](e,t,c)}),FB(e,(e,n)=>{if(!n.context.hasMathModeAncestor&&i(e))return t[e.content](e,n,c)});let f=pZ(e);for(let e of f.messages)c.message(e,e.place,`unified-latex-to-pretext:report-unsupported-macro-mathjax`);$X(e),FB(e,e=>{if(o(e))return ZX[e.content](e);if(s(e))return QX[tB(e.env)](e)}),r||(_Z(e),e.content=[DJ({tag:`pretext`,content:e.content})]),l.content=e.content}};function hZ(e){let t=e.content;return SB(e,e=>{if(Q.anyEnvironment(e))return t=e.content,bB},{test:e=>Q.environment(e,`document`)}),gZ(t)}function gZ(e){return e.some(e=>iX(e)?gZ(e.content):Q.parbreak(e)||Q.macro(e,`par`))}function _Z(e){let t=!1,n=bZ(e,`documentclass`);if(n){let e=WV(n)[0];if(e){let n=e[0];(n.content==`book`||n.content==`memoir`)&&(t=!0)}}t||SB(e,e=>{if(iB(e)&&e.env==`_chapter`)return t=!0,bB});let r=bZ(e,`title`);if(r){let t=WV(r)[1];t?(e.content.unshift(DJ({tag:`title`,content:t})),FB(e,e=>{if(e===r)return[]})):e.content.unshift(DJ({tag:`title`,content:Xz(``)}))}else e.content.unshift(DJ({tag:`title`,content:Xz(``)}));t?e.content=[DJ({tag:`book`,content:e.content})]:e.content=[DJ({tag:`article`,content:e.content})]}function vZ(e){FB(e,(e,t)=>{if(Q.comment(e)&&(t.context.inMathMode||t.context.hasMathModeAncestor))return null})}function yZ(e){FB(e,(e,t)=>{if(Q.macro(e,`label`)){let n=WV(e),r=n[n.length-1];if(r){let e=t.parents[0]?._renderInfo??{};e&&(e.additionalAttributes=e.additionalAttributes??{},e.additionalAttributes[`xml:id`]=ZY(tB(r)),t.parents[0]._renderInfo=e)}return null}})}function bZ(e,t){let n=null;return SB(e,e=>{if(iB(e))return yB;if(aB(e)&&e.content===t)return n=e,bB}),n}function xZ(e){let t=dY(e),n=new Set(t.map(e=>e.name)),r=Object.fromEntries(t.map(e=>[e.name,{signature:e.signature}]));for(let i=0;i<100&&SZ(e,n);i++)UV(e,r),fY(e,t)}function SZ(e,t){let n=!1;return SB(e,e=>{aB(e)&&t.has(e.content)&&(n=!0)}),n}function CZ(e,t){return e.type===`string`&&e.content===t}function wZ(e){return!e||e.type!==`string`?!1:/^[a-zA-Z]/.test(e.content)}function TZ(e){let t=[],n=[],r=0;for(;r<e.length;){let i=e[r],a=e[r+1];if(Q.parbreak(i)){for(;n.length>0;)n.pop();t.push(i),r++;continue}if(CZ(i,"`")&&a&&CZ(a,"`")){n.push({kind:`double`,startIndex:t.length}),t.push(i,a),r+=2;continue}if(CZ(i,`'`)&&a&&CZ(a,`'`)){let e=EZ(n,`double`);if(e!==-1){let i=n.splice(e,1)[0],a=t.splice(i.startIndex);a.splice(0,2);let o=TZ(a);t.push(Yz(`enquote`,[Jz(o,{braces:`{}`})])),r+=2;continue}t.push(i,a),r+=2;continue}if(CZ(i,"`")&&!(a&&CZ(a,"`"))){n.push({kind:`single`,startIndex:t.length}),t.push(i),r++;continue}if(CZ(i,`'`)&&!(a&&CZ(a,`'`))){let a=EZ(n,`single`);if(a!==-1&&!wZ(e[r+1])){let e=n.splice(a,1)[0],i=t.splice(e.startIndex);i.splice(0,1);let o=TZ(i);t.push(Yz(`sq`,[Jz(o,{braces:`{}`})])),r++;continue}t.push(i),r++;continue}t.push(i),r++}return t}function EZ(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].kind===t)return n;return-1}function DZ(e){let t=[],n=0;for(;n<e.length;){let r=e[n],i=e[n+1],a=e[n+2];if(CZ(r,`-`)&&CZ(i,`-`)&&CZ(a,`-`)){t.push(Yz(`mdash`)),n+=3;continue}if(CZ(r,`-`)&&CZ(i,`-`)){t.push(Yz(`ndash`)),n+=2;continue}if(CZ(r,`~`)){t.push(Yz(`nbsp`)),n++;continue}if(CZ(r,`'`)||CZ(r,"`")){t.push(r),n++;continue}t.push(r),n++}return t}function OZ(e){SB(e,(e,t)=>{if(t.context.inMathMode||t.context.hasMathModeAncestor)return;let n=DZ(TZ(e));e.length=0,e.push(...n)},{includeArrays:!0,test:Array.isArray})}var kZ={...aZ,term:{signature:`m`},code:{signature:`m`},lstinline:{signature:`m`},preface:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},biography:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},dedication:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},glossary:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},exercises:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},worksheet:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},handout:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},paragraphs:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},readingquestions:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},solutions:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},fn:{signature:`m`},q:{signature:`m`},sq:{signature:`m`},enquote:{signature:`m`},enquotestar:{signature:`m`},abbr:{signature:`m`},ac:{signature:`m`},acro:{signature:`m`},init:{signature:`m`},foreign:{signature:`m`},foreignlanguage:{signature:`m m`},booktitle:{signature:`m`},pubtitle:{signature:`m`},articletitle:{signature:`m`},xmltag:{signature:`m`},xmlattr:{signature:`m`},taxon:{signature:`m`},kbd:{signature:`m`},icon:{signature:`m`},nb:{signature:``},ps:{signature:``},vs:{signature:``},viz:{signature:``},etal:{signature:``},circa:{signature:``},ca:{signature:``},PreFigure:{signature:``},XeLaTeX:{signature:``},timeofday:{signature:``},mdash:{signature:``},ndash:{signature:``},nbsp:{signature:``},sout:{signature:`m`},insert:{signature:`m`},stale:{signature:`m`}},AZ={aside:{signature:`o`},biographical:{signature:`o`},historical:{signature:`o`},assemblage:{signature:`o`},activity:{signature:`o`},exploration:{signature:`o`},investigation:{signature:`o`},project:{signature:`o`},computation:{signature:`o`},technology:{signature:`o`},data:{signature:`o`},case:{signature:`o`},poem:{signature:`o`},sidebyside:{signature:`o`},program:{signature:`o`},console:{signature:``},sage:{signature:``},webwork:{signature:`o`},task:{signature:`o`},preface:{signature:`o`},biography:{signature:`o`},dedication:{signature:`o`},glossary:{signature:`o`},exercises:{signature:`o`},exercisegroup:{signature:`o`},subexercises:{signature:`o`},worksheet:{signature:`o`},handout:{signature:`o`},readingquestions:{signature:`o`},"reading-questions":{signature:`o`},introduction:{signature:`o`},conclusion:{signature:`o`},paragraphs:{signature:`o`},objectives:{signature:`o`},outcomes:{signature:`o`},solutions:{signature:`o`},gi:{signature:`o`},sbsgroup:{signature:`o`},stack:{signature:`o`},list:{signature:`o`},listing:{signature:`o`}};function jZ(e){return e.replace(/\u2014/g,`---`).replace(/\u2013/g,`--`).replace(/\u00A0/g,` `).replace(/\u201C/g,"``").replace(/\u201D/g,`''`).replace(/\u2018/g,"`").replace(/\u2019/g,`'`).replace(/\u00AB/g,`<<`).replace(/\u00BB/g,`>>`).replace(/\u2026/g,`...`).replace(/\u2009/g,` `).replace(/\u2005/g,` `).replace(/\u2002/g,` `).replace(/\u2003/g,` `)}var MZ=function(e){return(t,n)=>{let r=e?.producePretextFragment?e?.producePretextFragment:!1;xZ(t),OZ(t),UV(t,kZ),SB(t,e=>{if(!Q.environment(e))return;let t=AZ[tB(e.env)];if(t?.signature&&e.args==null){let{args:n}=zV(e.content,t.signature);e.args=n}}),EX(t);let i=t.content;SB(t,e=>(i=e.content,bB),{test:(e=>Q.environment(e,`document`))}),t.content=i,eJ().use(mZ,e).run(t,n),SJ(t),i=t.content;let a=pX(n.message.bind(n),typeof n.value==`string`?n.value:void 0)({type:`root`,content:i});Array.isArray(a)||(a=[a]);let o=Dq();return o.children=a,r||o.children.unshift({type:`instruction`,name:`xml`,value:`version='1.0' encoding='utf-8'`}),(function e(t){for(let n of t)n.type===`text`?n.value=jZ(n.value):`children`in n&&e(n.children)})(o.children),o}},NZ=function(){this.Compiler=e=>JY(e,{closeEmptyElements:!0})};Eq().use(MZ).use(NZ);function PZ(e){return(e=>Eq().use(MZ,{producePretextFragment:!0}).use(NZ).processSync({value:e}))(e)}var FZ={basename:IZ,dirname:LZ,extname:RZ,join:zZ,sep:`/`};function IZ(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);HZ(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function LZ(e){if(HZ(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function RZ(e){HZ(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function zZ(...e){let t=-1,n;for(;++t<e.length;)HZ(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:BZ(n)}function BZ(e){HZ(e);let t=e.codePointAt(0)===47,n=VZ(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function VZ(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function HZ(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var UZ={cwd:WZ};function WZ(){return`/`}function GZ(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function KZ(e){if(typeof e==`string`)e=new URL(e);else if(!GZ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return qZ(e)}function qZ(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var JZ=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],YZ=class{constructor(e){let t;t=e?GZ(e)?{path:e}:typeof e==`string`||$Z(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:UZ.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<JZ.length;){let e=JZ[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)JZ.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?FZ.basename(this.path):void 0}set basename(e){ZZ(e,`basename`),XZ(e,`basename`),this.path=FZ.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?FZ.dirname(this.path):void 0}set dirname(e){QZ(this.basename,`dirname`),this.path=FZ.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?FZ.extname(this.path):void 0}set extname(e){if(XZ(e,`extname`),QZ(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=FZ.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){GZ(e)&&(e=KZ(e)),ZZ(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?FZ.basename(this.path,this.extname):void 0}set stem(e){ZZ(e,`stem`),XZ(e,`stem`),this.path=FZ.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new FJ(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function XZ(e,t){if(e&&e.includes(FZ.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+FZ.sep+"`")}function ZZ(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function QZ(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function $Z(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var eQ=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),tQ={}.hasOwnProperty,nQ=new class e extends eQ{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=mR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,VR.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(aQ(`data`,this.frozen),this.namespace[e]=t,this):tQ.call(this.namespace,e)&&this.namespace[e]||void 0:e?(aQ(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=cQ(e),n=this.parser||this.Parser;return rQ(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),rQ(`process`,this.parser||this.Parser),iQ(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=cQ(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);uQ(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),rQ(`processSync`,this.parser||this.Parser),iQ(`processSync`,this.compiler||this.Compiler),this.process(e,r),sQ(`processSync`,`process`,t),n;function r(e,r){t=!0,uR(e),n=r}}run(e,t,n){oQ(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=cQ(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),sQ(`runSync`,`run`,n),r;function i(e,t){uR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=cQ(t),r=this.compiler||this.Compiler;return iQ(`stringify`,r),oQ(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(aQ(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,VR.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];pR(o)&&pR(r)&&(r=(0,VR.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function rQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function iQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function aQ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oQ(e){if(!pR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function sQ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function cQ(e){return lQ(e)?e:new YZ(e)}function lQ(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function uQ(e){return typeof e==`string`||dQ(e)}function dQ(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var fQ={};function pQ(e,t){let n=t||fQ;return mQ(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function mQ(e,t,n){if(gQ(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return hQ(e.children,t,n)}return Array.isArray(e)?hQ(e,t,n):``}function hQ(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=mQ(e[i],t,n);return r.join(``)}function gQ(e){return!!(e&&typeof e==`object`)}var _Q=document.createElement(`i`);function vQ(e){let t=`&`+e+`;`;_Q.innerHTML=t;let n=_Q.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function yQ(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function bQ(e,t){return e.length>0?(yQ(e,e.length,0,t),e):t}var xQ={}.hasOwnProperty;function SQ(e){let t={},n=-1;for(;++n<e.length;)CQ(t,e[n]);return t}function CQ(e,t){let n;for(n in t){let r=(xQ.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){xQ.call(r,a)||(r[a]=[]);let e=i[a];wQ(r[a],Array.isArray(e)?e:e?[e]:[])}}}function wQ(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);yQ(e,0,0,r)}function TQ(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function EQ(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var DQ=zQ(/[A-Za-z]/),OQ=zQ(/[\dA-Za-z]/),kQ=zQ(/[#-'*+\--9=?A-Z^-~]/);function AQ(e){return e!==null&&(e<32||e===127)}var jQ=zQ(/\d/),MQ=zQ(/[\dA-Fa-f]/),NQ=zQ(/[!-/:-@[-`{-~]/);function PQ(e){return e!==null&&e<-2}function FQ(e){return e!==null&&(e<0||e===32)}function IQ(e){return e===-2||e===-1||e===32}var LQ=zQ(/\p{P}|\p{S}/u),RQ=zQ(/\s/);function zQ(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function BQ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return IQ(r)?(e.enter(n),s(r)):t(r)}function s(r){return IQ(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var VQ={tokenize:HQ};function HQ(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),BQ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return PQ(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var UQ={tokenize:GQ},WQ={tokenize:KQ};function GQ(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return yQ(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(WQ,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(WQ,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return PQ(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;yQ(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function KQ(e,t,n){return BQ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function qQ(e){if(e===null||FQ(e)||RQ(e))return 1;if(LQ(e))return 2}function JQ(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var YQ={name:`attention`,resolveAll:XQ,tokenize:ZQ};function XQ(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};QQ(d,-c),QQ(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=bQ(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=bQ(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=bQ(l,JQ(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=bQ(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=bQ(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,yQ(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function ZQ(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qQ(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=qQ(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function QQ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $Q={name:`autolink`,tokenize:e$};function e$(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return DQ(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||OQ(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||OQ(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||AQ(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):kQ(t)?(e.consume(t),l):n(t)}function u(e){return OQ(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||OQ(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var t$={partial:!0,tokenize:n$};function n$(e,t,n){return r;function r(t){return IQ(t)?BQ(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||PQ(e)?t(e):n(e)}}var r$={continuation:{tokenize:a$},exit:o$,name:`blockQuote`,tokenize:i$};function i$(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return IQ(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function a$(e,t,n){let r=this;return i;function i(t){return IQ(t)?BQ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(r$,t,n)(r)}}function o$(e){e.exit(`blockQuote`)}var s$={name:`characterEscape`,tokenize:c$};function c$(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return NQ(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var l$={name:`characterReference`,tokenize:u$};function u$(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=OQ,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=MQ,u):(e.enter(`characterReferenceValue`),a=7,o=jQ,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===OQ&&!vQ(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var d$={partial:!0,tokenize:m$},f$={concrete:!0,name:`codeFenced`,tokenize:p$};function p$(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),IQ(t)?BQ(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||PQ(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(d$,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||PQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):IQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),BQ(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||PQ(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||PQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&IQ(t)?BQ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||PQ(t)?e.check(d$,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||PQ(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),IQ(t)?BQ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),IQ(t)?BQ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||PQ(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function m$(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var h$={name:`codeIndented`,tokenize:_$},g$={partial:!0,tokenize:v$};function _$(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),BQ(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):PQ(t)?e.attempt(g$,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||PQ(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function v$(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):PQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):BQ(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):PQ(e)?i(e):n(e)}}var y$={name:`codeText`,previous:x$,resolve:b$,tokenize:S$};function b$(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function x$(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function S$(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):PQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||PQ(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var C$=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&w$(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),w$(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),w$(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);w$(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);w$(this.left,t.reverse())}}};function w$(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function T$(e){let t={},n=-1,r,i,a,o,s,c,l,u=new C$(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,E$(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return yQ(e,0,1/0,u.slice(0)),!l}function E$(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var D$={resolve:k$,tokenize:A$},O$={partial:!0,tokenize:j$};function k$(e){return T$(e),e}function A$(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):PQ(t)?e.check(O$,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function j$(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),BQ(e,a,`linePrefix`)}function a(i){if(i===null||PQ(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function M$(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||AQ(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||PQ(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||FQ(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||AQ(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function N$(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):PQ(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||PQ(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!IQ(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function P$(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):PQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),BQ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||PQ(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function F$(e,t){let n;return r;function r(i){return PQ(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):IQ(i)?BQ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var I$={name:`definition`,tokenize:R$},L$={partial:!0,tokenize:z$};function R$(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return N$.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=EQ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return FQ(t)?F$(e,l)(t):l(t)}function l(t){return M$(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(L$,d,d)(t)}function d(t){return IQ(t)?BQ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||PQ(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function z$(e,t,n){return r;function r(t){return FQ(t)?F$(e,i)(t):n(t)}function i(t){return P$(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return IQ(t)?BQ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||PQ(e)?t(e):n(e)}}var B$={name:`hardBreakEscape`,tokenize:V$};function V$(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return PQ(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var H$={name:`headingAtx`,resolve:U$,tokenize:W$};function U$(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},yQ(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function W$(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||FQ(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||PQ(n)?(e.exit(`atxHeading`),t(n)):IQ(n)?BQ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||FQ(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var G$=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),K$=[`pre`,`script`,`style`,`textarea`],q$={concrete:!0,name:`htmlFlow`,resolveTo:X$,tokenize:Z$},J$={partial:!0,tokenize:$$},Y$={partial:!0,tokenize:Q$};function X$(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Z$(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):DQ(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):DQ(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return DQ(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||FQ(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&K$.includes(l)?(i=1,r.interrupt?t(s):O(s)):G$.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||OQ(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return IQ(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||DQ(t)?(e.consume(t),b):IQ(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||OQ(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):IQ(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):IQ(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||PQ(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||FQ(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||IQ(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||PQ(t)?O(t):IQ(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),te):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):PQ(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(J$,ie,k)(t)):t===null||PQ(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Y$,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||PQ(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function te(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return K$.includes(n)?(e.consume(t),re):O(t)}return DQ(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||PQ(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Q$(e,t,n){let r=this;return i;function i(t){return PQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function $$(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(t$,t,n)}}var e1={name:`htmlText`,tokenize:t1};function t1(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):DQ(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):DQ(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):PQ(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?te(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):PQ(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?te(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?te(t):PQ(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):PQ(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?te(e):y(e)}function x(t){return DQ(t)?(e.consume(t),S):n(t)}function S(t){return t===45||OQ(t)?(e.consume(t),S):C(t)}function C(t){return PQ(t)?(o=C,j(t)):IQ(t)?(e.consume(t),C):te(t)}function w(t){return t===45||OQ(t)?(e.consume(t),w):t===47||t===62||FQ(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),te):t===58||t===95||DQ(t)?(e.consume(t),E):PQ(t)?(o=T,j(t)):IQ(t)?(e.consume(t),T):te(t)}function E(t){return t===45||t===46||t===58||t===95||OQ(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):PQ(t)?(o=D,j(t)):IQ(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):PQ(t)?(o=O,j(t)):IQ(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):PQ(t)?(o=k,j(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||FQ(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||FQ(e)?T(e):n(e)}function te(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return IQ(t)?BQ(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var n1={name:`labelEnd`,resolveAll:o1,resolveTo:s1,tokenize:c1},r1={tokenize:l1},i1={tokenize:u1},a1={tokenize:d1};function o1(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&yQ(e,0,e.length,n),e}function s1(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=bQ(s,e.slice(a+1,a+r+3)),s=bQ(s,[[`enter`,u,t]]),s=bQ(s,JQ(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=bQ(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=bQ(s,e.slice(o+1)),s=bQ(s,[[`exit`,c,t]]),yQ(e,a,e.length,s),e}function c1(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(EQ(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(r1,u,o?u:d)(t):t===91?e.attempt(i1,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(a1,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function l1(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return FQ(t)?F$(e,a)(t):a(t)}function a(t){return t===41?u(t):M$(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return FQ(t)?F$(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?P$(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return FQ(t)?F$(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function u1(e,t,n){let r=this;return i;function i(t){return N$.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(EQ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function d1(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var f1={name:`labelStartImage`,resolveAll:n1.resolveAll,tokenize:p1};function p1(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var m1={name:`labelStartLink`,resolveAll:n1.resolveAll,tokenize:h1};function h1(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var g1={name:`lineEnding`,tokenize:_1};function _1(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),BQ(e,t,`linePrefix`)}}var v1={name:`thematicBreak`,tokenize:y1};function y1(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||PQ(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),IQ(t)?BQ(e,s,`whitespace`)(t):s(t))}}var b1={continuation:{tokenize:w1},exit:E1,name:`list`,tokenize:C1},x1={partial:!0,tokenize:D1},S1={partial:!0,tokenize:T1};function C1(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:jQ(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(v1,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return jQ(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(t$,r.interrupt?n:u,e.attempt(x1,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return IQ(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function w1(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(t$,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,BQ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!IQ(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(S1,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,BQ(e,e.attempt(b1,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function T1(e,t,n){let r=this;return BQ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function E1(e){e.exit(this.containerState.type)}function D1(e,t,n){let r=this;return BQ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!IQ(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var O1={name:`setextUnderline`,resolveTo:k1,tokenize:A1};function k1(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function A1(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),IQ(t)?BQ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||PQ(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var j1={tokenize:M1};function M1(e){let t=this,n=e.attempt(t$,r,e.attempt(this.parser.constructs.flowInitial,i,BQ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(D$,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var N1={resolveAll:L1()},P1=I1(`string`),F1=I1(`text`);function I1(e){return{resolveAll:L1(e===`text`?R1:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function L1(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function R1(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var z1=m({attentionMarkers:()=>q1,contentInitial:()=>V1,disable:()=>J1,document:()=>B1,flow:()=>U1,flowInitial:()=>H1,insideSpan:()=>K1,string:()=>W1,text:()=>G1}),B1={42:b1,43:b1,45:b1,48:b1,49:b1,50:b1,51:b1,52:b1,53:b1,54:b1,55:b1,56:b1,57:b1,62:r$},V1={91:I$},H1={[-2]:h$,[-1]:h$,32:h$},U1={35:H$,42:v1,45:[O1,v1],60:q$,61:O1,95:v1,96:f$,126:f$},W1={38:l$,92:s$},G1={[-5]:g1,[-4]:g1,[-3]:g1,33:f1,38:l$,42:YQ,60:[$Q,e1],91:m1,92:[B$,s$],93:n1,95:YQ,96:y$},K1={null:[YQ,N1]},q1={null:[42,95]},J1={null:[]};function Y1(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=bQ(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=JQ(a,l.events,l),l.events):[]}function f(e,t){return Z1(p(e),t)}function p(e){return X1(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){PQ(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&yQ(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function X1(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Z1(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
1053
|
+
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function MY(e){return TY(e,jY)}function NY(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function PY(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;NY(n,r)>NY(n,e)&&(r=e)}return r+TY(n,[`<`,`&`,r])+r}function FY(e,t){let n=MY(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+PY(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+PY(i,t)),a+`>`}var IY={}.hasOwnProperty;function LY(e,t){let n=MY(e.name),r=qY(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(IY.call(i,s)){let e=i[s];e!=null&&o.push(MY(s)+`=`+PY(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var RY=/\?>/g,zY=[`>`];function BY(e){let t=MY(e.name)||`x`,n=TY(e.value,zY,RY);return`<?`+t+(n?` `+n:``)+`?>`}var VY=[`&`,`<`];function HY(e){return TY(e.value,VY)}function UY(e,t){return t.options.allowDangerousXml?e.value:HY(e)}var WY={}.hasOwnProperty,GY={cdata:kY,comment:AY,doctype:FY,element:LY,instruction:BY,raw:UY,root:qY,text:HY};function KY(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!WY.call(GY,n))throw Error("Cannot compile unknown node `"+n+"`");let r=GY[n];return r(e,t)}function qY(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=KY(n[r],t);return i.join(``)}function JY(e,t){let n={options:t||{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return KY(Array.isArray(e)?{type:`root`,children:e}:e,n)}function YY(e,t,n){let r=new FJ(t,e);return r.source=`unified-latex-to-pretext:${n}`,r}function XY(e){return(t,n,r)=>{if(r){let n=YY(t,e,`macro-subs`);r.message(n,n.place,`unified-latex-to-pretext:macro-subs`)}return Xz(``)}}function ZY(e){return e.replace(/["'<>&:\s]/g,e=>{switch(e){case`&`:case`:`:return`-`;case` `:case` `:return`_`;default:return``}})}var QY=[{division:`book`,mappedEnviron:`_book`},{division:`article`,mappedEnviron:`_article`},{division:`slideshow`,mappedEnviron:`_slideshow`}],$Y=[QY,[{division:`part`,mappedEnviron:`_part`}],[{division:`chapter`,mappedEnviron:`_chapter`},{division:`preface`,mappedEnviron:`_preface`},{division:`biography`,mappedEnviron:`_biography`},{division:`dedication`,mappedEnviron:`_dedication`},{division:`glossary`,mappedEnviron:`_glossary`},{division:`appendix`,mappedEnviron:`_appendix`},{division:`bibliography`,mappedEnviron:`_bibliography`},{division:`references`,mappedEnviron:`_references`}],[{division:`section`,mappedEnviron:`_section`},{division:`exercises`,mappedEnviron:`_exercises`},{division:`solutions`,mappedEnviron:`_solutions`},{division:`worksheet`,mappedEnviron:`_worksheet`},{division:`handout`,mappedEnviron:`_handout`},{division:`readingquestions`,mappedEnviron:`_readingquestions`,pretextTag:`reading-questions`}],[{division:`subsection`,mappedEnviron:`_subsection`}],[{division:`subsubsection`,mappedEnviron:`_subsubsection`}],[{division:`paragraphs`,mappedEnviron:`_paragraphs`}],[{division:`subparagraph`,mappedEnviron:`_subparagraph`}]],eX=Q.createEnvironmentMatcher([`parts`,`subparts`,`subsubparts`]),tX=$Y.reduce((e,t)=>e.concat(t),[]),nX=new Set([`chapter`,`section`,`subsection`,`subsubsection`]),rX=new Map;for(let e of tX)rX.set(e.division.toLowerCase(),e),e.pretextTag&&rX.set(e.pretextTag.toLowerCase(),e);var iX=Q.createMacroMatcher(tX.map(e=>e.division)),aX=Q.createEnvironmentMatcher(tX.map(e=>e.mappedEnviron)),oX=Q.createEnvironmentMatcher(QY.map(e=>e.mappedEnviron));function sX(e){let t={messages:[]};return FB(e,e=>{if(Q.group(e)&&e.content.some(e=>aB(e)&&iX(e)))return t.messages.push(YY(e,`Warning: hoisted out of a group, which might break the LaTeX code.`,`break-on-boundaries`)),e.content}),SB(e,(e,t)=>{!(iB(e)||e.type===`root`||Q.group(e))||t.context.hasMathModeAncestor||iB(e)&&aX(e)||iB(e)&&eX(e)||(e.content=cX(e.content,0))}),FB(e,(e,t)=>{if(aB(e)&&iX(e))return t.parents.some(e=>iB(e)&&eX(e))?void 0:null}),t}function cX(e,t){if(t>=$Y.length)return e;let n=$Y[t],r=MB(e,n.map(e=>e.division));for(let e=0;e<r.segments.length;e++)r.segments[e]=cX(r.segments[e],t+1);return lX(r,n),NB(r)}function lX(e,t){let n=new Map(t.map(e=>[e.division,e.mappedEnviron]));for(let t=1;t<e.segments.length;t++){let r=e.macros[t-1],i=n.get(r.content)??`_unknown`,a=GV(r);if(nX.has(r.content)&&a.tocTitle){let e=tB(a.tocTitle).trim().toLowerCase(),t=rX.get(e);t&&(i=t.mappedEnviron)}let o=a.title,s=[];o&&s.push(Jz(o,{braces:`[]`})),e.segments[t]=[Zz(i,e.segments[t],s)]}}function uX(e){try{return tB(e)}catch{}return JSON.stringify(e)}function dX(e){return e=e.replace(/--/g,`- -`),e.endsWith(`-`)&&(e+=` `),{type:`comment`,value:e}}function fX(e,t){let n=e.position?.start?.offset,r=e.position?.end?.offset;return t&&n!=null&&r!=null?t.slice(n,r):uX(e)}function pX(e,t,n){return Dq(`TODO`,{type:e},[dX(`todo: ${t}`),Dq(`pre`,n)])}function mX(e,t,n){return Dq(`TODO`,{type:e},[dX(`todo: ${t}`),Dq(`c`,n)])}function hX(e,t){return function n(r){let i=r;if(kJ(i)){let e=OJ(i),t=e.attributes;return Dq(e.tag,t,e.content.flatMap(n))}switch(r.type){case`string`:return{type:`text`,value:r.content,position:r.position};case`comment`:{let e=dX(r.content);return e.position=r.position,r.leadingWhitespace||!r.sameline?[{type:`text`,value:` `},e]:e}case`inlinemath`:return Dq(`m`,tB(r.content));case`mathenv`:case`displaymath`:return Dq(`md`,tB(r.content));case`verb`:return Dq(`c`,r.content);case`verbatim`:return Dq(`pre`,r.content);case`whitespace`:return{type:`text`,value:` `,position:r.position};case`parbreak`:return e(`There is no equivalent for parbreak, so it was replaced with an empty string.`,r),{type:`text`,value:``,position:r.position};case`group`:return r.content.flatMap(n);case`environment`:if(aX(r)){let t=tX.find(e=>e.mappedEnviron===r.env);t?.division===`subparagraph`&&e(`Warning: There is no equivalent tag for "subparagraph", "paragraphs" was used as a replacement.`,r);let i=t?.pretextTag??t?.division;i===`subparagraph`&&(i=`paragraphs`);let a={};r._renderInfo?.additionalAttributes&&Object.assign(a,r._renderInfo.additionalAttributes);let o=WV(r)[0];o||e(`Warning: No title was given, so an empty title tag was used.`,r);let s=Dq(`title`,o?.flatMap(n));if(i)return Dq(i,a,[s,...r.content.flatMap(n)])}return e(`Unknown environment when converting to XML \`${uX(r.env)}\``,r),pX(`unknown-environment`,`unknown environment "${tB(r.env)}"`,fX(r,t));case`macro`:return e(`Unknown macro when converting to XML \`${uX(r)}\``,r),mX(`unknown-macro`,`unknown macro "\\${r.content}"`,fX(r,t));case`argument`:return e(`Unknown argument when converting to XML \`${uX(r)}\``,r),{type:`text`,value:tB(r.content),position:r.position};case`root`:return r.content.flatMap(n);default:throw Error(`Unknown node type; cannot convert to XAST ${JSON.stringify(r)}`)}}}function gX(e,t){let n=[],r=[];TB(e);let i=Q.createMacroMatcher(t.macrosThatBreakPars),a=Q.createEnvironmentMatcher(t.environmentsThatDontBreakPars);function o(){if(r.length>0){TB(r);let e=r.some(e=>e.type!==`comment`&&e.type!==`whitespace`);n.push({content:r,wrapInPar:e}),r=[]}}for(let t of e){if(i(t)){o(),n.push({content:[t],wrapInPar:!1});continue}if(Q.anyEnvironment(t)&&!a(t)){o(),n.push({content:[t],wrapInPar:!1});continue}if(Q.parbreak(t)||Q.macro(t,`par`)){o();continue}r.push(t)}return o(),n}function _X(e,t){let{macrosThatBreakPars:n=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`paragraph`,`subparagraph`,`vspace`,`smallskip`,`medskip`,`bigskip`,`hfill`,`includegraphics`,`plus`,`include`,`title`],environmentsThatDontBreakPars:r=[`index`,`itemize`,`enumerate`]}=t||{};return gX(e,{macrosThatBreakPars:n,environmentsThatDontBreakPars:r}).flatMap(e=>e.wrapInPar?DJ({tag:`p`,content:e.content}):e.content)}function vX(e){let t=eK(e.content),n=WV(e),r=[];try{r=HJ(n[1]||[])}catch{}let i={},a=!1,o={},s=t.map(e=>DJ({tag:`row`,content:e.cells.map((e,t)=>{let n=r[t];if(n){let{alignment:e}=n;n.pre_dividers.some(e=>e.type===`vert_divider`)&&(i.left=`minor`),n.post_dividers.some(e=>e.type===`vert_divider`)&&(o[t]=!0),e.alignment!==`left`&&(a=!0)}return TB(e),DJ({tag:`cell`,content:e})})}));if(a||Object.values(o).some(e=>e))for(let e=r.length;e>=0;e--){let t=r[e];if(!t)continue;let n={},{alignment:i}=t;i.alignment!==`left`&&(n.halign=i.alignment),o[e]===!0&&(n.right=`minor`),s.unshift(DJ({tag:`col`,attributes:n}))}return DJ({tag:`tabular`,content:s,attributes:i})}var yX=[`label`],bX=[null,`label`,null];function xX(e){if(!Array.isArray(e.args))throw Error(`Cannot find \\item macros arguments; you must attach the \\item body to the macro before calling this function ${JSON.stringify(e)}`);let t=e.args.length-1===bX.length?bX:yX;return Object.assign({body:e.args[e.args.length-1].content},GV(e,t))}function SX(e=`ol`){return function(t){let n=t.content.filter(e=>Q.macro(e,`item`)),r=!1,i=n.flatMap(e=>{if(!Q.macro(e)||!e.args)return[];let t=xX(e);t.body=_X(t.body),t.label!=null&&(r=!0,t.body.unshift(DJ({tag:`title`,content:t.label})));let n=t.body;return DJ({tag:`li`,content:n})});return DJ({tag:r?`dl`:e,content:i})}}var CX=new Set([`proof`,`hint`,`answer`,`solution`]);function wX(e,t={}){let{requiresStatementTag:n=!1,wrapContentInPars:r=!0,extractTitleFromArgs:i=!0,warningMessage:a=``}=t;return(t,o,s)=>{if(a&&s){let e=YY(t,a,`env-subs`);s.message(e,e.place,e.source)}let c;if(n){let e=[],n=[];for(let r of t.content)kJ(r)&&CX.has(r.content.slice(9))?n.push(r):e.push(r);c=[DJ({tag:`statement`,content:r?_X(e):e}),...n]}else c=r?_X(t.content):t.content;if(i){let e=WV(t);e[0]&&c.unshift(DJ({tag:`title`,content:e[0]||[]}))}let l={};return t._renderInfo?.additionalAttributes&&Object.assign(l,t._renderInfo.additionalAttributes),DJ({tag:e,content:c,attributes:l})}}var TX={enumerate:SX(`ol`),itemize:SX(`ul`),tabular:vX,center:wX(`blockquote`),quote:wX(`blockquote`),figure:wX(`figure`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),table:wX(`table`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),code:e=>DJ({tag:`pre`,content:[{type:`string`,content:tB(e.content)}]}),poem:e=>{let t=WV(e)[0],n=tB(e.content).trim(),r=n.split(/\n[ \t]*\n/).map(e=>e.trim()).filter(e=>e.length>0).map(e=>DJ({tag:`stanza`,content:e.split(/\\\\[ \t]*\n?/).map(e=>e.trim()).filter(e=>e.length>0).map(e=>DJ({tag:`line`,content:[{type:`string`,content:e}]}))}));r.length===0&&r.push(DJ({tag:`stanza`,content:[DJ({tag:`line`,content:[{type:`string`,content:n}]})]}));let i=[];return t&&i.push(DJ({tag:`title`,content:t})),i.push(...r),DJ({tag:`poem`,content:i})},sidebyside:wX(`sidebyside`,{requiresStatementTag:!1,extractTitleFromArgs:!1}),program:e=>{let t=WV(e),n=t[0]?tB(t[0]).trim():void 0;return DJ({tag:`program`,content:[DJ({tag:`input`,content:[{type:`string`,content:tB(e.content).trim()}]})],attributes:n?{language:n}:{}})},console:e=>DJ({tag:`console`,content:[{type:`string`,content:tB(e.content).trim()}]}),sage:e=>DJ({tag:`sage`,content:[DJ({tag:`input`,content:[{type:`string`,content:tB(e.content).trim()}]})]}),webwork:wX(`webwork`,{requiresStatementTag:!1}),preface:wX(`preface`),biography:wX(`biography`),dedication:wX(`dedication`),glossary:wX(`glossary`),biblio:wX(`biblio`),gi:wX(`gi`,{requiresStatementTag:!1}),exercises:wX(`exercises`),exercisegroup:wX(`exercisegroup`),subexercises:wX(`subexercises`),worksheet:wX(`worksheet`),handout:wX(`handout`),"reading-questions":wX(`reading-questions`),readingquestions:wX(`reading-questions`),solutions:wX(`solutions`),introduction:wX(`introduction`),conclusion:wX(`conclusion`),paragraphs:wX(`paragraphs`),objectives:wX(`objectives`),outcomes:wX(`outcomes`),list:wX(`list`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),listing:wX(`listing`,{requiresStatementTag:!1,wrapContentInPars:!1,extractTitleFromArgs:!1}),sbsgroup:wX(`sbsgroup`,{requiresStatementTag:!1}),stack:wX(`stack`,{requiresStatementTag:!1}),...EX()};function EX(){let e=Object.entries({abstract:{requiresStatement:!1,aliases:[`abs`,`abstr`]},acknowledgement:{requiresStatement:!1,aliases:[`ack`]},algorithm:{requiresStatement:!0,aliases:[`algo`,`alg`]},answer:{requiresStatement:!1,aliases:[`ans`]},assumption:{requiresStatement:!0,aliases:[`assu`,`ass`]},axiom:{requiresStatement:!0,aliases:[`axm`]},claim:{requiresStatement:!0,aliases:[`cla`]},conjecture:{requiresStatement:!0,aliases:[`con`,`conj`,`conjec`]},activity:{requiresStatement:!1,aliases:[]},aside:{requiresStatement:!1,aliases:[]},assemblage:{requiresStatement:!1,aliases:[]},biographical:{requiresStatement:!1,aliases:[]},case:{requiresStatement:!1,aliases:[]},computation:{requiresStatement:!1,aliases:[`comp`]},construction:{requiresStatement:!1,aliases:[]},convention:{requiresStatement:!1,aliases:[`conv`]},corollary:{requiresStatement:!0,aliases:[`cor`,`corr`,`coro`,`corol`,`corss`]},definition:{requiresStatement:!0,aliases:[`def`,`defn`,`dfn`,`defi`,`defin`,`de`]},example:{requiresStatement:!0,aliases:[`exam`,`exa`,`eg`,`exmp`,`expl`,`exm`]},exercise:{requiresStatement:!0,aliases:[`exer`,`exers`]},data:{requiresStatement:!1,aliases:[]},exploration:{requiresStatement:!1,aliases:[]},fact:{requiresStatement:!0,aliases:[]},heuristic:{requiresStatement:!0,aliases:[]},hint:{requiresStatement:!1,aliases:[]},historical:{requiresStatement:!1,aliases:[]},hypothesis:{requiresStatement:!0,aliases:[`hyp`]},identity:{requiresStatement:!0,aliases:[`idnty`]},insight:{requiresStatement:!1,aliases:[]},investigation:{requiresStatement:!1,aliases:[]},lemma:{requiresStatement:!0,aliases:[`lem`,`lma`,`lemm`,`lm`]},notation:{requiresStatement:!1,aliases:[`no`,`nota`,`ntn`,`nt`,`notn`,`notat`]},note:{requiresStatement:!1,aliases:[`notes`]},observation:{requiresStatement:!1,aliases:[`obs`]},principle:{requiresStatement:!0,aliases:[]},problem:{requiresStatement:!0,aliases:[`prob`,`prb`]},project:{requiresStatement:!1,aliases:[]},proof:{requiresStatement:!1,aliases:[`pf`,`prf`,`demo`]},proposition:{requiresStatement:!0,aliases:[`prop`,`pro`,`prp`,`props`]},question:{requiresStatement:!0,aliases:[`qu`,`ques`,`quest`,`qsn`]},remark:{requiresStatement:!1,aliases:[`rem`,`rmk`,`rema`,`bem`,`subrem`]},task:{requiresStatement:!0,aliases:[]},technology:{requiresStatement:!1,aliases:[`tech`]},theorem:{requiresStatement:!0,aliases:[`thm`,`theo`,`theor`,`thmss`,`thrm`]},solution:{requiresStatement:!1,aliases:[`sol`]},warning:{requiresStatement:!1,aliases:[`warn`,`wrn`]}}).flatMap(([e,t])=>[[e,wX(e,{requiresStatementTag:t.requiresStatement})],...t.aliases.map(n=>[n,wX(e,{requiresStatementTag:t.requiresStatement})])]);return Object.fromEntries(e)}QB.questions,QB.parts,QB.subparts,QB.subsubparts;var DX=new Set([`question`,`part`,`subpart`,`subsubpart`]);function OX(e){SB(e,e=>{let t=e;if(!DX.has(t.content)||!t.args||t.args.length===0)return;let n=t.args[t.args.length-1];if(t.args.length>=4&&t.args[t.args.length-2].openMark===`{`&&n.openMark===``){let e=t.args[t.args.length-3],r=t.args[t.args.length-2].content,i=n.content;t.args=[e,Jz([...r,...i],{openMark:``,closeMark:``})];return}if(t.args.length!==1||n.openMark!==``)return;let r=[...n.content],{args:i}=zV(r,`o`);t.args=[i[0],Jz(r,{openMark:``,closeMark:``})]},{test:Q.anyMacro})}function kX(e){let t=WV(e)[0];if(t&&t.length>0){let e=tB(t).trim();if(e)return{points:e}}return{}}function AX(e){return!e.args||e.args.length===0?[]:e.args[e.args.length-1].content}function jX(e){return e.type===`whitespace`||e.type===`comment`}function MX(e){return Q.macro(e,`vfill`)||Q.macro(e,`vfil`)}function NX(e){return Q.macro(e,`vspace`)}function PX(e){let t=WV(e);for(let e=t.length-1;e>=0;e--){let n=t[e];if(!n||n.length===0)continue;let r=tB(n).trim();if(r)return r}}function FX(e){let t=[...e];for(;t.length>0&&jX(t[t.length-1]);)t.pop();let n=t[t.length-1];if(!n)return{bodyNodes:t};if(MX(n))return t.pop(),TB(t),{bodyNodes:t,workspace:`1in`};if(NX(n)){let e=PX(n);return e?(t.pop(),TB(t),{bodyNodes:t,workspace:e}):{bodyNodes:t}}if(n.type!==`string`)return{bodyNodes:t};let r=t.length-2;for(;r>=0&&jX(t[r]);)r--;let i=t[r];if(!i||!Q.macro(i,`vskip`))return{bodyNodes:t};let a=n.content.trim();return a?(t.splice(r),TB(t),{bodyNodes:t,workspace:a}):{bodyNodes:t}}function IX(e){let t=kX(e),{bodyNodes:n,workspace:r}=FX(AX(e));return{attributes:r?{...t,workspace:r}:t,bodyNodes:n}}var LX=new Set([`html-tag:solution`,`html-tag:answer`,`html-tag:hint`]);function RX(e){return Q.anyMacro(e)&&LX.has(e.content)}function zX(e){let t=e.findIndex(RX);return t===-1?{statementNodes:e,solutionNodes:[]}:{statementNodes:e.slice(0,t),solutionNodes:e.filter(RX)}}function BX(e){return Q.macro(e,`html-tag:task`)}function VX(e){return Q.macro(e,`newpage`)||Q.macro(e,`clearpage`)}function HX(e){let{attributes:t,bodyNodes:n}=IX(e),r=n.findIndex(BX);if(r===-1){let{statementNodes:e,solutionNodes:r}=zX(n);return DJ({tag:`task`,attributes:t,content:[DJ({tag:`statement`,content:_X(e)}),...r]})}else{let e=n.slice(0,r),i=n.filter(BX),a=[];return TB(e),e.length>0&&a.push(DJ({tag:`introduction`,content:_X(e)})),a.push(...i),DJ({tag:`task`,attributes:t,content:a})}}function UX(e){return e.content.filter(e=>Q.macro(e,`subsubpart`)).reduce((e,t)=>{if(!Q.macro(t)||!t.args)return e;let{attributes:n,bodyNodes:r}=IX(t);return e.push(DJ({tag:`task`,attributes:n,content:[DJ({tag:`statement`,content:_X(r)})]})),e},[])}function WX(e){return e.content.filter(e=>Q.macro(e,`subpart`)).reduce((e,t)=>(!Q.macro(t)||!t.args||e.push(HX(t)),e),[])}function GX(e){return e.content.filter(e=>Q.macro(e,`part`)).reduce((e,t)=>(!Q.macro(t)||!t.args||e.push(HX(t)),e),[])}function KX(e,t){let n=e.content.find(e=>Q.macro(e,`title`))?.args?.find(e=>e.openMark===`{`),r=n&&n.content.length>0?DJ({tag:`title`,content:n.content}):void 0;function i(e){let t=[...e];for(;t.length>0&&jX(t[t.length-1]);)t.pop();let n=t[t.length-1];return!n||!VX(n)?{bodyNodes:t,breakAfter:!1}:(t.pop(),TB(t),{bodyNodes:t,breakAfter:!0})}function a(e){let{attributes:t,bodyNodes:n}=IX(e),{bodyNodes:r,breakAfter:a}=i(n),o=r.findIndex(BX),s;if(o===-1){let{statementNodes:e,solutionNodes:t}=zX(r);s=[DJ({tag:`statement`,content:_X(e)}),...t]}else{let e=r.slice(0,o),t=r.filter(BX);s=[],TB(e),e.length>0&&s.push(DJ({tag:`introduction`,content:_X(e)})),s.push(...t)}return{exercise:DJ({tag:`exercise`,attributes:t,content:s}),breakAfter:a}}let o=e.content.reduce((e,t)=>(!Q.macro(t,`question`)||!t.args||e.push(a(t)),e),[]);if(!o.some(e=>e.breakAfter)){let e=o.map(e=>e.exercise);return DJ({tag:`worksheet`,content:r?[r,...e]:e})}let s=[],c=[],l=()=>{s.push(DJ({tag:`page`,content:c})),c=[]};for(let e of o)c.push(e.exercise),e.breakAfter&&l();return l(),DJ({tag:`worksheet`,content:r?[r,...s]:s})}var qX={questions:KX,parts:GX,subparts:WX,subsubparts:UX},JX={KATEX_MACROS:` (!("(#(&('(*(,(.(:(;(=(>(AA(AE(Alpha(And(Arrowvert(Bbb(Bbbk(Beta(Big(Bigg(Biggl(Biggm(Biggr(Bigl(Bigm(Bigr(Box(Bra(Bumpeq(C(Cap(Chi(Colonapprox(Coloneq(Coloneqq(Colonsim(Complex(Coppa(Cup(Dagger(Darr(DeclareMathOperator(Delta(Diamond(Digamma(Doteq(Downarrow(Epsilon(Eqcolon(Eqqcolon(Eta(Finv(Game(Gamma(H(Harr(Huge(Im(Iota(Join(KaTeX(Kappa(Ket(Koppa(L(LARGE(LaTeX(Lambda(Large(Larr(LeftArrow(Leftarrow(Leftrightarrow(Lleftarrow(Longleftarrow(Longleftrightarrow(Longrightarrow(Lrarr(Lsh(Mu(N(Newextarrow(Nu(O(OE(Omega(Omicron(Overrightarrow(P(Phi(Pi(Pr(Psi(Q(R(Rarr(Re(Reals(Rho(Rightarrow(Rrightarrow(Rsh(Rule(S(Sampi(Sigma(Space(Stigma(Subset(Supset(Tau(TeX(Theta(Tiny(Uarr(Uparrow(Updownarrow(Upsilon(Vdash(Vert(Vvdash(Xi(Z(Zeta(\\(^(_(\`(aa(above(abovewithdelims(acute(add(ae(alef(alefsym(aleph(allowbreak(alpha(amalg(and(ang(angl(angle(angln(approx(approxcolon(approxcoloncolon(approxeq(arccos(arcctg(arcsin(arctan(arctg(arg(argmax(argmin(array(arraystretch(arrowvert(ast(asymp(atop(atopwithdelims(backepsilon(backprime(backsim(backsimeq(backslash(bar(barwedge(bbox(bcancel(because(begin(begingroup(beta(beth(between(bf(bfseries(big(bigcap(bigcirc(bigcup(bigg(biggl(biggm(biggr(bigl(bigm(bigodot(bigominus(bigoplus(bigoslash(bigotimes(bigr(bigsqcap(bigsqcup(bigstar(bigtriangledown(bigtriangleup(biguplus(bigvee(bigwedge(binom(blacklozenge(blacksquare(blacktriangle(blacktriangledown(blacktriangleleft(blacktriangleright(bm(bmod(bold(boldsymbol(bot(bowtie(boxdot(boxed(boxminus(boxplus(boxtimes(bra(brace(bracevert(brack(braket(breve(buildrel(bull(bullet(bumpeq(cal(cancel(cancelto(cap(cases(cdot(cdotp(cdots(ce(cee(centerdot(cf(cfrac(ch(char(check(checkmark(chi(chk(choose(circ(circeq(circlearrowleft(circlearrowright(circledR(circledS(circledast(circledcirc(circleddash(class(cline(clubs(clubsuit(cnums(colon(colonapprox(coloncolon(coloncolonapprox(coloncolonequals(coloncolonminus(coloncolonsim(coloneq(coloneqq(colonequals(colonminus(colonsim(color(colorbox(complement(cong(coppa(coprod(copyright(cos(cosec(cosh(cot(cotg(coth(cr(csc(cssId(ctg(cth(cup(curlyeqprec(curlyeqsucc(curlyvee(curlywedge(curvearrowleft(curvearrowright(dArr(dag(dagger(daleth(darr(dashleftarrow(dashrightarrow(dashv(dbinom(dblcolon(ddag(ddagger(ddddot(dddot(ddot(ddots(def(definecolor(deg(degree(delta(det(dfrac(diagdown(diagup(diamond(diamonds(diamondsuit(digamma(dim(displaylines(displaystyle(div(divideontimes(dot(doteq(doteqdot(dotplus(dots(dotsb(dotsc(dotsi(dotsm(dotso(doublebarwedge(doublecap(doublecup(downarrow(downdownarrows(downharpoonleft(downharpoonright(edef(ell(else(em(emph(empty(emptyset(enclose(end(endgroup(enspace(epsilon(eqalign(eqalignno(eqcirc(eqcolon(eqqcolon(eqref(eqsim(eqslantgtr(eqslantless(equalscolon(equalscoloncolon(equiv(eta(eth(euro(exist(exists(exp(expandafter(fallingdotseq(fbox(fcolorbox(fi(flat(foo(footnotesize(forall(frac(frak(frown(futurelet(gamma(gcd(gdef(ge(geneuro(geneuronarrow(geneurowide(genfrac(geq(geqq(geqslant(gets(gg(ggg(gggtr(gimel(global(gnapprox(gneq(gneqq(gnsim(grave(greet(gt(gtrapprox(gtrdot(gtreqless(gtreqqless(gtrless(gtrsim(gvertneqq(hArr(hail(harr(hat(hbar(hbox(hdashline(hearts(heartsuit(hfil(hfill(hline(hom(hookleftarrow(hookrightarrow(hphantom(href(hskip(hslash(hspace(htmlClass(htmlData(htmlId(htmlStyle(huge(i(iddots(idotsint(if(iff(ifmode(ifx(iiiint(iiint(iint(image(imageof(imath(impliedby(implies(in(includegraphics(inf(infin(infty(injlim(int(intercal(intop(iota(isin(it(itshape(j(jmath(kappa(ker(kern(ket(koppa(l(lArr(lBrace(lVert(label(lambda(land(lang(langle(large(larr(lbrace(lbrack(lceil(ldotp(ldots(le(leadsto(left(leftarrow(leftarrowtail(leftharpoondown(leftharpoonup(leftleftarrows(leftrightarrow(leftrightarrows(leftrightharpoons(leftrightsquigarrow(leftroot(leftthreetimes(leq(leqalignno(leqq(leqslant(lessapprox(lessdot(lesseqgtr(lesseqqgtr(lessgtr(lesssim(let(lfloor(lg(lgroup(lhd(lim(liminf(limits(limsup(ll(llap(llbracket(llcorner(lll(llless(lmoustache(ln(lnapprox(lneq(lneqq(lnot(lnsim(log(long(longleftarrow(longleftrightarrow(longmapsto(longrightarrow(looparrowleft(looparrowright(lor(lower(lozenge(lparen(lq(lrArr(lrarr(lrcorner(lt(ltimes(lvert(lvertneqq(maltese(mapsto(mathbb(mathbf(mathbin(mathcal(mathchoice(mathclap(mathclose(mathellipsis(mathfrak(mathinner(mathit(mathllap(mathnormal(mathop(mathopen(mathord(mathpunct(mathrel(mathring(mathrlap(mathrm(mathscr(mathsf(mathsterling(mathstrut(mathtip(mathtt(matrix(max(mbox(md(mdseries(measuredangle(medspace(mho(mid(middle(min(minuscolon(minuscoloncolon(minuso(mit(mkern(mmlToken(mod(models(moveleft(moveright(mp(mskip(mspace(mu(multicolumn(multimap(nLeftarrow(nLeftrightarrow(nRightarrow(nVDash(nVdash(nabla(natnums(natural(ncong(ne(nearrow(neg(negmedspace(negthickspace(negthinspace(neq(newcommand(newenvironment(newline(nexists(ngeq(ngeqq(ngeqslant(ngtr(ni(nleftarrow(nleftrightarrow(nleq(nleqq(nleqslant(nless(nmid(nobreak(nobreakspace(noexpand(nolimits(nonumber(normalfont(normalsize(not(notag(notin(notni(nparallel(nprec(npreceq(nrightarrow(nshortmid(nshortparallel(nsim(nsubseteq(nsubseteqq(nsucc(nsucceq(nsupseteq(nsupseteqq(ntriangleleft(ntrianglelefteq(ntriangleright(ntrianglerighteq(nu(nvDash(nvdash(nwarrow(o(odot(oe(officialeuro(oiiint(oiint(oint(oldstyle(omega(omicron(ominus(operatorname(operatornamewithlimits(oplus(or(origof(oslash(otimes(over(overbrace(overbracket(overgroup(overleftarrow(overleftharpoon(overleftrightarrow(overline(overlinesegment(overparen(overrightarrow(overrightharpoon(overset(overwithdelims(owns(pagecolor(parallel(part(partial(perp(phantom(phase(phi(pi(pitchfork(plim(plusmn(pm(pmatrix(pmb(pmod(pod(pounds(prec(precapprox(preccurlyeq(preceq(precnapprox(precneqq(precnsim(precsim(prime(prod(projlim(propto(providecommand(psi(pu(qquad(quad(r(rArr(rBrace(rVert(raise(raisebox(rang(rangle(rarr(ratio(rbrace(rbrack(rceil(real(reals(ref(relax(renewcommand(renewenvironment(require(restriction(rfloor(rgroup(rhd(rho(right(rightarrow(rightarrowtail(rightharpoondown(rightharpoonup(rightleftarrows(rightleftharpoons(rightrightarrows(rightsquigarrow(rightthreetimes(risingdotseq(rlap(rm(rmoustache(root(rotatebox(rparen(rq(rrbracket(rtimes(rule(rvert(sampi(sc(scalebox(scr(scriptscriptstyle(scriptsize(scriptstyle(sdot(searrow(sec(sect(setlength(setminus(sf(sh(sharp(shortmid(shortparallel(shoveleft(shoveright(sideset(sigma(sim(simcolon(simcoloncolon(simeq(sin(sinh(sixptsize(skew(skip(sl(small(smallfrown(smallint(smallsetminus(smallsmile(smash(smile(smiley(sout(space(spades(spadesuit(sphericalangle(sqcap(sqcup(sqrt(sqsubset(sqsubseteq(sqsupset(sqsupseteq(square(ss(stackrel(star(stigma(strut(style(sub(sube(subset(subseteq(subseteqq(subsetneq(subsetneqq(substack(succ(succapprox(succcurlyeq(succeq(succnapprox(succneqq(succnsim(succsim(sum(sup(supe(supset(supseteq(supseteqq(supsetneq(supsetneqq(surd(swarrow(tag(tan(tanh(tau(tbinom(text(textasciicircum(textasciitilde(textbackslash(textbar(textbardbl(textbf(textbraceleft(textbraceright(textcircled(textcolor(textdagger(textdaggerdbl(textdegree(textdollar(textellipsis(textemdash(textendash(textgreater(textit(textless(textmd(textnormal(textquotedblleft(textquotedblright(textquoteleft(textquoteright(textregistered(textrm(textsc(textsf(textsl(textsterling(textstyle(texttip(texttt(textunderscore(textup(textvisiblespace(tfrac(tg(th(therefore(theta(thetasym(thickapprox(thicksim(thickspace(thinspace(tilde(times(tiny(to(toggle(top(triangle(triangledown(triangleleft(trianglelefteq(triangleq(triangleright(trianglerighteq(tt(twoheadleftarrow(twoheadrightarrow(u(uArr(uarr(ulcorner(underbar(underbrace(underbracket(undergroup(underleftarrow(underleftrightarrow(underline(underlinesegment(underparen(underrightarrow(underset(unicode(unlhd(unrhd(up(uparrow(updownarrow(upharpoonleft(upharpoonright(uplus(uproot(upshape(upsilon(upuparrows(urcorner(url(utilde(v(vDash(varDelta(varGamma(varLambda(varOmega(varPhi(varPi(varPsi(varSigma(varTheta(varUpsilon(varXi(varcoppa(varepsilon(varinjlim(varkappa(varliminf(varlimsup(varnothing(varphi(varpi(varprojlim(varpropto(varrho(varsigma(varstigma(varsubsetneq(varsubsetneqq(varsupsetneq(varsupsetneqq(vartheta(vartriangle(vartriangleleft(vartriangleright(vcentcolon(vcenter(vdash(vdots(vec(vee(veebar(vert(vfil(vfill(vline(vphantom(wedge(weierp(widecheck(widehat(wideparen(widetilde(wp(wr(xLeftarrow(xLeftrightarrow(xRightarrow(xcancel(xdef(xhookleftarrow(xhookrightarrow(xi(xleftarrow(xleftharpoondown(xleftharpoonup(xleftrightarrow(xleftrightharpoons(xlongequal(xmapsto(xrightarrow(xrightharpoondown(xrightharpoonup(xrightleftharpoons(xtofrom(xtwoheadleftarrow(xtwoheadrightarrow(yen(zeta({(|(}(~`.split(`(`),KATEX_ENVIRONMENTS:`align.align*.alignat.alignat*.aligned.alignedat.array.Bmatrix.bmatrix.Bmatrix*.bmatrix*.cases.CD.darray.dcases.drcases.equation.equation*.gather.gathered.matrix.matrix*.pmatrix.pmatrix*.rcases.smallmatrix.split.Vmatrix.vmatrix.Vmatrix*.vmatrix*`.split(`.`)},YX={type:`macro`,content:`left`},XX={type:`macro`,content:`right`},ZX={type:`macro`,content:`{`},QX={type:`string`,content:`.`},$X={systeme:e=>{try{let t=WV(e),n=t[1]||void 0,r=EH(t[3]||[],{properSpacing:!1,whitelistedVariables:n});if(e?._renderInfo?.sysdelims){let[t,n]=e._renderInfo?.sysdelims;return[YX,...t||[],r,XX,...n||[]]}return[YX,ZX,r,XX,QX]}catch{return e}},sysdelim:()=>[]},eZ={};function tZ(e){DH(e)}var nZ={macros:JX.KATEX_MACROS,environments:JX.KATEX_ENVIRONMENTS};function rZ(e,t=``,n){return(r,i,a)=>{if(!r.args)throw Error(`Found macro to replace but couldn't find content ${tB(r)}`);if(t&&a){let t=YY(r,`Warning: There is no equivalent tag for \"${r.content}\", \"${e}\" was used as a replacement.`,`macro-subs`);a.message(t,t.place,t.source)}let o=WV(r);return DJ({tag:e,content:o[o.length-1]||[],attributes:n})}}function iZ(e,t={}){return n=>{let r=WV(n),i={};return t&&Object.assign(i,t),DJ({tag:e,content:r[r.length-1]||[],attributes:i})}}var aZ={emph:rZ(`em`),textrm:rZ(`em`,`Warning: There is no equivalent tag for "textrm", "em" was used as a replacement.`),textsf:rZ(`em`,`Warning: There is no equivalent tag for "textsf", "em" was used as a replacement.`),texttt:rZ(`em`,`Warning: There is no equivalent tag for "textsf", "em" was used as a replacement.`),textsl:rZ(`em`,`Warning: There is no equivalent tag for "textsl", "em" was used as a replacement.`),textit:rZ(`em`),textbf:rZ(`alert`),term:rZ(`term`),underline:rZ(`em`,`Warning: There is no equivalent tag for "underline", "em" was used as a replacement.`),mbox:XY(`Warning: There is no equivalent tag for "mbox", an empty Ast.String was used as a replacement.`),phantom:XY(`Warning: There is no equivalent tag for "phantom", an empty Ast.String was used as a replacement.`),appendix:iZ(`appendix`),url:e=>{let t=tB(WV(e)[0]||`#`);return DJ({tag:`url`,attributes:{href:t},content:[{type:`string`,content:t}]})},href:e=>{let t=WV(e);return DJ({tag:`url`,attributes:{href:tB(t[1]||`#`)},content:t[2]||[]})},hyperref:e=>{let t=WV(e);return DJ({tag:`url`,attributes:{href:`#`+tB(t[0]||``)},content:t[1]||[]})},ref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),eqref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[0]||``))||``}}),cref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),Cref:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),cite:e=>DJ({tag:`xref`,attributes:{ref:ZY(tB(WV(e)[1]||``))||``}}),index:e=>DJ({tag:`idx`,content:DJ({tag:`h`,content:WV(e)[0]||[]})}),"\\":XY(`Warning: There is no equivalent tag for "\\", an empty Ast.String was used as a replacement.`),vspace:XY(`Warning: There is no equivalent tag for "vspace", an empty Ast.String was used as a replacement.`),hspace:XY(`Warning: There is no equivalent tag for "hspace", an empty Ast.String was used as a replacement.`),textcolor:rZ(`em`,`Warning: There is no equivalent tag for "textcolor", "em" was used as a replacement.`),textsize:XY(`Warning: There is no equivalent tag for "textsize", an empty Ast.String was used as a replacement.`),makebox:XY(`Warning: There is no equivalent tag for "makebox", an empty Ast.String was used as a replacement.`),noindent:XY(`Warning: There is no equivalent tag for "noindent", an empty Ast.String was used as a replacement.`),latex:e=>DJ({tag:`latex`}),Latex:e=>DJ({tag:`latex`}),LaTeX:e=>DJ({tag:`latex`}),latexe:e=>DJ({tag:`latex`}),today:e=>DJ({tag:`today`}),tex:e=>DJ({tag:`tex`}),eg:()=>DJ({tag:`eg`}),ie:()=>DJ({tag:`ie`}),etc:()=>DJ({tag:`etc`}),XeTeX:()=>DJ({tag:`xetex`}),XeLaTeX:()=>DJ({tag:`xelatex`}),xelatex:()=>DJ({tag:`xelatex`}),LuaTeX:()=>DJ({tag:`luatex`}),luatex:()=>DJ({tag:`luatex`}),PreTeXt:()=>DJ({tag:`pretext`}),pretext:()=>DJ({tag:`pretext`}),Pretext:()=>DJ({tag:`pretext`}),PreFigure:()=>DJ({tag:`prefigure`}),webwork:()=>DJ({tag:`webwork`}),WeBWorK:()=>DJ({tag:`webwork`}),AD:()=>DJ({tag:`ad`}),ad:()=>DJ({tag:`ad`}),BC:()=>DJ({tag:`bc`}),bc:()=>DJ({tag:`bc`}),AM:()=>DJ({tag:`am`}),am:()=>DJ({tag:`am`}),PM:()=>DJ({tag:`pm`}),pm:()=>DJ({tag:`pm`}),nb:()=>DJ({tag:`nb`}),ps:()=>DJ({tag:`ps`}),vs:()=>DJ({tag:`vs`}),viz:()=>DJ({tag:`viz`}),etal:()=>DJ({tag:`etal`}),circa:()=>DJ({tag:`ca`}),ca:()=>DJ({tag:`ca`}),timeofday:()=>DJ({tag:`timeofday`}),code:rZ(`c`),lstinline:rZ(`c`),fn:rZ(`fn`),footnote:rZ(`fn`),q:rZ(`q`),sq:rZ(`sq`),enquote:rZ(`q`),enquotestar:rZ(`sq`),abbr:rZ(`abbr`),ac:rZ(`acro`),acro:rZ(`acro`),init:rZ(`init`),foreign:rZ(`foreign`),foreignlanguage:rZ(`foreign`),booktitle:rZ(`pubtitle`),pubtitle:rZ(`pubtitle`),articletitle:rZ(`articletitle`),xmltag:rZ(`tag`),xmlattr:rZ(`attr`),taxon:rZ(`taxon`),kbd:rZ(`kbd`),icon:rZ(`icon`),fillin:()=>DJ({tag:`fillin`}),sout:rZ(`delete`),insert:rZ(`insert`),stale:rZ(`stale`),mdash:()=>DJ({tag:`mdash`}),ndash:()=>DJ({tag:`ndash`}),nbsp:()=>DJ({tag:`nbsp`}),P:()=>DJ({tag:`pilcrow`}),S:()=>DJ({tag:`section-mark`}),copyright:()=>DJ({tag:`copyright`}),registered:()=>DJ({tag:`registered`}),trademark:()=>DJ({tag:`trademark`}),degree:()=>DJ({tag:`degree`}),textdegree:()=>DJ({tag:`degree`}),dagger:()=>DJ({tag:`dagger`}),ddagger:()=>DJ({tag:`dagger`}),ldots:()=>DJ({tag:`ellipsis`}),dots:()=>DJ({tag:`ellipsis`}),textpm:()=>DJ({tag:`plusminus`}),textregistered:()=>DJ({tag:`registered`}),texttrademark:()=>DJ({tag:`trademark`}),textsection:()=>DJ({tag:`section-mark`}),textpilcrow:()=>DJ({tag:`pilcrow`}),textperiodcentered:()=>DJ({tag:`midpoint`}),texttildelow:()=>DJ({tag:`swungdash`}),textperthousand:()=>DJ({tag:`permille`}),includegraphics:e=>{let t=WV(e);return DJ({tag:`image`,attributes:{source:tB(t[t.length-1]||[])},content:[]})},caption:(e,t)=>{let n=WV(e),r=GV(e).captionText||n[n.length-1]||[];return DJ({tag:t?.parents?.some(e=>e.type===`macro`&&e.content===`html-tag:table`)??!1?`title`:`caption`,content:r})}},oZ=`http://www.w3.org/2001/XInclude`,sZ={plus:{signature:`o m m`,renderInfo:{breakAround:!0}}},cZ=`frontmatter.part.chapter.section.subsection.subsubsection.preface.biography.dedication.glossary.appendix.index.bibliography.references.exercises.solutions.worksheet.handout.reading-questions.paragraphs.introduction.conclusion.backmatter.image.video.audio.interactive.program.listing.doenet.webwork.sageplot.asymptote.latex-image`.split(`.`),lZ=new Set([`width`,`margin`]);function uZ(e){let t={};if(!e)return t;for(let n of tB(e).split(`,`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);if(r===-1){t[e]=`yes`;continue}let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();(a.startsWith(`"`)&&a.endsWith(`"`)||a.startsWith(`'`)&&a.endsWith(`'`))&&(a=a.slice(1,-1)),a=a.replace(/\\%/g,`%`),lZ.has(i)&&/^\d+(\.\d+)?$/.test(a)&&(a+=`%`),i&&(t[i]=a)}return t}function dZ(e={}){let{format:t=`plus`,resolveHref:n=e=>`${e}.ptx`,resolveType:r,extraTypes:i=[]}=e,a=new Set([...cZ,...i]);function o(e,t,n){if(!t)return;let r=YY(e,n,`plus-subs`);t.message(r,r.place,r.source)}function s(e,r,i,a,s){if(t===`xinclude`){let t=Object.keys(s);return t.length>0&&o(e,r,`Warning: attributes "${t.join(`, `)}" cannot be represented on an <xi:include> element and were dropped.`),DJ({tag:`xi:include`,attributes:{"xmlns:xi":oZ,href:n(a,i)}})}return DJ({tag:`plus:${i}`,attributes:{ref:a,...s}})}return{plus:(e,t,n)=>{let r=WV(e),i=tB(r[1]||[]).trim(),c=ZY(tB(r[2]||[]).trim());return i?(a.has(i)||o(e,n,`Warning: "${i}" is not a recognized type in \\plus{${i}}{${c}}. It was used anyway; pass it in "extraTypes" to suppress this warning.`),s(e,n,i,c,uZ(r[0]))):(o(e,n,`Warning: \\plus is missing its type argument; expected \\plus[attrs]{type}{ref}. The macro was removed.`),Xz(``))},include:(e,t,n)=>{let i=WV(e),a=ZY(tB(i[i.length-1]||[]).trim());return s(e,n,r?.(a)||`include`,a,{})}}}function fZ(e,...t){return(n,r)=>Yz(e,t.map(e=>Jz(e)).concat(Jz(n)))}var pZ={color:$H,bfseries:fZ(`textbf`),itshape:fZ(`textit`),rmfamily:fZ(`textrm`),scshape:fZ(`textsc`),sffamily:fZ(`textsf`),slshape:fZ(`textsl`),ttfamily:fZ(`texttt`),Huge:fZ(`textsize`,`Huge`),huge:fZ(`textsize`,`huge`),LARGE:fZ(`textsize`,`LARGE`),Large:fZ(`textsize`,`Large`),large:fZ(`textsize`,`large`),normalsize:fZ(`textsize`,`normalsize`),small:fZ(`textsize`,`small`),footnotesize:fZ(`textsize`,`footnotesize`),scriptsize:fZ(`textsize`,`scriptsize`),tiny:fZ(`textsize`,`tiny`)},mZ=function(e){let{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}=e||{};return e=>{let r=!1;SB(e,e=>{(Q.environment(e,`document`)||aX(e))&&(Q.environment(e,`document`)&&(r=!0),e.content=_X(e.content,{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}))},{test:Q.anyEnvironment}),r||(e.content=_X(e.content,{macrosThatBreakPars:t,environmentsThatDontBreakPars:n}))}};function hZ(e){let t={messages:[]},n=Q.createMacroMatcher(nZ.macros);return SB(e,(e,r)=>{aB(e)&&r.context.hasMathModeAncestor&&(n(e)||t.messages.push(YY(e,`Warning: \"${e.content}\" is unsupported by Katex.`,`report-unsupported-macro-katex`)))}),t}var gZ=function(e){let t=Object.assign({},aZ,dZ(e?.plusIncludes),e?.macroReplacements||{}),n=Object.assign({},TX,qX,e?.environmentReplacements||{}),r=e?.producePretextFragment?e?.producePretextFragment:!1,i=Q.createMacroMatcher(t),a=Q.createEnvironmentMatcher(n),o=Q.createMacroMatcher($X),s=Q.createEnvironmentMatcher(eZ);return(e,c)=>{let l=e;bZ(e);let u=eJ().use(BJ,{fix:!0}).use(JB,{replacers:pZ}),d=sX(e);for(let e of d.messages)c.message(e,e.place,`unified-latex-to-pretext:break-on-boundaries`);xZ(e),_Z(e)&&(u=u.use(mZ)),e=u.runSync(e,c),FB(e,(e,t)=>{if(!t.context.hasMathModeAncestor&&a(e))return n[tB(e.env)](e,t,c)}),FB(e,(e,n)=>{if(!n.context.hasMathModeAncestor&&i(e))return t[e.content](e,n,c)});let f=hZ(e);for(let e of f.messages)c.message(e,e.place,`unified-latex-to-pretext:report-unsupported-macro-mathjax`);tZ(e),FB(e,e=>{if(o(e))return $X[e.content](e);if(s(e))return eZ[tB(e.env)](e)}),r||(yZ(e),e.content=[DJ({tag:`pretext`,content:e.content})]),l.content=e.content}};function _Z(e){let t=e.content;return SB(e,e=>{if(Q.anyEnvironment(e))return t=e.content,bB},{test:e=>Q.environment(e,`document`)}),vZ(t)}function vZ(e){return e.some(e=>aX(e)?vZ(e.content):Q.parbreak(e)||Q.macro(e,`par`))}function yZ(e){let t=e.content.find(e=>iB(e)&&oX(e));if(t){e.content=[t];return}let n=!1,r=SZ(e,`documentclass`);if(r){let e=WV(r)[0];if(e){let t=e[0];(t.content==`book`||t.content==`memoir`)&&(n=!0)}}n||SB(e,e=>{if(iB(e)&&e.env==`_chapter`)return n=!0,bB});let i=SZ(e,`title`);if(i){let t=WV(i)[1];t?(e.content.unshift(DJ({tag:`title`,content:t})),FB(e,e=>{if(e===i)return[]})):e.content.unshift(DJ({tag:`title`,content:Xz(``)}))}else e.content.unshift(DJ({tag:`title`,content:Xz(``)}));n?e.content=[DJ({tag:`book`,content:e.content})]:e.content=[DJ({tag:`article`,content:e.content})]}function bZ(e){FB(e,(e,t)=>{if(Q.comment(e)&&(t.context.inMathMode||t.context.hasMathModeAncestor))return null})}function xZ(e){FB(e,(e,t)=>{if(Q.macro(e,`label`)){let n=WV(e),r=n[n.length-1];if(r){let e=t.parents[0]?._renderInfo??{};e&&(e.additionalAttributes=e.additionalAttributes??{},e.additionalAttributes[`xml:id`]=ZY(tB(r)),t.parents[0]._renderInfo=e)}return null}})}function SZ(e,t){let n=null;return SB(e,e=>{if(iB(e))return yB;if(aB(e)&&e.content===t)return n=e,bB}),n}function CZ(e){let t=dY(e),n=new Set(t.map(e=>e.name)),r=Object.fromEntries(t.map(e=>[e.name,{signature:e.signature}]));for(let i=0;i<100&&wZ(e,n);i++)UV(e,r),fY(e,t)}function wZ(e,t){let n=!1;return SB(e,e=>{aB(e)&&t.has(e.content)&&(n=!0)}),n}function TZ(e,t){return e.type===`string`&&e.content===t}function EZ(e){return!e||e.type!==`string`?!1:/^[a-zA-Z]/.test(e.content)}function DZ(e){let t=[],n=[],r=0;for(;r<e.length;){let i=e[r],a=e[r+1];if(Q.parbreak(i)){for(;n.length>0;)n.pop();t.push(i),r++;continue}if(TZ(i,"`")&&a&&TZ(a,"`")){n.push({kind:`double`,startIndex:t.length}),t.push(i,a),r+=2;continue}if(TZ(i,`'`)&&a&&TZ(a,`'`)){let e=OZ(n,`double`);if(e!==-1){let i=n.splice(e,1)[0],a=t.splice(i.startIndex);a.splice(0,2);let o=DZ(a);t.push(Yz(`enquote`,[Jz(o,{braces:`{}`})])),r+=2;continue}t.push(i,a),r+=2;continue}if(TZ(i,"`")&&!(a&&TZ(a,"`"))){n.push({kind:`single`,startIndex:t.length}),t.push(i),r++;continue}if(TZ(i,`'`)&&!(a&&TZ(a,`'`))){let a=OZ(n,`single`);if(a!==-1&&!EZ(e[r+1])){let e=n.splice(a,1)[0],i=t.splice(e.startIndex);i.splice(0,1);let o=DZ(i);t.push(Yz(`sq`,[Jz(o,{braces:`{}`})])),r++;continue}t.push(i),r++;continue}t.push(i),r++}return t}function OZ(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].kind===t)return n;return-1}function kZ(e){let t=[],n=0;for(;n<e.length;){let r=e[n],i=e[n+1],a=e[n+2];if(TZ(r,`-`)&&TZ(i,`-`)&&TZ(a,`-`)){t.push(Yz(`mdash`)),n+=3;continue}if(TZ(r,`-`)&&TZ(i,`-`)){t.push(Yz(`ndash`)),n+=2;continue}if(TZ(r,`~`)){t.push(Yz(`nbsp`)),n++;continue}if(TZ(r,`'`)||TZ(r,"`")){t.push(r),n++;continue}t.push(r),n++}return t}function AZ(e){SB(e,(e,t)=>{if(t.context.inMathMode||t.context.hasMathModeAncestor)return;let n=kZ(DZ(e));e.length=0,e.push(...n)},{includeArrays:!0,test:Array.isArray})}var jZ={...sZ,term:{signature:`m`},code:{signature:`m`},lstinline:{signature:`m`},book:{signature:`m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`title`]}},article:{signature:`m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`title`]}},slideshow:{signature:`m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`title`]}},preface:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},biography:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},dedication:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},glossary:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},exercises:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},worksheet:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},handout:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},paragraphs:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},readingquestions:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},solutions:{signature:`s o m`,renderInfo:{breakAround:!0,inParMode:!0,namedArguments:[`starred`,`tocTitle`,`title`]}},fn:{signature:`m`},q:{signature:`m`},sq:{signature:`m`},enquote:{signature:`m`},enquotestar:{signature:`m`},abbr:{signature:`m`},ac:{signature:`m`},acro:{signature:`m`},init:{signature:`m`},foreign:{signature:`m`},foreignlanguage:{signature:`m m`},booktitle:{signature:`m`},pubtitle:{signature:`m`},articletitle:{signature:`m`},xmltag:{signature:`m`},xmlattr:{signature:`m`},taxon:{signature:`m`},kbd:{signature:`m`},icon:{signature:`m`},nb:{signature:``},ps:{signature:``},vs:{signature:``},viz:{signature:``},etal:{signature:``},circa:{signature:``},ca:{signature:``},PreFigure:{signature:``},XeLaTeX:{signature:``},timeofday:{signature:``},mdash:{signature:``},ndash:{signature:``},nbsp:{signature:``},sout:{signature:`m`},insert:{signature:`m`},stale:{signature:`m`}},MZ={aside:{signature:`o`},biographical:{signature:`o`},historical:{signature:`o`},assemblage:{signature:`o`},activity:{signature:`o`},exploration:{signature:`o`},investigation:{signature:`o`},project:{signature:`o`},computation:{signature:`o`},technology:{signature:`o`},data:{signature:`o`},case:{signature:`o`},poem:{signature:`o`},sidebyside:{signature:`o`},program:{signature:`o`},console:{signature:``},sage:{signature:``},webwork:{signature:`o`},task:{signature:`o`},preface:{signature:`o`},biography:{signature:`o`},dedication:{signature:`o`},glossary:{signature:`o`},exercises:{signature:`o`},exercisegroup:{signature:`o`},subexercises:{signature:`o`},worksheet:{signature:`o`},handout:{signature:`o`},readingquestions:{signature:`o`},"reading-questions":{signature:`o`},introduction:{signature:`o`},conclusion:{signature:`o`},paragraphs:{signature:`o`},objectives:{signature:`o`},outcomes:{signature:`o`},solutions:{signature:`o`},gi:{signature:`o`},sbsgroup:{signature:`o`},stack:{signature:`o`},list:{signature:`o`},listing:{signature:`o`}};function NZ(e){return e.replace(/\u2014/g,`---`).replace(/\u2013/g,`--`).replace(/\u00A0/g,` `).replace(/\u201C/g,"``").replace(/\u201D/g,`''`).replace(/\u2018/g,"`").replace(/\u2019/g,`'`).replace(/\u00AB/g,`<<`).replace(/\u00BB/g,`>>`).replace(/\u2026/g,`...`).replace(/\u2009/g,` `).replace(/\u2005/g,` `).replace(/\u2002/g,` `).replace(/\u2003/g,` `)}var PZ=function(e){return(t,n)=>{let r=e?.producePretextFragment?e?.producePretextFragment:!1;CZ(t),AZ(t),UV(t,jZ),SB(t,e=>{if(!Q.environment(e))return;let t=MZ[tB(e.env)];if(t?.signature&&e.args==null){let{args:n}=zV(e.content,t.signature);e.args=n}}),OX(t);let i=t.content;SB(t,e=>(i=e.content,bB),{test:(e=>Q.environment(e,`document`))}),t.content=i,eJ().use(gZ,e).run(t,n),SJ(t),i=t.content;let a=hX(n.message.bind(n),typeof n.value==`string`?n.value:void 0)({type:`root`,content:i});Array.isArray(a)||(a=[a]);let o=Dq();return o.children=a,r||o.children.unshift({type:`instruction`,name:`xml`,value:`version='1.0' encoding='utf-8'`}),(function e(t){for(let n of t)n.type===`text`?n.value=NZ(n.value):`children`in n&&e(n.children)})(o.children),o}},FZ=function(){this.Compiler=e=>JY(e,{closeEmptyElements:!0})};Eq().use(PZ).use(FZ);function IZ(e){return(e=>Eq().use(PZ,{producePretextFragment:!0}).use(FZ).processSync({value:e}))(e)}var LZ={basename:RZ,dirname:zZ,extname:BZ,join:VZ,sep:`/`};function RZ(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);WZ(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function zZ(e){if(WZ(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function BZ(e){WZ(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function VZ(...e){let t=-1,n;for(;++t<e.length;)WZ(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:HZ(n)}function HZ(e){WZ(e);let t=e.codePointAt(0)===47,n=UZ(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function UZ(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function WZ(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var GZ={cwd:KZ};function KZ(){return`/`}function qZ(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function JZ(e){if(typeof e==`string`)e=new URL(e);else if(!qZ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return YZ(e)}function YZ(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var XZ=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ZZ=class{constructor(e){let t;t=e?qZ(e)?{path:e}:typeof e==`string`||tQ(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:GZ.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<XZ.length;){let e=XZ[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)XZ.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?LZ.basename(this.path):void 0}set basename(e){$Z(e,`basename`),QZ(e,`basename`),this.path=LZ.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?LZ.dirname(this.path):void 0}set dirname(e){eQ(this.basename,`dirname`),this.path=LZ.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?LZ.extname(this.path):void 0}set extname(e){if(QZ(e,`extname`),eQ(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=LZ.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){qZ(e)&&(e=JZ(e)),$Z(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?LZ.basename(this.path,this.extname):void 0}set stem(e){$Z(e,`stem`),QZ(e,`stem`),this.path=LZ.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new FJ(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function QZ(e,t){if(e&&e.includes(LZ.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+LZ.sep+"`")}function $Z(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function eQ(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function tQ(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var nQ=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),rQ={}.hasOwnProperty,iQ=new class e extends nQ{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=mR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,VR.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(sQ(`data`,this.frozen),this.namespace[e]=t,this):rQ.call(this.namespace,e)&&this.namespace[e]||void 0:e?(sQ(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=uQ(e),n=this.parser||this.Parser;return aQ(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),aQ(`process`,this.parser||this.Parser),oQ(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=uQ(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);fQ(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),aQ(`processSync`,this.parser||this.Parser),oQ(`processSync`,this.compiler||this.Compiler),this.process(e,r),lQ(`processSync`,`process`,t),n;function r(e,r){t=!0,uR(e),n=r}}run(e,t,n){cQ(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=uQ(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),lQ(`runSync`,`run`,n),r;function i(e,t){uR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=uQ(t),r=this.compiler||this.Compiler;return oQ(`stringify`,r),cQ(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(sQ(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,VR.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];pR(o)&&pR(r)&&(r=(0,VR.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function aQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function oQ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function sQ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cQ(e){if(!pR(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function lQ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function uQ(e){return dQ(e)?e:new ZZ(e)}function dQ(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function fQ(e){return typeof e==`string`||pQ(e)}function pQ(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var mQ={};function hQ(e,t){let n=t||mQ;return gQ(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function gQ(e,t,n){if(vQ(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return _Q(e.children,t,n)}return Array.isArray(e)?_Q(e,t,n):``}function _Q(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=gQ(e[i],t,n);return r.join(``)}function vQ(e){return!!(e&&typeof e==`object`)}var yQ=document.createElement(`i`);function bQ(e){let t=`&`+e+`;`;yQ.innerHTML=t;let n=yQ.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function xQ(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function SQ(e,t){return e.length>0?(xQ(e,e.length,0,t),e):t}var CQ={}.hasOwnProperty;function wQ(e){let t={},n=-1;for(;++n<e.length;)TQ(t,e[n]);return t}function TQ(e,t){let n;for(n in t){let r=(CQ.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){CQ.call(r,a)||(r[a]=[]);let e=i[a];EQ(r[a],Array.isArray(e)?e:e?[e]:[])}}}function EQ(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);xQ(e,0,0,r)}function DQ(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function OQ(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var kQ=VQ(/[A-Za-z]/),AQ=VQ(/[\dA-Za-z]/),jQ=VQ(/[#-'*+\--9=?A-Z^-~]/);function MQ(e){return e!==null&&(e<32||e===127)}var NQ=VQ(/\d/),PQ=VQ(/[\dA-Fa-f]/),FQ=VQ(/[!-/:-@[-`{-~]/);function IQ(e){return e!==null&&e<-2}function LQ(e){return e!==null&&(e<0||e===32)}function RQ(e){return e===-2||e===-1||e===32}var zQ=VQ(/\p{P}|\p{S}/u),BQ=VQ(/\s/);function VQ(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function HQ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return RQ(r)?(e.enter(n),s(r)):t(r)}function s(r){return RQ(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var UQ={tokenize:WQ};function WQ(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),HQ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return IQ(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var GQ={tokenize:qQ},KQ={tokenize:JQ};function qQ(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return xQ(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(KQ,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(KQ,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return IQ(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;xQ(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function JQ(e,t,n){return HQ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function YQ(e){if(e===null||LQ(e)||BQ(e))return 1;if(zQ(e))return 2}function XQ(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var ZQ={name:`attention`,resolveAll:QQ,tokenize:$Q};function QQ(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};e$(d,-c),e$(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=SQ(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=SQ(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=SQ(l,XQ(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=SQ(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=SQ(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,xQ(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function $Q(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=YQ(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=YQ(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function e$(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var t$={name:`autolink`,tokenize:n$};function n$(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return kQ(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||AQ(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||AQ(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||MQ(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):jQ(t)?(e.consume(t),l):n(t)}function u(e){return AQ(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||AQ(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var r$={partial:!0,tokenize:i$};function i$(e,t,n){return r;function r(t){return RQ(t)?HQ(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||IQ(e)?t(e):n(e)}}var a$={continuation:{tokenize:s$},exit:c$,name:`blockQuote`,tokenize:o$};function o$(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return RQ(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function s$(e,t,n){let r=this;return i;function i(t){return RQ(t)?HQ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(a$,t,n)(r)}}function c$(e){e.exit(`blockQuote`)}var l$={name:`characterEscape`,tokenize:u$};function u$(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return FQ(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var d$={name:`characterReference`,tokenize:f$};function f$(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=AQ,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=PQ,u):(e.enter(`characterReferenceValue`),a=7,o=NQ,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===AQ&&!bQ(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var p$={partial:!0,tokenize:g$},m$={concrete:!0,name:`codeFenced`,tokenize:h$};function h$(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),RQ(t)?HQ(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||IQ(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(p$,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||IQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):RQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),HQ(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||IQ(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||IQ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&RQ(t)?HQ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||IQ(t)?e.check(p$,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||IQ(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),RQ(t)?HQ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),RQ(t)?HQ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||IQ(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function g$(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var _$={name:`codeIndented`,tokenize:y$},v$={partial:!0,tokenize:b$};function y$(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),HQ(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):IQ(t)?e.attempt(v$,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||IQ(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function b$(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):IQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):HQ(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):IQ(e)?i(e):n(e)}}var x$={name:`codeText`,previous:C$,resolve:S$,tokenize:w$};function S$(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function C$(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function w$(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):IQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||IQ(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var T$=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&E$(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),E$(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),E$(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);E$(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);E$(this.left,t.reverse())}}};function E$(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function D$(e){let t={},n=-1,r,i,a,o,s,c,l,u=new T$(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,O$(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return xQ(e,0,1/0,u.slice(0)),!l}function O$(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var k$={resolve:j$,tokenize:M$},A$={partial:!0,tokenize:N$};function j$(e){return D$(e),e}function M$(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):IQ(t)?e.check(A$,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function N$(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),HQ(e,a,`linePrefix`)}function a(i){if(i===null||IQ(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function P$(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||MQ(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||IQ(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||LQ(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||MQ(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function F$(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):IQ(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||IQ(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!RQ(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function I$(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):IQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),HQ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||IQ(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function L$(e,t){let n;return r;function r(i){return IQ(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):RQ(i)?HQ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var R$={name:`definition`,tokenize:B$},z$={partial:!0,tokenize:V$};function B$(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return F$.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=OQ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return LQ(t)?L$(e,l)(t):l(t)}function l(t){return P$(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(z$,d,d)(t)}function d(t){return RQ(t)?HQ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||IQ(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function V$(e,t,n){return r;function r(t){return LQ(t)?L$(e,i)(t):n(t)}function i(t){return I$(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return RQ(t)?HQ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||IQ(e)?t(e):n(e)}}var H$={name:`hardBreakEscape`,tokenize:U$};function U$(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return IQ(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var W$={name:`headingAtx`,resolve:G$,tokenize:K$};function G$(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},xQ(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function K$(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||LQ(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||IQ(n)?(e.exit(`atxHeading`),t(n)):RQ(n)?HQ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||LQ(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var q$=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),J$=[`pre`,`script`,`style`,`textarea`],Y$={concrete:!0,name:`htmlFlow`,resolveTo:Q$,tokenize:$$},X$={partial:!0,tokenize:t1},Z$={partial:!0,tokenize:e1};function Q$(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function $$(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):kQ(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):kQ(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return kQ(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||LQ(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&J$.includes(l)?(i=1,r.interrupt?t(s):O(s)):q$.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||AQ(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return RQ(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||kQ(t)?(e.consume(t),b):RQ(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||AQ(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):RQ(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):RQ(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||IQ(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||LQ(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||RQ(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||IQ(t)?O(t):RQ(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),te):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):IQ(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(X$,ie,k)(t)):t===null||IQ(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Z$,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||IQ(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function te(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return J$.includes(n)?(e.consume(t),re):O(t)}return kQ(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||IQ(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function e1(e,t,n){let r=this;return i;function i(t){return IQ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function t1(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(r$,t,n)}}var n1={name:`htmlText`,tokenize:r1};function r1(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):kQ(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):kQ(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):IQ(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?te(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):IQ(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?te(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?te(t):IQ(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):IQ(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?te(e):y(e)}function x(t){return kQ(t)?(e.consume(t),S):n(t)}function S(t){return t===45||AQ(t)?(e.consume(t),S):C(t)}function C(t){return IQ(t)?(o=C,j(t)):RQ(t)?(e.consume(t),C):te(t)}function w(t){return t===45||AQ(t)?(e.consume(t),w):t===47||t===62||LQ(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),te):t===58||t===95||kQ(t)?(e.consume(t),E):IQ(t)?(o=T,j(t)):RQ(t)?(e.consume(t),T):te(t)}function E(t){return t===45||t===46||t===58||t===95||AQ(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):IQ(t)?(o=D,j(t)):RQ(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):IQ(t)?(o=O,j(t)):RQ(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):IQ(t)?(o=k,j(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||LQ(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||LQ(e)?T(e):n(e)}function te(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return RQ(t)?HQ(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var i1={name:`labelEnd`,resolveAll:c1,resolveTo:l1,tokenize:u1},a1={tokenize:d1},o1={tokenize:f1},s1={tokenize:p1};function c1(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&xQ(e,0,e.length,n),e}function l1(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=SQ(s,e.slice(a+1,a+r+3)),s=SQ(s,[[`enter`,u,t]]),s=SQ(s,XQ(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=SQ(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=SQ(s,e.slice(o+1)),s=SQ(s,[[`exit`,c,t]]),xQ(e,a,e.length,s),e}function u1(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(OQ(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(a1,u,o?u:d)(t):t===91?e.attempt(o1,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(s1,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function d1(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return LQ(t)?L$(e,a)(t):a(t)}function a(t){return t===41?u(t):P$(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return LQ(t)?L$(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?I$(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return LQ(t)?L$(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function f1(e,t,n){let r=this;return i;function i(t){return F$.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(OQ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function p1(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var m1={name:`labelStartImage`,resolveAll:i1.resolveAll,tokenize:h1};function h1(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var g1={name:`labelStartLink`,resolveAll:i1.resolveAll,tokenize:_1};function _1(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var v1={name:`lineEnding`,tokenize:y1};function y1(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),HQ(e,t,`linePrefix`)}}var b1={name:`thematicBreak`,tokenize:x1};function x1(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||IQ(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),RQ(t)?HQ(e,s,`whitespace`)(t):s(t))}}var S1={continuation:{tokenize:E1},exit:O1,name:`list`,tokenize:T1},C1={partial:!0,tokenize:k1},w1={partial:!0,tokenize:D1};function T1(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:NQ(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(b1,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return NQ(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(r$,r.interrupt?n:u,e.attempt(C1,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return RQ(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function E1(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(r$,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,HQ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!RQ(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(w1,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,HQ(e,e.attempt(S1,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function D1(e,t,n){let r=this;return HQ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function O1(e){e.exit(this.containerState.type)}function k1(e,t,n){let r=this;return HQ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!RQ(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var A1={name:`setextUnderline`,resolveTo:j1,tokenize:M1};function j1(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function M1(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),RQ(t)?HQ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||IQ(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var N1={tokenize:P1};function P1(e){let t=this,n=e.attempt(r$,r,e.attempt(this.parser.constructs.flowInitial,i,HQ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(k$,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var F1={resolveAll:z1()},I1=R1(`string`),L1=R1(`text`);function R1(e){return{resolveAll:z1(e===`text`?B1:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function z1(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function B1(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var V1=m({attentionMarkers:()=>Y1,contentInitial:()=>U1,disable:()=>X1,document:()=>H1,flow:()=>G1,flowInitial:()=>W1,insideSpan:()=>J1,string:()=>K1,text:()=>q1}),H1={42:S1,43:S1,45:S1,48:S1,49:S1,50:S1,51:S1,52:S1,53:S1,54:S1,55:S1,56:S1,57:S1,62:a$},U1={91:R$},W1={[-2]:_$,[-1]:_$,32:_$},G1={35:W$,42:b1,45:[A1,b1],60:Y$,61:A1,95:b1,96:m$,126:m$},K1={38:d$,92:l$},q1={[-5]:v1,[-4]:v1,[-3]:v1,33:m1,38:d$,42:ZQ,60:[t$,n1],91:g1,92:[H$,l$],93:i1,95:ZQ,96:x$},J1={null:[ZQ,F1]},Y1={null:[42,95]},X1={null:[]};function Z1(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=SQ(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=XQ(a,l.events,l),l.events):[]}function f(e,t){return $1(p(e),t)}function p(e){return Q1(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){IQ(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&xQ(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Q1(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function $1(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
1054
1054
|
`;break;case-3:o=`\r
|
|
1055
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Q1(e){let t={constructs:SQ([z1,...(e||{}).extensions||[]]),content:n(VQ),defined:[],document:n(UQ),flow:n(j1),lazy:{},string:n(P1),text:n(F1)};return t;function n(e){return n;function n(n){return Y1(t,e,n)}}}function $1(e){for(;!T$(e););return e}var e0=/[\0\t\n\r]/g;function t0(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(e0.lastIndex=u,c=e0.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var n0=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function r0(e){return e.replace(n0,i0)}function i0(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return TQ(n.slice(t?2:1),t?16:10)}return vQ(n)||e}var a0={}.hasOwnProperty;function o0(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),s0(n)($1(Q1(n).document().write(t0()(e,t,!0))))}function s0(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(de),characterEscape:T,characterReference:T,codeFenced:a(F),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(F,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(I,o),htmlFlowData:T,htmlText:a(I,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:ae,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Se),thematicBreak:a(L)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ue,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:P,characterReference:ce,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ee),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(j),label:ne,labelText:M,lineEnding:D,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:N,resourceTitleString:re,resource:ie,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};l0(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];a0.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||d0).call(a,void 0,e[0])}for(r.position={start:c0(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:c0(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:c0(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||d0).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+jJ({start:e.start,end:e.end})+`): it’s not open`);n.position.end=c0(e.end)}function u(){return pQ(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=EQ(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:c0(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=c0(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=c0(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=r0(t),n.identifier=EQ(t).toLowerCase()}function ne(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ie(){this.data.inReference=void 0}function ae(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=EQ(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function P(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=TQ(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=vQ(t);let i=this.stack[this.stack.length-1];i.value+=r}function ce(e){let t=this.stack.pop();t.position.end=c0(e.end)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function de(){return{type:`blockquote`,children:[]}}function F(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function I(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function L(){return{type:`thematicBreak`}}}function c0(e){return{line:e.line,column:e.column,offset:e.offset}}function l0(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?l0(e,r):u0(e,r)}}function u0(e,t){let n;for(n in t)if(a0.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function d0(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+jJ({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jJ({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+jJ({start:t.start,end:t.end})+`) is still open`)}function f0(e){let t=this;t.parser=n;function n(n){return o0(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}var p0={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function m0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function h0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function g0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function _0(e){return g0(e)||m0(e)}var v0=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function y0(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?_0:u===`decimal`?m0:h0;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&xY.includes(y)&&(_=y,v=vQ(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?vQ(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):_0(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(b0(e))h(7,S),C=`�`;else if(e in p0)h(6,S),C=p0[e];else{let t=``;x0(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,v0[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function b0(e){return e>=55296&&e<=57343||e>1114111}function x0(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var S0=(function(e){if(e==null)return D0;if(typeof e==`function`)return E0(e);if(typeof e==`object`)return Array.isArray(e)?C0(e):w0(e);if(typeof e==`string`)return T0(e);throw Error(`Expected function, string, or object as test`)});function C0(e){let t=[],n=-1;for(;++n<e.length;)t[n]=S0(e[n]);return E0(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function w0(e){let t=e;return E0(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function T0(e){return E0(t);function t(t){return t&&t.type===e}}function E0(e){return t;function t(t,n,r){return!!(O0(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function D0(){return!0}function O0(e){return typeof e==`object`&&!!e&&`type`in e}function k0(e){return e}var A0=[];function j0(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=S0(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+k0(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=A0,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=M0(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function M0(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?A0:[e]}var N0={}.hasOwnProperty,P0={},F0=/^[^\t\n\r "#'.<=>`}]+$/,I0=/^[^\t\n\r "'<=>`}]+$/;function L0(){return{canContainEols:[`textDirective`],enter:{directiveContainer:z0,directiveContainerAttributes:K0,directiveContainerLabel:W0,directiveLeaf:B0,directiveLeafAttributes:K0,directiveText:V0,directiveTextAttributes:K0},exit:{directiveContainer:Q0,directiveContainerAttributeClassValue:J0,directiveContainerAttributeIdValue:q0,directiveContainerAttributeName:X0,directiveContainerAttributeValue:Y0,directiveContainerAttributes:Z0,directiveContainerLabel:G0,directiveContainerName:U0,directiveLeaf:Q0,directiveLeafAttributeClassValue:J0,directiveLeafAttributeIdValue:q0,directiveLeafAttributeName:X0,directiveLeafAttributeValue:Y0,directiveLeafAttributes:Z0,directiveLeafName:U0,directiveText:Q0,directiveTextAttributeClassValue:J0,directiveTextAttributeIdValue:q0,directiveTextAttributeName:X0,directiveTextAttributeValue:Y0,directiveTextAttributes:Z0,directiveTextName:U0}}}function R0(e){let t=e||P0;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=$0,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
1056
|
-
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=
|
|
1055
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function e0(e){let t={constructs:wQ([V1,...(e||{}).extensions||[]]),content:n(UQ),defined:[],document:n(GQ),flow:n(N1),lazy:{},string:n(I1),text:n(L1)};return t;function n(e){return n;function n(n){return Z1(t,e,n)}}}function t0(e){for(;!D$(e););return e}var n0=/[\0\t\n\r]/g;function r0(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(n0.lastIndex=u,c=n0.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var i0=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function a0(e){return e.replace(i0,o0)}function o0(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return DQ(n.slice(t?2:1),t?16:10)}return bQ(n)||e}var s0={}.hasOwnProperty;function c0(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),l0(n)(t0(e0(n).document().write(r0()(e,t,!0))))}function l0(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(de),characterEscape:T,characterReference:T,codeFenced:a(F),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(F,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(I,o),htmlFlowData:T,htmlText:a(I,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:ae,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Se),thematicBreak:a(L)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ue,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:P,characterReference:ce,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ee),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(j),label:ne,labelText:M,lineEnding:D,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:N,resourceTitleString:re,resource:ie,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};d0(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];s0.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||p0).call(a,void 0,e[0])}for(r.position={start:u0(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:u0(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:u0(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||p0).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+jJ({start:e.start,end:e.end})+`): it’s not open`);n.position.end=u0(e.end)}function u(){return hQ(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=OQ(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:u0(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=u0(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=u0(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=a0(t),n.identifier=OQ(t).toLowerCase()}function ne(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ie(){this.data.inReference=void 0}function ae(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=OQ(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function P(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=DQ(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=bQ(t);let i=this.stack[this.stack.length-1];i.value+=r}function ce(e){let t=this.stack.pop();t.position.end=u0(e.end)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function de(){return{type:`blockquote`,children:[]}}function F(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function I(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function L(){return{type:`thematicBreak`}}}function u0(e){return{line:e.line,column:e.column,offset:e.offset}}function d0(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?d0(e,r):f0(e,r)}}function f0(e,t){let n;for(n in t)if(s0.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function p0(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+jJ({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jJ({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+jJ({start:t.start,end:t.end})+`) is still open`)}function m0(e){let t=this;t.parser=n;function n(n){return c0(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}var h0={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function g0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function _0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function v0(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function y0(e){return v0(e)||g0(e)}var b0=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function x0(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?y0:u===`decimal`?g0:_0;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&xY.includes(y)&&(_=y,v=bQ(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?bQ(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):y0(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(S0(e))h(7,S),C=`�`;else if(e in h0)h(6,S),C=h0[e];else{let t=``;C0(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,b0[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function S0(e){return e>=55296&&e<=57343||e>1114111}function C0(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var w0=(function(e){if(e==null)return k0;if(typeof e==`function`)return O0(e);if(typeof e==`object`)return Array.isArray(e)?T0(e):E0(e);if(typeof e==`string`)return D0(e);throw Error(`Expected function, string, or object as test`)});function T0(e){let t=[],n=-1;for(;++n<e.length;)t[n]=w0(e[n]);return O0(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function E0(e){let t=e;return O0(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function D0(e){return O0(t);function t(t){return t&&t.type===e}}function O0(e){return t;function t(t,n,r){return!!(A0(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function k0(){return!0}function A0(e){return typeof e==`object`&&!!e&&`type`in e}function j0(e){return e}var M0=[];function N0(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=w0(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+j0(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=M0,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=P0(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function P0(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?M0:[e]}var F0={}.hasOwnProperty,I0={},L0=/^[^\t\n\r "#'.<=>`}]+$/,R0=/^[^\t\n\r "'<=>`}]+$/;function z0(){return{canContainEols:[`textDirective`],enter:{directiveContainer:V0,directiveContainerAttributes:J0,directiveContainerLabel:K0,directiveLeaf:H0,directiveLeafAttributes:J0,directiveText:U0,directiveTextAttributes:J0},exit:{directiveContainer:e2,directiveContainerAttributeClassValue:X0,directiveContainerAttributeIdValue:Y0,directiveContainerAttributeName:Q0,directiveContainerAttributeValue:Z0,directiveContainerAttributes:$0,directiveContainerLabel:q0,directiveContainerName:G0,directiveLeaf:e2,directiveLeafAttributeClassValue:X0,directiveLeafAttributeIdValue:Y0,directiveLeafAttributeName:Q0,directiveLeafAttributeValue:Z0,directiveLeafAttributes:$0,directiveLeafName:G0,directiveText:e2,directiveTextAttributeClassValue:X0,directiveTextAttributeIdValue:Y0,directiveTextAttributeName:Q0,directiveTextAttributeValue:Z0,directiveTextAttributes:$0,directiveTextName:G0}}}function B0(e){let t=e||I0;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=t2,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
1056
|
+
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=r2(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=n2(t)?t:void 0}else l=e;if(l&&l.children&&l.children.length>0){let t=n.enter(`label`),r=`${e.type}Label`,i=n.enter(r);c+=a.move(`[`),c+=a.move(n.containerPhrasing(l,{...a.current(),before:c,after:`]`})),c+=a.move(`]`),i(),t()}if(c+=a.move(r(e,n)),e.type===`containerDirective`){let t=(e.children||[])[0],r=e;n2(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
|
|
1057
1057
|
`),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
|
|
1058
|
-
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(
|
|
1059
|
-
`,`\r`];return e+`=`+s+CY(n,{subset:c})+s}}function z0(e){H0.call(this,`containerDirective`,e)}function B0(e){H0.call(this,`leafDirective`,e)}function V0(e){H0.call(this,`textDirective`,e)}function H0(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function U0(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function W0(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function G0(e){this.exit(e)}function K0(){this.data.directiveAttributes=[],this.buffer()}function q0(e){this.data.directiveAttributes.push([`id`,y0(this.sliceSerialize(e),{attribute:!0})])}function J0(e){this.data.directiveAttributes.push([`class`,y0(this.sliceSerialize(e),{attribute:!0})])}function Y0(e){let t=this.data.directiveAttributes;t[t.length-1][1]=y0(this.sliceSerialize(e),{attribute:!0})}function X0(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Z0(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Q0(e){this.exit(e)}function $0(){return`:`}function e2(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function t2(e){let t=0;return e.type===`containerDirective`?(j0(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function n2(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&IQ(t)?BQ(e,v,`whitespace`)(t):!m&&FQ(t)?F$(e,v)(t):t===null||PQ(t)||RQ(t)||LQ(t)&&t!==45&&t!==95?A(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||FQ(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||FQ(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||PQ(t)||RQ(t)||LQ(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&IQ(t)?BQ(e,C,`whitespace`)(t):!m&&FQ(t)?F$(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&PQ(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&IQ(t)?BQ(e,w,`whitespace`)(t):!m&&FQ(t)?F$(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||FQ(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),k):(e.enter(d),D(t))}function D(t){return t===g?(e.exit(d),E(t)):t===null?n(t):PQ(t)?m?n(t):F$(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||PQ(t)?(e.exit(p),D(t)):(e.consume(t),O)}function k(e){return e===125||FQ(e)?v(e):A(e)}function A(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function r2(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):PQ(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function i2(e,t,n,r){let i=this;return a;function a(t){return t===null||PQ(t)||LQ(t)||RQ(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||PQ(a)||RQ(a)||LQ(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var a2={tokenize:l2,concrete:!0},o2={tokenize:u2,partial:!0},s2={tokenize:d2,partial:!0},c2={tokenize:f2,partial:!0};function l2(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),i2.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(o2,d,d)(t):d(t)}function d(t){return t===123?e.attempt(s2,f,f)(t):f(t)}function f(t){return BQ(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):PQ(i)?r.interrupt?t(i):e.attempt(c2,m,C)(i):n(i)}function m(t){return t===null?C(t):PQ(t)?e.check(c2,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?BQ(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):PQ(t)?e.check(c2,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return PQ(t)?e.check(c2,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return BQ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),BQ(e,c,`whitespace`)(t))}function c(r){return r===null||PQ(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function u2(e,t,n){return r2(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function d2(e,t,n){return n2(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function f2(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var p2={tokenize:g2},m2={tokenize:_2,partial:!0},h2={tokenize:v2,partial:!0};function g2(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),i2.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(m2,s,s)(t):s(t)}function s(t){return t===123?e.attempt(h2,c,c)(t):c(t)}function c(t){return BQ(e,l,`whitespace`)(t)}function l(r){return r===null||PQ(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function _2(e,t,n){return r2(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function v2(e,t,n){return n2(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var y2={tokenize:C2,previous:S2},b2={tokenize:w2,partial:!0},x2={tokenize:T2,partial:!0};function S2(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function C2(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),i2.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(b2,o,o)(t):o(t)}function o(t){return t===123?e.attempt(x2,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function w2(e,t,n){return r2(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function T2(e,t,n){return n2(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function E2(){return{text:{58:y2},flow:{58:[a2,p2]}}}function D2(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(E2()),n.push(L0()),r.push(R0())}var O2={abbr:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},abstract:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[`component`,`label`,`xml:id`]},acknowledgement:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},acro:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},activity:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},ad:{elements:[],attributes:[]},address:{elements:[],attributes:[]},affiliation:{elements:[`department`,`institution`,`location`],attributes:[]},alert:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},algorithm:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},alteration:{elements:`copyleft.copyright.dblprime.degree.ellipsis.flat.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.sharp.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},am:{elements:[],attributes:[]},angles:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},answer:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},appendix:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.notation-list.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.subsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},archive:{elements:[],attributes:[`from`]},area:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`correct`]},areas:{elements:[`p`],attributes:[]},argument:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},article:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.backmatter.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.frontmatter.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.subtitle.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},articletitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},aside:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},assemblage:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},assumption:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},asymptote:{elements:[],attributes:[`component`,`label`]},"asymptote-preamble":{elements:[],attributes:[]},attr:{elements:[],attributes:[]},attribution:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},author:{elements:`abbr.acro.ad.affiliation.alert.am.angles.articletitle.attr.bc.biography.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.department.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.institution.kbd.langle.latex.ldblbracket.location.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.personname.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.support.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`corresponding`,`halign`,`xml:id`]},"author-biographies":{elements:[],attributes:[`length`]},axiom:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},backmatter:{elements:[`appendix`,`colophon`,`idx`,`index`,`references`,`solutions`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},bc:{elements:[],attributes:[]},bibinfo:{elements:[`author`,`copyright`,`credit`,`date`,`edition`,`editor`,`keywords`,`support`,`website`],attributes:[]},biblio:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.author.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.editor.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.ibid.icon.idx.ie.init.insert.journal.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.note.number.obelus.pages.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.publisher.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.series.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.title.today.trademark.url.var.viz.volume.vs.webwork.xelatex.xetex.xref.year`.split(`.`),attributes:[`component`,`label`,`type`,`xml:id`]},biographical:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},biography:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},block:{elements:[`blockquote`,`choice`,`cline`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[`correct`,`order`]},blockquote:{elements:[`attribution`,`idx`,`p`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},blocks:{elements:[`block`],attributes:[`layout`,`randomize`]},blurb:{elements:[],attributes:[`shelf`]},book:{elements:[`backmatter`,`chapter`,`frontmatter`,`handout`,`idx`,`part`,`plaintitle`,`shorttitle`,`subtitle`,`title`,`worksheet`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},brandlogo:{elements:[],attributes:[`source`,`url`]},c:{elements:[],attributes:[]},ca:{elements:[],attributes:[]},caption:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},case:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`direction`,`label`,`xml:base`,`xml:id`,`xml:lang`]},cd:{elements:[`cline`],attributes:[`latexsep`]},cell:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.p.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`bottom`,`colspan`,`halign`,`right`]},chapter:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},checkpoint:{elements:[`feedback`,`prompt`],attributes:[`answer`,`answer-variable`,`line`]},choice:{elements:[`blockquote`,`cline`,`console`,`feedback`,`image`,`p`,`pre`,`program`,`statement`,`tabular`,`video`],attributes:[`correct`]},choices:{elements:[`choice`],attributes:[`randomize`]},chord:{elements:[`alteration`],attributes:[`bass`,`bps`,`mode`,`parentheses`,`root`,`suspended`]},claim:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},cline:{elements:[],attributes:[]},code:{elements:[],attributes:[]},col:{elements:[],attributes:[`halign`,`right`,`top`,`width`]},colophon:{elements:[`blockquote`,`colophon-items`,`console`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`video`],attributes:[`component`,`label`,`xml:id`]},"colophon-items":{elements:[],attributes:[]},computation:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},conclusion:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},conjecture:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},console:{elements:[`input`,`output`],attributes:[`component`,`continuation`,`margins`,`prompt`,`width`]},contributor:{elements:[`affiliation`,`department`,`email`,`idx`,`institution`,`location`,`personname`],attributes:[`component`,`label`,`xml:id`]},contributors:{elements:[`contributor`],attributes:[]},convention:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},copyleft:{elements:[],attributes:[]},copyright:{elements:[`holder`,`minilicense`,`shortlicense`,`year`],attributes:[]},corollary:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},creator:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},credit:{elements:[`author`,`entity`,`role`,`title`],attributes:[]},"cross-references":{elements:[],attributes:[`text`]},data:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},date:{elements:`ad.am.bc.ca.copyleft.copyright.dblprime.degree.eg.ellipsis.etal.etc.fillin.icon.ie.kbd.langle.latex.ldblbracket.lq.lsq.mdash.midpoint.minus.nb.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.quantity.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.tex.timeofday.times.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},dblbrackets:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},dblprime:{elements:[],attributes:[]},dedication:{elements:[`idx`,`p`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},definition:{elements:[`idx`,`notation`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},degree:{elements:[],attributes:[]},delete:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},department:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},description:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.p.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tabular.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},division:{elements:[],attributes:[`part`]},dl:{elements:[`li`],attributes:[`component`,`width`]},docinfo:{elements:[`asymptote-preamble`,`author-biographies`,`blurb`,`brandlogo`,`cross-references`,`document-id`,`feedback`,`images`,`initialism`,`latex-image-preamble`,`macros`,`math-package`,`numbering`,`parsons`,`programs`,`rename`],attributes:[`xml:base`,`xml:lang`]},"document-id":{elements:[],attributes:[`edition`]},doubleflat:{elements:[],attributes:[]},doublesharp:{elements:[],attributes:[]},edition:{elements:[],attributes:[]},editor:{elements:[`affiliation`,`department`,`email`,`institution`,`location`,`personname`],attributes:[]},eg:{elements:[],attributes:[]},ellipsis:{elements:[],attributes:[]},em:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},email:{elements:[],attributes:[]},entity:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},etal:{elements:[],attributes:[]},etc:{elements:[],attributes:[]},event:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},example:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exercise:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.pre.preamble.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`workspace`,`xml:base`,`xml:id`,`xml:lang`]},exercisegroup:{elements:[`conclusion`,`exercise`,`idx`,`introduction`,`title`],attributes:[`cols`,`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exercises:{elements:[`conclusion`,`exercise`,`exercisegroup`,`idx`,`interactive`,`introduction`,`plaintitle`,`shorttitle`,`subexercises`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},explanation:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exploration:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},fact:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},feedback:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.url.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},figure:{elements:[`caption`,`idx`,`image`,`interactive`,`sbsgroup`,`score`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},fillin:{elements:[],attributes:[`characters`,`cols`,`fill`,`rows`]},flat:{elements:[],attributes:[]},fn:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:id`]},foreign:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`xml:lang`]},fragment:{elements:[`code`,`fragref`,`title`],attributes:[`filename`,`xml:id`]},fragref:{elements:[],attributes:[`ref`]},frontmatter:{elements:[`abstract`,`acknowledgement`,`bibinfo`,`biography`,`colophon`,`dedication`,`idx`,`preface`,`title`,`titlepage`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},genus:{elements:[],attributes:[]},gi:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},glossary:{elements:[`gi`,`headnote`,`idx`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},h:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`sortby`]},handout:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.page.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.shorttitle.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`bottom`,`component`,`label`,`left`,`margin`,`right`,`top`,`xml:base`,`xml:id`,`xml:lang`]},headnote:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`video`],attributes:[]},heuristic:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},hint:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},historical:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},holder:{elements:[],attributes:[]},hypothesis:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ibid:{elements:[],attributes:[]},icon:{elements:[],attributes:[`name`]},identity:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},idx:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.h.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.see.seealso.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`component`,`finish`,`label`,`sortby`,`start`,`xml:id`]},ie:{elements:[],attributes:[]},image:{elements:[`asymptote`,`description`,`latex-image`,`sageplot`,`shortdescription`],attributes:[`archive`,`component`,`decorative`,`margins`,`pg-name`,`rotate`,`source`,`width`,`xml:id`]},images:{elements:[`archive`],attributes:[]},index:{elements:[`idx`,`index-list`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},"index-list":{elements:[],attributes:[]},init:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},initialism:{elements:[],attributes:[]},input:{elements:[],attributes:[`continuation`,`onclick`,`onkeypress`,`prompt`,`style`,`type`,`value`]},insert:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},insight:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},institution:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},instruction:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},instructions:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},interactive:{elements:[`instructions`,`sbsgroup`,`sidebyside`,`slate`,`static`],attributes:[`aspect`,`component`,`iframe`,`label`,`platform`,`preview`,`source`,`version`,`width`,`xml:id`]},interlude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},intertext:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},introduction:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},investigation:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},iotest:{elements:[`input`,`output`],attributes:[]},journal:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.m.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},justification:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},kbd:{elements:[],attributes:[`name`]},keyword:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[`primary`]},keywords:{elements:[`keyword`,`title`],attributes:[`authority`,`variant`]},langle:{elements:[],attributes:[]},latex:{elements:[],attributes:[]},"latex-image":{elements:[],attributes:[`component`,`label`]},"latex-image-preamble":{elements:[],attributes:[]},ldblbracket:{elements:[],attributes:[]},lemma:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},letter:{elements:[],attributes:[]},li:{elements:`abbr.acro.ad.alert.am.angles.articletitle.aside.attr.bc.biographical.blockquote.c.ca.cd.chord.console.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.figure.fillin.flat.fn.foreign.historical.icon.idx.ie.image.init.insert.interactive.kbd.langle.latex.ldblbracket.list.listing.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.p.permille.pf.phonomark.pilcrow.plusminus.pm.pre.prefigure.pretext.prime.program.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.sage.sbsgroup.scaledeg.section-mark.servicemark.sharp.sidebyside.solidus.sq.stale.swungdash.table.tabular.tag.tage.taxon.term.tex.timeofday.times.timesignature.title.today.trademark.ul.url.var.video.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},line:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`indent`]},list:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`plaintitle`,`shorttitle`,`title`,`ul`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},"list-of":{elements:[],attributes:[`divisions`,`elements`,`empty`,`scope`]},listing:{elements:[`console`,`idx`,`plaintitle`,`program`,`shorttitle`,`title`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},location:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},lq:{elements:[],attributes:[]},lsq:{elements:[],attributes:[]},m:{elements:[`fillin`,`var`],attributes:[]},"macro-file":{elements:[],attributes:[]},macros:{elements:[],attributes:[]},mag:{elements:[],attributes:[]},match:{elements:[`premise`,`response`],attributes:[`order`]},matches:{elements:[`match`],attributes:[]},"math-package":{elements:[],attributes:[`latex-name`,`mathjax-name`]},md:{elements:[`fillin`,`intertext`,`mrow`,`var`,`xref`],attributes:[`alignat-columns`,`alignment`,`break`,`number`]},mdash:{elements:[],attributes:[]},mdn:{elements:[`fillin`,`intertext`,`mrow`,`var`],attributes:[`alignat-columns`,`alignment`,`break`,`number`]},me:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`component`,`label`,`xml:id`]},memo:{elements:[],attributes:[]},men:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`component`,`label`,`xml:id`]},midpoint:{elements:[],attributes:[]},minilicense:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},minus:{elements:[],attributes:[]},mrow:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`break`,`component`,`label`,`number`,`tag`,`xml:id`]},myopenmath:{elements:[],attributes:[`params`,`problem`]},n:{elements:[],attributes:[`acc`,`octave`,`pc`]},name:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},natural:{elements:[],attributes:[]},nb:{elements:[],attributes:[]},nbsp:{elements:[],attributes:[]},ndash:{elements:[],attributes:[]},notation:{elements:[`description`,`usage`],attributes:[]},"notation-list":{elements:[],attributes:[]},note:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},number:{elements:[],attributes:[]},numbering:{elements:[`division`],attributes:[]},obelus:{elements:[],attributes:[]},objectives:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`title`,`ul`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},observation:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ol:{elements:[`li`],attributes:[`cols`,`component`,`marker`]},outcomes:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`title`,`ul`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},output:{elements:[],attributes:[]},p:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.cd.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.ul.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:id`]},page:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.video.warning`.split(`.`),attributes:[]},pages:{elements:[],attributes:[`end`,`start`]},paragraphs:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},parsons:{elements:[],attributes:[`language`]},part:{elements:[`chapter`,`idx`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},per:{elements:[],attributes:[`base`,`exp`,`prefix`]},permille:{elements:[],attributes:[]},personname:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},pf:{elements:[],attributes:[`language`]},"pg-code":{elements:[],attributes:[]},"pg-macros":{elements:[`macro-file`],attributes:[]},phonomark:{elements:[],attributes:[]},pilcrow:{elements:[],attributes:[]},plaintitle:{elements:[],attributes:[]},plusminus:{elements:[],attributes:[]},pm:{elements:[],attributes:[]},poem:{elements:[`author`,`idx`,`line`,`stanza`,`title`],attributes:[`component`,`halign`,`label`,`xml:base`,`xml:id`,`xml:lang`]},postamble:{elements:[],attributes:[`indent`,`visible`]},postlude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},pre:{elements:[`cline`],attributes:[]},preamble:{elements:[],attributes:[`indent`,`visible`]},preface:{elements:[`aside`,`attribution`,`biographical`,`blockquote`,`console`,`contributors`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},prefigure:{elements:[],attributes:[]},prelude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},premise:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},pretext:{elements:[`article`,`book`,`docinfo`,`letter`,`memo`],attributes:[`xml:lang`]},prime:{elements:[],attributes:[]},principle:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},problem:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},program:{elements:[`checkpoint`,`code`,`postamble`,`preamble`,`stdin`,`tests`],attributes:[`add-files`,`autorun`,`chatcodes`,`codelens`,`compile-also`,`compiler-args`,`component`,`database`,`download`,`extra-compiler-args`,`filename`,`hidecode`,`highlight-lines`,`include`,`interactive`,`interpreter-args`,`label`,`language`,`line-numbers`,`linker-args`,`margins`,`starting-step`,`timelimit`,`width`,`xml:id`]},programs:{elements:[],attributes:[`compiler-args`,`download`,`interpreter-args`,`language`,`linenumbers`,`linker-args`,`timeout`]},project:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},prompt:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},proof:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},proposition:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ps:{elements:[],attributes:[]},publisher:{elements:[],attributes:[]},pubtitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},q:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},quantity:{elements:[`mag`,`per`,`unit`],attributes:[]},question:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},rangle:{elements:[],attributes:[]},rdblbracket:{elements:[],attributes:[]},"reading-questions":{elements:[`conclusion`,`exercise`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},reasoning:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},references:{elements:[`biblio`,`conclusion`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},registered:{elements:[],attributes:[]},remark:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},rename:{elements:[],attributes:[`element`,`xml:lang`]},response:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},role:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},row:{elements:[`cell`],attributes:[`bottom`,`halign`,`header`,`left`,`valign`]},rq:{elements:[],attributes:[]},rsq:{elements:[],attributes:[]},sage:{elements:[`input`,`output`],attributes:[`auto-evaluate`,`component`,`doctest`,`language`,`tolerance`,`type`]},sageplot:{elements:[],attributes:[`aspect`,`component`,`label`,`variant`]},sbsgroup:{elements:[`sidebyside`],attributes:[`component`,`margins`,`valign`,`valigns`,`width`,`widths`]},scaledeg:{elements:[],attributes:[]},score:{elements:[],attributes:[`musescore`,`musescoreuser`]},section:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.subsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},"section-mark":{elements:[],attributes:[]},see:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},seealso:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},series:{elements:[],attributes:[]},servicemark:{elements:[],attributes:[]},sharp:{elements:[],attributes:[]},shortdescription:{elements:[`var`],attributes:[]},shortlicense:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},shorttitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},sidebyside:{elements:[`console`,`dl`,`exercise`,`figure`,`image`,`interactive`,`list`,`listing`,`ol`,`p`,`poem`,`pre`,`program`,`slate`,`stack`,`table`,`tabular`,`task`,`ul`,`video`],attributes:[`component`,`margins`,`valign`,`valigns`,`width`,`widths`]},slate:{elements:[`input`,`p`,`sidebyside`,`tabular`,`xhtml:button`],attributes:[`aspect`,`axis`,`component`,`grid`,`label`,`material`,`source`,`surface`,`xml:id`]},solidus:{elements:[],attributes:[]},solution:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},solutions:{elements:[`conclusion`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`admit`,`component`,`divisional`,`inline`,`label`,`project`,`reading`,`scope`,`worksheet`,`xml:base`,`xml:id`,`xml:lang`]},species:{elements:[],attributes:[]},sq:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},stack:{elements:[`console`,`dl`,`image`,`ol`,`p`,`pre`,`program`,`slate`,`tabular`,`ul`,`video`],attributes:[]},stale:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},stanza:{elements:[`idx`,`line`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},statement:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`image`,`instruction`,`interactive`,`list`,`listing`,`ol`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`video`],attributes:[`correct`]},static:{elements:[`image`],attributes:[]},stdin:{elements:[],attributes:[]},subexercises:{elements:[`conclusion`,`exercise`,`exercisegroup`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subsection:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.subsubsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subsubsection:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subtitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},support:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.cd.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.ul.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},swungdash:{elements:[],attributes:[]},table:{elements:[`idx`,`plaintitle`,`shorttitle`,`tabular`,`title`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},tabular:{elements:[`col`,`row`],attributes:[`bottom`,`component`,`halign`,`left`,`margins`,`right`,`row-headers`,`top`,`valign`,`width`]},tag:{elements:[],attributes:[]},tage:{elements:[],attributes:[]},task:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`workspace`,`xml:base`,`xml:id`,`xml:lang`]},taxon:{elements:[`genus`,`species`],attributes:[`ncbi`]},technology:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},term:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},tests:{elements:[`iotest`],attributes:[`visible`]},tex:{elements:[],attributes:[]},theorem:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},timeofday:{elements:[],attributes:[]},times:{elements:[],attributes:[]},timesignature:{elements:[],attributes:[`bottom`,`top`]},title:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},titlepage:{elements:[`titlepage-items`],attributes:[]},"titlepage-items":{elements:[],attributes:[]},today:{elements:[],attributes:[]},trademark:{elements:[],attributes:[]},ul:{elements:[`li`],attributes:[`cols`,`component`,`marker`]},unit:{elements:[],attributes:[`base`,`exp`,`prefix`]},url:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`href`,`visual`]},usage:{elements:[`m`],attributes:[]},var:{elements:[],attributes:[`category`,`evaluator`,`form`,`name`,`width`]},video:{elements:[],attributes:[`aspect`,`component`,`end`,`href`,`label`,`margins`,`play-at`,`preview`,`source`,`start`,`vimeo`,`width`,`xml:id`,`youtube`,`youtubeplaylist`]},viz:{elements:[],attributes:[]},volume:{elements:[],attributes:[]},vs:{elements:[],attributes:[]},warning:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},website:{elements:[`address`,`name`,`url`],attributes:[]},webwork:{elements:[`conclusion`,`description`,`hint`,`introduction`,`pg-code`,`pg-macros`,`solution`,`statement`,`task`],attributes:[`component`,`copy`,`label`,`seed`,`source`,`xml:id`]},worksheet:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.page.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.shorttitle.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`bottom`,`component`,`label`,`left`,`margin`,`right`,`top`,`xml:base`,`xml:id`,`xml:lang`]},xelatex:{elements:[],attributes:[]},xetex:{elements:[],attributes:[]},"xhtml:button":{elements:[],attributes:[`id`,`type`]},xref:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`detail`,`first`,`last`,`provisional`,`ref`,`text`]},year:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]}},k2=[],A2=Object.freeze(Object.keys(O2));new Set(A2),new Set(k2);var j2=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`paragraphs`];function M2(e){return j2.includes(e)}var N2=[`worksheet`,`exercises`,`references`,`appendix`,`glossary`,`handout`,`solutions`,`reading-questions`,`introduction`,`conclusion`,`slide`];function P2(e){return N2.includes(e)}var F2=[`introduction`,`conclusion`];function I2(e){return F2.includes(e)}function L2(e){return M2(e)||P2(e)}function R2(e,t){if(I2(e))return`paragraphs`;if(t<=1)return e;if(e===`appendix`)return R2(`chapter`,t);if(P2(e))return`paragraphs`;let n=j2.indexOf(e)+(t-1);return j2[Math.min(n,j2.length-1)]}var z2=[`article`,`book`,`slideshow`];function B2(e){return z2.includes(e)}function V2(e){return U2(e,1)}var H2=[`section`,`slide`,`paragraphs`];function U2(e,t){if(e===`slideshow`){let e=Math.max(0,t-1);return H2[Math.min(e,H2.length-1)]}return R2(e===`book`?`chapter`:`section`,t)}function W2(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),j0(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function G2(e,t={}){let n={};for(let[e,r]of Object.entries(t))r!=null&&(n[e]=r);return{type:`element`,name:`plus:${e}`,attributes:n,children:[]}}function K2(e){let t=e.name?.trim();return t?G2(t,e.attributes??{}):null}var q2={theorem:{type:`theorem`,category:`theorem-like`,requiresStatement:!0},lemma:{type:`lemma`,category:`theorem-like`,requiresStatement:!0},corollary:{type:`corollary`,category:`theorem-like`,requiresStatement:!0},proposition:{type:`proposition`,category:`theorem-like`,requiresStatement:!0},claim:{type:`claim`,category:`theorem-like`,requiresStatement:!0},fact:{type:`fact`,category:`theorem-like`,requiresStatement:!0},conjecture:{type:`conjecture`,category:`theorem-like`,requiresStatement:!0},axiom:{type:`axiom`,category:`theorem-like`,requiresStatement:!0},principle:{type:`principle`,category:`theorem-like`,requiresStatement:!0},hypothesis:{type:`hypothesis`,category:`theorem-like`,requiresStatement:!0},algorithm:{type:`algorithm`,category:`theorem-like`,requiresStatement:!0},definition:{type:`definition`,category:`definition-like`,requiresStatement:!0},notation:{type:`notation`,category:`definition-like`,requiresStatement:!0},remark:{type:`remark`,category:`remark-like`,requiresStatement:!1},note:{type:`note`,category:`remark-like`,requiresStatement:!1},observation:{type:`observation`,category:`remark-like`,requiresStatement:!1},warning:{type:`warning`,category:`remark-like`,requiresStatement:!1},insight:{type:`insight`,category:`remark-like`,requiresStatement:!1},assemblage:{type:`assemblage`,category:`remark-like`,requiresStatement:!1},example:{type:`example`,category:`example-like`,requiresStatement:!1},question:{type:`question`,category:`example-like`,requiresStatement:!1},problem:{type:`problem`,category:`example-like`,requiresStatement:!1},exercise:{type:`exercise`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},activity:{type:`activity`,category:`example-like`,requiresStatement:!1},exploration:{type:`exploration`,category:`example-like`,requiresStatement:!1},investigation:{type:`investigation`,category:`example-like`,requiresStatement:!1},project:{type:`project`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},task:{type:`task`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},proof:{type:`proof`,category:`proof-like`,requiresStatement:!1},case:{type:`case`,category:`proof-like`,requiresStatement:!1},solution:{type:`solution`,category:`solution-like`,requiresStatement:!1},hint:{type:`hint`,category:`solution-like`,requiresStatement:!1},answer:{type:`answer`,category:`solution-like`,requiresStatement:!1}};function J2(e){return q2[e.toLowerCase()]}var Y2=new Set(Object.entries(q2).filter(([e,t])=>t.category===`proof-like`||t.category===`solution-like`).map(([e])=>e));function X2(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function Z2(e){return e.type===`containerDirective`&&e.name===`task`}function Q2(e){return e.type===`containerDirective`&&Y2.has(e.name)}function $2(e){let t=[];for(let n of e)n.name===`ul`||n.name===`ol`?t.length>0&&t[t.length-1]?.name===`p`?t[t.length-1].children.push(n):t.push(X2(`p`,[n])):t.push(n);return t}function e4(e,t,n,r,i,a,o){let s=[];if(n&&s.push(n),e.hasNestedTasks){let t=r.findIndex(Z2);if(t!==-1){let n=[];for(let e=0;e<r.length;e++)Z2(r[e])&&n.push(e);let c=n[n.length-1],l=r.slice(0,t),u=r.slice(t).filter(Z2),d=[],f=[],p=[];for(let e=t;e<r.length;e++){let t=r[e];if(!Z2(t)){if(e<c){d.push(t);continue}if(Q2(t)){p.push(t);continue}f.push(t)}}if(d.length>0&&(i.messages??=[]).push({type:`warning`,reason:`Dropped ${d.length} non-task node(s) between task directives in ${e.type}.`,category:`dropped-content-between-tasks`,position:d[0].position?.start}),l.length>0){let e=$2(l.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(X2(`introduction`,e))}for(let e of u){let t=o(e,i);t&&s.push(t)}if(f.length>0){let e=$2(f.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(X2(`conclusion`,e))}for(let e of p){let t=o(e,i);t&&s.push(t)}}else t4(s,e,r,i,a,o)}else t4(s,e,r,i,a,o);return X2(e.type,s,t)}function t4(e,t,n,r,i,a){if(t.requiresStatement){let t=[],o=[];for(let e of n)if(e.type===`containerDirective`&&Y2.has(e.name)){let t=a(e,r);t&&o.push(t)}else t.push(e);if(t.length>0){let n=$2(t.map(e=>i(e,r)).filter(e=>e!==null));n.length>0&&e.push(X2(`statement`,n))}e.push(...o)}else{let t=$2(n.map(e=>i(e,r)).filter(e=>e!==null));e.push(...t)}}function n4(e){return{type:`text`,value:e}}function r4(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function i4(e,t,n){return r4(e,[n4(t)],n)}function a4(e){return{type:`comment`,value:e.replace(/--/g,`- -`)}}function o4(e,t){let n=e?.position,r=n?.start?.offset,i=n?.end?.offset;return t.source&&r!=null&&i!=null?t.source.slice(r,i):``}function s4(e,t,n){return r4(`TODO`,[a4(`todo: ${t}`),i4(`pre`,n)],{type:e})}function c4(e,t,n){return r4(`TODO`,[a4(`todo: ${t}`),i4(`c`,n)],{type:e})}function l4(e){let t=[];for(let n of e)n.name===`ul`||n.name===`ol`?t.length>0&&t[t.length-1]?.name===`p`?t[t.length-1].children.push(n):t.push(r4(`p`,[n])):t.push(n);return t}function u4(e,t,n){return d4(e,t,n).tree}function d4(e,t,n){let r=[],i={ancestors:[],depth:0,messages:r,source:t,topLevelDivision:n?.topLevelDivision??`chapter`,documentRoot:n?.documentRoot,topLevelAttributes:n?.topLevelAttributes,topLevelAttributesApplied:n?.topLevelAttributes?{done:!1}:void 0},a=e.children;if(i.documentRoot){let e=y4(i),t=f4(a,i);return{tree:{type:`root`,children:[r4(i.documentRoot,t,e)]},messages:r}}if(I2(i.topLevelDivision)){let e=y4(i),t=l4(f4(a,{...i,depth:1},!0));return{tree:{type:`root`,children:[r4(i.topLevelDivision,t,e)]},messages:r}}return{tree:{type:`root`,children:f4(a,i)},messages:r}}function f4(e,t,n=!1){let r=7;for(let t of e)t.type===`heading`&&(r=Math.min(r,t.depth));if(r===7)return p4(e,t,n);let i=[],a=null,o=[],s=[],c=()=>{a&&(i.push(m4(a,s,t)),a=null,s=[])};for(let l of e)l.type===`heading`&&l.depth===r?(!a&&o.length>0&&(i.push(...p4(o,t,n)),o=[]),c(),a=l,s=[]):a?s.push(l):o.push(l);return!a&&o.length>0&&i.push(...p4(o,t,n)),c(),i}function p4(e,t,n=!1){let r=[];for(let n=0;n<e.length;n+=1){let i=e[n],a=x4(i,t);if(a!==null){if(a.name===`p`&&a.children.length===1&&a.children[0].name===`md`){let i=a.children[0],o=r[r.length-1],s=n+1<e.length?x4(e[n+1],t):null,c=s?.name===`p`?s.children:null;if(o?.name===`p`)o.children.push(i),c&&(o.children.push(...c),n+=1);else{let e=[i];c&&(e.push(...c),n+=1),r.push(r4(`p`,e))}continue}if((a.name===`ul`||a.name===`ol`)&&r.length>0){let e=r[r.length-1];if(e?.name===`p`){e.children.push(a);continue}}r.push(a)}}return n?l4(r):r}function m4(e,t,n){let r=n.documentRoot?U2(n.documentRoot,e.depth):R2(n.topLevelDivision,e.depth),i=r4(`title`,F4(e.children,n)),a=v4(e,n),o={...n,depth:n.depth+1},{introduction:s,rest:c}=g4(t,o),l=l4(f4(c,o,!0));return r4(r,s?[i,s,...l]:[i,...l],a)}function h4(e){return e.type===`leafDirective`&&L2(e.name)}function g4(e,t){let n=e.findIndex(e=>e.type===`heading`||h4(e));if(n<=0)return{introduction:null,rest:e};let r=e.slice(0,n),i=e.slice(n),a=p4(r,t,!0);return{introduction:a.length>0?r4(`introduction`,a):null,rest:i}}function _4(e){let t=e.data;return t?.id?{"xml:id":t.id}:void 0}function v4(e,t){let n=_4(e),r=y4(t);if(!(!n&&!r))return{...r,...n}}function y4(e){if(e.depth!==0)return;let t=e.topLevelAttributesApplied;if(!(!e.topLevelAttributes||!t||t.done))return t.done=!0,e.topLevelAttributes}var b4={paragraph:(e,t)=>S4(e,t),blockquote:(e,t)=>C4(e,t),list:(e,t)=>w4(e,t),code:(e,t)=>E4(e),containerDirective:(e,t)=>A4(e,t),leafDirective:(e,t)=>k4(e,t)};function x4(e,t){let n=b4[e.type];return n?n(e,t):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown block type: ${e.type}`,category:`unknown-block-type`}),s4(`unknown-block-type`,`unknown block type "${e.type}"`,o4(e,t)))}function S4(e,t){return r4(`p`,F4(e.children,t))}function C4(e,t){return r4(`blockquote`,e.children.filter(e=>e.type===`paragraph`).map(n=>S4(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1})))}function w4(e,t){let n=e.children.map(n=>T4(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1}));return r4(e.ordered?`ol`:`ul`,n)}function T4(e,t){return r4(`li`,p4(e.children,t))}function E4(e,t){return i4(`program`,e.value,e.lang?{language:e.lang}:void 0)}function D4(e,t){let n=e.value.split(/\\\\|[\r\n]+/).map(e=>e.trim()).filter(e=>e.length>0);return n.length>1?r4(`md`,n.map(e=>i4(`mrow`,e))):i4(`md`,n[0]??``)}function O4(e,t){return e.meta===`inline`?i4(`m`,e.value):D4(e)}function k4(e,t){return K2(e)||(t.messages&&t.messages.push({type:`warning`,reason:`Unnamed leaf directive`,category:`unknown-directive`}),s4(`unknown-directive`,`unnamed leaf directive`,o4(e,t)))}function A4(e,t){let n=J2(e.name);if(!n)return t.messages&&t.messages.push({type:`warning`,reason:`Unknown directive: ${e.name}`,category:`unknown-directive`}),s4(`unknown-directive`,`unknown directive "${e.name}"`,o4(e,t));let r=M4(e),i=e.children,{title:a,body:o}=j4(i,t);return e4(n,r,a,o,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1},(e,t)=>x4(e,t),(e,t)=>A4(e,t))}function j4(e,t){let n=e[0];return n?.type===`paragraph`&&n.data?.directiveLabel===!0?{title:r4(`title`,F4(n.children,t)),body:e.slice(1)}:{title:null,body:e}}function M4(e){let t=e.attributes??{},n={};for(let[e,r]of Object.entries(t))r!=null&&(n[e===`id`?`xml:id`:e]=r);return Object.keys(n).length>0?n:void 0}function N4(e,t){return!t||e.position?.start?.offset===null||e.position?.start?.offset===void 0?`asterisk`:t.charAt(e.position.start.offset)===`_`?`underscore`:`asterisk`}var P4={text:(e,t)=>n4(e.value),emphasis:(e,t)=>r4(N4(e,t.source)===`underscore`?`term`:`em`,F4(e.children,t)),strong:(e,t)=>r4(`alert`,F4(e.children,t)),inlineCode:(e,t)=>i4(`c`,e.value),math:(e,t)=>O4(e)};function F4(e,t){return e.flatMap(e=>I4(e,t)).filter(e=>e!==null)}function I4(e,t){let n=P4[e.type];return n?n(e,{...t,ancestors:[...t.ancestors,e]}):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown inline type: ${e.type}`,category:`unknown-inline-type`}),c4(`unknown-inline-type`,`unknown inline type "${e.type}"`,o4(e,t)))}var L4=[{open:`$$`,close:`$$`,isDisplay:!0},{open:`\\[`,close:`\\]`,isDisplay:!0},{open:`$`,close:`$`,isDisplay:!1},{open:`\\(`,close:`\\)`,isDisplay:!1}],R4=`PTX_MATH_TOKEN_`,z4=RegExp(`${R4}(\\d+)`,`g`);function B4(e,t){let n=null;for(let r of L4){let i=e.indexOf(r.open,t);if(i===-1)continue;let a=e.indexOf(r.close,i+r.open.length);a!==-1&&!(r.open===`$`&&(i>0&&e[i-1]===`$`||i+1<e.length&&e[i+1]===`$`))&&(!n||i<n.index)&&(n={index:i,pattern:r,content:e.substring(i+r.open.length,a)})}return n}function V4(e,t){let n=t;for(;n<e.length;){let t=e.indexOf("`",n);if(t===-1)return null;let r=0,i=t;for(;i<e.length&&e[i]==="`";)r++,i++;let a="`".repeat(r),o=i;for(;o<e.length;){let n=e.indexOf(a,o);if(n===-1)break;let i=n+r;if(i>=e.length||e[i]!=="`")return{start:t,end:i};o=n+1}n=t+r}return null}function H4(e){let t=new Map,n=``,r=0,i=0;for(;r<e.length;){let a=V4(e,r),o=B4(e,r);if(a&&(!o||a.start<o.index)){n+=e.substring(r,a.end),r=a.end;continue}if(!o){n+=e.substring(r);break}n+=e.substring(r,o.index);let s=`${R4}${i}`;n+=s,t.set(s,{type:`math`,value:o.content,meta:o.pattern.isDisplay?`display`:`inline`}),r=o.index+o.pattern.open.length+o.content.length+o.pattern.close.length,i+=1}return{markdown:n,tokens:t}}function U4(e){let t=[],n=0;for(;n<e.length;){let r=B4(e,n);if(!r){n<e.length&&t.push({type:`text`,value:e.substring(n)});break}r.index>n&&t.push({type:`text`,value:e.substring(n,r.index)}),t.push({type:`math`,value:r.content,meta:r.pattern.isDisplay?`display`:`inline`}),n=r.index+r.pattern.open.length+r.content.length+r.pattern.close.length}return t.length===0?[{type:`text`,value:e}]:t}function W4(e,t){let n=[],r=0;z4.lastIndex=0;let i=z4.exec(e);for(;i;){let a=i.index,o=i[0];a>r&&n.push({type:`text`,value:e.substring(r,a)});let s=t.get(o);s?n.push(s):n.push({type:`text`,value:o}),r=a+o.length,i=z4.exec(e)}return r<e.length&&n.push({type:`text`,value:e.substring(r)}),n.length===0?[{type:`text`,value:e}]:n}function G4(e){W2(e,`paragraph`,e=>{let t=e.children||[],n=[];for(let e of t)if(e.type===`text`){let t=U4(e.value);n.push(...t)}else n.push(e);e.children=n})}function K4(e,t){W2(e,`paragraph`,e=>{let n=e.children||[],r=[];for(let e of n)if(e.type===`text`){let n=W4(e.value,t);r.push(...n)}else r.push(e);e.children=r})}function q4(e){let t=e.trim();if(!t.startsWith(`:`))return null;let n=0;for(let e=0;e<t.length&&t[e]===`:`;e++)n++;if(n<3)return null;let r=t.slice(n).trim(),i=r.match(/^([a-zA-Z0-9_-]+)(\[[^\]]*\])?(\{[^}]*\})?$/);return r===``?{colons:n,label:null,lineIndex:-1,isOpen:!1}:i?{colons:n,label:i[0],lineIndex:-1,isOpen:!0}:null}function J4(e){let t=[],n=[];for(let r of e)if(r.isOpen){let e={colons:r.colons,finalColons:r.colons,label:r.label,openLineIndex:r.lineIndex,closeLineIndex:null,children:[],parent:null};if(t.length>0){let n=t[t.length-1];e.parent=n,n.children.push(e)}else n.push(e);t.push(e)}else{let e=t[t.length-1];e&&e.colons===r.colons&&(e.closeLineIndex=r.lineIndex,t.pop())}return n}function Y4(e){if(e.children.length===0)e.finalColons=e.colons;else{let t=Math.max(...e.children.map(Y4));e.finalColons=Math.max(e.colons,t+1)}return e.finalColons}function X4(e,t,n){let r=e.slice(),i=[],a=t.slice();for(;a.length>0;){let e=a.shift();i.push(e),a.push(...e.children)}for(let e of i){if(e.openLineIndex>=0){let t=r[e.openLineIndex],n=t.match(/^:+/)?.[0].length||3,i=t.slice(n);r[e.openLineIndex]=`:`.repeat(e.finalColons)+i}e.closeLineIndex!==null&&e.closeLineIndex>=0&&(r[e.closeLineIndex]=`:`.repeat(e.finalColons))}return r}function Z4(e){let t=e.split(`
|
|
1060
|
-
`),n=[],r=!1,i=null;for(let e=0;e<t.length;e++){let a=t[e],o=a.trim().match(/^(`{3,}|~{3,})/);if(o){let e=o[1];r?i&&e[0]===i[0]&&e.length>=i.length&&(r=!1,i=null):(r=!0,i=e);continue}if(r)continue;let s=
|
|
1061
|
-
`)}function
|
|
1062
|
-
`),n=[],r={level:0,openDirectives:[],inCodeFence:!1,codeFenceMarker:null};for(let e=0;e<t.length;e++){let i=t[e],a=i.trim(),o
|
|
1063
|
-
`)}var
|
|
1064
|
-
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function A3(e){return C3(e,k3)}function j3(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function M3(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;j3(n,r)>j3(n,e)&&(r=e)}return r+C3(n,[`<`,`&`,r])+r}function N3(e,t){let n=A3(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+M3(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+M3(i,t)),a+`>`}var P3={}.hasOwnProperty;function F3(e,t){let n=A3(e.name),r=G3(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(P3.call(i,s)){let e=i[s];e!=null&&o.push(A3(s)+`=`+M3(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var I3=/\?>/g,L3=[`>`];function R3(e){let t=A3(e.name)||`x`,n=C3(e.value,L3,I3);return`<?`+t+(n?` `+n:``)+`?>`}var z3=[`&`,`<`];function B3(e){return C3(e.value,z3)}function V3(e,t){return t.options.allowDangerousXml?e.value:B3(e)}var H3={}.hasOwnProperty,U3={cdata:D3,comment:O3,doctype:N3,element:F3,instruction:R3,raw:V3,root:G3,text:B3};function W3(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!H3.call(U3,n))throw Error("Cannot compile unknown node `"+n+"`");let r=U3[n];return r(e,t)}function G3(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=W3(n[r],t);return i.join(``)}function K3(e,t){let n={options:t||{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return W3(Array.isArray(e)?{type:`root`,children:e}:e,n)}function q3(e,t){let n=nQ().use(f0).use(D2).use(d3,t),r=n.parse(e);return K3(n.runSync(r,{value:e}).children,{closeEmptyElements:!0,tightClose:!0})}var J3=[`\\documentclass`,`\\begin{document}`,`\\begin{`,`\\section`,`\\chapter`,`\\title`,`\\author`],Y3=[`# `,`## `,`### `,`#### `];function X3(e){let t=e.trim();return!t||t.startsWith(`<`)?`pretext`:J3.some(e=>t.includes(e))?`latex`:Y3.some(e=>t.startsWith(e))?`markdown`:`pretext`}function Z3(e){let t=e.trim();if(!t)return``;let n=String(PZ(t)).trim();return n?ps(n):``}function Q3(e){let t=e.trim();if(!t)return``;let n=String(q3(t)).trim();return n?ps(n):``}function $3(e){return e instanceof Error&&e.message.trim()?e.message.trim():`Could not convert LaTeX to PreTeXt.`}function e6(e,t){if(t===`pretext`)return{pretextSource:e};if(t===`markdown`)try{return{pretextSource:Q3(e)}}catch(e){return{pretextError:$3(e)}}try{return{pretextSource:Z3(e)}}catch(e){return{pretextError:$3(e)}}}var t6=()=>typeof window>`u`?void 0:window.location.href||void 0,n6=({label:e=`Give feedback`,context:r,onSubmit:i,projectUrl:a,currentSource:o,sourceFormat:s,title:c,className:l})=>{let u=(0,n.useId)(),d=`${u}-title`,f=`${u}-email`,p=`${u}-message`,m=`${u}-source`,[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(``),[y,b]=(0,n.useState)(``),[x,S]=(0,n.useState)(!1),[C,w]=(0,n.useState)(!1),[T,E]=(0,n.useState)(null),D=(0,n.useMemo)(()=>a?.trim()||t6(),[a]),O=()=>{g(!1),E(null)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`button`,{type:`button`,className:l||`pretext-plus-editor__feedback-trigger pretext-plus-editor__dialog-link-button`,onClick:()=>g(!0),children:e}),h?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:O,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__feedback-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:d,className:`pretext-plus-editor__dialog-title`,children:`Provide Feedback`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`Help us improve PreTeXt.plus! We'd love to hear from you.`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`(If you would like a response, please include your email address in the form below and we will get back to you as soon as we can.)`})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:O,"aria-label":`Close feedback dialog`,disabled:C,children:`Close`})]}),(0,t.jsxs)(`form`,{className:`pretext-plus-editor__feedback-form`,onSubmit:async e=>{e.preventDefault();let t=y.trim(),n=_.trim();if(!t){E(`Please enter a message.`);return}E(null),w(!0);try{await i({context:r,email:n||void 0,message:t,includeCurrentSource:x,currentSource:x?o:void 0,projectUrl:D,sourceFormat:s,title:c,submittedAt:new Date().toISOString()}),b(``),S(!1),g(!1)}catch(e){E(e instanceof Error?e.message:`Could not submit feedback.`)}finally{w(!1)}},children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__feedback-label`,htmlFor:f,children:`Email (optional)`}),(0,t.jsx)(`input`,{id:f,type:`email`,className:`pretext-plus-editor__feedback-input`,value:_,onChange:e=>v(e.target.value),placeholder:`name@example.com`,autoComplete:`email`}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__feedback-label`,htmlFor:p,children:`Message`}),(0,t.jsx)(`textarea`,{id:p,className:`pretext-plus-editor__feedback-textarea`,value:y,onChange:e=>b(e.target.value),rows:5,required:!0}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__feedback-checkbox-row`,htmlFor:m,children:[(0,t.jsx)(`input`,{id:m,type:`checkbox`,checked:x,onChange:e=>S(e.target.checked)}),`Include current source`]}),D?(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-project`,children:`Project link will be included.`}):(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-project`,children:`No project link is currently available.`}),T?(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-error`,children:T}):null,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:O,disabled:C,children:`Cancel`}),(0,t.jsx)(`button`,{type:`submit`,className:`pretext-plus-editor__dialog-button`,disabled:C||!y.trim(),children:C?`Submitting...`:`Submit`})]})]})]})}):null]})},r6=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i6=(e=>e?r6(e):r6),a6=e=>e;function o6(e,t=a6){let r=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),n.default.useCallback(()=>t(e.getInitialState()),[e,t]));return n.default.useDebugValue(r),r}var s6=(0,n.createContext)(null);function c6(e){let t=(0,n.useContext)(s6);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return o6(t,e)}var l6=({label:e,context:n,className:r})=>{let i=c6(e=>e.hasFeedback),a=c6(e=>e.projectUrl),o=c6(e=>e.source),s=c6(e=>e.sourceFormat),c=c6(e=>e.title),l=c6(e=>e.feedbackSubmit);return i?(0,t.jsx)(n6,{label:e,context:n,className:r,projectUrl:a,currentSource:o,sourceFormat:s,title:c,onSubmit:l}):null},u6=({onClose:e})=>{let[r,i]=(0,n.useState)(``),[a,o]=(0,n.useState)(``),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(`idle`),d=(0,n.useRef)(null),f=(0,n.useRef)(null),p={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}};(0,n.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),d.current?.focus(),()=>{window.removeEventListener(`keydown`,t)}},[e]);let m=()=>{let e=r.trim();if(e)try{o(Z3(e)),u(`idle`)}catch(e){console.error(`Error converting LaTeX:`,e),alert($3(e))}},h=async()=>{if(a)try{await navigator.clipboard.writeText(a),u(`copied`),e()}catch(e){console.error(`Error copying converted PreTeXt:`,e),u(`error`),alert(`Could not copy to clipboard`)}},g=e=>{if(!e.name.toLowerCase().endsWith(`.tex`)){alert(`Please choose a .tex file`);return}let t=new FileReader;t.onload=()=>{i(typeof t.result==`string`?t.result:``),o(``),u(`idle`),d.current?.focus()},t.onerror=()=>{alert(`Could not read file`)},t.readAsText(e)};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Convert LaTeX`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`Paste LaTeX, convert it to PreTeXt, then copy the result.`}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-feedback-row`,children:(0,t.jsx)(l6,{label:`Give feedback on conversion`,context:`latex-conversion`})})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:e,"aria-label":`Close LaTeX import dialog`,children:`Close`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`LaTeX Input`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-link-button`,onClick:()=>f.current?.click(),children:`Open .tex File`}),(0,t.jsx)(`input`,{ref:f,type:`file`,accept:`.tex,text/x-tex`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&g(t),e.target.value=``}})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor ${s?`pretext-plus-editor__dialog-editor--drag`:``}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,c(!0)},onDragLeave:e=>{e.preventDefault(),c(!1)},onDrop:e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&g(t)},children:(0,t.jsx)(Yn,{options:p,height:`100%`,language:`latex`,value:r,onMount:e=>{d.current=e,e.focus()},onChange:e=>i(e||``)})}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:"Paste LaTeX, open a `.tex` file, or drag one onto this editor."})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Converted PreTeXt`}),l===`copied`?(0,t.jsx)(`span`,{className:`pretext-plus-editor__dialog-status`,children:`Copied`}):null]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:{...p,readOnly:!0},height:`100%`,language:`xml`,value:a})})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:e,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:m,disabled:!r.trim(),children:`Convert`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:h,disabled:!a,children:`Copy and Close`})]})]})})},d6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},f6={latex:`LaTeX`,markdown:`Markdown`,pretext:`PreTeXt`},p6={latex:`latex`,markdown:`markdown`,pretext:`xml`},m6=({sourceContent:e,sourceFormat:r,pretextSource:i,onConfirm:a,onClose:o})=>{(0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let s=()=>{a(),o()},c=f6[r]??r;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:o,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-convert-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-convert-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Convert Division to PreTeXt`}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:[`Add a new PreTeXt division using the converted source below. Your current `,c,` division will remain unchanged.`]})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:o,"aria-label":`Close convert to PreTeXt dialog`,children:`Close`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-label`,children:[`Current `,c,` Source`]})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:d6,height:`100%`,language:p6[r]??`plaintext`,value:e})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Converted PreTeXt`})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:d6,height:`100%`,language:`xml`,value:i})})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:o,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--danger`,onClick:s,children:`Create PreTeXt Division`})]})]})})},h6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},g6={...h6,language:`xml`},_6=(e,t)=>e.querySelector(t)?.textContent??``,v6=(e,t)=>{let n=new XMLSerializer;return Array.from(e.documentElement.children).filter(e=>!t.includes(e.tagName)).map(e=>n.serializeToString(e)).join(`
|
|
1065
|
-
`)},
|
|
1058
|
+
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(F0.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&L0.test(u)?`#`+u:i(`id`,u,e,n);else if(l===`class`){let r=u.split(/[\t\n\r ]+/g),a=[],c=[],l=-1;for(;++l<r.length;)(t.preferShortcut!==!1&&L0.test(r[l])?c:a).push(r[l]);o=a.length>0?i(`class`,a.join(` `),e,n):``,s=c.length>0?`.`+c.join(`.`):``}else a.push(i(l,u,e,n))}return o&&a.unshift(o),s&&a.unshift(s),c&&a.unshift(c),a.length>0?`{`+a.join(` `)+`}`:``}function i(e,n,r,i){if(t.collapseEmptyAttributes!==!1&&!n)return e;if(t.preferUnquoted&&R0.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&NY(n,a)>NY(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
|
|
1059
|
+
`,`\r`];return e+`=`+s+CY(n,{subset:c})+s}}function V0(e){W0.call(this,`containerDirective`,e)}function H0(e){W0.call(this,`leafDirective`,e)}function U0(e){W0.call(this,`textDirective`,e)}function W0(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function G0(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function K0(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function q0(e){this.exit(e)}function J0(){this.data.directiveAttributes=[],this.buffer()}function Y0(e){this.data.directiveAttributes.push([`id`,x0(this.sliceSerialize(e),{attribute:!0})])}function X0(e){this.data.directiveAttributes.push([`class`,x0(this.sliceSerialize(e),{attribute:!0})])}function Z0(e){let t=this.data.directiveAttributes;t[t.length-1][1]=x0(this.sliceSerialize(e),{attribute:!0})}function Q0(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function $0(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function e2(e){this.exit(e)}function t2(){return`:`}function n2(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function r2(e){let t=0;return e.type===`containerDirective`?(N0(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function i2(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&RQ(t)?HQ(e,v,`whitespace`)(t):!m&&LQ(t)?L$(e,v)(t):t===null||IQ(t)||BQ(t)||zQ(t)&&t!==45&&t!==95?A(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||LQ(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||LQ(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||IQ(t)||BQ(t)||zQ(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&RQ(t)?HQ(e,C,`whitespace`)(t):!m&&LQ(t)?L$(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&IQ(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&RQ(t)?HQ(e,w,`whitespace`)(t):!m&&LQ(t)?L$(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||LQ(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),k):(e.enter(d),D(t))}function D(t){return t===g?(e.exit(d),E(t)):t===null?n(t):IQ(t)?m?n(t):L$(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||IQ(t)?(e.exit(p),D(t)):(e.consume(t),O)}function k(e){return e===125||LQ(e)?v(e):A(e)}function A(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function a2(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):IQ(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function o2(e,t,n,r){let i=this;return a;function a(t){return t===null||IQ(t)||zQ(t)||BQ(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||IQ(a)||BQ(a)||zQ(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var s2={tokenize:d2,concrete:!0},c2={tokenize:f2,partial:!0},l2={tokenize:p2,partial:!0},u2={tokenize:m2,partial:!0};function d2(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),o2.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(c2,d,d)(t):d(t)}function d(t){return t===123?e.attempt(l2,f,f)(t):f(t)}function f(t){return HQ(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):IQ(i)?r.interrupt?t(i):e.attempt(u2,m,C)(i):n(i)}function m(t){return t===null?C(t):IQ(t)?e.check(u2,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?HQ(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):IQ(t)?e.check(u2,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return IQ(t)?e.check(u2,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return HQ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),HQ(e,c,`whitespace`)(t))}function c(r){return r===null||IQ(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function f2(e,t,n){return a2(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function p2(e,t,n){return i2(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function m2(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var h2={tokenize:v2},g2={tokenize:y2,partial:!0},_2={tokenize:b2,partial:!0};function v2(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),o2.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(g2,s,s)(t):s(t)}function s(t){return t===123?e.attempt(_2,c,c)(t):c(t)}function c(t){return HQ(e,l,`whitespace`)(t)}function l(r){return r===null||IQ(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function y2(e,t,n){return a2(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function b2(e,t,n){return i2(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var x2={tokenize:T2,previous:w2},S2={tokenize:E2,partial:!0},C2={tokenize:D2,partial:!0};function w2(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function T2(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),o2.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(S2,o,o)(t):o(t)}function o(t){return t===123?e.attempt(C2,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function E2(e,t,n){return a2(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function D2(e,t,n){return i2(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function O2(){return{text:{58:x2},flow:{58:[s2,h2]}}}function k2(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(O2()),n.push(z0()),r.push(B0())}var A2={abbr:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},abstract:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[`component`,`label`,`xml:id`]},acknowledgement:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},acro:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},activity:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},ad:{elements:[],attributes:[]},address:{elements:[],attributes:[]},affiliation:{elements:[`department`,`institution`,`location`],attributes:[]},alert:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},algorithm:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},alteration:{elements:`copyleft.copyright.dblprime.degree.ellipsis.flat.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.sharp.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},am:{elements:[],attributes:[]},angles:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},answer:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},appendix:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.notation-list.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.subsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},archive:{elements:[],attributes:[`from`]},area:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`correct`]},areas:{elements:[`p`],attributes:[]},argument:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},article:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.backmatter.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.frontmatter.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.subtitle.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},articletitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},aside:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},assemblage:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},assumption:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},asymptote:{elements:[],attributes:[`component`,`label`]},"asymptote-preamble":{elements:[],attributes:[]},attr:{elements:[],attributes:[]},attribution:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},author:{elements:`abbr.acro.ad.affiliation.alert.am.angles.articletitle.attr.bc.biography.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.department.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.institution.kbd.langle.latex.ldblbracket.location.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.personname.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.support.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`corresponding`,`halign`,`xml:id`]},"author-biographies":{elements:[],attributes:[`length`]},axiom:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},backmatter:{elements:[`appendix`,`colophon`,`idx`,`index`,`references`,`solutions`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},bc:{elements:[],attributes:[]},bibinfo:{elements:[`author`,`copyright`,`credit`,`date`,`edition`,`editor`,`keywords`,`support`,`website`],attributes:[]},biblio:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.author.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.editor.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.ibid.icon.idx.ie.init.insert.journal.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.note.number.obelus.pages.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.publisher.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.series.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.title.today.trademark.url.var.viz.volume.vs.webwork.xelatex.xetex.xref.year`.split(`.`),attributes:[`component`,`label`,`type`,`xml:id`]},biographical:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},biography:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},block:{elements:[`blockquote`,`choice`,`cline`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[`correct`,`order`]},blockquote:{elements:[`attribution`,`idx`,`p`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},blocks:{elements:[`block`],attributes:[`layout`,`randomize`]},blurb:{elements:[],attributes:[`shelf`]},book:{elements:[`backmatter`,`chapter`,`frontmatter`,`handout`,`idx`,`part`,`plaintitle`,`shorttitle`,`subtitle`,`title`,`worksheet`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},brandlogo:{elements:[],attributes:[`source`,`url`]},c:{elements:[],attributes:[]},ca:{elements:[],attributes:[]},caption:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},case:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`direction`,`label`,`xml:base`,`xml:id`,`xml:lang`]},cd:{elements:[`cline`],attributes:[`latexsep`]},cell:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.p.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`bottom`,`colspan`,`halign`,`right`]},chapter:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.section.shorttitle.sidebyside.solutions.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},checkpoint:{elements:[`feedback`,`prompt`],attributes:[`answer`,`answer-variable`,`line`]},choice:{elements:[`blockquote`,`cline`,`console`,`feedback`,`image`,`p`,`pre`,`program`,`statement`,`tabular`,`video`],attributes:[`correct`]},choices:{elements:[`choice`],attributes:[`randomize`]},chord:{elements:[`alteration`],attributes:[`bass`,`bps`,`mode`,`parentheses`,`root`,`suspended`]},claim:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},cline:{elements:[],attributes:[]},code:{elements:[],attributes:[]},col:{elements:[],attributes:[`halign`,`right`,`top`,`width`]},colophon:{elements:[`blockquote`,`colophon-items`,`console`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`video`],attributes:[`component`,`label`,`xml:id`]},"colophon-items":{elements:[],attributes:[]},computation:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},conclusion:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},conjecture:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},console:{elements:[`input`,`output`],attributes:[`component`,`continuation`,`margins`,`prompt`,`width`]},contributor:{elements:[`affiliation`,`department`,`email`,`idx`,`institution`,`location`,`personname`],attributes:[`component`,`label`,`xml:id`]},contributors:{elements:[`contributor`],attributes:[]},convention:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},copyleft:{elements:[],attributes:[]},copyright:{elements:[`holder`,`minilicense`,`shortlicense`,`year`],attributes:[]},corollary:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},creator:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},credit:{elements:[`author`,`entity`,`role`,`title`],attributes:[]},"cross-references":{elements:[],attributes:[`text`]},data:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},date:{elements:`ad.am.bc.ca.copyleft.copyright.dblprime.degree.eg.ellipsis.etal.etc.fillin.icon.ie.kbd.langle.latex.ldblbracket.lq.lsq.mdash.midpoint.minus.nb.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.quantity.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.tex.timeofday.times.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},dblbrackets:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},dblprime:{elements:[],attributes:[]},dedication:{elements:[`idx`,`p`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},definition:{elements:[`idx`,`notation`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},degree:{elements:[],attributes:[]},delete:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},department:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},description:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.p.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tabular.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},division:{elements:[],attributes:[`part`]},dl:{elements:[`li`],attributes:[`component`,`width`]},docinfo:{elements:[`asymptote-preamble`,`author-biographies`,`blurb`,`brandlogo`,`cross-references`,`document-id`,`feedback`,`images`,`initialism`,`latex-image-preamble`,`macros`,`math-package`,`numbering`,`parsons`,`programs`,`rename`],attributes:[`xml:base`,`xml:lang`]},"document-id":{elements:[],attributes:[`edition`]},doubleflat:{elements:[],attributes:[]},doublesharp:{elements:[],attributes:[]},edition:{elements:[],attributes:[]},editor:{elements:[`affiliation`,`department`,`email`,`institution`,`location`,`personname`],attributes:[]},eg:{elements:[],attributes:[]},ellipsis:{elements:[],attributes:[]},em:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},email:{elements:[],attributes:[]},entity:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},etal:{elements:[],attributes:[]},etc:{elements:[],attributes:[]},event:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},example:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exercise:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.pre.preamble.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`workspace`,`xml:base`,`xml:id`,`xml:lang`]},exercisegroup:{elements:[`conclusion`,`exercise`,`idx`,`introduction`,`title`],attributes:[`cols`,`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exercises:{elements:[`conclusion`,`exercise`,`exercisegroup`,`idx`,`interactive`,`introduction`,`plaintitle`,`shorttitle`,`subexercises`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},explanation:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},exploration:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},fact:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},feedback:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.url.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},figure:{elements:[`caption`,`idx`,`image`,`interactive`,`sbsgroup`,`score`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},fillin:{elements:[],attributes:[`characters`,`cols`,`fill`,`rows`]},flat:{elements:[],attributes:[]},fn:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:id`]},foreign:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`xml:lang`]},fragment:{elements:[`code`,`fragref`,`title`],attributes:[`filename`,`xml:id`]},fragref:{elements:[],attributes:[`ref`]},frontmatter:{elements:[`abstract`,`acknowledgement`,`bibinfo`,`biography`,`colophon`,`dedication`,`idx`,`preface`,`title`,`titlepage`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},genus:{elements:[],attributes:[]},gi:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`idx`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},glossary:{elements:[`gi`,`headnote`,`idx`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},h:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`sortby`]},handout:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.page.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.shorttitle.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`bottom`,`component`,`label`,`left`,`margin`,`right`,`top`,`xml:base`,`xml:id`,`xml:lang`]},headnote:{elements:[`aside`,`biographical`,`blockquote`,`console`,`historical`,`image`,`p`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`video`],attributes:[]},heuristic:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},hint:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},historical:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},holder:{elements:[],attributes:[]},hypothesis:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ibid:{elements:[],attributes:[]},icon:{elements:[],attributes:[`name`]},identity:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},idx:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.h.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.see.seealso.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`component`,`finish`,`label`,`sortby`,`start`,`xml:id`]},ie:{elements:[],attributes:[]},image:{elements:[`asymptote`,`description`,`latex-image`,`sageplot`,`shortdescription`],attributes:[`archive`,`component`,`decorative`,`margins`,`pg-name`,`rotate`,`source`,`width`,`xml:id`]},images:{elements:[`archive`],attributes:[]},index:{elements:[`idx`,`index-list`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},"index-list":{elements:[],attributes:[]},init:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},initialism:{elements:[],attributes:[]},input:{elements:[],attributes:[`continuation`,`onclick`,`onkeypress`,`prompt`,`style`,`type`,`value`]},insert:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},insight:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},institution:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},instruction:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},instructions:{elements:[`blockquote`,`console`,`idx`,`image`,`p`,`pre`,`program`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},interactive:{elements:[`instructions`,`sbsgroup`,`sidebyside`,`slate`,`static`],attributes:[`aspect`,`component`,`iframe`,`label`,`platform`,`preview`,`source`,`version`,`width`,`xml:id`]},interlude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},intertext:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},introduction:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},investigation:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},iotest:{elements:[`input`,`output`],attributes:[]},journal:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.m.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},justification:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},kbd:{elements:[],attributes:[`name`]},keyword:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[`primary`]},keywords:{elements:[`keyword`,`title`],attributes:[`authority`,`variant`]},langle:{elements:[],attributes:[]},latex:{elements:[],attributes:[]},"latex-image":{elements:[],attributes:[`component`,`label`]},"latex-image-preamble":{elements:[],attributes:[]},ldblbracket:{elements:[],attributes:[]},lemma:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},letter:{elements:[],attributes:[]},li:{elements:`abbr.acro.ad.alert.am.angles.articletitle.aside.attr.bc.biographical.blockquote.c.ca.cd.chord.console.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.figure.fillin.flat.fn.foreign.historical.icon.idx.ie.image.init.insert.interactive.kbd.langle.latex.ldblbracket.list.listing.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.p.permille.pf.phonomark.pilcrow.plusminus.pm.pre.prefigure.pretext.prime.program.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.sage.sbsgroup.scaledeg.section-mark.servicemark.sharp.sidebyside.solidus.sq.stale.swungdash.table.tabular.tag.tage.taxon.term.tex.timeofday.times.timesignature.title.today.trademark.ul.url.var.video.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},line:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`indent`]},list:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`plaintitle`,`shorttitle`,`title`,`ul`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},"list-of":{elements:[],attributes:[`divisions`,`elements`,`empty`,`scope`]},listing:{elements:[`console`,`idx`,`plaintitle`,`program`,`shorttitle`,`title`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},location:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.line.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},lq:{elements:[],attributes:[]},lsq:{elements:[],attributes:[]},m:{elements:[`fillin`,`var`],attributes:[]},"macro-file":{elements:[],attributes:[]},macros:{elements:[],attributes:[]},mag:{elements:[],attributes:[]},match:{elements:[`premise`,`response`],attributes:[`order`]},matches:{elements:[`match`],attributes:[]},"math-package":{elements:[],attributes:[`latex-name`,`mathjax-name`]},md:{elements:[`fillin`,`intertext`,`mrow`,`var`,`xref`],attributes:[`alignat-columns`,`alignment`,`break`,`number`]},mdash:{elements:[],attributes:[]},mdn:{elements:[`fillin`,`intertext`,`mrow`,`var`],attributes:[`alignat-columns`,`alignment`,`break`,`number`]},me:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`component`,`label`,`xml:id`]},memo:{elements:[],attributes:[]},men:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`component`,`label`,`xml:id`]},midpoint:{elements:[],attributes:[]},minilicense:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},minus:{elements:[],attributes:[]},mrow:{elements:[`fillin`,`idx`,`var`,`xref`],attributes:[`break`,`component`,`label`,`number`,`tag`,`xml:id`]},myopenmath:{elements:[],attributes:[`params`,`problem`]},n:{elements:[],attributes:[`acc`,`octave`,`pc`]},name:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},natural:{elements:[],attributes:[]},nb:{elements:[],attributes:[]},nbsp:{elements:[],attributes:[]},ndash:{elements:[],attributes:[]},notation:{elements:[`description`,`usage`],attributes:[]},"notation-list":{elements:[],attributes:[]},note:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},number:{elements:[],attributes:[]},numbering:{elements:[`division`],attributes:[]},obelus:{elements:[],attributes:[]},objectives:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`title`,`ul`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},observation:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ol:{elements:[`li`],attributes:[`cols`,`component`,`marker`]},outcomes:{elements:[`conclusion`,`dl`,`idx`,`introduction`,`ol`,`title`,`ul`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},output:{elements:[],attributes:[]},p:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.cd.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.ul.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[`component`,`label`,`xml:id`]},page:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.video.warning`.split(`.`),attributes:[]},pages:{elements:[],attributes:[`end`,`start`]},paragraphs:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.observation.p.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},parsons:{elements:[],attributes:[`language`]},part:{elements:[`chapter`,`idx`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},per:{elements:[],attributes:[`base`,`exp`,`prefix`]},permille:{elements:[],attributes:[]},personname:{elements:`copyleft.copyright.dblprime.degree.ellipsis.icon.kbd.langle.ldblbracket.lq.lsq.mdash.midpoint.minus.nbsp.ndash.obelus.permille.phonomark.pilcrow.plusminus.prime.rangle.rdblbracket.registered.rq.rsq.section-mark.servicemark.solidus.swungdash.times.trademark`.split(`.`),attributes:[]},pf:{elements:[],attributes:[`language`]},"pg-code":{elements:[],attributes:[]},"pg-macros":{elements:[`macro-file`],attributes:[]},phonomark:{elements:[],attributes:[]},pilcrow:{elements:[],attributes:[]},plaintitle:{elements:[],attributes:[]},plusminus:{elements:[],attributes:[]},pm:{elements:[],attributes:[]},poem:{elements:[`author`,`idx`,`line`,`stanza`,`title`],attributes:[`component`,`halign`,`label`,`xml:base`,`xml:id`,`xml:lang`]},postamble:{elements:[],attributes:[`indent`,`visible`]},postlude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},pre:{elements:[`cline`],attributes:[]},preamble:{elements:[],attributes:[`indent`,`visible`]},preface:{elements:[`aside`,`attribution`,`biographical`,`blockquote`,`console`,`contributors`,`historical`,`idx`,`image`,`p`,`paragraphs`,`pre`,`program`,`sbsgroup`,`sidebyside`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},prefigure:{elements:[],attributes:[]},prelude:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},premise:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},pretext:{elements:[`article`,`book`,`docinfo`,`letter`,`memo`],attributes:[`xml:lang`]},prime:{elements:[],attributes:[]},principle:{elements:[`creator`,`idx`,`statement`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},problem:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},program:{elements:[`checkpoint`,`code`,`postamble`,`preamble`,`stdin`,`tests`],attributes:[`add-files`,`autorun`,`chatcodes`,`codelens`,`compile-also`,`compiler-args`,`component`,`database`,`download`,`extra-compiler-args`,`filename`,`hidecode`,`highlight-lines`,`include`,`interactive`,`interpreter-args`,`label`,`language`,`line-numbers`,`linker-args`,`margins`,`starting-step`,`timelimit`,`width`,`xml:id`]},programs:{elements:[],attributes:[`compiler-args`,`download`,`interpreter-args`,`language`,`linenumbers`,`linker-args`,`timeout`]},project:{elements:`answer.areas.aside.biographical.blockquote.blocks.choices.conclusion.console.feedback.figure.hint.historical.idx.image.interactive.introduction.list.listing.matches.myopenmath.ol.p.postamble.postlude.pre.preamble.prelude.program.response.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video.webwork`.split(`.`),attributes:[`adaptive`,`attachment`,`component`,`indentation`,`label`,`language`,`number`,`xml:base`,`xml:id`,`xml:lang`]},prompt:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},proof:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},proposition:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},ps:{elements:[],attributes:[]},publisher:{elements:[],attributes:[]},pubtitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},q:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},quantity:{elements:[`mag`,`per`,`unit`],attributes:[]},question:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},rangle:{elements:[],attributes:[]},rdblbracket:{elements:[],attributes:[]},"reading-questions":{elements:[`conclusion`,`exercise`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},reasoning:{elements:[`aside`,`biographical`,`blockquote`,`case`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},references:{elements:[`biblio`,`conclusion`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},registered:{elements:[],attributes:[]},remark:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},rename:{elements:[],attributes:[`element`,`xml:lang`]},response:{elements:[`blockquote`,`console`,`image`,`p`,`pre`,`program`,`tabular`,`video`],attributes:[]},role:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},row:{elements:[`cell`],attributes:[`bottom`,`halign`,`header`,`left`,`valign`]},rq:{elements:[],attributes:[]},rsq:{elements:[],attributes:[]},sage:{elements:[`input`,`output`],attributes:[`auto-evaluate`,`component`,`doctest`,`language`,`tolerance`,`type`]},sageplot:{elements:[],attributes:[`aspect`,`component`,`label`,`variant`]},sbsgroup:{elements:[`sidebyside`],attributes:[`component`,`margins`,`valign`,`valigns`,`width`,`widths`]},scaledeg:{elements:[],attributes:[]},score:{elements:[],attributes:[`musescore`,`musescoreuser`]},section:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.subsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},"section-mark":{elements:[],attributes:[]},see:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},seealso:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},series:{elements:[],attributes:[]},servicemark:{elements:[],attributes:[]},sharp:{elements:[],attributes:[]},shortdescription:{elements:[`var`],attributes:[]},shortlicense:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},shorttitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]},sidebyside:{elements:[`console`,`dl`,`exercise`,`figure`,`image`,`interactive`,`list`,`listing`,`ol`,`p`,`poem`,`pre`,`program`,`slate`,`stack`,`table`,`tabular`,`task`,`ul`,`video`],attributes:[`component`,`margins`,`valign`,`valigns`,`width`,`widths`]},slate:{elements:[`input`,`p`,`sidebyside`,`tabular`,`xhtml:button`],attributes:[`aspect`,`axis`,`component`,`grid`,`label`,`material`,`source`,`surface`,`xml:id`]},solidus:{elements:[],attributes:[]},solution:{elements:`argument.aside.biographical.blockquote.console.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},solutions:{elements:[`conclusion`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`admit`,`component`,`divisional`,`inline`,`label`,`project`,`reading`,`scope`,`worksheet`,`xml:base`,`xml:id`,`xml:lang`]},species:{elements:[],attributes:[]},sq:{elements:`abbr.acro.ad.alert.am.angles.area.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},stack:{elements:[`console`,`dl`,`image`,`ol`,`p`,`pre`,`program`,`slate`,`tabular`,`ul`,`video`],attributes:[]},stale:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},stanza:{elements:[`idx`,`line`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},statement:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`image`,`instruction`,`interactive`,`list`,`listing`,`ol`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`video`],attributes:[`correct`]},static:{elements:[`image`],attributes:[]},stdin:{elements:[],attributes:[]},subexercises:{elements:[`conclusion`,`exercise`,`exercisegroup`,`idx`,`introduction`,`plaintitle`,`shorttitle`,`title`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subsection:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.subsubsection.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subsubsection:{elements:`activity.algorithm.argument.aside.assemblage.assumption.author.axiom.biographical.blockquote.claim.computation.conjecture.console.convention.corollary.data.definition.example.exercise.exercises.explanation.exploration.fact.figure.fragment.glossary.handout.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.paragraphs.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reading-questions.reasoning.references.remark.sage.sbsgroup.shorttitle.sidebyside.solutions.table.tabular.technology.theorem.title.video.warning.worksheet`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},subtitle:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},support:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.cd.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.dl.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.fn.foreign.icon.idx.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.md.mdash.mdn.me.men.midpoint.minus.n.natural.nb.nbsp.ndash.notation.obelus.ol.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.ul.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},swungdash:{elements:[],attributes:[]},table:{elements:[`idx`,`plaintitle`,`shorttitle`,`tabular`,`title`],attributes:[`component`,`label`,`landscape`,`xml:base`,`xml:id`,`xml:lang`]},tabular:{elements:[`col`,`row`],attributes:[`bottom`,`component`,`halign`,`left`,`margins`,`right`,`row-headers`,`top`,`valign`,`width`]},tag:{elements:[],attributes:[]},tage:{elements:[],attributes:[]},task:{elements:`answer.aside.biographical.blockquote.conclusion.console.figure.hint.historical.idx.image.interactive.introduction.list.listing.p.pre.program.sage.sbsgroup.sidebyside.solution.statement.table.tabular.task.title.video`.split(`.`),attributes:[`component`,`label`,`workspace`,`xml:base`,`xml:id`,`xml:lang`]},taxon:{elements:[`genus`,`species`],attributes:[`ncbi`]},technology:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},term:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},tests:{elements:[`iotest`],attributes:[`visible`]},tex:{elements:[],attributes:[]},theorem:{elements:`argument.aside.biographical.blockquote.console.creator.explanation.figure.historical.idx.image.interactive.justification.list.listing.p.pre.program.proof.reasoning.sage.sbsgroup.sidebyside.statement.table.tabular.title.video`.split(`.`),attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},timeofday:{elements:[],attributes:[]},times:{elements:[],attributes:[]},timesignature:{elements:[],attributes:[`bottom`,`top`]},title:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.line.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.url.var.viz.vs.webwork.xelatex.xetex.xref`.split(`.`),attributes:[]},titlepage:{elements:[`titlepage-items`],attributes:[]},"titlepage-items":{elements:[],attributes:[]},today:{elements:[],attributes:[]},trademark:{elements:[],attributes:[]},ul:{elements:[`li`],attributes:[`cols`,`component`,`marker`]},unit:{elements:[],attributes:[`base`,`exp`,`prefix`]},url:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`href`,`visual`]},usage:{elements:[`m`],attributes:[]},var:{elements:[],attributes:[`category`,`evaluator`,`form`,`name`,`width`]},video:{elements:[],attributes:[`aspect`,`component`,`end`,`href`,`label`,`margins`,`play-at`,`preview`,`source`,`start`,`vimeo`,`width`,`xml:id`,`youtube`,`youtubeplaylist`]},viz:{elements:[],attributes:[]},volume:{elements:[],attributes:[]},vs:{elements:[],attributes:[]},warning:{elements:[`aside`,`biographical`,`blockquote`,`console`,`figure`,`historical`,`idx`,`image`,`interactive`,`list`,`listing`,`p`,`pre`,`program`,`sage`,`sbsgroup`,`sidebyside`,`table`,`tabular`,`title`,`video`],attributes:[`component`,`label`,`xml:base`,`xml:id`,`xml:lang`]},website:{elements:[`address`,`name`,`url`],attributes:[]},webwork:{elements:[`conclusion`,`description`,`hint`,`introduction`,`pg-code`,`pg-macros`,`solution`,`statement`,`task`],attributes:[`component`,`copy`,`label`,`seed`,`source`,`xml:id`]},worksheet:{elements:`activity.algorithm.argument.aside.assemblage.assumption.axiom.biographical.blockquote.claim.computation.conclusion.conjecture.console.convention.corollary.data.definition.example.exercise.explanation.exploration.fact.figure.fragment.heuristic.historical.hypothesis.identity.idx.image.insight.interactive.introduction.investigation.justification.lemma.list.list-of.listing.note.objectives.observation.outcomes.p.page.plaintitle.poem.pre.principle.problem.program.project.proof.proposition.question.reasoning.remark.sage.sbsgroup.shorttitle.sidebyside.table.tabular.technology.theorem.title.video.warning`.split(`.`),attributes:[`bottom`,`component`,`label`,`left`,`margin`,`right`,`top`,`xml:base`,`xml:id`,`xml:lang`]},xelatex:{elements:[],attributes:[]},xetex:{elements:[],attributes:[]},"xhtml:button":{elements:[],attributes:[`id`,`type`]},xref:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[`detail`,`first`,`last`,`provisional`,`ref`,`text`]},year:{elements:`abbr.acro.ad.alert.am.angles.articletitle.attr.bc.c.ca.chord.copyleft.copyright.dblbrackets.dblprime.degree.delete.doubleflat.doublesharp.eg.ellipsis.em.email.etal.etc.fillin.flat.foreign.icon.ie.init.insert.kbd.langle.latex.ldblbracket.lq.lsq.m.mdash.midpoint.minus.n.natural.nb.nbsp.ndash.obelus.permille.pf.phonomark.pilcrow.plusminus.pm.prefigure.pretext.prime.ps.pubtitle.q.quantity.rangle.rdblbracket.registered.rq.rsq.scaledeg.section-mark.servicemark.sharp.solidus.sq.stale.swungdash.tag.tage.taxon.term.tex.timeofday.times.timesignature.today.trademark.viz.vs.webwork.xelatex.xetex`.split(`.`),attributes:[]}},j2=[],M2=Object.freeze(Object.keys(A2));new Set(M2),new Set(j2);var N2=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`paragraphs`];function P2(e){return N2.includes(e)}var F2=[`worksheet`,`exercises`,`references`,`appendix`,`glossary`,`handout`,`solutions`,`reading-questions`,`introduction`,`conclusion`,`slide`];function I2(e){return F2.includes(e)}var L2=[`introduction`,`conclusion`];function R2(e){return L2.includes(e)}function z2(e){return P2(e)||I2(e)}function B2(e,t){if(R2(e))return`paragraphs`;if(t<=1)return e;if(e===`appendix`)return B2(`chapter`,t);if(I2(e))return`paragraphs`;let n=N2.indexOf(e)+(t-1);return N2[Math.min(n,N2.length-1)]}var V2=[`article`,`book`,`slideshow`];function H2(e){return V2.includes(e)}function U2(e){return G2(e,1)}var W2=[`section`,`slide`,`paragraphs`];function G2(e,t){if(e===`slideshow`){let e=Math.max(0,t-1);return W2[Math.min(e,W2.length-1)]}return B2(e===`book`?`chapter`:`section`,t)}function K2(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),N0(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function q2(e,t={}){let n={};for(let[e,r]of Object.entries(t))r!=null&&(n[e]=r);return{type:`element`,name:`plus:${e}`,attributes:n,children:[]}}function J2(e){let t=e.name?.trim();return t?q2(t,e.attributes??{}):null}var Y2={theorem:{type:`theorem`,category:`theorem-like`,requiresStatement:!0},lemma:{type:`lemma`,category:`theorem-like`,requiresStatement:!0},corollary:{type:`corollary`,category:`theorem-like`,requiresStatement:!0},proposition:{type:`proposition`,category:`theorem-like`,requiresStatement:!0},claim:{type:`claim`,category:`theorem-like`,requiresStatement:!0},fact:{type:`fact`,category:`theorem-like`,requiresStatement:!0},conjecture:{type:`conjecture`,category:`theorem-like`,requiresStatement:!0},axiom:{type:`axiom`,category:`theorem-like`,requiresStatement:!0},principle:{type:`principle`,category:`theorem-like`,requiresStatement:!0},hypothesis:{type:`hypothesis`,category:`theorem-like`,requiresStatement:!0},algorithm:{type:`algorithm`,category:`theorem-like`,requiresStatement:!0},definition:{type:`definition`,category:`definition-like`,requiresStatement:!0},notation:{type:`notation`,category:`definition-like`,requiresStatement:!0},remark:{type:`remark`,category:`remark-like`,requiresStatement:!1},note:{type:`note`,category:`remark-like`,requiresStatement:!1},observation:{type:`observation`,category:`remark-like`,requiresStatement:!1},warning:{type:`warning`,category:`remark-like`,requiresStatement:!1},insight:{type:`insight`,category:`remark-like`,requiresStatement:!1},assemblage:{type:`assemblage`,category:`remark-like`,requiresStatement:!1},example:{type:`example`,category:`example-like`,requiresStatement:!1},question:{type:`question`,category:`example-like`,requiresStatement:!1},problem:{type:`problem`,category:`example-like`,requiresStatement:!1},exercise:{type:`exercise`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},activity:{type:`activity`,category:`example-like`,requiresStatement:!1},exploration:{type:`exploration`,category:`example-like`,requiresStatement:!1},investigation:{type:`investigation`,category:`example-like`,requiresStatement:!1},project:{type:`project`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},task:{type:`task`,category:`example-like`,requiresStatement:!0,hasNestedTasks:!0},proof:{type:`proof`,category:`proof-like`,requiresStatement:!1},case:{type:`case`,category:`proof-like`,requiresStatement:!1},solution:{type:`solution`,category:`solution-like`,requiresStatement:!1},hint:{type:`hint`,category:`solution-like`,requiresStatement:!1},answer:{type:`answer`,category:`solution-like`,requiresStatement:!1}};function X2(e){return Y2[e.toLowerCase()]}var Z2=new Set(Object.entries(Y2).filter(([e,t])=>t.category===`proof-like`||t.category===`solution-like`).map(([e])=>e));function Q2(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function $2(e){return e.type===`containerDirective`&&e.name===`task`}function e4(e){return e.type===`containerDirective`&&Z2.has(e.name)}function t4(e){let t=[];for(let n of e)n.name===`ul`||n.name===`ol`?t.length>0&&t[t.length-1]?.name===`p`?t[t.length-1].children.push(n):t.push(Q2(`p`,[n])):t.push(n);return t}function n4(e,t,n,r,i,a,o){let s=[];if(n&&s.push(n),e.hasNestedTasks){let t=r.findIndex($2);if(t!==-1){let n=[];for(let e=0;e<r.length;e++)$2(r[e])&&n.push(e);let c=n[n.length-1],l=r.slice(0,t),u=r.slice(t).filter($2),d=[],f=[],p=[];for(let e=t;e<r.length;e++){let t=r[e];if(!$2(t)){if(e<c){d.push(t);continue}if(e4(t)){p.push(t);continue}f.push(t)}}if(d.length>0&&(i.messages??=[]).push({type:`warning`,reason:`Dropped ${d.length} non-task node(s) between task directives in ${e.type}.`,category:`dropped-content-between-tasks`,position:d[0].position?.start}),l.length>0){let e=t4(l.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(Q2(`introduction`,e))}for(let e of u){let t=o(e,i);t&&s.push(t)}if(f.length>0){let e=t4(f.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(Q2(`conclusion`,e))}for(let e of p){let t=o(e,i);t&&s.push(t)}}else r4(s,e,r,i,a,o)}else r4(s,e,r,i,a,o);return Q2(e.type,s,t)}function r4(e,t,n,r,i,a){if(t.requiresStatement){let t=[],o=[];for(let e of n)if(e.type===`containerDirective`&&Z2.has(e.name)){let t=a(e,r);t&&o.push(t)}else t.push(e);if(t.length>0){let n=t4(t.map(e=>i(e,r)).filter(e=>e!==null));n.length>0&&e.push(Q2(`statement`,n))}e.push(...o)}else{let t=t4(n.map(e=>i(e,r)).filter(e=>e!==null));e.push(...t)}}function i4(e){return{type:`text`,value:e}}function a4(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function o4(e,t,n){return a4(e,[i4(t)],n)}function s4(e){return{type:`comment`,value:e.replace(/--/g,`- -`)}}function c4(e,t){let n=e?.position,r=n?.start?.offset,i=n?.end?.offset;return t.source&&r!=null&&i!=null?t.source.slice(r,i):``}function l4(e,t,n){return a4(`TODO`,[s4(`todo: ${t}`),o4(`pre`,n)],{type:e})}function u4(e,t,n){return a4(`TODO`,[s4(`todo: ${t}`),o4(`c`,n)],{type:e})}function d4(e){let t=[];for(let n of e)n.name===`ul`||n.name===`ol`?t.length>0&&t[t.length-1]?.name===`p`?t[t.length-1].children.push(n):t.push(a4(`p`,[n])):t.push(n);return t}function f4(e,t,n){return p4(e,t,n).tree}function p4(e,t,n){let r=[],i={ancestors:[],depth:0,messages:r,source:t,topLevelDivision:n?.topLevelDivision??`chapter`,documentRoot:n?.documentRoot,topLevelAttributes:n?.topLevelAttributes,topLevelAttributesApplied:n?.topLevelAttributes?{done:!1}:void 0,topLevelTitle:n?.topLevelTitle},a=e.children;if(i.documentRoot){let e=x4(i),t=i.topLevelTitle?a4(`title`,[i4(i.topLevelTitle)]):null,{introduction:n,rest:o}=v4(a,i),s=m4(o,i),c=[...t?[t]:[],...n?[n]:[],...s];return{tree:{type:`root`,children:[a4(i.documentRoot,c,e)]},messages:r}}if(R2(i.topLevelDivision)){let e=x4(i),t=d4(m4(a,{...i,depth:1},!0));return{tree:{type:`root`,children:[a4(i.topLevelDivision,t,e)]},messages:r}}if(i.topLevelTitle){let e=x4(i),t=a4(`title`,[i4(i.topLevelTitle)]),n={...i,depth:i.depth+1,headingDepthOffset:(i.headingDepthOffset??0)+1},{introduction:o,rest:s}=v4(a,n),c=d4(m4(s,n,!0)),l=o?[t,o,...c]:[t,...c];return{tree:{type:`root`,children:[a4(i.topLevelDivision,l,e)]},messages:r}}let{introduction:o,rest:s}=v4(a,i),c=m4(s,i);return{tree:{type:`root`,children:o?[o,...c]:c},messages:r}}function m4(e,t,n=!1){let r=7;for(let t of e)t.type===`heading`&&(r=Math.min(r,t.depth));if(r===7)return h4(e,t,n);let i=[],a=null,o=[],s=[],c=()=>{a&&(i.push(g4(a,s,t)),a=null,s=[])};for(let l of e)l.type===`heading`&&l.depth===r?(!a&&o.length>0&&(i.push(...h4(o,t,n)),o=[]),c(),a=l,s=[]):a?s.push(l):o.push(l);return!a&&o.length>0&&i.push(...h4(o,t,n)),c(),i}function h4(e,t,n=!1){let r=[];for(let n=0;n<e.length;n+=1){let i=e[n],a=C4(i,t);if(a!==null){if(a.name===`p`&&a.children.length===1&&a.children[0].name===`md`){let i=a.children[0],o=r[r.length-1],s=n+1<e.length?C4(e[n+1],t):null,c=s?.name===`p`?s.children:null;if(o?.name===`p`)o.children.push(i),c&&(o.children.push(...c),n+=1);else{let e=[i];c&&(e.push(...c),n+=1),r.push(a4(`p`,e))}continue}if((a.name===`ul`||a.name===`ol`)&&r.length>0){let e=r[r.length-1];if(e?.name===`p`){e.children.push(a);continue}}r.push(a)}}return n?d4(r):r}function g4(e,t,n){let r=e.depth+(n.headingDepthOffset??0),i=n.documentRoot?G2(n.documentRoot,r):B2(n.topLevelDivision,r),a=a4(`title`,L4(e.children,n)),o=b4(e,n),s={...n,depth:n.depth+1},{introduction:c,rest:l}=v4(t,s),u=d4(m4(l,s,!0));return a4(i,c?[a,c,...u]:[a,...u],o)}function _4(e){return e.type===`leafDirective`&&z2(e.name)}function v4(e,t){let n=e.findIndex(e=>e.type===`heading`||_4(e));if(n<=0)return{introduction:null,rest:e};let r=e.slice(0,n),i=e.slice(n),a=h4(r,t,!0);return{introduction:a.length>0?a4(`introduction`,a):null,rest:i}}function y4(e){let t=e.data;return t?.id?{"xml:id":t.id}:void 0}function b4(e,t){let n=y4(e),r=x4(t);if(!(!n&&!r))return{...r,...n}}function x4(e){if(e.depth!==0)return;let t=e.topLevelAttributesApplied;if(!(!e.topLevelAttributes||!t||t.done))return t.done=!0,e.topLevelAttributes}var S4={paragraph:(e,t)=>w4(e,t),blockquote:(e,t)=>T4(e,t),list:(e,t)=>E4(e,t),code:(e,t)=>O4(e),containerDirective:(e,t)=>M4(e,t),leafDirective:(e,t)=>j4(e,t)};function C4(e,t){let n=S4[e.type];return n?n(e,t):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown block type: ${e.type}`,category:`unknown-block-type`}),l4(`unknown-block-type`,`unknown block type "${e.type}"`,c4(e,t)))}function w4(e,t){return a4(`p`,L4(e.children,t))}function T4(e,t){return a4(`blockquote`,e.children.filter(e=>e.type===`paragraph`).map(n=>w4(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1})))}function E4(e,t){let n=e.children.map(n=>D4(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1}));return a4(e.ordered?`ol`:`ul`,n)}function D4(e,t){return a4(`li`,h4(e.children,t))}function O4(e,t){return o4(`program`,e.value,e.lang?{language:e.lang}:void 0)}function k4(e,t){let n=e.value.split(/\\\\|[\r\n]+/).map(e=>e.trim()).filter(e=>e.length>0);return n.length>1?a4(`md`,n.map(e=>o4(`mrow`,e))):o4(`md`,n[0]??``)}function A4(e,t){return e.meta===`inline`?o4(`m`,e.value):k4(e)}function j4(e,t){return J2(e)||(t.messages&&t.messages.push({type:`warning`,reason:`Unnamed leaf directive`,category:`unknown-directive`}),l4(`unknown-directive`,`unnamed leaf directive`,c4(e,t)))}function M4(e,t){let n=X2(e.name);if(!n)return t.messages&&t.messages.push({type:`warning`,reason:`Unknown directive: ${e.name}`,category:`unknown-directive`}),l4(`unknown-directive`,`unknown directive "${e.name}"`,c4(e,t));let r=P4(e),i=e.children,{title:a,body:o}=N4(i,t);return n4(n,r,a,o,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1},(e,t)=>C4(e,t),(e,t)=>M4(e,t))}function N4(e,t){let n=e[0];return n?.type===`paragraph`&&n.data?.directiveLabel===!0?{title:a4(`title`,L4(n.children,t)),body:e.slice(1)}:{title:null,body:e}}function P4(e){let t=e.attributes??{},n={};for(let[e,r]of Object.entries(t))r!=null&&(n[e===`id`?`xml:id`:e]=r);return Object.keys(n).length>0?n:void 0}function F4(e,t){return!t||e.position?.start?.offset===null||e.position?.start?.offset===void 0?`asterisk`:t.charAt(e.position.start.offset)===`_`?`underscore`:`asterisk`}var I4={text:(e,t)=>i4(e.value),emphasis:(e,t)=>a4(F4(e,t.source)===`underscore`?`term`:`em`,L4(e.children,t)),strong:(e,t)=>a4(`alert`,L4(e.children,t)),inlineCode:(e,t)=>o4(`c`,e.value),math:(e,t)=>A4(e)};function L4(e,t){return e.flatMap(e=>R4(e,t)).filter(e=>e!==null)}function R4(e,t){let n=I4[e.type];return n?n(e,{...t,ancestors:[...t.ancestors,e]}):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown inline type: ${e.type}`,category:`unknown-inline-type`}),u4(`unknown-inline-type`,`unknown inline type "${e.type}"`,c4(e,t)))}var z4=[{open:`$$`,close:`$$`,isDisplay:!0},{open:`\\[`,close:`\\]`,isDisplay:!0},{open:`$`,close:`$`,isDisplay:!1},{open:`\\(`,close:`\\)`,isDisplay:!1}],B4=`PTX_MATH_TOKEN_`,V4=RegExp(`${B4}(\\d+)`,`g`);function H4(e,t){let n=null;for(let r of z4){let i=e.indexOf(r.open,t);if(i===-1)continue;let a=e.indexOf(r.close,i+r.open.length);a!==-1&&!(r.open===`$`&&(i>0&&e[i-1]===`$`||i+1<e.length&&e[i+1]===`$`))&&(!n||i<n.index)&&(n={index:i,pattern:r,content:e.substring(i+r.open.length,a)})}return n}function U4(e,t){let n=t;for(;n<e.length;){let t=e.indexOf("`",n);if(t===-1)return null;let r=0,i=t;for(;i<e.length&&e[i]==="`";)r++,i++;let a="`".repeat(r),o=i;for(;o<e.length;){let n=e.indexOf(a,o);if(n===-1)break;let i=n+r;if(i>=e.length||e[i]!=="`")return{start:t,end:i};o=n+1}n=t+r}return null}function W4(e){let t=new Map,n=``,r=0,i=0;for(;r<e.length;){let a=U4(e,r),o=H4(e,r);if(a&&(!o||a.start<o.index)){n+=e.substring(r,a.end),r=a.end;continue}if(!o){n+=e.substring(r);break}n+=e.substring(r,o.index);let s=`${B4}${i}`;n+=s,t.set(s,{type:`math`,value:o.content,meta:o.pattern.isDisplay?`display`:`inline`}),r=o.index+o.pattern.open.length+o.content.length+o.pattern.close.length,i+=1}return{markdown:n,tokens:t}}function G4(e){let t=[],n=0;for(;n<e.length;){let r=H4(e,n);if(!r){n<e.length&&t.push({type:`text`,value:e.substring(n)});break}r.index>n&&t.push({type:`text`,value:e.substring(n,r.index)}),t.push({type:`math`,value:r.content,meta:r.pattern.isDisplay?`display`:`inline`}),n=r.index+r.pattern.open.length+r.content.length+r.pattern.close.length}return t.length===0?[{type:`text`,value:e}]:t}function K4(e,t){let n=[],r=0;V4.lastIndex=0;let i=V4.exec(e);for(;i;){let a=i.index,o=i[0];a>r&&n.push({type:`text`,value:e.substring(r,a)});let s=t.get(o);s?n.push(s):n.push({type:`text`,value:o}),r=a+o.length,i=V4.exec(e)}return r<e.length&&n.push({type:`text`,value:e.substring(r)}),n.length===0?[{type:`text`,value:e}]:n}function q4(e){K2(e,`paragraph`,e=>{let t=e.children||[],n=[];for(let e of t)if(e.type===`text`){let t=G4(e.value);n.push(...t)}else n.push(e);e.children=n})}function J4(e,t){K2(e,`paragraph`,e=>{let n=e.children||[],r=[];for(let e of n)if(e.type===`text`){let n=K4(e.value,t);r.push(...n)}else r.push(e);e.children=r})}function Y4(e){let t=e.trim();if(!t.startsWith(`:`))return null;let n=0;for(let e=0;e<t.length&&t[e]===`:`;e++)n++;if(n<3)return null;let r=t.slice(n).trim(),i=r.match(/^([a-zA-Z0-9_-]+)(\[[^\]]*\])?(\{[^}]*\})?$/);return r===``?{colons:n,label:null,lineIndex:-1,isOpen:!1}:i?{colons:n,label:i[0],lineIndex:-1,isOpen:!0}:null}function X4(e){let t=[],n=[];for(let r of e)if(r.isOpen){let e={colons:r.colons,finalColons:r.colons,label:r.label,openLineIndex:r.lineIndex,closeLineIndex:null,children:[],parent:null};if(t.length>0){let n=t[t.length-1];e.parent=n,n.children.push(e)}else n.push(e);t.push(e)}else{let e=t[t.length-1];e&&e.colons===r.colons&&(e.closeLineIndex=r.lineIndex,t.pop())}return n}function Z4(e){if(e.children.length===0)e.finalColons=e.colons;else{let t=Math.max(...e.children.map(Z4));e.finalColons=Math.max(e.colons,t+1)}return e.finalColons}function Q4(e,t,n){let r=e.slice(),i=[],a=t.slice();for(;a.length>0;){let e=a.shift();i.push(e),a.push(...e.children)}for(let e of i){if(e.openLineIndex>=0){let t=r[e.openLineIndex],n=t.match(/^:+/)?.[0].length||3,i=t.slice(n);r[e.openLineIndex]=`:`.repeat(e.finalColons)+i}e.closeLineIndex!==null&&e.closeLineIndex>=0&&(r[e.closeLineIndex]=`:`.repeat(e.finalColons))}return r}function $4(e){let t=e.split(`
|
|
1060
|
+
`),n=[],r=!1,i=null;for(let e=0;e<t.length;e++){let a=t[e],o=a.trim().match(/^(`{3,}|~{3,})/);if(o){let e=o[1];r?i&&e[0]===i[0]&&e.length>=i.length&&(r=!1,i=null):(r=!0,i=e);continue}if(r)continue;let s=Y4(a);s&&n.push({...s,lineIndex:e})}if(n.length===0)return e;let a=X4(n);for(let e of a)Z4(e);return Q4(t,a).join(`
|
|
1061
|
+
`)}function e3(e){let t=e.trim();if(!t.endsWith(`:`))return null;let n=t.slice(0,-1);if(!/^[a-zA-Z]/.test(n))return null;let r=n.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)$/);if(!r)return null;let[,i,a]=r;return a&&!/^(\[[^\]]*\]|\{[^}]*\})*$/.test(a)||!Y2[i.toLowerCase()]?null:n}function t3(e){let t=0;for(let n=0;n<e.length;n++)if(e[n]===` `)t+=1;else if(e[n]===` `)t+=4;else break;return t}function n3(e,t){let n=t3(e[t]);for(let r=t+1;r<e.length;r++)if(!r3(e[r]))return t3(e[r])>n;return!1}function r3(e){return e.trim()===``}function i3(e,t){let n=0,r=0;for(;r<e.length&&n<t;)if(e[r]===` `)n++,r++;else if(e[r]===` `)n+=4,r++;else break;return e.slice(r)}function a3(e){let t=e.split(`
|
|
1062
|
+
`),n=[],r={level:0,openDirectives:[],inCodeFence:!1,codeFenceMarker:null};for(let e=0;e<t.length;e++){let i=t[e],a=i.trim(),o=t3(i),s=a.match(/^(`{3,}|~{3,})/);if(s){let e=s[1];r.inCodeFence?r.codeFenceMarker&&a.startsWith(r.codeFenceMarker)&&(r.inCodeFence=!1,r.codeFenceMarker=null):(r.inCodeFence=!0,r.codeFenceMarker=e),n.push(i);continue}if(r.inCodeFence){n.push(i);continue}if(r3(i)){n.push(``);continue}let c=e3(a);if(c&&n3(t,e)){for(;r.openDirectives.length>0&&!(r.openDirectives[r.openDirectives.length-1].indentLevel<o);){let e=r.openDirectives.pop();e&&n.push(`:`.repeat(e.colonCount))}let e=c.match(/^([a-zA-Z][a-zA-Z0-9_-]*)(.*)/),t=e?e[1].toLowerCase()+(e[2]||``):c,i=r.openDirectives.length*1+3;n.push(`:`.repeat(i)+t),r.openDirectives.push({label:t,indentLevel:o,colonCount:i,bodyBaseIndent:-1}),r.level=o}else{for(;r.openDirectives.length>0&&o<=r.openDirectives[r.openDirectives.length-1].indentLevel;){let e=r.openDirectives.pop();e&&n.push(`:`.repeat(e.colonCount))}if(r.openDirectives.length>0){let e=r.openDirectives[r.openDirectives.length-1];e.bodyBaseIndent<0&&(e.bodyBaseIndent=o),n.push(i3(i,e.bodyBaseIndent))}else n.push(i);r.level=o}}for(;r.openDirectives.length>0;){let e=r.openDirectives.pop();e&&n.push(`:`.repeat(e.colonCount))}return n.join(`
|
|
1063
|
+
`)}var o3=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/,s3=/^division:\s*(\S+)\s*$/m,c3=/^id:\s*(\S+)\s*$/m,l3=/^xmlid:\s*(\S+)\s*$/m,u3=/^xml:id:\s*(\S+)\s*$/m,d3=/^label:\s*(\S+)\s*$/m,f3=/^component:\s*(\S+)\s*$/m,p3=/^title:\s*(.+?)\s*$/m;function m3(e){if(e.length>=2){let t=e[0],n=e[e.length-1];if(t===`"`&&n===`"`||t===`'`&&n===`'`)return e.slice(1,-1)}return e}function h3(e){let t=e.match(o3);if(!t)return{body:e};let n=t[1],r=e.slice(t[0].length),i=n.match(s3)?.[1],a,o;i&&H2(i)?(o=i,a=U2(i)):i&&z2(i)&&(a=i);let s={},c=n.match(c3)?.[1]??n.match(l3)?.[1]??n.match(u3)?.[1],l=n.match(d3)?.[1],u=n.match(f3)?.[1];c&&(s[`xml:id`]=c),l&&(s.label=l),u&&(s.component=u);let d=n.match(p3)?.[1],f=d?m3(d):void 0;return{division:a,documentRoot:o,attributes:Object.keys(s).length>0?s:void 0,title:f,body:r}}var g3=function(e){return function(t,n){if(typeof n?.value==`string`){let t=h3(n.value),r=e?.documentRoot??t.documentRoot,i=e?.topLevelDivision??t.division??(r?U2(r):`chapter`),a=e?.topLevelAttributes??t.attributes,o=e?.topLevelTitle??t.title,s=W4($4(a3(t.body))),c=iQ().data(`micromarkExtensions`,[{disable:{null:[`codeIndented`]}}]).use(m0).use(k2).parse(s.markdown);return J4(c,s.tokens),f4(c,s.markdown,{topLevelDivision:i,documentRoot:r,topLevelAttributes:a,topLevelTitle:o})}return q4(t),f4(t,void 0,{topLevelDivision:e?.topLevelDivision??(e?.documentRoot?U2(e.documentRoot):`chapter`),documentRoot:e?.documentRoot,topLevelAttributes:e?.topLevelAttributes,topLevelTitle:e?.topLevelTitle})}},_3=/["&'<>`]/g,v3=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y3=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,b3=/[|\\{}()[\]^$+*?.]/g,x3=new WeakMap;function S3(e,t){if(e=e.replace(t.subset?C3(t.subset):_3,r),t.subset||t.escapeOnly)return e;return e.replace(v3,n).replace(y3,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function C3(e){let t=x3.get(e);return t||(t=w3(e),x3.set(e,t)),t}function w3(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(b3,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function T3(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function E3(e,t){return S3(e,Object.assign({format:T3},t))}var D3=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function O3(e,t,n){let r=k3(e);return n?r.replace(n,i):i(r);function i(e){return E3(e,{subset:t})}}function k3(e){return String(e||``).replace(D3,``)}var A3=/]]>/g,j3=[`>`];function M3(e){return`<![CDATA[`+O3(e.value,j3,A3)+`]]>`}function N3(e){return`<!--`+O3(e.value,[`-`])+`-->`}var P3=[` `,`
|
|
1064
|
+
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function F3(e){return O3(e,P3)}function I3(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function L3(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;I3(n,r)>I3(n,e)&&(r=e)}return r+O3(n,[`<`,`&`,r])+r}function R3(e,t){let n=F3(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+L3(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+L3(i,t)),a+`>`}var z3={}.hasOwnProperty;function B3(e,t){let n=F3(e.name),r=X3(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(z3.call(i,s)){let e=i[s];e!=null&&o.push(F3(s)+`=`+L3(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var V3=/\?>/g,H3=[`>`];function U3(e){let t=F3(e.name)||`x`,n=O3(e.value,H3,V3);return`<?`+t+(n?` `+n:``)+`?>`}var W3=[`&`,`<`];function G3(e){return O3(e.value,W3)}function K3(e,t){return t.options.allowDangerousXml?e.value:G3(e)}var q3={}.hasOwnProperty,J3={cdata:M3,comment:N3,doctype:R3,element:B3,instruction:U3,raw:K3,root:X3,text:G3};function Y3(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!q3.call(J3,n))throw Error("Cannot compile unknown node `"+n+"`");let r=J3[n];return r(e,t)}function X3(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=Y3(n[r],t);return i.join(``)}function Z3(e,t){let n={options:t||{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return Y3(Array.isArray(e)?{type:`root`,children:e}:e,n)}function Q3(e,t){let n=iQ().use(m0).use(k2).use(g3,t),r=n.parse(e);return Z3(n.runSync(r,{value:e}).children,{closeEmptyElements:!0,tightClose:!0})}var $3=[`\\documentclass`,`\\begin{document}`,`\\begin{`,`\\article{`,`\\book{`,`\\slideshow{`,`\\section`,`\\chapter`,`\\title`,`\\author`],e6=[`# `,`## `,`### `,`#### `],t6=/^[ \t]*---[ \t]*\r?\n[\s\S]*?\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/;function n6(e){let t=e.trim();return!t||t.startsWith(`<`)?`pretext`:$3.some(e=>t.includes(e))?`latex`:e6.some(e=>t.startsWith(e))||t6.test(t)?`markdown`:`pretext`}function r6(e){let t=e.trim();if(!t)return``;let n=String(IZ(t)).trim();return n?ps(n):``}function i6(e){let t=e.trim();if(!t)return``;let n=String(Q3(t)).trim();return n?ps(n):``}function a6(e){return e instanceof Error&&e.message.trim()?e.message.trim():`Could not convert LaTeX to PreTeXt.`}function o6(e,t){if(t===`pretext`)return{pretextSource:e};if(t===`markdown`)try{return{pretextSource:i6(e)}}catch(e){return{pretextError:a6(e)}}try{return{pretextSource:r6(e)}}catch(e){return{pretextError:a6(e)}}}var s6=()=>typeof window>`u`?void 0:window.location.href||void 0,c6=({label:e=`Give feedback`,context:r,onSubmit:i,projectUrl:a,currentSource:o,sourceFormat:s,title:c,className:l})=>{let u=(0,n.useId)(),d=`${u}-title`,f=`${u}-email`,p=`${u}-message`,m=`${u}-source`,[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(``),[y,b]=(0,n.useState)(``),[x,S]=(0,n.useState)(!1),[C,w]=(0,n.useState)(!1),[T,E]=(0,n.useState)(null),D=(0,n.useMemo)(()=>a?.trim()||s6(),[a]),O=()=>{g(!1),E(null)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`button`,{type:`button`,className:l||`pretext-plus-editor__feedback-trigger pretext-plus-editor__dialog-link-button`,onClick:()=>g(!0),children:e}),h?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:O,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__feedback-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:d,className:`pretext-plus-editor__dialog-title`,children:`Provide Feedback`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`Help us improve PreTeXt.plus! We'd love to hear from you.`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`(If you would like a response, please include your email address in the form below and we will get back to you as soon as we can.)`})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:O,"aria-label":`Close feedback dialog`,disabled:C,children:`Close`})]}),(0,t.jsxs)(`form`,{className:`pretext-plus-editor__feedback-form`,onSubmit:async e=>{e.preventDefault();let t=y.trim(),n=_.trim();if(!t){E(`Please enter a message.`);return}E(null),w(!0);try{await i({context:r,email:n||void 0,message:t,includeCurrentSource:x,currentSource:x?o:void 0,projectUrl:D,sourceFormat:s,title:c,submittedAt:new Date().toISOString()}),b(``),S(!1),g(!1)}catch(e){E(e instanceof Error?e.message:`Could not submit feedback.`)}finally{w(!1)}},children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__feedback-label`,htmlFor:f,children:`Email (optional)`}),(0,t.jsx)(`input`,{id:f,type:`email`,className:`pretext-plus-editor__feedback-input`,value:_,onChange:e=>v(e.target.value),placeholder:`name@example.com`,autoComplete:`email`}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__feedback-label`,htmlFor:p,children:`Message`}),(0,t.jsx)(`textarea`,{id:p,className:`pretext-plus-editor__feedback-textarea`,value:y,onChange:e=>b(e.target.value),rows:5,required:!0}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__feedback-checkbox-row`,htmlFor:m,children:[(0,t.jsx)(`input`,{id:m,type:`checkbox`,checked:x,onChange:e=>S(e.target.checked)}),`Include current source`]}),D?(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-project`,children:`Project link will be included.`}):(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-project`,children:`No project link is currently available.`}),T?(0,t.jsx)(`p`,{className:`pretext-plus-editor__feedback-error`,children:T}):null,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:O,disabled:C,children:`Cancel`}),(0,t.jsx)(`button`,{type:`submit`,className:`pretext-plus-editor__dialog-button`,disabled:C||!y.trim(),children:C?`Submitting...`:`Submit`})]})]})]})}):null]})},l6=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},u6=(e=>e?l6(e):l6),d6=e=>e;function f6(e,t=d6){let r=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),n.default.useCallback(()=>t(e.getInitialState()),[e,t]));return n.default.useDebugValue(r),r}var p6=(0,n.createContext)(null);function m6(e){let t=(0,n.useContext)(p6);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return f6(t,e)}var h6=({label:e,context:n,className:r})=>{let i=m6(e=>e.hasFeedback),a=m6(e=>e.projectUrl),o=m6(e=>e.source),s=m6(e=>e.sourceFormat),c=m6(e=>e.title),l=m6(e=>e.feedbackSubmit);return i?(0,t.jsx)(c6,{label:e,context:n,className:r,projectUrl:a,currentSource:o,sourceFormat:s,title:c,onSubmit:l}):null},g6=({onClose:e})=>{let[r,i]=(0,n.useState)(``),[a,o]=(0,n.useState)(``),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(`idle`),d=(0,n.useRef)(null),f=(0,n.useRef)(null),p={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}};(0,n.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),d.current?.focus(),()=>{window.removeEventListener(`keydown`,t)}},[e]);let m=()=>{let e=r.trim();if(e)try{o(r6(e)),u(`idle`)}catch(e){console.error(`Error converting LaTeX:`,e),alert(a6(e))}},h=async()=>{if(a)try{await navigator.clipboard.writeText(a),u(`copied`),e()}catch(e){console.error(`Error copying converted PreTeXt:`,e),u(`error`),alert(`Could not copy to clipboard`)}},g=e=>{if(!e.name.toLowerCase().endsWith(`.tex`)){alert(`Please choose a .tex file`);return}let t=new FileReader;t.onload=()=>{i(typeof t.result==`string`?t.result:``),o(``),u(`idle`),d.current?.focus()},t.onerror=()=>{alert(`Could not read file`)},t.readAsText(e)};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Convert LaTeX`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`Paste LaTeX, convert it to PreTeXt, then copy the result.`}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-feedback-row`,children:(0,t.jsx)(h6,{label:`Give feedback on conversion`,context:`latex-conversion`})})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:e,"aria-label":`Close LaTeX import dialog`,children:`Close`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`LaTeX Input`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-link-button`,onClick:()=>f.current?.click(),children:`Open .tex File`}),(0,t.jsx)(`input`,{ref:f,type:`file`,accept:`.tex,text/x-tex`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&g(t),e.target.value=``}})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor ${s?`pretext-plus-editor__dialog-editor--drag`:``}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`,c(!0)},onDragLeave:e=>{e.preventDefault(),c(!1)},onDrop:e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&g(t)},children:(0,t.jsx)(Yn,{options:p,height:`100%`,language:`latex`,value:r,onMount:e=>{d.current=e,e.focus()},onChange:e=>i(e||``)})}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:"Paste LaTeX, open a `.tex` file, or drag one onto this editor."})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Converted PreTeXt`}),l===`copied`?(0,t.jsx)(`span`,{className:`pretext-plus-editor__dialog-status`,children:`Copied`}):null]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:{...p,readOnly:!0},height:`100%`,language:`xml`,value:a})})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:e,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:m,disabled:!r.trim(),children:`Convert`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:h,disabled:!a,children:`Copy and Close`})]})]})})},_6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},v6={latex:`LaTeX`,markdown:`Markdown`,pretext:`PreTeXt`},y6={latex:`latex`,markdown:`markdown`,pretext:`xml`},b6=({source:e,sourceFormat:r,pretextSource:i,onConfirm:a,onClose:o})=>{(0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let s=()=>{a(),o()},c=v6[r]??r;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:o,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-convert-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-convert-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Convert Division to PreTeXt`}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:[`Add a new PreTeXt division using the converted source below. Your current `,c,` division will remain unchanged.`]})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:o,"aria-label":`Close convert to PreTeXt dialog`,children:`Close`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-label`,children:[`Current `,c,` Source`]})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:_6,height:`100%`,language:y6[r]??`plaintext`,value:e})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-label-row`,children:(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Converted PreTeXt`})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:_6,height:`100%`,language:`xml`,value:i})})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:o,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--danger`,onClick:s,children:`Create PreTeXt Division`})]})]})})},x6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},S6={...x6,language:`xml`},C6=(e,t)=>e.querySelector(t)?.textContent??``,w6=(e,t)=>{let n=new XMLSerializer;return Array.from(e.documentElement.children).filter(e=>!t.includes(e.tagName)).map(e=>n.serializeToString(e)).join(`
|
|
1065
|
+
`)},T6=e=>e.trim()?new DOMParser().parseFromString(e,`application/xml`):new DOMParser().parseFromString(`<docinfo/>`,`application/xml`),E6=e=>e.getElementsByTagName(`parsererror`).length>0,D6=(e,t)=>{let n=e.trim(),r=t.trim();return r?n?n.includes(r)?e:r.includes(n)?r:`${n}\n${r}`:r:e},O6=(e,t)=>{if(E6(t))return e;let n=new DOMParser().parseFromString(`<docinfo>${e}</docinfo>`,`application/xml`);if(E6(n))return e;let r=new Set(Array.from(n.documentElement.children).map(e=>e.tagName)),i=new XMLSerializer,a=Array.from(t.documentElement.children).filter(e=>![`macros`,`latex-image-preamble`].includes(e.tagName)).filter(e=>!r.has(e.tagName)).map(e=>i.serializeToString(e));if(a.length===0)return e;let o=e.trim();return o?`${o}\n${a.join(`
|
|
1066
1066
|
`)}`:a.join(`
|
|
1067
|
-
`)},
|
|
1067
|
+
`)},k6=(e,t,n)=>{let r=[];if(e.trim()&&r.push(` <macros>${e}</macros>`),t.trim()&&r.push(` <latex-image-preamble>${t}</latex-image-preamble>`),n.trim())for(let e of n.trim().split(`
|
|
1068
1068
|
`))r.push(` ${e}`);return r.length===0?``:`<docinfo>\n${r.join(`
|
|
1069
|
-
`)}\n</docinfo>`},w6={macros:`LaTeX Macros`,preamble:`Image Macros`,other:`Other Elements`},T6={macros:`LaTeX macros available throughout the document. Stored in <macros> inside <docinfo>. Use \\newcommand to define new macros (avoid using \\def).`,preamble:`LaTeX macros for rendering TikZ/LaTeX images. Stored in <latex-image-preamble> inside <docinfo>.`,other:`Any additional <docinfo> child elements (e.g. <cross-references>, <rename>). Edit as raw XML — one element per line.`},E6=({docinfo:e,onClose:r,showCommonDocinfoControls:i=!1,commonDocinfo:a=``,initialUseCommonDocinfo:o=!1})=>{let[s,c]=(0,n.useState)(`macros`),[l,u]=(0,n.useState)(o),d=y6(e),[f,p]=(0,n.useState)(()=>_6(d,`macros`)),[m,h]=(0,n.useState)(()=>_6(d,`latex-image-preamble`)),[g,_]=(0,n.useState)(()=>v6(d,[`macros`,`latex-image-preamble`])),v=y6(a),[y,b]=(0,n.useState)(()=>_6(v,`macros`)),[x,S]=(0,n.useState)(()=>_6(v,`latex-image-preamble`)),[C,w]=(0,n.useState)(()=>v6(v,[`macros`,`latex-image-preamble`])),T=a.trim().length>0;(0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r(void 0)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let E=()=>{r({docinfo:C6(f,m,g),commonDocinfo:C6(y,x,C),useCommonDocinfo:l})},D=()=>{if(!T)return;let e=y6(a);b6(e)||(p(t=>x6(t,_6(e,`macros`))),h(t=>x6(t,_6(e,`latex-image-preamble`))),_(t=>S6(t,e)))},O=s===`macros`?l?y:f:s===`preamble`?l?x:m:l?C:g,k=s===`other`?`xml`:`latex`,A=i&&l,ee=s===`macros`?l?b:p:s===`preamble`?l?S:h:l?w:_;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:()=>r(void 0),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog${A?` pretext-plus-editor__dialog--common-mode`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-docinfo-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-docinfo-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Edit docinfo/preamble elements`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:T6[s]}),i?(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-checkbox-row`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.currentTarget.checked)}),(0,t.jsx)(`span`,{children:`Use my common docinfo/preamble.`})]}):null,i&&!l?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-common-import-row`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-link-button`,onClick:D,disabled:!T,children:`Import common docinfo`})}):null]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:()=>r(void 0),"aria-label":`Close docinfo editor`,children:`Close`})]}),A?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-common-mode-banner`,children:`You are editing your shared common docinfo/preamble. These values will apply to all projects that use this option.`}):null,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,role:`tablist`,children:[`macros`,`preamble`,`other`].map(e=>(0,t.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===e,className:`pretext-plus-editor__dialog-tab${s===e?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>c(e),children:w6[e]},e))}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-section`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:s===`other`?g6:h6,height:`100%`,language:k,value:O,onChange:e=>ee(e??``)},`${s}-${l?`common`:`project`}`)})})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>r(void 0),children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:E,children:`Save`})]})]})})},D6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},O6=({source:e,onClose:r})=>((0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:r,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-full-source-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-full-source-title`,className:`pretext-plus-editor__dialog-title`,children:`Full Document Source`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`The complete assembled PreTeXt source for this project, with every division and asset reference expanded. This view is read-only.`})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close full document source dialog`,children:`Close`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-section`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:D6,height:`100%`,language:`xml`,value:e})})})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{})},children:`Copy to Clipboard`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:r,children:`Done`})]})]})})),k6=p(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{XmlCdata:()=>E,XmlComment:()=>D,XmlDeclaration:()=>O,XmlDocument:()=>A,XmlDocumentType:()=>ee,XmlElement:()=>k,XmlError:()=>te,XmlNode:()=>w,XmlProcessingInstruction:()=>j,XmlText:()=>T,parseXml:()=>re}),t.exports=c(l);var u=``,d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=class{constructor(e){if(this.k=this.u(e,!0),this.d=0,this.length=e.length,this.l=this.k!==this.length,this.h=e,this.l){let t=[];for(let n=0,r=0;r<this.k;++r)t[r]=n,n+=e.codePointAt(n)>65535?2:1;this.A=t}}get B(){return this.d>=this.k}u(e,t=this.l){return t?e.replace(d,`_`).length:e.length}p(e=1){this.d=Math.min(this.k,this.d+e)}f(e=this.d){return this.l?this.A[e]??1/0:e}G(e=1){let t=this.m(e);return this.p(e),t}v(e){let t=this.f(),n=this.h.slice(t,t+e);return this.p(this.u(n)),n}w(e){let{length:t,l:n,h:r}=this,i=this.f(),a=i;if(n)for(;a<t;){let t=r[a],n=t>=`\ud800`&&t<=`\udbff`;if(n&&(t+=r[a+1]),!e(t))break;a+=n?2:1}else for(;a<t&&e(r[a]);)++a;return this.v(a-i)}b(e){let{length:t}=e,n=this.f();return e===this.h.slice(n,n+t)?(this.p(t===1?1:this.u(e)),e):u}x(e){let t=this.h.slice(this.f()).search(e);return t>0?this.v(t):u}s(e){let t=this.f(),n=this.h.indexOf(e,t);return n>0?this.v(n-t):u}m(e=1){let{d:t,h:n}=this;return this.l?n.slice(this.f(t),this.f(t+e)):n.slice(t,t+e)}n(e=0){this.d=e>=0?Math.min(this.k,e):Math.max(0,this.d+e)}},p=/["&<]/,m=/['&<]/,h=/\r\n|[\n\r\t]/g,g=/<|&|]]>/,_=Object.freeze(Object.assign(Object.create(null),{amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`}));function v(e){let t=e.codePointAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===46||t===183||t>=768&&t<=879||t===8255||t===8256||y(e,t)}function y(e,t=e.codePointAt(0)){return t>=97&&t<=122||t>=65&&t<=90||t===58||t===95||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t===8204||t===8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}function b(e){return e===`#`||v(e)}function x(e){let t=e.codePointAt(0);return t===32||t===9||t===10||t===13}function S(e){return e>=32&&e<=55295||e===10||e===9||e===13||e>=57344&&e<=65533||e>=65536&&e<=1114111}var C=class e{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){return this.parent?.document??null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===e.TYPE_ELEMENT}get preserveWhitespace(){return!!this.parent?.preserveWhitespace}get type(){return``}toJSON(){let e={type:this.type};return this.isRootNode&&(e.isRootNode=!0),this.preserveWhitespace&&(e.preserveWhitespace=!0),this.start!==-1&&(e.start=this.start,e.end=this.end),e}};C.TYPE_CDATA=`cdata`,C.TYPE_COMMENT=`comment`,C.TYPE_DOCUMENT=`document`,C.TYPE_DOCUMENT_TYPE=`doctype`,C.TYPE_ELEMENT=`element`,C.TYPE_PROCESSING_INSTRUCTION=`pi`,C.TYPE_TEXT=`text`,C.TYPE_XML_DECLARATION=`xmldecl`;var w=C,T=class extends w{constructor(e=``){super(),this.text=e}get type(){return w.TYPE_TEXT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{text:this.text})}},E=class extends T{get type(){return w.TYPE_CDATA}},D=class extends w{constructor(e=``){super(),this.content=e}get type(){return w.TYPE_COMMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{content:this.content})}},O=class extends w{constructor(e,t,n){super(),this.version=e,this.encoding=t??null,this.standalone=n??null}get type(){return w.TYPE_XML_DECLARATION}toJSON(){let e=w.prototype.toJSON.call(this);e.version=this.version;for(let t of[`encoding`,`standalone`])this[t]!==null&&(e[t]=this[t]);return e}},k=class e extends w{constructor(e,t=Object.create(null),n=[]){super(),this.name=e,this.attributes=t,this.children=n}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let t=this;for(;t instanceof e;){if(`xml:space`in t.attributes)return t.attributes[`xml:space`]===`preserve`;t=t.parent}return!1}get text(){return this.children.map(e=>`text`in e?e.text:``).join(``)}get type(){return w.TYPE_ELEMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(e=>e.toJSON())})}},A=class extends w{constructor(e=[]){super(),this.children=e}get document(){return this}get root(){for(let e of this.children)if(e instanceof k)return e;return null}get text(){return this.children.map(e=>`text`in e?e.text:``).join(``)}get type(){return w.TYPE_DOCUMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{children:this.children.map(e=>e.toJSON())})}},ee=class extends w{constructor(e,t,n,r){super(),this.name=e,this.publicId=t??null,this.systemId=n??null,this.internalSubset=r??null}get type(){return w.TYPE_DOCUMENT_TYPE}toJSON(){let e=w.prototype.toJSON.call(this);e.name=this.name;for(let t of[`publicId`,`systemId`,`internalSubset`])this[t]!==null&&(e[t]=this[t]);return e}},te=class extends Error{constructor(e,t,n){let r=1,i=``,a=1;for(let e=0;e<t;++e){let t=n[e];t===`
|
|
1069
|
+
`)}\n</docinfo>`},A6={macros:`LaTeX Macros`,preamble:`Image Macros`,other:`Other Elements`},j6={macros:`LaTeX macros available throughout the document. Stored in <macros> inside <docinfo>. Use \\newcommand to define new macros (avoid using \\def).`,preamble:`LaTeX macros for rendering TikZ/LaTeX images. Stored in <latex-image-preamble> inside <docinfo>.`,other:`Any additional <docinfo> child elements (e.g. <cross-references>, <rename>). Edit as raw XML — one element per line.`},M6=({docinfo:e,onClose:r,showCommonDocinfoControls:i=!1,commonDocinfo:a=``,initialUseCommonDocinfo:o=!1})=>{let[s,c]=(0,n.useState)(`macros`),[l,u]=(0,n.useState)(o),d=T6(e),[f,p]=(0,n.useState)(()=>C6(d,`macros`)),[m,h]=(0,n.useState)(()=>C6(d,`latex-image-preamble`)),[g,_]=(0,n.useState)(()=>w6(d,[`macros`,`latex-image-preamble`])),v=T6(a),[y,b]=(0,n.useState)(()=>C6(v,`macros`)),[x,S]=(0,n.useState)(()=>C6(v,`latex-image-preamble`)),[C,w]=(0,n.useState)(()=>w6(v,[`macros`,`latex-image-preamble`])),T=a.trim().length>0;(0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r(void 0)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let E=()=>{r({docinfo:k6(f,m,g),commonDocinfo:k6(y,x,C),useCommonDocinfo:l})},D=()=>{if(!T)return;let e=T6(a);E6(e)||(p(t=>D6(t,C6(e,`macros`))),h(t=>D6(t,C6(e,`latex-image-preamble`))),_(t=>O6(t,e)))},O=s===`macros`?l?y:f:s===`preamble`?l?x:m:l?C:g,k=s===`other`?`xml`:`latex`,A=i&&l,ee=s===`macros`?l?b:p:s===`preamble`?l?S:h:l?w:_;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:()=>r(void 0),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog${A?` pretext-plus-editor__dialog--common-mode`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-docinfo-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-docinfo-dialog-title`,className:`pretext-plus-editor__dialog-title`,children:`Edit docinfo/preamble elements`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:j6[s]}),i?(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-checkbox-row`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.currentTarget.checked)}),(0,t.jsx)(`span`,{children:`Use my common docinfo/preamble.`})]}):null,i&&!l?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-common-import-row`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-link-button`,onClick:D,disabled:!T,children:`Import common docinfo`})}):null]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:()=>r(void 0),"aria-label":`Close docinfo editor`,children:`Close`})]}),A?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-common-mode-banner`,children:`You are editing your shared common docinfo/preamble. These values will apply to all projects that use this option.`}):null,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,role:`tablist`,children:[`macros`,`preamble`,`other`].map(e=>(0,t.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===e,className:`pretext-plus-editor__dialog-tab${s===e?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>c(e),children:A6[e]},e))}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-section`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:s===`other`?S6:x6,height:`100%`,language:k,value:O,onChange:e=>ee(e??``)},`${s}-${l?`common`:`project`}`)})})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>r(void 0),children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:E,children:`Save`})]})]})})},N6={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},P6=({source:e,onClose:r})=>((0,n.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:r,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pretext-plus-editor-full-source-title`,onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{id:`pretext-plus-editor-full-source-title`,className:`pretext-plus-editor__dialog-title`,children:`Full Document Source`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-copy`,children:`The complete assembled PreTeXt source for this project, with every division and asset reference expanded. This view is read-only.`})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close full document source dialog`,children:`Close`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-section`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor`,children:(0,t.jsx)(Yn,{options:N6,height:`100%`,language:`xml`,value:e})})})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{})},children:`Copy to Clipboard`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:r,children:`Done`})]})]})})),F6=p(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{XmlCdata:()=>E,XmlComment:()=>D,XmlDeclaration:()=>O,XmlDocument:()=>A,XmlDocumentType:()=>ee,XmlElement:()=>k,XmlError:()=>te,XmlNode:()=>w,XmlProcessingInstruction:()=>j,XmlText:()=>T,parseXml:()=>re}),t.exports=c(l);var u=``,d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=class{constructor(e){if(this.k=this.u(e,!0),this.d=0,this.length=e.length,this.l=this.k!==this.length,this.h=e,this.l){let t=[];for(let n=0,r=0;r<this.k;++r)t[r]=n,n+=e.codePointAt(n)>65535?2:1;this.A=t}}get B(){return this.d>=this.k}u(e,t=this.l){return t?e.replace(d,`_`).length:e.length}p(e=1){this.d=Math.min(this.k,this.d+e)}f(e=this.d){return this.l?this.A[e]??1/0:e}G(e=1){let t=this.m(e);return this.p(e),t}v(e){let t=this.f(),n=this.h.slice(t,t+e);return this.p(this.u(n)),n}w(e){let{length:t,l:n,h:r}=this,i=this.f(),a=i;if(n)for(;a<t;){let t=r[a],n=t>=`\ud800`&&t<=`\udbff`;if(n&&(t+=r[a+1]),!e(t))break;a+=n?2:1}else for(;a<t&&e(r[a]);)++a;return this.v(a-i)}b(e){let{length:t}=e,n=this.f();return e===this.h.slice(n,n+t)?(this.p(t===1?1:this.u(e)),e):u}x(e){let t=this.h.slice(this.f()).search(e);return t>0?this.v(t):u}s(e){let t=this.f(),n=this.h.indexOf(e,t);return n>0?this.v(n-t):u}m(e=1){let{d:t,h:n}=this;return this.l?n.slice(this.f(t),this.f(t+e)):n.slice(t,t+e)}n(e=0){this.d=e>=0?Math.min(this.k,e):Math.max(0,this.d+e)}},p=/["&<]/,m=/['&<]/,h=/\r\n|[\n\r\t]/g,g=/<|&|]]>/,_=Object.freeze(Object.assign(Object.create(null),{amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`}));function v(e){let t=e.codePointAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===46||t===183||t>=768&&t<=879||t===8255||t===8256||y(e,t)}function y(e,t=e.codePointAt(0)){return t>=97&&t<=122||t>=65&&t<=90||t===58||t===95||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t===8204||t===8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}function b(e){return e===`#`||v(e)}function x(e){let t=e.codePointAt(0);return t===32||t===9||t===10||t===13}function S(e){return e>=32&&e<=55295||e===10||e===9||e===13||e>=57344&&e<=65533||e>=65536&&e<=1114111}var C=class e{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){return this.parent?.document??null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===e.TYPE_ELEMENT}get preserveWhitespace(){return!!this.parent?.preserveWhitespace}get type(){return``}toJSON(){let e={type:this.type};return this.isRootNode&&(e.isRootNode=!0),this.preserveWhitespace&&(e.preserveWhitespace=!0),this.start!==-1&&(e.start=this.start,e.end=this.end),e}};C.TYPE_CDATA=`cdata`,C.TYPE_COMMENT=`comment`,C.TYPE_DOCUMENT=`document`,C.TYPE_DOCUMENT_TYPE=`doctype`,C.TYPE_ELEMENT=`element`,C.TYPE_PROCESSING_INSTRUCTION=`pi`,C.TYPE_TEXT=`text`,C.TYPE_XML_DECLARATION=`xmldecl`;var w=C,T=class extends w{constructor(e=``){super(),this.text=e}get type(){return w.TYPE_TEXT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{text:this.text})}},E=class extends T{get type(){return w.TYPE_CDATA}},D=class extends w{constructor(e=``){super(),this.content=e}get type(){return w.TYPE_COMMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{content:this.content})}},O=class extends w{constructor(e,t,n){super(),this.version=e,this.encoding=t??null,this.standalone=n??null}get type(){return w.TYPE_XML_DECLARATION}toJSON(){let e=w.prototype.toJSON.call(this);e.version=this.version;for(let t of[`encoding`,`standalone`])this[t]!==null&&(e[t]=this[t]);return e}},k=class e extends w{constructor(e,t=Object.create(null),n=[]){super(),this.name=e,this.attributes=t,this.children=n}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let t=this;for(;t instanceof e;){if(`xml:space`in t.attributes)return t.attributes[`xml:space`]===`preserve`;t=t.parent}return!1}get text(){return this.children.map(e=>`text`in e?e.text:``).join(``)}get type(){return w.TYPE_ELEMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(e=>e.toJSON())})}},A=class extends w{constructor(e=[]){super(),this.children=e}get document(){return this}get root(){for(let e of this.children)if(e instanceof k)return e;return null}get text(){return this.children.map(e=>`text`in e?e.text:``).join(``)}get type(){return w.TYPE_DOCUMENT}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{children:this.children.map(e=>e.toJSON())})}},ee=class extends w{constructor(e,t,n,r){super(),this.name=e,this.publicId=t??null,this.systemId=n??null,this.internalSubset=r??null}get type(){return w.TYPE_DOCUMENT_TYPE}toJSON(){let e=w.prototype.toJSON.call(this);e.name=this.name;for(let t of[`publicId`,`systemId`,`internalSubset`])this[t]!==null&&(e[t]=this[t]);return e}},te=class extends Error{constructor(e,t,n){let r=1,i=``,a=1;for(let e=0;e<t;++e){let t=n[e];t===`
|
|
1070
1070
|
`?(r=1,i=``,a+=1):(r+=1,i+=t)}let o=n.indexOf(`
|
|
1071
1071
|
`,t);i+=o===-1?n.slice(t):n.slice(t,o);let s=0;i.length>50&&(r<40?i=i.slice(0,50):(s=r-20,i=i.slice(s,r+30))),super(`${e} (line ${a}, column ${r})
|
|
1072
1072
|
${i}
|
|
1073
1073
|
`+` `.repeat(r-s+1)+`^
|
|
1074
1074
|
`),this.column=r,this.excerpt=i,this.line=a,this.name=`XmlError`,this.pos=t}},j=class extends w{constructor(e,t=``){super(),this.name=e,this.content=t}get type(){return w.TYPE_PROCESSING_INSTRUCTION}toJSON(){return Object.assign(w.prototype.toJSON.call(this),{name:this.name,content:this.content})}},M=``,ne=class{constructor(e,t={}){let n=this.document=new A;this.j=n,this.g=t,this.c=new f(e),this.g.includeOffsets&&(n.start=0,n.end=e.length),this.parse()}i(e,t){return e.parent=this.j,this.g.includeOffsets&&(e.start=this.c.f(t),e.end=this.c.f()),this.j.children.push(e),!0}y(e,t){let{children:n}=this.j,{length:r}=n;if(e=N(e),r>0){let t=n[r-1];if(t?.type===w.TYPE_TEXT){let n=t;return n.text+=e,this.g.includeOffsets&&(n.end=this.c.f()),!0}}return this.i(new T(e),t)}H(){let e=Object.create(null);for(;this.e();){let t=this.q();if(!t)break;let n=this.t()&&this.I();if(n===!1)throw this.a(`Attribute value expected`);if(t in e)throw this.a(`Duplicate attribute: ${t}`);if(t===`xml:space`&&n!=="default"&&n!==`preserve`)throw this.a('Value of the `xml:space` attribute must be "default" or "preserve"');e[t]=n}if(this.g.sortAttributes){let t=Object.keys(e).sort(),n=Object.create(null);for(let r=0;r<t.length;++r){let i=t[r];n[i]=e[i]}e=n}return e}I(){let{c:e}=this,t=e.m();if(t!==`"`&&t!==`'`)return!1;e.p();let n,r=!1,i=M,a=t===`"`?p:m;matchLoop:for(;!e.B;)switch(n=e.x(a),n&&(this.o(n),i+=n.replace(h,` `)),e.m()){case t:r=!0;break matchLoop;case`&`:i+=this.C();continue;case`<`:throw this.a("Unescaped `<` is not allowed in an attribute value");default:break matchLoop}if(!r)throw this.a(`Unclosed attribute`);return e.p(),i}J(){let{c:e}=this,t=e.d;if(!e.b(`<![CDATA[`))return!1;let n=e.s(`]]>`);if(this.o(n),!e.b(`]]>`))throw this.a(`Unclosed CDATA section`);return this.g.preserveCdata?this.i(new E(N(n)),t):this.y(n,t)}K(){let{c:e}=this,t=e.d,n=e.x(g);if(!n)return!1;if(this.o(n),e.m(3)===`]]>`)throw this.a("Element content may not contain the CDATA section close delimiter `]]>`");return this.y(n,t)}D(){let{c:e}=this,t=e.d;if(!e.b(`<!--`))return!1;let n=e.s(`--`);if(this.o(n),!e.b(`-->`))throw e.m(2)===`--`?this.a("The string `--` isn't allowed inside a comment"):this.a(`Unclosed comment`);return this.g.preserveComments?this.i(new D(N(n)),t):!0}L(){let e=this.c.d,t=this.C();return t?this.y(t,e):!1}M(){let{c:e}=this,t=e.d;if(!e.b(`<!DOCTYPE`))return!1;let n=this.e()&&this.q();if(!n)throw this.a(`Expected a name`);let r,i;if(this.e()){if(e.b(`PUBLIC`)){if(r=this.e()&&this.N(),r===!1)throw this.a(`Expected a public identifier`);this.e()}if(r!==void 0||e.b(`SYSTEM`)){if(this.e(),i=this.r(),i===!1)throw this.a(`Expected a system identifier`);this.e()}}let a;if(e.b(`[`)){if(a=e.x(/\][\x20\t\r\n]*>/),!e.b(`]`))throw this.a(`Unclosed internal subset`);this.e()}if(!e.b(`>`))throw this.a(`Unclosed doctype declaration`);return this.g.preserveDocumentType?this.i(new ee(n,r,i,a),t):!0}E(){let{c:e}=this,t=e.d;if(!e.b(`<`))return!1;let n=this.q();if(!n)return e.n(t),!1;let r=this.H(),i=!!e.b(`/>`),a=new k(n,r);if(a.parent=this.j,!i){if(!e.b(`>`))throw this.a(`Unclosed start tag for element \`${n}\``);this.j=a;do this.K();while(this.E()||this.L()||this.J()||this.F()||this.D());let t=e.d,r;if(!e.b(`</`)||!(r=this.q())||r!==n)throw e.n(t),this.a(`Missing end tag for element ${n}`);if(this.e(),!e.b(`>`))throw this.a(`Unclosed end tag for element ${n}`);this.j=a.parent}return this.i(a,t)}t(){return this.e(),this.c.b(`=`)?(this.e(),!0):!1}z(){return this.D()||this.F()||this.e()}q(){return y(this.c.m())?this.c.w(v):M}F(){let{c:e}=this,t=e.d;if(!e.b(`<?`))return!1;let n=this.q();if(n){if(n.toLowerCase()===`xml`)throw e.n(t),this.a(`XML declaration isn't allowed here`)}else throw this.a(`Invalid processing instruction`);if(!this.e()){if(e.b(`?>`))return this.i(new j(n),t);throw this.a(`Whitespace is required after a processing instruction name`)}let r=e.s(`?>`);if(this.o(r),!e.b(`?>`))throw this.a(`Unterminated processing instruction`);return this.i(new j(n,N(r)),t)}O(){let{c:e}=this,t=e.d;for(this.P();this.z(););if(this.M())for(;this.z(););return t<e.d}N(){let e=this.c.d,t=this.r();if(t!==!1&&!/^[-\x20\r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*$/.test(t))throw this.c.n(e),this.a(`Invalid character in public identifier`);return t}C(){let{c:e}=this;if(!e.b(`&`))return!1;let t=e.w(b);if(e.G()!==`;`)throw this.a("Unterminated reference (a reference must end with `;`)");let n;if(t[0]===`#`){let e=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);if(isNaN(e))throw this.a(`Invalid character reference`);if(!S(e))throw this.a(`Character reference resolves to an invalid character`);n=String.fromCodePoint(e)}else if(n=_[t],n===void 0){let{ignoreUndefinedEntities:n,resolveUndefinedEntity:r}=this.g,i=`&${t};`;if(r){let e=r(i);if(e!=null){let t=typeof e;if(t!==`string`)throw TypeError(`\`resolveUndefinedEntity()\` must return a string, \`null\`, or \`undefined\`, but returned a value of type ${t}`);return e}}if(n)return i;throw e.n(-i.length),this.a(`Named entity isn't defined: ${i}`)}return n}r(){let{c:e}=this,t=e.b(`"`)||e.b(`'`);if(!t)return!1;let n=e.s(t);if(this.o(n),!e.b(t))throw this.a(`Missing end quote`);return n}e(){return!!this.c.w(x)}P(){let{c:e}=this,t=e.d;if(!e.b(`<?xml`))return!1;if(!this.e())throw this.a(`Invalid XML declaration`);let n=!!e.b(`version`)&&this.t()&&this.r();if(n===!1)throw this.a(`XML version is missing or invalid`);if(!/^1\.[0-9]+$/.test(n))throw this.a(`Invalid character in version number`);let r,i;if(this.e()){if(r=!!e.b(`encoding`)&&this.t()&&this.r(),r){if(!/^[A-Za-z][\w.-]*$/.test(r))throw this.a(`Invalid character in encoding name`);this.e()}if(i=!!e.b(`standalone`)&&this.t()&&this.r(),i){if(i!==`yes`&&i!==`no`)throw this.a('Only "yes" and "no" are permitted as values of `standalone`');this.e()}}if(!e.b(`?>`))throw this.a(`Invalid or unclosed XML declaration`);return this.g.preserveXmlDeclaration?this.i(new O(n,r||void 0,i||void 0),t):!0}a(e){let{c:t}=this;return new te(e,t.d,t.h)}parse(){if(this.c.b(``),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(e){let{length:t}=e;for(let n=0;n<t;++n){let t=e.codePointAt(n);if(!S(t))throw this.c.n(-([...e].length-n)),this.a(`Invalid character`);t>65535&&(n+=1)}}};function N(e){let t=0;for(;(t=e.indexOf(`\r`,t))!==-1;)e=e[t+1]===`
|
|
1075
1075
|
`?e.slice(0,t)+e.slice(t+1):e.slice(0,t)+`
|
|
1076
|
-
`+e.slice(t+1);return e}function re(e,t){return new ne(e,t).document}}));function
|
|
1077
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var
|
|
1076
|
+
`+e.slice(t+1);return e}function re(e,t){return new ne(e,t).document}}));function I6(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=L6(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=L6(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function L6(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
1077
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var R6=F6();function z6(e){let t=I6(e),n;try{n=(0,R6.parseXml)(String(e),{includeOffsets:!0,preserveCdata:!0,preserveComments:!0,preserveDocumentType:!0,preserveXmlDeclaration:!0})}catch(e){let n=e,r=new FJ("Could not parse XML with `@rgrove/parse-xml`",{cause:n,place:t.toPoint(n.pos),ruleId:`error`,source:`xast-util-from-xml`});throw r.fatal=!0,r.url=`https://github.com/syntax-tree/xast-util-from-xml#throws`,r}let r={location:t},i=H6(n,r);return Y6(n,i,r),i}function B6(e){return{type:`cdata`,value:e.text}}function V6(e){return{type:`comment`,value:e.content}}function H6(e,t){return{type:`root`,children:J6(e.children,t)}}function U6(e){return{type:`doctype`,name:e.name,public:e.publicId||void 0,system:e.systemId||void 0}}function W6(e,t){let n=J6(e.children,t);return{type:`element`,name:e.name,attributes:{...e.attributes},children:n}}function G6(e){return{type:`instruction`,name:e.name,value:e.content}}function K6(e){return{type:`text`,value:e.text}}function q6(e){let t=[];return e.version&&t.push(`version="`+e.version+`"`),e.encoding&&t.push(`encoding="`+e.encoding+`"`),e.standalone&&t.push(`standalone="`+e.standalone+`"`),{type:`instruction`,name:`xml`,value:t.join(` `)}}function J6(e,t){let n=[],r=-1;for(;++r<e.length;){let i=e[r],a;i.type===`cdata`?a=B6(i):i.type===`comment`?a=V6(i):i.type===`doctype`?a=U6(i):i.type===`element`?a=W6(i,t):i.type===`pi`?a=G6(i):i.type===`text`?a=K6(i):i.type===`xmldecl`&&(a=q6(i)),a&&(Y6(i,a,t),n.push(a))}return n}function Y6(e,t,n){let r=e.start===-1?void 0:n.location.toPoint(e.start),i=e.end===-1?void 0:n.location.toPoint(e.end);r&&i&&(t.position={start:r,end:i})}function X6(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/"/g,`"`)}var Z6={"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/svg+xml":`svg`,"image/webp":`webp`,"image/bmp":`bmp`,"image/tiff":`tiff`};function Q6(e){let t=e.split(/[?#]/)[0];return/\.([a-zA-Z0-9]+)$/.exec(t)?.[1]}function $6(e){return e.fileRef&&Q6(e.fileRef)||e.url&&Q6(e.url)||e.contentType&&Z6[e.contentType]}function e8(e,t,n){if(e.isFile&&!e.fileRef&&!e.url)return`<!-- image asset "${t}" is marked as file-based but has no fileRef or url -->`;let r=e.isFile?$6(e):void 0,i=e.isFile?` source="${X6(r?`${t}.${r}`:t)}"`:``,a=n?` width="${X6(n)}"`:``,o=e.source?.trim();return o?`<image${i}${a}>\n${o}\n</image>`:`<image${i}${a}/>`}function t8(e,t){let n=e.source?.trim();return n?`<interactive xml:id="${X6(t)}">\n${n}\n</interactive>`:`<interactive xml:id="${X6(t)}"></interactive>`}var n8={image:e8,doenet:t8},r8=new Set(Object.keys(n8));function i8(e,t,n,r){let i=n.find(n=>n.kind===e&&n.ref===t);return i?n8[e](i,t,r):`<!-- missing asset: ${e} ${t} -->`}var a8={closeEmptyElements:!0,tightClose:!0};function o8(){return`sec-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function s8(e){let t=e.children.find(e=>e.type===`element`&&e.name===`title`);return t?t.children.filter(e=>e.type===`text`).map(e=>e.value).join(``).trim():``}var c8=new Set([`book`,`article`,`slideshow`,`part`,`chapter`,...new Set([`introduction`,`section`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`conclusion`])]);function l8(e){let t=0,n=e.length;for(;t<n;){let n=e[t];if(n.type!==`text`||/\S/.test(n.value))break;t+=1}for(;n>t;){let t=e[n-1];if(t.type!==`text`||/\S/.test(t.value))break;--n}return e.slice(t,n)}function u8(e){return e.replace(/^(?:[ \t]*\r?\n)+/,``).replace(/(?:\r?\n[ \t]*)+$/,``)}function d8(e){try{return z6(e)}catch{return null}}function f8(e){let t=d8(`<__title__>${e}</__title__>`)?.children.find(e=>e.type===`element`);return t?t.children:[{type:`text`,value:e}]}function p8(e){let t=e.match(/^\s*<([A-Za-z_][\w.:-]*)\b[^>]*?>/);if(!t||t.index===void 0)return e;let n=e.slice(t.index+t[0].length),r=RegExp(`\\s*</${q8(t[1])}\\s*>\\s*$`);return u8(n.replace(r,``))}function m8(e,t){let n=d8(e);if(!n)return e;let r=n.children.find(e=>e.type===`element`);if(!r)return e;let i=r.children.findIndex(e=>e.type===`element`&&e.name===`title`),a={type:`element`,name:`title`,attributes:{},children:f8(t)};return i===-1?r.children.unshift(a):r.children.splice(i,1,a),JY(n,a8)}function h8(e=`New Section`){let t=o8();return{id:t,xmlId:t,title:e,source:`<section xml:id="${t}">\n\t<title>${e}</title>\n\n\t<p>\n\n\t</p>\n\n</section>`,type:`section`,sourceFormat:`pretext`}}function g8(){let e=o8();return{id:e,xmlId:e,title:`Introduction`,source:`<introduction xml:id="${e}">\n\n\t<p>\n\n\t</p>\n\n</introduction>`,type:`introduction`,sourceFormat:`pretext`}}function _8(){let e=o8();return{id:e,xmlId:e,title:`Conclusion`,source:`<conclusion xml:id="${e}">\n\n\t<p>\n\n\t</p>\n\n</conclusion>`,type:`conclusion`,sourceFormat:`pretext`}}function v8(e){let t=d8(e);if(!t)return p8(e);let n=t.children.find(e=>e.type===`element`);return n?JY({type:`root`,children:l8(n.children)},a8):e}function y8(e,t){return`<${t}>\n${u8(e)}\n</${t}>`}function b8(e,t){return e.trimStart().startsWith(`<${t}`)?e:y8(e,t)}function x8(e,t){if(t===`introduction`||t===`conclusion`)return e;let n=e.trimStart();return n.startsWith(`\\begin{section}`)?n.replace(/^\\begin\{section\}\s*\n?/,``).replace(/\n?\\end\{section\}\s*$/,``):e.replace(/^\\section\*?\{[^}]*\}\s*\n?/,``)}function S8(e,t,n,r){return t===`introduction`||t===`conclusion`?e:r?.trimStart().startsWith(`\\begin{section}`)?`\\begin{section}\n\n${e}\n\n\\end{section}`:`\\section{${n}}\n\n${e}`}function C8(e,t,n,r){if(t===`introduction`||t===`conclusion`)return e;let i=e.trimStart();return i.startsWith(`\\section`)||i.startsWith(`\\begin{section}`)?e:S8(e,t,n,r)}var w8=/^(\s*)\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*(\*?\{)/;function T8(e,t){let n=/^(\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{)[^}]*/;return n.test(e)?e.replace(n,(e,n)=>`${n}${t}`):e.includes(`\\begin{section}`)?/\\title\{/.test(e)?e.replace(/\\title\{[^}]*\}/,`\\title{${t}}`):e.replace(`\\begin{section}`,`\\begin{section}\n\n\\title{${t}}\n\n`):e}function E8(e){let t=/^\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{([^}]*)\}/.exec(e);if(t)return t[1].trim();if(e.includes(`\\begin{section}`)){let t=/\\title\{([^}]*)\}/.exec(e);if(t)return t[1].trim()}return null}function D8(e){return/^\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{[^}]*\}\s*\\label\{([^}]*)\}/.exec(e)?.[1]?.trim()??``}function O8(e,t){let n=e.source;return t.type!==void 0&&(n=n.replace(w8,`$1\\${t.type}$2`)),t.title!==void 0&&(n=T8(n,t.title)),t.xmlId!==void 0&&(n=n.replace(/^(\s*\\(?!begin\b|end\b)[A-Za-z][A-Za-z-]*\*?\{[^}]*\})(\s*\\label\{[^}]*\})?/,(e,n)=>t.xmlId==null||t.xmlId===``?n:`${n}\\label{${t.xmlId}}`)),{...e,source:n,title:t.title??e.title,type:t.type??e.type,xmlId:t.xmlId||e.xmlId}}function k8(e){let{pretextSource:t,pretextError:n}=o6(e.source,`latex`);return n||t===void 0?null:S5.has(e.type)?`<${e.type} xml:id="${e.xmlId}">\n<title>${e.title}</title>\n\n${t}\n</${e.type}>`:t}function A8(e=`New Section`){let t=o8();return{id:t,xmlId:t,title:e,source:`\\section{${e}}\n\n`,type:`section`,sourceFormat:`latex`}}function j8(){let e=o8();return{id:e,xmlId:e,title:`Introduction`,source:`% Introduction
|
|
1078
1078
|
|
|
1079
|
-
`,type:`introduction`,sourceFormat:`latex`}}function
|
|
1079
|
+
`,type:`introduction`,sourceFormat:`latex`}}function M8(){let e=o8();return{id:e,xmlId:e,title:`Conclusion`,source:`% Conclusion
|
|
1080
1080
|
|
|
1081
|
-
`,type:`conclusion`,sourceFormat:`latex`}}function
|
|
1081
|
+
`,type:`conclusion`,sourceFormat:`latex`}}function N8(e,t,n){if(n){let n=x8(t.source,t.type);return{...e,source:e.source.trimEnd()+`
|
|
1082
1082
|
|
|
1083
|
-
`+n.trimStart()}}let r=
|
|
1083
|
+
`+n.trimStart()}}let r=d8(e.source),i=d8(t.source),a=r?.children.find(e=>e.type===`element`),o=i?.children.find(e=>e.type===`element`);if(!a||!o)return{...e,source:e.source+`
|
|
1084
1084
|
|
|
1085
|
-
`+t.
|
|
1086
|
-
`)}\n---`}function
|
|
1085
|
+
`+t.source};let s=o.children.filter(e=>!(e.type===`element`&&e.name===`title`)),c={...a,children:[...a.children,...s]};return{...e,source:JY({type:`root`,children:[c]},a8)}}function P8(e){try{let t=z6(e).children.find(e=>e.type===`element`);return t?{xmlId:t.attributes?.[`xml:id`]??``,label:t.attributes?.label??``}:{xmlId:``,label:``}}catch{return{xmlId:``,label:``}}}function F8(e){return e.trim().replace(/[^A-Za-z0-9_-]/g,`-`).replace(/^[^A-Za-z_]+/,``)}function I8(e){return F8(e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``))}function L8(e){let t=d8(e);if(!t)return null;let n=t.children.find(e=>e.type===`element`);return!n||!c8.has(n.name)?null:{title:s8(n),type:n.name,xmlId:n.attributes?.[`xml:id`]??``,label:n.attributes?.label??``}}function R8(e,t){let n=t.type??e.type,r=t.title??e.title;try{let i=z6(e.source).children.find(e=>e.type===`element`);if(!i)return{...e,title:r,type:n};let a={...i,name:n,attributes:{...i.attributes}};t.xmlId!==void 0&&(t.xmlId===null||t.xmlId===``?delete a.attributes[`xml:id`]:a.attributes[`xml:id`]=t.xmlId),t.label!==void 0&&(t.label===null||t.label===``?delete a.attributes.label:a.attributes.label=t.label);let o=a.children.findIndex(e=>e.type===`element`&&e.name===`title`),s={type:`element`,name:`title`,attributes:{},children:f8(r)};o===-1?a.children=[s,...a.children]:a.children=[...a.children.slice(0,o),s,...a.children.slice(o+1)];let c=JY({type:`root`,children:[a]},a8),l=t.xmlId!==void 0&&t.xmlId!==null&&t.xmlId!==``?t.xmlId:e.xmlId;return{...e,title:r,type:n,xmlId:l,source:c}}catch{return{...e,title:r,type:n}}}var z8=/^\uFEFF?[ \t]*---[ \t]*\r?\n([\s\S]*?)\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/;function B8(e){let t=e.trim();return t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`):t.replace(/^['"]|['"]$/g,``)}function V8(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function H8(e){let t=z8.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=`section`,i=``,a=``,o=``;for(let e of t[1].split(/\r?\n/)){let t=/^[ \t]*(xmlid|xml:id|division|label|title)[ \t]*:[ \t]*(.*)$/.exec(e);if(!t)continue;let n=B8(t[2]);t[1]===`division`?r=n:t[1]===`xmlid`||t[1]===`xml:id`?i=n:t[1]===`title`?o=n:a=n}return{type:r||`section`,xmlId:i,label:a,title:o,body:n}}function U8(e){let t=[`division: ${e.type}`,`xmlid: ${e.xmlId}`];return e.title&&t.push(`title: ${V8(e.title)}`),e.label&&t.push(`label: ${e.label}`),`---\n${t.join(`
|
|
1086
|
+
`)}\n---`}function W8(e){let t=/^[ \t]*#[ \t]+(.*)$/m.exec(e);return t?t[1].trim():null}function G8(e){let t=H8(e);return t?{title:t.title||W8(t.body)||``,type:t.type,xmlId:t.xmlId,label:t.label}:null}function K8(e,t){let n=H8(e.source),r=n?n.body:e.source,i=n?.type??e.type,a=n?.xmlId??e.xmlId,o=n?.label??``,s=n?.title||e.title,c=t.type??i,l=(t.xmlId===void 0?a:t.xmlId??``)||e.xmlId,u=t.label===void 0?o:t.label??``,d=t.title??s,f=`${U8({type:c,xmlId:l,label:u,title:d})}\n${r}`;return{...e,title:d,type:c,xmlId:l,source:f}}function q8(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function J8(e){return e===`pretext`||e===`markdown`||e===`latex`}var Y8=new Set([`division`,...c8,`subsection`,`subsubsection`,`paragraphs`]),X8=Array.from(Y8).join(`|`);function Z8(e){let t=e===null?`ref="([^"]+)"`:`ref="${q8(e)}"`,n=`(?:${X8})`;return`<plus:${n}\\s[^>]*${t}[^>]*?(?:/>|>\\s*</plus:${n}>)`}function Q8(e){let t=e===null?`ref="([^"]+)"`:`ref="${q8(e)}"`;return`::${`(?:${X8})`}(?:\\[[^\\]]*\\])?\\{[^}]*${t}[^}]*\\}`}function $8(e){let t=e===null?`([^}]+)`:q8(e);return`\\\\plus\\{${`(?:${X8})`}\\}\\{${t}\\}`}function e5(e){return`(?:${Z8(e)}|${Q8(e)}|${$8(e)})`}function t5(e,t){switch(e){case`pretext`:return Z8(t);case`markdown`:return Q8(t);case`latex`:return $8(t)}}var n5={pretext:[`pre`,`c`,`cd`,`program`,`console`,`sage`,`latex-image`,`sageplot`,`asymptote`].map(e=>`<${e}(?:\\s[^>]*)?>[\\s\\S]*?</${e}>`),markdown:["```[\\s\\S]*?```",`~~~[\\s\\S]*?~~~`,"`[^`\\n]*`"],latex:[`\\\\begin\\{verbatim\\}[\\s\\S]*?\\\\end\\{verbatim\\}`,`\\\\begin\\{lstlisting\\}[\\s\\S]*?\\\\end\\{lstlisting\\}`,`\\\\verb\\*?\\|[^|\\n]*\\|`]};function r5(e,t){let n=n5[t];if(n.length===0)return e;let r=new RegExp(n.join(`|`),`g`);return e.replace(r,e=>e.replace(/[^\n]/g,` `))}function i5(e,t){let n=[],r=new RegExp(t5(t,null),`g`),i=r5(e,t),a;for(;(a=r.exec(i))!==null;)n.push(a[1]);return n}function a5(e,t){let n=[],r=X8,i={pretext:`<plus:(${r})\\s[^>]*ref="([^"]+)"[^>]*?(?:/>|>\\s*</plus:${`(?:${r})`}>)`,markdown:`::(${r})(?:\\[[^\\]]*\\])?\\{[^}]*ref="([^"]+)"[^}]*\\}`,latex:`\\\\plus\\{(${r})\\}\\{([^}]+)\\}`},a=new RegExp(i[t],`g`),o=r5(e,t),s;for(;(s=a.exec(o))!==null;){let e=s[1],t=s[2],r=e===`division`?`section`:e;n.push({type:r,xmlId:t})}return n}function o5(e,t){let n=[],r=new RegExp({pretext:`<plus:(image|doenet)\\b[^>]*\\bref="([^"]+)"`,markdown:`::(image|doenet)(?:\\[[^\\]]*\\])?\\{[^}]*\\bref="([^"]+)"[^}]*\\}`,latex:`\\\\plus\\{(image|doenet)\\}\\{([^}]+)\\}`}[t],`g`),i=r5(e,t),a;for(;(a=r.exec(i))!==null;)n.push({kind:a[1],ref:a[2]});return n}function s5(e,t,n,r){let i=q8(t),a=q8(n),o=RegExp(`(<plus:${i}\\b[^>]*?\\bref=")${a}(")`,`g`),s=RegExp(`(::${i}(?:\\[[^\\]]*\\])?\\{[^}]*?\\bref=")${a}(")`,`g`),c=RegExp(`(\\\\plus\\{${i}\\}\\{)${a}(\\})`,`g`);return e.replace(o,`$1${r}$2`).replace(s,`$1${r}$2`).replace(c,`$1${r}$2`)}function c5(e,t,n){let r=q8(t),i=q8(n),a=RegExp(`<plus:${r}\\b[^>]*?\\bref="${i}"[^>]*/?>`,`g`),o=RegExp(`::${r}(?:\\[[^\\]]*\\])?\\{[^}]*?\\bref="${i}"[^}]*\\}`,`g`),s=RegExp(`\\\\plus\\{${r}\\}\\{${i}\\}`,`g`);return e.replace(a,``).replace(o,``).replace(s,``)}function l5(e,t,n=`pretext`){return n===`markdown`?`::${e}{ref="${t}"}`:n===`latex`?`\\plus{${e}}{${t}}`:`<plus:${e} ref="${t}"/>`}function u5(e,t,n=`pretext`){let r=`New ${t.charAt(0).toUpperCase()+t.slice(1)}`;return{id:e,xmlId:e,title:r,type:t,sourceFormat:n,source:d5(t,n,r,e)}}function d5(e,t,n,r){return t===`latex`?e===`introduction`||e===`conclusion`?`% ${n}\n\n`:`\\${e}{${n}}\\label{${r}}\n\n`:t===`markdown`?`${U8({type:e,xmlId:r,label:``,title:n})}\n\n`:e===`introduction`||e===`conclusion`?`<${e} xml:id="${r}">\n\n\t<p>\n\n\t</p>\n\n</${e}>`:`<${e} xml:id="${r}">\n\t<title>${n}</title>\n\n\t<p>\n\n\t</p>\n\n</${e}>`}function f5(e,t,n,r,i=`pretext`){let a=i===`markdown`?`::${n}{ref="${t}"}`:i===`latex`?`\\plus{${n}}{${t}}`:`<plus:${n} ref="${t}"/>`;if(r!==null){let t=new RegExp(e5(r)).exec(e);if(t){let n=t.index+t[0].length;return e.slice(0,n)+`
|
|
1087
1087
|
`+a+e.slice(n)}}let o=e.lastIndexOf(`</`);return o===-1?e+`
|
|
1088
1088
|
`+a:e.slice(0,o)+a+`
|
|
1089
|
-
`+e.slice(o)}function
|
|
1089
|
+
`+e.slice(o)}function p5(e,t){let n=RegExp(`[ \t]*${e5(t)}[ \t]*\n?`,`g`);return e.replace(n,``)}function m5(e,t,n){let r=new RegExp(e5(t)).exec(e),i=r?r[0]:`<plus:division ref="${t}"/>`,a=p5(e,t);if(n!==null){let e=new RegExp(e5(n)).exec(a);if(e){let t=e.index+e[0].length;return a.slice(0,t)+`
|
|
1090
1090
|
`+i+a.slice(t)}}let o=a.lastIndexOf(`</`);return o===-1?a+`
|
|
1091
1091
|
`+i:a.slice(0,o)+i+`
|
|
1092
|
-
`+a.slice(o)}function n5(e,t,n,r){let i=new RegExp(W8(t));return e.replace(i,e=>{let t=e.trimStart();return t.startsWith(`::`)?`::${r}{ref="${n}"}`:t.startsWith(`\\plus`)?`\\plus{${r}}{${n}}`:`<plus:${r} ref="${n}"/>`})}function r5(e,t){let n=new RegExp(W8(t));return e.find(e=>n.test(e.content))??null}function i5(e,t){let n=e,r=null;for(let e of t)n=t5(n,e,r),r=e;return n}function a5(e,t){let n=new Set,r=[t];for(;r.length>0;){let t=r.pop();if(n.has(t))continue;n.add(t);let i=e.find(e=>e.xmlId===t);if(i)for(let e of G8(i.content))r.push(e)}return n}function o5(e,t){let n=a5(e,t);return e.filter(e=>!n.has(e.xmlId))}function s5(e,t){let n=[],r=new Set([t]),i=(t,a)=>{let o=e.find(e=>e.xmlId===t);if(o)for(let s of G8(o.content)){if(r.has(s))continue;let o=e.find(e=>e.xmlId===s);o&&(r.add(s),n.push({division:o,depth:a,parentXmlId:t}),i(s,a+1))}};return i(t,0),n}function c5(e,t){let n=o5(e,t),r=new Set(n.map(e=>e.xmlId)),i=new Set;for(let e of n)for(let t of G8(e.content))r.has(t)&&i.add(t);return n.filter(e=>!i.has(e.xmlId))}var l5=new Set([`book`,`article`,`slideshow`]);function u5(e){try{let t=N6(e),n=t.children.find(e=>e.type===`element`),r=n?.name===`pretext`?n.children.find(e=>e.type===`element`&&l5.has(e.name)):n&&l5.has(n.name)?n:void 0;if(!r)return e;if(!r.attributes.label){let e=f5(t,`pretext-plus-preview`);return r.attributes.label=e,JY(t,X6)}return e}catch(t){return console.error(`Error ensuring label:`,t),e}}function d5(e,t){return e.type===`element`&&e.attributes?.label===t?!0:`children`in e&&e.children?e.children.some(e=>e.type===`element`?d5(e,t):!1):!1}function f5(e,t){let n=t,r=1;for(;d5(e,n);)n=`${t}-${r}`,r++;return n}function p5(e,t,n,r){let i=t.find(t=>t.xmlId===e);if(!i)return`<!-- missing division: ${e} -->`;if(n.has(e))return`<!-- circular reference: ${e} -->`;let a;if(i.sourceFormat===`pretext`)a=i.content;else if(i.sourceFormat===`markdown`){let{pretextSource:e,pretextError:t}=e6(i.content,`markdown`);a=e??`<!-- conversion error: ${t} -->`}else a=b8(i)??`<!-- conversion error: ${i.xmlId} -->`;let o=new Set(n).add(e);return a.replace(/<plus:([a-z-]+)\s([^>]*ref="[^"]+"[^>]*?)(?:\/>|>\s*<\/plus:\1>)/g,(e,n,i)=>{let a=/ref="([^"]+)"/.exec(i)?.[1]??``;if(!J6.has(n))return p5(a,t,o,r);let s=/width="([^"]+)"/.exec(i)?.[1];return Y6(n,a,r,s)})}function m5(e,t,n=[]){return u5(p5(t,e,new Set,n))}function h5(e,t){return u5(`<pretext>\n${t.trim()?`${t.trim()}\n`:``}${e}\n</pretext>`)}function g5(e,t,n,r=[]){return h5(p5(t,e,new Set,r),n)}var _5=new Set([`part`,`chapter`]);function v5(e,t,n,r){return h5(l5.has(e)?t:_5.has(e)?`<book>\n<title>${r}</title>\n${t}\n</book>`:`<article>\n<title>${r}</title>\n${t}\n</article>`,n)}function y5(e){let t=e.trim(),n=t.match(/^<title\b[^>]*>([\s\S]*?)<\/title>\s*/);return n?{title:n[1].trim(),body:t.slice(n[0].length)}:{title:``,body:t}}function b5(e,t,n,r){let i=n===`book`?`book`:`article`;return e.map(e=>{if(e.sourceFormat===`markdown`){if(!e.title){let t=F8(e.content)?.title;if(t)return{...e,title:t}}return e}if(e.sourceFormat===`latex`){if(!e.title){let t=_8(e.content);if(t)return{...e,title:t}}return e}if(e.sourceFormat!==`pretext`)return e;let n=O8(e.content);if(e.xmlId===t&&!(n&&l5.has(n.type))){let{title:t,body:n}=y5(e.content),a=e.title||t||r||`Untitled`;return{...e,type:i,title:a,content:`<${i} xml:id="${e.xmlId}">\n<title>${a}</title>\n\n${n}\n</${i}>`}}return!e.title&&n?.title?{...e,title:n.title}:e})}function x5(e,t){let n=t??[],r=(e,t)=>n.find(n=>n.kind===e&&n.ref===t),i=[],a=new Set;for(let t of e??[])for(let{kind:e,ref:n}of q8(t.content)){let t=`${e}:${n}`;if(a.has(t))continue;a.add(t);let o=r(e,n);i.push({kind:e,ref:n,asset:o,inDocument:!0,status:o?`linked`:`unlinked`})}for(let e of n){if(!e.ref)continue;let t=`${e.kind}:${e.ref}`;a.has(t)||(a.add(t),i.push({kind:e.kind,ref:e.ref,asset:e,inDocument:!1,status:`unused`}))}return i}function S5(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let e=2;;e++){let r=`${n}-${e}`;if(!t.has(r))return r}}var C5={image:`Images`,doenet:`Doenet`},w5=[`image`,`doenet`].filter(e=>e!==`doenet`||!1);function T5(e){return`${e}-${Date.now()}`}var E5=({open:e,onClose:r,resolveTarget:i,replaceTarget:a,onLoadAssets:o,onLoadLibraryAssets:s,onAddFromLibrary:c,onUpload:l,onFetchUrl:u,onCreateDoenet:d,onRemoveAsset:f,onDuplicateAsset:p,onAssetAdded:m,onResolveRef:h,onReplaceAsset:g})=>{let _=c6(e=>e.divisions),v=c6(e=>e.activeDivisionId),y=_?.find(e=>e.xmlId===v)?.sourceFormat??`pretext`,b=(e,t)=>X8(e,t,y),x=c6(e=>e.projectAssets)??[],S=c6(e=>e.setProjectAssets),C=c6(e=>e.libraryAssets),w=c6(e=>e.openAssetEditor),T=c6(e=>e.openAssetResolver),E=c6(e=>e.removeAssetRefFromDocument),D=!!(o||s),[O,k]=(0,n.useState)(null),[A,ee]=(0,n.useState)(!1),[te,j]=(0,n.useState)(null),M=x,ne=O??C??M,N=new Set(M.map(e=>e.id)),[re,ie]=(0,n.useState)(`in-document`),[ae,oe]=(0,n.useState)(null),[se,P]=(0,n.useState)(`library`),[ce,le]=(0,n.useState)(`library`),[ue,de]=(0,n.useState)(null),[F,fe]=(0,n.useState)(!1),[pe,me]=(0,n.useState)(!1),[he,ge]=(0,n.useState)(null),I=(0,n.useRef)(null),[_e,ve]=(0,n.useState)(``),[ye,be]=(0,n.useState)(``),[xe,Se]=(0,n.useState)(!1),[Ce,L]=(0,n.useState)(null),[we,Te]=(0,n.useState)(``),[Ee,R]=(0,n.useState)(``),[De,Oe]=(0,n.useState)(!1),[ke,z]=(0,n.useState)(null),[Ae,je]=(0,n.useState)(null),[Me,Ne]=(0,n.useState)(null),[Pe,Fe]=(0,n.useState)(null),Ie=(0,n.useCallback)(()=>{!o&&!s||(ee(!0),j(null),Promise.all([o?.()??Promise.resolve(null),s?.()??Promise.resolve(null)]).then(([e,t])=>{e!==null&&S(e),t!==null&&k(t)}).catch(e=>{j(e instanceof Error?e.message:`Failed to load assets.`)}).finally(()=>ee(!1)))},[o,s,S]),Le=(0,n.useRef)(Ie);if((0,n.useEffect)(()=>{Le.current=Ie}),(0,n.useEffect)(()=>{e&&Le.current()},[e]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r]),!e)return null;let Re=x5(_,M),ze=(e,t)=>{if(a){g(a,e,!!t?.fromLibrary),r();return}if(m(e),i){e.ref&&h(i.kind,i.ref,e.ref),r();return}e.ref&&navigator.clipboard.writeText(b(e.kind,e.ref)).catch(()=>{}),Fe(e)},Be=(e,t)=>{let n=`${e}:${t}`;navigator.clipboard.writeText(b(e,t)).catch(()=>{}),je(n),setTimeout(()=>je(e=>e===n?null:e),2e3)},Ve=async e=>{if(!N.has(e.id)&&c){de(e.id);try{await c(e)}finally{de(null)}}ze(e,{fromLibrary:!0})},He=async e=>{if(l){ge(null),me(!0);try{ze(await l(e))}catch(e){ge(e instanceof Error?e.message:`Upload failed.`)}finally{me(!1)}}},Ue=async()=>{let e=_e.trim();if(!e)return;let t=ye.trim();if(u&&l){L(null),Se(!0);try{let n=await u(e);ze(await l(t?new File([n],t,{type:n.type}):n))}catch(e){L(e instanceof Error?e.message:`Failed to add URL.`)}finally{Se(!1)}}else ze({id:T5(`url`),name:t||e,ref:e.split(`/`).pop()??`image`,kind:`image`,url:e})},B=async()=>{let e=we.trim(),t=Ee.trim();if(!(!e||!t))if(d){z(null),Oe(!0);try{ze(await d(e,t))}catch(e){z(e instanceof Error?e.message:`Failed to create activity.`)}finally{Oe(!1)}}else ze({id:T5(`doenet`),name:e,ref:t,kind:`doenet`})},We=e=>{let n=ne.filter(t=>t.kind===e);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-library`,children:[D&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-toolbar`,children:[te&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-load-error`,children:te}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__asset-library-refresh`,onClick:Ie,disabled:A,children:A?`Loading…`:`Refresh`})]}),A&&n.length===0?(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-empty-text`,children:`Loading…`}):n.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__am-empty-text`,children:[`No `,C5[e].toLowerCase(),` assets in your library.`]}):(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:n.map(e=>{let n=N.has(e.id),r=ue===e.id;return(0,t.jsx)(`li`,{children:(0,t.jsxs)(`button`,{type:`button`,className:[`pretext-plus-editor__am-lib-row`,n?`pretext-plus-editor__am-lib-row--in-project`:``].filter(Boolean).join(` `),onClick:()=>Ve(e),disabled:r||!e.ref,title:e.ref?n?`Use "${e.ref}"`:`Add to project & use "${e.ref}"`:`Asset has no reference — cannot use`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-info`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-name`,children:e.name}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:r?`Adding…`:e.ref})]}),n&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-badge`,children:`✓`})]})},e.id)})})]})},Ge=()=>{if(Re.length===0)return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-placeholder`,children:[(0,t.jsx)(`p`,{children:`No assets in this project yet.`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{ie(`add`),oe(null)},children:`Add an asset`})]});let e=w5.map(e=>({kind:e,rows:Re.filter(t=>t.kind===e)})).filter(e=>e.rows.length>0),n=e=>{let n=`${e.kind}:${e.ref}`,i=Me===n,a=()=>{e.status===`unlinked`?T(e.kind,e.ref):(w(e.kind,e.ref),r())};return(0,t.jsxs)(`li`,{className:`pretext-plus-editor__am-doc-row`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-row-info pretext-plus-editor__am-row-info--btn`,onClick:a,title:e.status===`unlinked`?`No asset for this reference — click to link or create one`:`Edit asset`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-name`,children:e.asset?.name??e.ref}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:e.ref})]}),e.status===`unlinked`&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-status pretext-plus-editor__am-status--warn`,title:`No asset for this reference`,children:`needs asset`}),e.status===`unused`&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-status`,title:`Not referenced in the document yet`,children:`not placed`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:a,children:e.status===`unlinked`?`Link / create`:`Edit`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ae===n?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>Be(e.kind,e.ref),title:`Copy ${b(e.kind,e.ref)}`,children:Ae===n?`Copied!`:`Copy embed code`}),p&&e.asset?.url&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,disabled:i,onClick:async()=>{Ne(n);try{await p(e.asset),r()}catch{Ne(null)}},title:`Create a copy of this asset under a new reference`,children:i?`Duplicating…`:`Duplicate`}),f&&e.asset&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn pretext-plus-editor__am-action-btn--danger`,onClick:()=>{e.inDocument&&!window.confirm(`Remove "${e.asset.name}" from the project? This also deletes its reference(s) from the document.`)||(f(e.asset),E(e.kind,e.ref),r())},title:`Remove from project`,children:`Remove`})]})]},n)};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-in-doc`,children:e.map(({kind:e,rows:r})=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-group`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-header`,children:[(0,t.jsx)(`span`,{"aria-hidden":`true`,children:`📁`}),(0,t.jsx)(`span`,{children:C5[e]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-count`,children:r.length})]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:r.map(n)})]},e))})},Ke=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-success`,children:[(0,t.jsxs)(`p`,{className:`pretext-plus-editor__am-success-title`,children:[`✓ Added “`,e.name,`” — embed code copied to clipboard`]}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`It now appears in the Assets list. Paste this where you want it to appear:`}),e.ref&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-embed-row`,children:[(0,t.jsx)(`code`,{className:`pretext-plus-editor__am-embed-code`,children:b(e.kind,e.ref)}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ae===`${e.kind}:${e.ref}`?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>Be(e.kind,e.ref),children:Ae===`${e.kind}:${e.ref}`?`Copied!`:`Copy again`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-success-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>{Fe(null),oe(null),ie(`add`)},children:`Add another`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{Fe(null),ie(`in-document`)},children:`Done`})]})]}),V=()=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-picker`,children:[(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-kind-picker-label`,children:`What kind of asset?`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-cards`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-kind-card`,onClick:()=>{oe(`image`),P(`library`)},children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:`🖼️`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`Image`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`PNG, JPEG, SVG, etc.`})]}),!1,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-card pretext-plus-editor__am-kind-card--soon`,"aria-disabled":`true`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:`✨`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`More coming soon`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`Interactive activities and more`})]})]})]}),qe=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>oe(null),children:`← Back`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`library`),children:`Library`}),l&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`upload`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`upload`),children:`Upload`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`url`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`url`),children:`External URL`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[se===`library`&&We(`image`),se===`upload`&&l&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-upload`,children:[(0,t.jsxs)(`div`,{className:[`pretext-plus-editor__am-drop-zone`,F?`pretext-plus-editor__am-drop-zone--active`:``,pe?`pretext-plus-editor__am-drop-zone--uploading`:``].filter(Boolean).join(` `),onDragOver:e=>{e.preventDefault(),fe(!0)},onDragLeave:()=>fe(!1),onDrop:e=>{e.preventDefault(),fe(!1);let t=e.dataTransfer.files[0];t&&He(t)},onClick:()=>!pe&&I.current?.click(),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I.current?.click())},"aria-label":`Upload image — click or drag and drop`,children:[(0,t.jsx)(`input`,{ref:I,type:`file`,accept:`image/*`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&He(t)}}),pe?(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-drop-text`,children:`Uploading…`}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-drop-icon`,"aria-hidden":`true`,children:`↑`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-drop-text`,children:`Drag & drop an image, or click to browse`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`PNG, JPEG, GIF, SVG, WebP`})]})]}),he&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:he})]}),se===`url`&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-url-form`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-url-value`,children:`Image URL`}),(0,t.jsx)(`input`,{id:`am-url-value`,type:`url`,className:`pretext-plus-editor__am-input`,placeholder:`https://example.com/image.png`,value:_e,onChange:e=>ve(e.target.value),disabled:xe,autoFocus:!0}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-url-name`,children:[`Name `,(0,t.jsx)(`span`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`(optional)`})]}),(0,t.jsx)(`input`,{id:`am-url-name`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`My image`,value:ye,onChange:e=>be(e.target.value),disabled:xe}),Ce&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:Ce}),_e.trim()&&(0,t.jsx)(`img`,{src:_e.trim(),alt:`Preview`,className:`pretext-plus-editor__am-url-preview`,onError:e=>{e.currentTarget.style.display=`none`}}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:Ue,disabled:!_e.trim()||xe,children:xe?`Adding…`:u&&l?`Add to Project`:`Add`})]})]})]}),Je=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>oe(null),children:`← Back`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${ce===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>le(`library`),children:`Library`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${ce===`create`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>le(`create`),children:`Create New`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[ce===`library`&&We(`doenet`),ce===`create`&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-create-form`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-doenet-name`,children:`Name`}),(0,t.jsx)(`input`,{id:`am-doenet-name`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`My Activity`,value:we,onChange:e=>Te(e.target.value),disabled:De,autoFocus:!0}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-doenet-ref`,children:`Reference ID`}),(0,t.jsx)(`input`,{id:`am-doenet-ref`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`my-activity`,value:Ee,onChange:e=>R(e.target.value),disabled:De}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`The reference ID is used in the embed code: `,(0,t.jsx)(`code`,{children:b(`doenet`,Ee||`my-activity`)})]}),ke&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:ke}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:B,disabled:!we.trim()||!Ee.trim()||De,children:De?`Creating…`:d?`Create`:`Add`})]})]})]}),Ye=(e,n,i)=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:n}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:[(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy pretext-plus-editor__am-resolve-hint`,children:i}),e===`doenet`?Je(!1):qe(!1)]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:r,children:`Cancel`})})]});return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&r(),children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__dialog--asset-manager`,role:`dialog`,"aria-modal":`true`,"aria-label":`Asset manager`,children:i?(e=>Ye(e.kind,`Link asset`,(0,t.jsxs)(t.Fragment,{children:[`The reference `,(0,t.jsx)(`code`,{children:e.ref}),` has no asset yet. Choose or create one — the reference in your document will be updated to match.`]})))(i):a?(e=>Ye(e.kind,`Replace asset`,(0,t.jsxs)(t.Fragment,{children:[`Choose or upload a new asset to replace `,(0,t.jsx)(`code`,{children:e.name}),`. Every place it’s used in your document will show the new asset.`]})))(a):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:`Assets`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),Pe?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:Ke(Pe)}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${re===`in-document`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ie(`in-document`),children:[`Assets`,Re.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-tab-count`,children:Re.length})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${re===`add`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>{ie(`add`),oe(null)},children:`Add Asset`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:re===`in-document`?Ge():ae===null?V():ae===`image`?qe(!0):Je(!0)})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:r,children:`Close`})})]})})})},D5={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10},scrollBeyondLastLine:!1},O5=160,k5={image:`image`,doenet:`interactive`},A5=({asset:e,projectAssets:r,onClose:i,onSave:a,onReplace:o,onDuplicate:s})=>{let c=c6(e=>e.divisions),l=c6(e=>e.activeDivisionId),u=c?.find(e=>e.xmlId===l)?.sourceFormat??`pretext`,d=e.ref??``,[f,p]=(0,n.useState)(e.name),[m,h]=(0,n.useState)(d),[g,_]=(0,n.useState)(e.source??``),[v,y]=(0,n.useState)(!1),[b,x]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),[w,T]=(0,n.useState)(!1),[E,D]=(0,n.useState)(O5),O=(0,n.useRef)(null);(0,n.useEffect)(()=>{O.current?.scrollTo({top:0})},[]);let k=e=>{let t=()=>D(Math.max(O5,e.getContentHeight()));e.onDidContentSizeChange(t),t()},A=X8(e.kind,m.trim()||d,u),ee=()=>{navigator.clipboard.writeText(A).catch(()=>{}),T(!0),setTimeout(()=>T(!1),2e3)},te=async()=>{let t=m.trim();if(!t){C(`Reference can't be empty — it identifies the asset and is used by every embed of it.`);return}if(t!==d&&r.some(n=>n.kind===e.kind&&n.ref===t)){C(`Reference "${t}" is already used by another asset. Choose a unique reference.`);return}C(null),y(!0);try{await a({...e,name:f.trim()||t,ref:t,source:g},d),i()}catch(e){C(e instanceof Error?e.message:`Failed to save asset.`),y(!1)}},j=async()=>{if(s){C(null),x(!0);try{await s(e)}catch(e){C(e instanceof Error?e.message:`Failed to duplicate asset.`),x(!1)}}},M=v||b,ne=e.kind===`image`&&!!e.url,N=e.kind===`image`&&!!o;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&i(),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Edit asset ${e.name}`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:`Edit asset`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,t.jsx)(`div`,{ref:O,className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single pretext-plus-editor__am-edit-content`,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-grid`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-col`,children:[ne&&(0,t.jsx)(`img`,{src:e.url,alt:f,className:`pretext-plus-editor__am-url-preview`,onError:e=>{e.currentTarget.style.display=`none`}}),N&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-replace-row`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:()=>o?.(e),disabled:M,title:`Choose or upload a different asset to use here`,children:`Replace image…`})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-col`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-edit-name`,children:`Name`}),(0,t.jsx)(`input`,{id:`am-edit-name`,type:`text`,className:`pretext-plus-editor__am-input`,value:f,onChange:e=>p(e.target.value),disabled:M}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-edit-ref`,children:`Reference`}),(0,t.jsx)(`input`,{id:`am-edit-ref`,type:`text`,className:`pretext-plus-editor__am-input`,value:m,onChange:e=>h(e.target.value),disabled:M}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`Used in the embed code. Changing it updates every reference to this asset already in your document.`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-embed-row`,children:[(0,t.jsx)(`code`,{className:`pretext-plus-editor__am-embed-code`,children:A}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${w?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:ee,title:`Copy embed code to clipboard`,children:w?`Copied!`:`Copy embed code`})]})]})]}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Asset content`}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`Inserted verbatim inside the generated `,(0,t.jsx)(`code`,{children:`<${k5[e.kind]}>`}),` element — e.g. `,(0,t.jsx)(`code`,{children:`<shortdescription>...</shortdescription>`}),`.`]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor pretext-plus-editor__am-edit-editor`,style:{height:E},children:(0,t.jsx)(Yn,{options:{...D5,readOnly:M},height:`100%`,language:`xml`,value:g,onMount:k,onChange:e=>_(e??``)})}),S&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:S})]})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[s&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary pretext-plus-editor__am-duplicate-btn`,onClick:j,disabled:M,title:`Create a copy of this asset under a new reference`,children:b?`Duplicating…`:`Duplicate`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:i,disabled:M,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:te,disabled:M,children:v?`Saving…`:`Save`})]})]})})},j5=e=>{let n=c6(e=>e.showFullPreview),r=c6(e=>e.setShowFullPreview),i=c6(e=>e.title),a=c6(e=>e.updateTitle),o;return o=e.showPreviewModeToggle===!1?null:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__preview-toggle`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:!n,onChange:()=>r(!n),className:`pretext-plus-editor__preview-toggle-input`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__preview-toggle-container`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-label`,children:`Simple`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-slider ${n?`pretext-plus-editor__preview-toggle-slider--active`:``}`,children:(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-dot ${n?`pretext-plus-editor__preview-toggle-dot--active`:``}`})}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-label`,children:`Full`})]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-caption`,children:`Preview Mode`}),(0,t.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(!n),className:`pretext-plus-editor__preview-toggle-input`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-bar`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__menu-left`,children:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__title-label`,children:[`Title`,` `,(0,t.jsx)(`input`,{className:`pretext-plus-editor__title-input`,type:`text`,value:i,onChange:e=>a(e.target.value)})]})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-right`,children:[e.onSaveButton&&(0,t.jsx)(`button`,{className:`pretext-plus-editor__button pretext-plus-editor__button--save`,onClick:e.onSaveButton,children:e.saveButtonLabel||`Save`}),e.onCancelButton&&(0,t.jsx)(`button`,{className:`pretext-plus-editor__button pretext-plus-editor__button--cancel`,onClick:e.onCancelButton,children:e.cancelButtonLabel||`Cancel`}),(0,t.jsx)(l6,{label:`Give feedback`,context:`main-editor`}),o]})]})},M5={pretext:`PreTeXt`,latex:`LaTeX`,markdown:`Markdown`},N5={book:`bk`,article:`art`,slideshow:`slides`,part:`pt`,chapter:`ch`,section:`sec`,subsection:`subsec`,subsubsection:`subsubsec`,introduction:`intro`,conclusion:`conc`,worksheet:`ws`,handout:`ho`,exercises:`ex`,references:`ref`,glossary:`gloss`,solutions:`sol`,"reading-questions":`rq`,paragraphs:`para`},P5={book:`Book`,article:`Article`,slideshow:`Slideshow`,part:`Part`,chapter:`Chapter`,section:`Section`,worksheet:`Worksheet`,handout:`Handout`,exercises:`Exercises`,references:`References`,glossary:`Glossary`,solutions:`Solutions`,"reading-questions":`Reading Questions`,introduction:`Introduction`,conclusion:`Conclusion`,subsection:`Subsection`,subsubsection:`Subsubsection`,paragraphs:`Paragraphs`},F5=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`paragraphs`],I5=[`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`paragraphs`],L5={book:[`part`,`chapter`],article:[`section`,...I5],slideshow:[`section`],part:[`chapter`],chapter:[`section`,...I5],section:[`subsection`,...I5],subsection:[`subsubsection`,...I5],subsubsection:[...I5],worksheet:[`paragraphs`],handout:[`paragraphs`]};function R5(e){return e?L5[e]??F5:F5}function z5(e,t){let n=N5[e]??`sec`,r=D8(t);return r?`${n}-${r}`:n}var B5=({draft:e,isNew:r=!1,isRoot:i=!1,parentType:a=null,onDraftChange:o,onCommit:s,onCancel:c})=>{let l=R5(a),u=(0,n.useRef)(r);return(0,n.useEffect)(()=>{i||l.length>0&&!l.includes(e.type)&&o({...e,type:l[0]})},[e,i,o,l]),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-edit-form`,children:[(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Title`}),(0,t.jsx)(`input`,{type:`text`,value:e.title,onChange:t=>{let n=t.target.value;o(u.current?{...e,title:n,xmlId:z5(e.type,n)}:{...e,title:n})},onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&c()},autoFocus:!0})]}),r?(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Format`}),(0,t.jsx)(`select`,{value:e.sourceFormat,onChange:t=>o({...e,sourceFormat:t.target.value}),children:Object.keys(M5).map(e=>(0,t.jsx)(`option`,{value:e,children:M5[e]},e))})]}):void 0,!i&&(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Type`}),(0,t.jsx)(`select`,{value:e.type,onChange:t=>{let n=t.target.value;o(u.current?{...e,type:n,xmlId:z5(n,e.title)}:{...e,type:n})},children:l.map(e=>(0,t.jsx)(`option`,{value:e,children:P5[e]},e))})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Id`}),(0,t.jsx)(`input`,{type:`text`,value:e.xmlId,placeholder:`unique identifier`,onChange:t=>{u.current=!1,o({...e,xmlId:t.target.value})}})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-edit-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-save`,onClick:s,children:`Save`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-cancel`,onClick:c,children:`Cancel`})]})]})},V5=({items:e})=>{let[i,a]=(0,n.useState)(!1),[o,s]=(0,n.useState)(null),c=(0,n.useRef)(null),l=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;c.current&&!c.current.contains(t)&&l.current&&!l.current.contains(t)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)},n=()=>a(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[i]),(0,n.useLayoutEffect)(()=>{if(!i)return;let e=c.current,t=l.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=window.innerHeight-n.bottom,o=r.height+4>a&&n.top>a;s({right:Math.max(4,window.innerWidth-n.right),...o?{bottom:window.innerHeight-n.top+3}:{top:n.bottom+3}})},[i]);let u=e=>{a(!1),e()};return(0,t.jsxs)(`div`,{ref:c,className:`pretext-plus-editor__toc-div-menu`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-div-menu-trigger`,onClick:e=>{e.stopPropagation(),a(e=>(e||s(null),!e))},"aria-haspopup":`true`,"aria-expanded":i,title:`More options`,children:`⋮`}),i&&(0,r.createPortal)((0,t.jsx)(`div`,{ref:l,className:`pretext-plus-editor__toc-div-menu-popup pretext-plus-editor__toc-div-menu-popup--portal`,style:{visibility:o?`visible`:`hidden`,right:o?.right,top:o?.top,bottom:o?.bottom},children:e.map(e=>(0,t.jsx)(`button`,{type:`button`,className:[`pretext-plus-editor__toc-div-menu-item`,e.danger?`pretext-plus-editor__toc-div-menu-item--danger`:``].filter(Boolean).join(` `),onClick:()=>u(e.onClick),children:e.label},e.label))}),document.body)]})},H5=({division:e,depth:n,isActive:r,hasChildren:i,isExpanded:a,onToggleExpand:o,editDraft:s,onSelect:c,onDraftChange:l,onEditCommit:u,onEditCancel:d,menuItems:f,isNew:p=!1,isRoot:m=!1,parentType:h=null})=>{let g=s!==null,_=e.type===`introduction`||e.type===`conclusion`?P5[e.type]:null;return(0,t.jsxs)(`li`,{className:[`pretext-plus-editor__toc-item`,`pretext-plus-editor__toc-item--${e.type}`,r?`pretext-plus-editor__toc-item--active`:``,g?`pretext-plus-editor__toc-item--editing`:``].filter(Boolean).join(` `),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-item-row`,style:n>0?{paddingLeft:`${n*14}px`}:void 0,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-expand-btn`,onClick:o,"aria-label":a?`Collapse`:`Expand`,tabIndex:i?0:-1,style:{visibility:i?`visible`:`hidden`},children:a?`▾`:`▸`}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-select`,onClick:c,"aria-current":r?`true`:void 0,title:P5[e.type]??e.type,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-title`,children:e.title||_||(0,t.jsx)(`em`,{children:`Untitled`})}),e.xmlId&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-xmlid`,children:e.xmlId})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:(0,t.jsx)(V5,{items:f})})]}),g&&s&&(0,t.jsx)(B5,{draft:s,isNew:p,isRoot:m,parentType:h,onDraftChange:l,onCommit:u,onCancel:d})]})},U5=({onOpenAssetPicker:e})=>{let r=c6(e=>e.divisions),i=c6(e=>e.rootDivisionId),a=c6(e=>e.activeDivisionId),o=c6(e=>e.projectAssets)??[],s=c6(e=>e.selectSection),c=c6(e=>e.addSection),l=c6(e=>e.removeSection),u=c6(e=>e.divisionContentChange),d=c6(e=>e.insertAtCursor),f=c6(e=>e.openAssetEditor),p=c6(e=>e.openAssetResolver),m=c6(e=>e.removeAsset),h=c6(e=>e.removeAssetRefFromDocument),g=c6(e=>e.duplicateAsset),_=c6(e=>e.hasAssetDuplicate),v=c6(e=>e.startSectionEdit),y=c6(e=>e.setEditDraft),b=c6(e=>e.commitSectionEdit),x=c6(e=>e.cancelSectionEdit),S=c6(e=>e.editingId),C=c6(e=>e.editDraft),w=c6(e=>e.editingIsNew),T=r?r.find(e=>e.xmlId===i)??r.find(e=>e.type===`book`||e.type===`article`||e.type===`slideshow`)??r[0]??null:null,E=T&&r?s5(r,T.xmlId):[],D=T&&r?c5(r,T.xmlId):[],O=x5(r,o),k=w5.map(e=>({kind:e,rows:O.filter(t=>t.kind===e)})).filter(e=>e.rows.length>0),[A,ee]=(0,n.useState)(!1),[te,j]=(0,n.useState)(null),M=async e=>{if(!(!e.asset||te)){j(e.ref);try{await g(e.asset)}finally{j(null)}}},[ne,N]=(0,n.useState)(new Set),re=e=>!ne.has(e),ie=e=>{N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[ae,oe]=(0,n.useState)(a);if(a!==ae&&(oe(a),a&&T)){let e=new Map(E.map(e=>[e.division.xmlId,e])),t=new Set;t.add(T.xmlId);let n=a;for(;n;){let r=e.get(n);if(!r?.parentXmlId)break;t.add(r.parentXmlId),n=r.parentXmlId}N(e=>{if([...t].every(t=>!e.has(t)))return e;let n=new Set(e);return t.forEach(e=>n.delete(e)),n})}let se=new Set(E.map(e=>e.parentXmlId).filter(Boolean)),P=[];if(T){let e=new Set;re(T.xmlId)&&e.add(T.xmlId);for(let t of E)t.parentXmlId&&e.has(t.parentXmlId)&&(P.push(t),re(t.division.xmlId)&&e.add(t.division.xmlId))}let ce=(e,t)=>{if(!r)return;let n=r.find(e=>e.xmlId===t);n&&u(n.xmlId,e5(n.content,e))},le=(e,t)=>{if(window.confirm(`Delete "${e.title||`Untitled`}"? This permanently removes the division.`)){if(t&&r){let n=r.find(e=>e.xmlId===t);n&&u(n.xmlId,e5(n.content,e.xmlId))}l(e.xmlId)}},ue=r?.find(e=>e.xmlId===a)?.sourceFormat??`pretext`,de=e=>{d(ue===`markdown`?`::${e.type}{ref="${e.xmlId}"}`:ue===`latex`?`\\plus{${e.type}}{${e.xmlId}}`:`<plus:${e.type} ref="${e.xmlId}"/>`)},F=e=>{T&&u(T.xmlId,$8(T.content,e.xmlId,e.type,null,T.sourceFormat))},fe=e=>e&&r?.find(t=>t.xmlId===e)?.type||null,pe=e=>e.status===`unlinked`?p(e.kind,e.ref):f(e.kind,e.ref),me=(e,t)=>{navigator.clipboard.writeText(X8(e,t,ue)).catch(()=>{})},he=e=>{let t=[{label:e.status===`unlinked`?`Link / create asset`:`Edit asset`,onClick:()=>pe(e)},{label:`Copy embed code`,onClick:()=>me(e.kind,e.ref)}];return _&&e.asset&&t.push({label:`Duplicate asset`,onClick:()=>M(e)}),e.status===`unlinked`?t.push({label:`Remove from document`,onClick:()=>h(e.kind,e.ref),danger:!0}):e.asset&&t.push({label:`Remove from project`,onClick:()=>{e.inDocument&&!window.confirm(`Remove "${e.asset.name}" from the project? This also deletes its ${e.inDocument?`reference(s)`:`reference`} from the document.`)||(m(e.asset),h(e.kind,e.ref))},danger:!0}),t};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`ul`,{className:`pretext-plus-editor__toc-list`,role:`list`,children:[T&&(0,t.jsx)(H5,{division:T,depth:0,isActive:a===T.xmlId,hasChildren:se.has(T.xmlId),isExpanded:re(T.xmlId),onToggleExpand:()=>ie(T.xmlId),editDraft:S===T.xmlId?C:null,onSelect:()=>s(T.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(T)},...R8(T.sourceFormat)?[{label:`Add new division`,onClick:()=>c(T.xmlId)}]:[]],isNew:S===T.xmlId&&w,isRoot:!0}),P.length===0&&T&&re(T.xmlId)&&(0,t.jsx)(`li`,{className:`pretext-plus-editor__toc-no-sections`,children:(0,t.jsx)(`span`,{children:`No placed divisions`})}),P.map(e=>(0,t.jsx)(H5,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:se.has(e.division.xmlId),isExpanded:re(e.division.xmlId),onToggleExpand:()=>ie(e.division.xmlId),editDraft:S===e.division.xmlId?C:null,onSelect:()=>s(e.division.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e.division)},...R8(e.division.sourceFormat)?[{label:`Add new division`,onClick:()=>c(e.division.xmlId)}]:[],{label:`Remove from document`,onClick:()=>ce(e.division.xmlId,e.parentXmlId)},{label:`Delete from project`,onClick:()=>le(e.division,e.parentXmlId),danger:!0}],isNew:S===e.division.xmlId&&w,parentType:fe(e.parentXmlId)},e.division.xmlId))]}),D.length>0&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-orphans`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-orphans-heading`,children:`Unplaced divisions`}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-list`,children:D.map(e=>{let i=r?s5(r,e.xmlId):[],o=new Set(i.map(e=>e.parentXmlId).filter(Boolean));return(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)(H5,{division:e,depth:0,isActive:a===e.xmlId,hasChildren:o.has(e.xmlId),isExpanded:re(e.xmlId),onToggleExpand:()=>ie(e.xmlId),editDraft:S===e.xmlId?C:null,onSelect:()=>s(e.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e)},{label:`Place in document`,onClick:()=>F(e)},{label:`Insert at cursor`,onClick:()=>de(e)},{label:`Delete from project`,onClick:()=>le(e,null),danger:!0}],parentType:null}),re(e.xmlId)&&i.map(e=>(0,t.jsx)(H5,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:o.has(e.division.xmlId),isExpanded:re(e.division.xmlId),onToggleExpand:()=>ie(e.division.xmlId),editDraft:S===e.division.xmlId?C:null,onSelect:()=>s(e.division.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e.division)},{label:`Insert at cursor`,onClick:()=>de(e.division)},{label:`Delete from project`,onClick:()=>le(e.division,e.parentXmlId),danger:!0}],parentType:fe(e.parentXmlId)},e.division.xmlId))]},e.xmlId)})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-assets`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-header`,children:(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-toggle`,onClick:()=>ee(e=>!e),"aria-expanded":A,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-chevron`,children:A?`▾`:`▸`}),(0,t.jsx)(`span`,{children:`Assets`}),O.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-count`,children:O.length})]})}),A&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-body`,children:O.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__toc-assets-empty`,children:[`No assets in this project yet.`,` `,e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-add-link`,onClick:e,children:`Add one`})]}):(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-groups`,children:k.map(({kind:e,rows:n})=>(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-group-header`,children:C5[e]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-assets-list`,children:n.map(e=>(0,t.jsxs)(`li`,{className:[`pretext-plus-editor__toc-asset-item`,e.status===`unlinked`?`pretext-plus-editor__toc-asset-item--unlinked`:``,e.status===`unused`?`pretext-plus-editor__toc-asset-item--unused`:``,te===e.ref?`pretext-plus-editor__toc-asset-item--busy`:``].filter(Boolean).join(` `),children:[e.asset?.url?(0,t.jsx)(`img`,{src:e.asset.url,className:`pretext-plus-editor__toc-asset-img`,onClick:()=>pe(e)}):(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-img pretext-plus-editor__toc-asset-img--placeholder`,onClick:()=>pe(e),title:e.status===`unlinked`?`No asset — click to link`:void 0,"aria-hidden":`true`,children:e.status===`unlinked`?`⚠`:`🖼`}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-asset-name`,onClick:()=>pe(e),title:e.status===`unlinked`?`No asset for this reference — click to link or create one`:`Edit asset`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-label`,children:e.asset?.name??e.ref}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-filename`,children:e.status===`unlinked`?`${e.ref} — needs asset`:e.status===`unused`?`${e.ref} — not placed`:e.ref})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:te===e.ref?(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-spinner`,role:`status`,"aria-label":`Duplicating asset`,title:`Duplicating…`}):(0,t.jsx)(V5,{items:he(e)})})]},e.ref))})]},e))})})]}),e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-btn`,onClick:e,children:`Manage Assets`})]})},W5=({isCollapsed:e,onToggleCollapse:n,onOpenAssetPicker:r})=>e?(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc pretext-plus-editor__toc--collapsed`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-toggle`,onClick:n,"aria-label":`Expand table of contents`,title:`Expand table of contents`,children:`☰`})}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-header`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-heading`,children:`Contents`}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-header-actions`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-toggle`,onClick:n,"aria-label":`Collapse table of contents`,title:`Collapse table of contents`,children:`✕`})})]}),(0,t.jsx)(U5,{onOpenAssetPicker:r})]}),G5=class extends n.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t),console.error(`ErrorBoundary caught an error:`,e,t)}componentDidUpdate(e){if(this.state.error===null)return;let{resetKeys:t}=this.props,n=e.resetKeys;t&&n&&(t.length!==n.length||t.some((e,t)=>!Object.is(e,n[t])))&&this.reset()}reset=()=>{this.setState({error:null})};render(){let{error:e}=this.state;return e===null?this.props.children:this.props.fallback?this.props.fallback(e,this.reset):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__error-boundary`,role:`alert`,children:[(0,t.jsx)(`strong`,{children:`Something went wrong rendering this view.`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__error-boundary-detail`,children:e.message}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__error-boundary-retry`,onClick:this.reset,children:`Try again`})]})}},K5=(e,t)=>e.kind===t.kind&&e.ref===t.ref;function q5(e){let t=()=>{},n={cbs:{selectDivision:t,addDivision:t,removeDivision:t,updateDivision:t,divisionContentChange:t,handleDivisionContentChange:t,assetInsert:t,updateTitle:t}};return{store:i6()((t,r)=>({source:e.source,sourceFormat:e.sourceFormat,projectAssets:e.projectAssets,libraryAssets:void 0,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,projectType:e.projectType,projectUrl:void 0,divisions:e.divisions,rootDivisionId:void 0,activeDivisionId:e.activeDivisionId,canConvertToPretext:!0,activeEditorSource:e.source,hasFeedback:!1,hasAssetDuplicate:!1,isTocCollapsed:!1,showFullPreview:!0,isNarrowScreen:typeof window<`u`?window.innerWidth<800:!1,activeTab:`editor`,isLatexDialogOpen:!1,isConvertDialogOpen:!1,isDocinfoEditorOpen:!1,isAssetPickerOpen:!1,isFullSourceOpen:!1,editingId:null,editDraft:null,editingIsNew:!1,editingAssetRef:null,assetResolveTarget:null,syncState:e=>t(e),applyExternalUpdate:e=>t(e),setDivisionContent:(e,n)=>t(t=>{if(!t.divisions)return{};let r=!1,i=t.divisions.map(t=>t.xmlId===e&&t.content!==n?(r=!0,{...t,content:n}):t);return r?{divisions:i}:{}}),patchDivision:(e,n)=>t(t=>t.divisions?{divisions:t.divisions.map(t=>t.xmlId===e?{...t,...n.id!==void 0&&{id:n.id},...n.title!==void 0&&{title:n.title},...n.type!==void 0&&{type:n.type},...n.xmlId!=null&&{xmlId:n.xmlId},...n.sourceFormat!==void 0&&{sourceFormat:n.sourceFormat}}:t)}:{}),addDivisionToPool:e=>t(t=>{let n=t.divisions??[];return n.some(t=>t.xmlId===e.xmlId)?{}:{divisions:[...n,e]}}),removeDivisionFromPool:e=>t(t=>({divisions:(t.divisions??[]).filter(t=>t.xmlId!==e)})),setActiveDivisionId:e=>t({activeDivisionId:e}),setTitle:e=>t({title:e}),setDocinfo:({docinfo:e,commonDocinfo:n,useCommonDocinfo:r})=>t({docinfo:e,commonDocinfo:n,useCommonDocinfo:r}),setShowFullPreview:e=>t({showFullPreview:e}),setActiveTab:e=>t({activeTab:e}),setIsNarrowScreen:e=>t({isNarrowScreen:e}),setIsTocCollapsed:e=>t(t=>({isTocCollapsed:typeof e==`function`?e(t.isTocCollapsed):e})),openModal:e=>t({[e]:!0}),closeModal:e=>t({[e]:!1}),selectSection:e=>n.cbs.selectDivision(e),addSection:e=>n.cbs.addDivision(e),removeSection:e=>n.cbs.removeDivision(e),updateSection:(e,t)=>n.cbs.updateDivision(e,t),divisionContentChange:(e,t)=>n.cbs.divisionContentChange?.(e,t),startSectionEdit:(e,n)=>{let{xmlId:r,label:i}=e.sourceFormat===`markdown`?F8(e.content)??{xmlId:e.xmlId,label:``}:e.sourceFormat===`latex`?{xmlId:v8(e.content)||e.xmlId,label:``}:T8(e.content);t({editingId:e.xmlId,editDraft:{title:e.title,type:e.type,xmlId:r,label:i,sourceFormat:e.sourceFormat},editingIsNew:n?.isNew??!1})},setEditDraft:e=>t({editDraft:e}),commitSectionEdit:()=>{let{editingId:e,editDraft:i,divisions:a}=r();if(e&&i){let t=(a??[]).find(t=>t.xmlId===e),r=null;if(t){let t=E8(i.xmlId);if(!t){window.alert(`xml:id can't be empty — it identifies the division and is used by references to it.`);return}if((a??[]).some(n=>n.xmlId!==e&&n.xmlId===t)){window.alert(`xml:id "${t}" is already used by another division. Choose a unique id.`);return}r=t}n.cbs.updateDivision(e,{title:i.title.trim()||void 0,type:i.type,xmlId:r,label:i.label.trim()||null,sourceFormat:i.sourceFormat})}t({editingId:null,editDraft:null,editingIsNew:!1})},cancelSectionEdit:()=>t({editingId:null,editDraft:null,editingIsNew:!1}),insertAsset:e=>n.cbs.assetInsert(e),insertAtCursor:e=>n.cbs.insertContentAtCursor?.(e),openAssetEditor:(e,n)=>t({editingAssetRef:{kind:e,ref:n}}),closeAssetEditor:()=>t({editingAssetRef:null}),openAssetResolver:(e,n)=>t({assetResolveTarget:{kind:e,ref:n}}),closeAssetResolver:()=>t({assetResolveTarget:null}),removeAsset:e=>n.cbs.assetRemove?.(e),removeAssetRefFromDocument:(e,t)=>n.cbs.assetRefRemove?.(e,t),duplicateAsset:async e=>{await n.cbs.assetDuplicate?.(e)},setProjectAssets:e=>t({projectAssets:e}),addAssetToPool:e=>t(t=>{let n=t.projectAssets??[];return n.some(t=>K5(t,e))?{}:{projectAssets:[...n,e]}}),updateAssetInPool:e=>t(t=>{let n=t.projectAssets??[];return n.some(t=>K5(t,e))?{projectAssets:n.map(t=>K5(t,e)?e:t)}:{projectAssets:[...n,e]}}),renameAssetInPool:(e,n,r)=>t(t=>({projectAssets:[...(t.projectAssets??[]).filter(t=>!(t.kind===e&&t.ref===n)&&!K5(t,r)),r]})),removeAssetFromPool:e=>t(t=>({projectAssets:(t.projectAssets??[]).filter(t=>!K5(t,e))})),updateTitle:e=>n.cbs.updateTitle(e),feedbackSubmit:e=>n.cbs.feedbackSubmit?.(e)})),bindCallbacks:e=>{n.cbs=e}}}function J5({store:e,children:n}){return(0,t.jsx)(s6.Provider,{value:e,children:n})}var Y5=(e,t)=>e.find(e=>t?e.xmlId===t:e.type===`book`||e.type===`article`||e.type===`slideshow`)??e[0]??null,X5=e=>{let[r]=(0,n.useState)(()=>{let t=Y5(e.divisions,e.rootDivisionId),n=b5(e.divisions,t?.xmlId,e.projectType,e.title),r=n.find(e=>e.xmlId===t?.xmlId)??t,i=e.activeDivisionId??r?.xmlId??null,a=n.find(e=>e.xmlId===i)??r;return q5({source:a?.content??``,sourceFormat:a?.sourceFormat??`pretext`,title:e.title||r?.title||`Document Title`,docinfo:e.docinfo??``,commonDocinfo:e.commonDocinfo??``,useCommonDocinfo:e.useCommonDocinfo??!1,projectType:e.projectType,divisions:n,activeDivisionId:i,projectAssets:e.projectAssets})});return(0,t.jsx)(J5,{store:r.store,children:(0,t.jsx)(Z5,{...e,bindCallbacks:r.bindCallbacks})})},Z5=e=>{let{bindCallbacks:r}=e,i=c6(e=>e.showFullPreview),a=c6(e=>e.isNarrowScreen),o=c6(e=>e.setIsNarrowScreen),s=c6(e=>e.activeTab),c=c6(e=>e.setActiveTab),l=c6(e=>e.isTocCollapsed),u=c6(e=>e.setIsTocCollapsed),d=c6(e=>e.isLatexDialogOpen),f=c6(e=>e.isConvertDialogOpen),p=c6(e=>e.isDocinfoEditorOpen),m=c6(e=>e.isAssetPickerOpen),h=c6(e=>e.isFullSourceOpen),g=c6(e=>e.editingAssetRef),_=c6(e=>e.openAssetEditor),v=c6(e=>e.closeAssetEditor),y=c6(e=>e.assetResolveTarget),b=c6(e=>e.closeAssetResolver),[x,S]=(0,n.useState)(null),C=c6(e=>e.openModal),w=c6(e=>e.closeModal),T=c6(e=>e.syncState),E=c6(e=>e.projectAssets),D=c6(e=>e.addAssetToPool),O=c6(e=>e.updateAssetInPool),k=c6(e=>e.renameAssetInPool),A=c6(e=>e.removeAssetFromPool),ee=g?E?.find(e=>e.kind===g.kind&&e.ref===g.ref):void 0,te=c6(e=>e.divisions),j=(0,n.useMemo)(()=>te??[],[te]),M=c6(e=>e.activeDivisionId),ne=c6(e=>e.title),N=c6(e=>e.docinfo),re=c6(e=>e.commonDocinfo),ie=c6(e=>e.useCommonDocinfo),ae=c6(e=>e.applyExternalUpdate),oe=c6(e=>e.setDivisionContent),se=c6(e=>e.patchDivision),P=c6(e=>e.addDivisionToPool),ce=c6(e=>e.removeDivisionFromPool),le=c6(e=>e.setActiveDivisionId),ue=c6(e=>e.startSectionEdit),de=c6(e=>e.setTitle),F=c6(e=>e.setDocinfo),fe=c6(e=>e.editingId),pe=c6(e=>e.editingIsNew),me=(0,n.useRef)(null),he=(0,n.useRef)(null),ge=(0,n.useRef)(!1);(0,n.useEffect)(()=>{fe&&pe?ge.current=!0:ge.current&&(ge.current=!1,he.current?.focus())},[fe,pe]);let I=Y5(j,e.rootDivisionId),_e=j.find(e=>e.xmlId===M)??j[0]??null,ve=_e?.sourceFormat??`pretext`,ye=_e?.content??``,be=(t,n,r,i)=>{oe(t,n),e.onContentChange({xmlId:t,sourceContent:n,sourceFormat:r,pretextSource:r===`pretext`?n:void 0,...i})},xe=(t,n)=>{se(t,n),e.onDivisionUpdate?.(t,n)},Se=(e,t)=>{let n=j.find(t=>t.xmlId===e);if(!n){xe(e,t);return}let r;if(t.sourceFormat!==void 0&&t.sourceFormat!==n.sourceFormat){let e=t.type??n.type,i=t.title??n.title,a=t.xmlId||n.xmlId;r={...n,sourceFormat:t.sourceFormat,type:e,title:i,xmlId:a,content:Q8(e,t.sourceFormat,i,a)}}else r=n.sourceFormat===`markdown`?I8(n,t):n.sourceFormat===`latex`?y8(n,t):k8(n,t);let i=r.xmlId;if(r.content!==n.content&&be(n.xmlId,r.content,r.sourceFormat),xe(e,{...t,xmlId:i}),i!==n.xmlId||r.type!==n.type){let e=r5(j,n.xmlId);if(e){let t=n5(e.content,n.xmlId,i,r.type);t!==e.content&&be(e.xmlId,t,e.sourceFormat)}}i!==n.xmlId&&we(i)},Ce=t=>{P(t),(e.onDivisionAdd?.(t))?.then(e=>se(t.xmlId,{id:e})).catch(()=>{})},L=t=>{ce(t),e.onDivisionRemove?.(t)},we=t=>{le(t),e.onDivisionSelect?.(t)},Te=(0,n.useMemo)(()=>{if(!_e||ve===`pretext`)return;if(ve===`latex`)return b8(_e)??void 0;let e=e6(ye,ve);return e.pretextError?void 0:e.pretextSource},[_e,ve,ye]),Ee=e=>{if(!_e)return;let t=e||``;if(ve===`pretext`){let e=O8(t);e&&e.xmlId!==_e.xmlId&&(t=k8({..._e,content:t,title:e.title,type:e.type},{xmlId:_e.xmlId,label:e.label||null}).content)}else if(ve===`markdown`){let e=F8(t);e&&e.xmlId!==_e.xmlId&&(t=I8({..._e,content:t},{xmlId:_e.xmlId}).content)}if(t===_e.content)return;if(be(_e.xmlId,t,ve),ve===`pretext`){let e=O8(t);if(e&&(xe(_e.xmlId,{title:e.title,type:e.type,label:e.label||null}),e.type!==_e.type)){let t=r5(j,_e.xmlId);if(t){let n=n5(t.content,_e.xmlId,_e.xmlId,e.type);n!==t.content&&be(t.xmlId,n,t.sourceFormat)}}}else if(ve===`markdown`){let e=F8(t);if(e&&(xe(_e.xmlId,{title:e.title,type:e.type,label:e.label||null}),e.type!==_e.type)){let t=r5(j,_e.xmlId);if(t){let n=n5(t.content,_e.xmlId,_e.xmlId,e.type);n!==t.content&&be(t.xmlId,n,t.sourceFormat)}}}else if(ve===`latex`){let e=_8(t);e!==null&&xe(_e.xmlId,{title:e})}let n=new Set(j.map(e=>e.xmlId));for(let{xmlId:e,type:r}of K8(t))n.has(e)||(Ce(Z8(e,r,ve)),n.add(e))},R=e=>{we(e)},De=()=>{_e&&(u(!1),ue(_e))},Oe=e=>{let t=o8();if(Ce(t),e){let n=j.find(t=>t.xmlId===e);n&&be(n.xmlId,$8(n.content,t.xmlId,t.type,null,n.sourceFormat),n.sourceFormat)}le(t.xmlId),ue(t,{isNew:!0})},ke=e=>{D(e)},z=t=>{A(t),e.onAssetRemove?.(t)},Ae=!!(e.onAssetUpload&&e.onAssetFetchUrl&&e.onAssetUpdate),je=!!(e.onAssetRemove&&(e.onAssetUpload||e.onAssetAddFromLibrary)),Me=async t=>{if(!e.onAssetUpload||!e.onAssetFetchUrl||!t.ref||!t.url)return;let n=new Set(x5(j,E).map(e=>e.ref)),r=S5(t.ref,n),i=await e.onAssetFetchUrl(t.url),a=/\.[^./\\]+$/.exec(i.name)?.[0]??``,o=new File([i],`${r}${a}`,{type:i.type}),s={...await e.onAssetUpload(o),ref:r,name:`${t.name} (copy)`,source:t.source};await e.onAssetUpdate?.(s),D(s),_(s.kind,r)},Ne=async(t,n,r)=>{if(r)n.ref&&t.ref&&Pe(t.kind,t.ref,n.ref),D(n);else{let r={...n,ref:t.ref,name:t.name,source:t.source};await e.onAssetUpdate?.(r),O(r)}e.onAssetRemove?.(t),A(t)},Pe=(e,t,n)=>{if(t!==n)for(let r of j){let i=J8(r.content,e,t,n);i!==r.content&&be(r.xmlId,i,r.sourceFormat)}},Fe=(e,t)=>{for(let n of j){let r=Y8(n.content,e,t);r!==n.content&&be(n.xmlId,r,n.sourceFormat)}};(0,n.useEffect)(()=>{let e=()=>o(window.innerWidth<800);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let Ie=ve!==`pretext`;(0,n.useLayoutEffect)(()=>{r({selectDivision:R,addDivision:e=>Oe(e),removeDivision:e=>L(e),updateDivision:(e,t)=>Se(e,t),divisionContentChange:(e,t)=>{be(e,t,j.find(t=>t.xmlId===e)?.sourceFormat??`pretext`)},handleDivisionContentChange:Ee,assetInsert:ke,assetRemove:z,assetRefRemove:Fe,assetDuplicate:Ae?Me:void 0,insertContentAtCursor:e=>he.current?.insertAtCursor(e),updateTitle:t=>{de(t),e.onTitleChange?.(t)},feedbackSubmit:e.onFeedbackSubmit})}),(0,n.useEffect)(()=>{T({source:ye,sourceFormat:ve,libraryAssets:e.libraryAssets,projectType:e.projectType,projectUrl:e.projectUrl,rootDivisionId:I?.xmlId,canConvertToPretext:Te!==void 0,activeEditorSource:ye,hasFeedback:e.onFeedbackSubmit!==void 0,hasAssetDuplicate:Ae})});let Le=(0,n.useRef)({divisions:e.divisions,projectAssets:e.projectAssets,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId});(0,n.useEffect)(()=>{let t=Le.current,n={},r=!1;if(e.projectAssets!==void 0&&e.projectAssets!==t.projectAssets&&(n.projectAssets=e.projectAssets,r=!0),e.divisions!==t.divisions){let t=Y5(e.divisions,e.rootDivisionId),i=b5(e.divisions,t?.xmlId,e.projectType,e.title);n.divisions=i;let a=i.find(e=>e.xmlId===t?.xmlId)??t;(M==null||!e.divisions.some(e=>e.xmlId===M))&&(n.activeDivisionId=a?.xmlId??null),!e.title&&a?.title&&(n.title=a.title),r=!0}e.title!==void 0&&e.title!==t.title&&(n.title=e.title,r=!0),e.docinfo!==void 0&&e.docinfo!==t.docinfo&&(n.docinfo=e.docinfo,r=!0),e.commonDocinfo!==void 0&&e.commonDocinfo!==t.commonDocinfo&&(n.commonDocinfo=e.commonDocinfo,r=!0),e.useCommonDocinfo!==void 0&&e.useCommonDocinfo!==t.useCommonDocinfo&&(n.useCommonDocinfo=e.useCommonDocinfo,r=!0),e.activeDivisionId!==void 0&&e.activeDivisionId!==t.activeDivisionId&&(n.activeDivisionId=e.activeDivisionId,r=!0),r&&ae(n),Le.current={divisions:e.divisions,projectAssets:e.projectAssets,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId}});let Re=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(Re.current===e.divisions)return;Re.current=e.divisions;let t=Y5(e.divisions,e.rootDivisionId),n=b5(e.divisions,t?.xmlId,e.projectType,e.title);for(let t of n){if(t.sourceFormat!==`pretext`)continue;let n=e.divisions.find(e=>e.xmlId===t.xmlId);!n||t.content===n.content||e.onContentChange({xmlId:t.xmlId,sourceContent:t.content,sourceFormat:`pretext`,pretextSource:t.content})}});let ze=ie?re:N,Be=(0,n.useMemo)(()=>{if(!h||!I)return``;try{return g5(j,I.xmlId,ze,E??[])}catch(e){return`<!-- Unable to assemble document source: ${e instanceof Error?e.message:String(e)} -->`}},[h,I,j,ze,E]),Ve=_e?ve===`pretext`?m5(j,_e.xmlId,E):Te:void 0,He=_e&&Ve!==void 0?v5(_e.type,Ve,ze,_e.title):void 0,Ue=()=>me.current?.rebuild(),B=()=>{e.onSave?.(),me.current?.rebuild()},We=t=>{let n=t.ctrlKey||t.metaKey;n&&t.key===`Enter`&&e.onPreviewRebuild?(t.preventDefault(),Ue()):n&&t.key===`s`&&(t.preventDefault(),B())},Ge=()=>{if(!_e||!Te)return;let e=o8(),t={id:e.xmlId,xmlId:_e.xmlId,title:_e.title,type:_e.type,sourceFormat:ve,content:_e.content};Ce(ve===`markdown`?I8(t,{xmlId:e.xmlId}):y8(t,{xmlId:e.xmlId})),be(_e.xmlId,Te,`pretext`),xe(_e.xmlId,{sourceFormat:`pretext`})},Ke=(0,t.jsx)(Ws,{ref:he,content:ye,sourceFormat:ve,onChange:Ee,onRebuild:e.onPreviewRebuild?Ue:void 0,onSave:B,onOpenLatexImport:()=>C(`isLatexDialogOpen`),onOpenDocinfoEditor:()=>C(`isDocinfoEditorOpen`),onOpenConvertToPretext:Ie&&Te!==void 0?()=>C(`isConvertDialogOpen`):void 0,canConvertToPretext:Te!==void 0,onOpenAssets:e.projectAssets!==void 0&&ve===`pretext`?()=>C(`isAssetPickerOpen`):void 0,onShowFullSource:()=>C(`isFullSourceOpen`),onRequestWrapperEdit:De}),V;V=i&&e.onPreviewRebuild?(0,t.jsx)(lR,{ref:me,content:He||``,title:ne,onRebuild:e.onPreviewRebuild}):(0,t.jsx)(oR,{content:ye,canEdit:ve===`pretext`,editDisabledReason:ve===`markdown`?`Visual editing is not available for Markdown documents.`:ve===`latex`?`Visual editing is not available for LaTeX documents.`:``,onChange:e=>Ee(e)});let qe=(0,t.jsx)(W5,{isCollapsed:l,onToggleCollapse:()=>u(e=>!e),onOpenAssetPicker:e.projectAssets===void 0?void 0:()=>C(`isAssetPickerOpen`)}),Je=`pretext-plus-tab-editor`,Ye=`pretext-plus-tab-preview`,Xe=`pretext-plus-tabpanel`,Ze;return Ze=a?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs`,children:[qe,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs-main`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tab-list`,role:`tablist`,children:[(0,t.jsx)(`button`,{type:`button`,id:Je,role:`tab`,"aria-controls":Xe,"aria-selected":s===`editor`,tabIndex:s===`editor`?0:-1,className:`pretext-plus-editor__tab-button ${s===`editor`?`is-active`:``}`,onClick:()=>c(`editor`),children:`Editor`}),(0,t.jsx)(`button`,{type:`button`,id:Ye,role:`tab`,"aria-controls":Xe,"aria-selected":s===`preview`,tabIndex:s===`preview`?0:-1,className:`pretext-plus-editor__tab-button ${s===`preview`?`is-active`:``}`,onClick:()=>c(`preview`),children:`Preview`})]}),(0,t.jsx)(`div`,{id:Xe,className:`pretext-plus-editor__tab-panel`,role:`tabpanel`,"aria-labelledby":s===`editor`?Je:Ye,children:(0,t.jsx)(`div`,{style:{height:`100%`},children:s===`editor`?Ke:V})})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__sectioned-layout`,children:[qe,(0,t.jsxs)(gt,{orientation:`horizontal`,className:`pretext-plus-editor__splitter`,children:[(0,t.jsx)(yt,{className:`pretext-plus-editor__editor-panel`,children:Ke}),(0,t.jsx)(St,{className:`pretext-plus-editor__resize-handle`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__resize-dots`})}),(0,t.jsx)(yt,{className:`pretext-plus-editor__preview-panel`,children:V})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor`,onKeyDown:We,children:[(0,t.jsx)(j5,{onSaveButton:e.onSaveButton,saveButtonLabel:e.saveButtonLabel,onCancelButton:e.onCancelButton,cancelButtonLabel:e.cancelButtonLabel,showPreviewModeToggle:e.onPreviewRebuild!==void 0}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__editor-displays`,children:[(0,t.jsx)(G5,{resetKeys:[ye,M],children:Ze}),d?(0,t.jsx)(u6,{onClose:()=>w(`isLatexDialogOpen`)}):null,f&&_e&&Te?(0,t.jsx)(m6,{sourceContent:ye,sourceFormat:ve,pretextSource:Te,onConfirm:Ge,onClose:()=>w(`isConvertDialogOpen`)}):null,p?(0,t.jsx)(E6,{docinfo:N,showCommonDocinfoControls:!0,commonDocinfo:re,initialUseCommonDocinfo:ie,onClose:t=>{if(w(`isDocinfoEditorOpen`),t!==void 0){F({docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo}),e.onCommonDocinfoChange?.(t.commonDocinfo),e.onUseCommonDocinfoChange?.(t.useCommonDocinfo);let n=I??_e;be(n?.xmlId??``,n?.content??``,n?.sourceFormat??`pretext`,{docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo})}}}):null,(m||y||x)&&e.projectAssets!==void 0?(0,t.jsx)(E5,{open:m||!!y||!!x,resolveTarget:y,replaceTarget:x,onClose:()=>{w(`isAssetPickerOpen`),b(),S(null)},onLoadAssets:e.onLoadAssets,onLoadLibraryAssets:e.onLoadLibraryAssets,onAddFromLibrary:e.onAssetAddFromLibrary,onUpload:e.onAssetUpload,onFetchUrl:e.onAssetFetchUrl,onCreateDoenet:e.onCreateDoenet,onRemoveAsset:e.onAssetRemove?z:void 0,onDuplicateAsset:Ae?Me:void 0,onAssetAdded:ke,onResolveRef:Pe,onReplaceAsset:Ne}):null,h?(0,t.jsx)(O6,{source:Be,onClose:()=>w(`isFullSourceOpen`)}):null,ee?(0,t.jsx)(A5,{asset:ee,projectAssets:E??[],onClose:v,onReplace:je?e=>{v(),S(e)}:void 0,onDuplicate:Ae?e=>Me(e):void 0,onSave:async(t,n)=>{t.ref&&t.ref!==n?(Pe(t.kind,n,t.ref),k(t.kind,n,t)):O(t),await e.onAssetUpdate?.(t)}},`${ee.kind}:${ee.ref}`):null]})]})};e.CodeEditor=Ws,e.DocinfoEditor=E6,e.Editors=X5,e.FeedbackLink=n6,e.FullPreview=lR,e.VisualEditor=oR,e.assembleFullProjectSource=g5,e.assembleProjectSource=m5,e.buildDivisionTree=s5,e.convertLatexToPretext=Z3,e.createConclusion=c8,e.createIntroduction=s8,e.createLatexConclusion=C8,e.createLatexIntroduction=S8,e.createNewLatexSection=x8,e.createNewSection=o8,e.derivePretextContent=e6,e.detectSourceFormat=X3,e.ensureLatexSectionWrapper=m8,e.ensureSectionWrapper=d8,e.extractDivisionMetadata=O8,e.extractLatexDivisionTitle=_8,e.findDivisionParent=r5,e.getOrphanRoots=c5,e.getOrphanedDivisions=o5,e.getSectionAttributes=T8,e.insertDivisionRef=$8,e.mergeTwoSections=w8,e.moveDivisionRef=t5,e.parseDivisionRefs=G8,e.postToIframe=cR,e.removeDivisionRef=e5,e.renameDivisionRef=n5,e.reorderDivisionRefs=i5,e.rewrapLatexSection=p8,e.rewrapSection=u8,e.stripLatexSectionWrapper=f8,e.stripSectionWrapper=l8,e.updateDivisionTitle=a8,e.updateLatexSectionTitle=g8,e.updateSectionMetadata=k8,e.wrapDivisionForPreview=v5});
|
|
1092
|
+
`+a.slice(o)}function h5(e,t,n,r){let i=new RegExp(e5(t));return e.replace(i,e=>{let t=e.trimStart();return t.startsWith(`::`)?`::${r}{ref="${n}"}`:t.startsWith(`\\plus`)?`\\plus{${r}}{${n}}`:`<plus:${r} ref="${n}"/>`})}function g5(e,t){let n=new RegExp(e5(t));return e.find(e=>n.test(e.source))??null}function _5(e,t){let n=e,r=null;for(let e of t)n=m5(n,e,r),r=e;return n}function v5(e,t){let n=new Set,r=[t];for(;r.length>0;){let t=r.pop();if(n.has(t))continue;n.add(t);let i=e.find(e=>e.xmlId===t);if(i)for(let e of i5(i.source,i.sourceFormat))r.push(e)}return n}function y5(e,t){let n=v5(e,t);return e.filter(e=>!n.has(e.xmlId))}function b5(e,t){let n=[],r=new Set([t]),i=(t,a)=>{let o=e.find(e=>e.xmlId===t);if(o)for(let s of i5(o.source,o.sourceFormat)){if(r.has(s))continue;let o=e.find(e=>e.xmlId===s);o&&(r.add(s),n.push({division:o,depth:a,parentXmlId:t}),i(s,a+1))}};return i(t,0),n}function x5(e,t){let n=y5(e,t),r=new Set(n.map(e=>e.xmlId)),i=new Set;for(let e of n)for(let t of i5(e.source,e.sourceFormat))r.has(t)&&i.add(t);return n.filter(e=>!i.has(e.xmlId))}var S5=new Set([`book`,`article`,`slideshow`]);function C5(e){try{let t=z6(e),n=t.children.find(e=>e.type===`element`),r=n?.name===`pretext`?n.children.find(e=>e.type===`element`&&S5.has(e.name)):n&&S5.has(n.name)?n:void 0;if(!r)return e;if(!r.attributes.label){let e=T5(t,`pretext-plus-preview`);return r.attributes.label=e,JY(t,a8)}return e}catch(t){return console.error(`Error ensuring label:`,t),e}}function w5(e,t){return e.type===`element`&&e.attributes?.label===t?!0:`children`in e&&e.children?e.children.some(e=>e.type===`element`?w5(e,t):!1):!1}function T5(e,t){let n=t,r=1;for(;w5(e,n);)n=`${t}-${r}`,r++;return n}function E5(e,t,n,r){let i=t.find(t=>t.xmlId===e);if(!i)return`<!-- missing division: ${e} -->`;if(n.has(e))return`<!-- circular reference: ${e} -->`;let a;if(i.sourceFormat===`pretext`)a=i.source;else if(i.sourceFormat===`markdown`){let{pretextSource:e,pretextError:t}=o6(i.source,`markdown`);a=e??`<!-- conversion error: ${t} -->`}else a=k8(i)??`<!-- conversion error: ${i.xmlId} -->`;let o=new Set(n).add(e);return a.replace(/<plus:([a-z-]+)\s([^>]*ref="[^"]+"[^>]*?)(?:\/>|>\s*<\/plus:\1>)/g,(e,n,i)=>{let a=/ref="([^"]+)"/.exec(i)?.[1]??``;if(!r8.has(n))return E5(a,t,o,r);let s=/width="([^"]+)"/.exec(i)?.[1];return i8(n,a,r,s)})}function D5(e,t,n=[]){return C5(E5(t,e,new Set,n))}function O5(e,t){return C5(`<pretext>\n${t.trim()?`${t.trim()}\n`:``}${e}\n</pretext>`)}function k5(e,t,n,r=[]){return O5(E5(t,e,new Set,r),n)}var A5=new Set([`part`,`chapter`]);function j5(e,t,n,r){return O5(S5.has(e)?t:A5.has(e)?`<book>\n<title>${r}</title>\n${t}\n</book>`:`<article>\n<title>${r}</title>\n${t}\n</article>`,n)}function M5(e){let t=e.trim(),n=t.match(/^<title\b[^>]*>([\s\S]*?)<\/title>\s*/);return n?{title:n[1].trim(),body:t.slice(n[0].length)}:{title:``,body:t}}function N5(e,t,n,r){let i=n===`book`?`book`:`article`;return e.map(e=>{if(e.sourceFormat===`markdown`){if(!e.title){let t=G8(e.source)?.title;if(t)return{...e,title:t}}return e}if(e.sourceFormat===`latex`){if(!e.title){let t=E8(e.source);if(t)return{...e,title:t}}return e}if(e.sourceFormat!==`pretext`)return e;let n=L8(e.source);if(e.xmlId===t&&!(n&&S5.has(n.type))){let{title:t,body:n}=M5(e.source),a=e.title||t||r||`Untitled`;return{...e,type:i,title:a,source:`<${i} xml:id="${e.xmlId}">\n<title>${a}</title>\n\n${n}\n</${i}>`}}return!e.title&&n?.title?{...e,title:n.title}:e})}function P5(e,t){let n=t??[],r=(e,t)=>n.find(n=>n.kind===e&&n.ref===t),i=[],a=new Set;for(let t of e??[])for(let{kind:e,ref:n}of o5(t.source,t.sourceFormat)){let t=`${e}:${n}`;if(a.has(t))continue;a.add(t);let o=r(e,n);i.push({kind:e,ref:n,asset:o,inDocument:!0,status:o?`linked`:`unlinked`})}for(let e of n){if(!e.ref)continue;let t=`${e.kind}:${e.ref}`;a.has(t)||(a.add(t),i.push({kind:e.kind,ref:e.ref,asset:e,inDocument:!1,status:`unused`}))}return i}function F5(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let e=2;;e++){let r=`${n}-${e}`;if(!t.has(r))return r}}var I5={image:`Images`,doenet:`Doenet`},L5=[`image`,`doenet`].filter(e=>e!==`doenet`||!1);function R5(e){return`${e}-${Date.now()}`}var z5=({open:e,onClose:r,resolveTarget:i,replaceTarget:a,onLoadAssets:o,onLoadLibraryAssets:s,onAddFromLibrary:c,onUpload:l,onFetchUrl:u,onCreateDoenet:d,onRemoveAsset:f,onDuplicateAsset:p,onAssetAdded:m,onResolveRef:h,onReplaceAsset:g})=>{let _=m6(e=>e.divisions),v=m6(e=>e.activeDivisionId),y=_?.find(e=>e.xmlId===v)?.sourceFormat??`pretext`,b=(e,t)=>l5(e,t,y),x=m6(e=>e.projectAssets)??[],S=m6(e=>e.setProjectAssets),C=m6(e=>e.libraryAssets),w=m6(e=>e.openAssetEditor),T=m6(e=>e.openAssetResolver),E=m6(e=>e.removeAssetRefFromDocument),D=!!(o||s),[O,k]=(0,n.useState)(null),[A,ee]=(0,n.useState)(!1),[te,j]=(0,n.useState)(null),M=x,ne=O??C??M,N=new Set(M.map(e=>e.id)),[re,ie]=(0,n.useState)(`in-document`),[ae,oe]=(0,n.useState)(null),[se,P]=(0,n.useState)(`library`),[ce,le]=(0,n.useState)(`library`),[ue,de]=(0,n.useState)(null),[F,fe]=(0,n.useState)(!1),[pe,me]=(0,n.useState)(!1),[he,ge]=(0,n.useState)(null),I=(0,n.useRef)(null),[_e,ve]=(0,n.useState)(null),[ye,be]=(0,n.useState)(null),[xe,Se]=(0,n.useState)(``),[Ce,L]=(0,n.useState)(``),[we,Te]=(0,n.useState)(``),[Ee,R]=(0,n.useState)(!1),[De,Oe]=(0,n.useState)(null),[ke,z]=(0,n.useState)(``),[Ae,je]=(0,n.useState)(``),[Me,Ne]=(0,n.useState)(!1),[Pe,Fe]=(0,n.useState)(null),[Ie,Le]=(0,n.useState)(null),[Re,ze]=(0,n.useState)(null),[Be,Ve]=(0,n.useState)(null),He=(0,n.useCallback)(()=>{!o&&!s||(ee(!0),j(null),Promise.all([o?.()??Promise.resolve(null),s?.()??Promise.resolve(null)]).then(([e,t])=>{e!==null&&S(e),t!==null&&k(t)}).catch(e=>{j(e instanceof Error?e.message:`Failed to load assets.`)}).finally(()=>ee(!1)))},[o,s,S]),Ue=(0,n.useRef)(He);if((0,n.useEffect)(()=>{Ue.current=He}),(0,n.useEffect)(()=>{e&&Ue.current()},[e]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r]),(0,n.useEffect)(()=>()=>{ye&&URL.revokeObjectURL(ye)},[ye]),!e)return null;let B=P5(_,M),We=(e,t)=>{if(a){g(a,e,!!t?.fromLibrary),r();return}if(m(e),i){e.ref&&h(i.kind,i.ref,e.ref),r();return}e.ref&&navigator.clipboard.writeText(b(e.kind,e.ref)).catch(()=>{}),Ve(e)},Ge=(e,t)=>{let n=`${e}:${t}`;navigator.clipboard.writeText(b(e,t)).catch(()=>{}),Le(n),setTimeout(()=>Le(e=>e===n?null:e),2e3)},Ke=async e=>{if(!N.has(e.id)&&c){de(e.id);try{await c(e)}finally{de(null)}}We(e,{fromLibrary:!0})},V=e=>{ge(null),ve(e),Se(e.name),be(URL.createObjectURL(e))},qe=()=>{ve(null),be(null),Se(``)},Je=async()=>{if(!(!l||!_e)){ge(null),me(!0);try{let e=xe.trim()||_e.name;We(await l(new File([_e],e,{type:_e.type}))),qe()}catch(e){ge(e instanceof Error?e.message:`Upload failed.`)}finally{me(!1)}}},Ye=async()=>{let e=Ce.trim();if(!e)return;let t=we.trim();if(u&&l){Oe(null),R(!0);try{let n=await u(e);We(await l(t?new File([n],t,{type:n.type}):n))}catch(e){Oe(e instanceof Error?e.message:`Failed to add URL.`)}finally{R(!1)}}else We({id:R5(`url`),title:t||e,ref:e.split(`/`).pop()??`image`,kind:`image`,url:e})},Xe=async()=>{let e=ke.trim(),t=Ae.trim();if(!(!e||!t))if(d){Fe(null),Ne(!0);try{We(await d(e,t))}catch(e){Fe(e instanceof Error?e.message:`Failed to create activity.`)}finally{Ne(!1)}}else We({id:R5(`doenet`),title:e,ref:t,kind:`doenet`})},Ze=e=>{let n=ne.filter(t=>t.kind===e);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-library`,children:[D&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-toolbar`,children:[te&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-load-error`,children:te}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__asset-library-refresh`,onClick:He,disabled:A,children:A?`Loading…`:`Refresh`})]}),A&&n.length===0?(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-empty-text`,children:`Loading…`}):n.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__am-empty-text`,children:[`No `,I5[e].toLowerCase(),` assets in your library.`]}):(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:n.map(e=>{let n=N.has(e.id),r=ue===e.id;return(0,t.jsx)(`li`,{children:(0,t.jsxs)(`button`,{type:`button`,className:[`pretext-plus-editor__am-lib-row`,n?`pretext-plus-editor__am-lib-row--in-project`:``].filter(Boolean).join(` `),onClick:()=>Ke(e),disabled:r||!e.ref,title:e.ref?n?`Use "${e.ref}"`:`Add to project & use "${e.ref}"`:`Asset has no reference — cannot use`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-info`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-name`,children:e.title}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:r?`Adding…`:e.ref})]}),n&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-badge`,children:`✓`})]})},e.id)})})]})},Qe=()=>{if(B.length===0)return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-placeholder`,children:[(0,t.jsx)(`p`,{children:`No assets in this project yet.`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{ie(`add`),oe(null)},children:`Add an asset`})]});let e=L5.map(e=>({kind:e,rows:B.filter(t=>t.kind===e)})).filter(e=>e.rows.length>0),n=e=>{let n=`${e.kind}:${e.ref}`,i=Re===n,a=()=>{e.status===`unlinked`?T(e.kind,e.ref):(w(e.kind,e.ref),r())};return(0,t.jsxs)(`li`,{className:`pretext-plus-editor__am-doc-row`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-row-info pretext-plus-editor__am-row-info--btn`,onClick:a,title:e.status===`unlinked`?`No asset for this reference — click to link or create one`:`Edit asset`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-name`,children:e.asset?.title??e.ref}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:e.ref})]}),e.status===`unlinked`&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-status pretext-plus-editor__am-status--warn`,title:`No asset for this reference`,children:`needs asset`}),e.status===`unused`&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-status`,title:`Not referenced in the document yet`,children:`not placed`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:a,children:e.status===`unlinked`?`Link / create`:`Edit`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ie===n?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>Ge(e.kind,e.ref),title:`Copy ${b(e.kind,e.ref)}`,children:Ie===n?`Copied!`:`Copy embed code`}),p&&e.asset?.url&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,disabled:i,onClick:async()=>{ze(n);try{await p(e.asset),r()}catch{ze(null)}},title:`Create a copy of this asset under a new reference`,children:i?`Duplicating…`:`Duplicate`}),f&&e.asset&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn pretext-plus-editor__am-action-btn--danger`,onClick:()=>{e.inDocument&&!window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its reference(s) from the document.`)||(f(e.asset),E(e.kind,e.ref),r())},title:`Remove from project`,children:`Remove`})]})]},n)};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-in-doc`,children:e.map(({kind:e,rows:r})=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-group`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-header`,children:[(0,t.jsx)(`span`,{"aria-hidden":`true`,children:`📁`}),(0,t.jsx)(`span`,{children:I5[e]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-count`,children:r.length})]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:r.map(n)})]},e))})},$e=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-success`,children:[(0,t.jsxs)(`p`,{className:`pretext-plus-editor__am-success-title`,children:[`✓ Added “`,e.title,`” — embed code copied to clipboard`]}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`It now appears in the Assets list. Paste this where you want it to appear:`}),e.ref&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-embed-row`,children:[(0,t.jsx)(`code`,{className:`pretext-plus-editor__am-embed-code`,children:b(e.kind,e.ref)}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ie===`${e.kind}:${e.ref}`?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>Ge(e.kind,e.ref),children:Ie===`${e.kind}:${e.ref}`?`Copied!`:`Copy again`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-success-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:()=>{Ve(null),oe(null),ie(`add`)},children:`Add another`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{Ve(null),ie(`in-document`)},children:`Done`})]})]}),et=()=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-picker`,children:[(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-kind-picker-label`,children:`What kind of asset?`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-cards`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-kind-card`,onClick:()=>{oe(`image`),P(`library`)},children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:`🖼️`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`Image`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`PNG, JPEG, SVG, etc.`})]}),!1,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-kind-card pretext-plus-editor__am-kind-card--soon`,"aria-disabled":`true`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:`✨`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`More coming soon`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`Interactive activities and more`})]})]})]}),tt=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>oe(null),children:`← Back`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`library`),children:`Library`}),l&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`upload`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`upload`),children:`Upload`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${se===`url`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>P(`url`),children:`External URL`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[se===`library`&&Ze(`image`),se===`upload`&&l&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-upload`,children:_e?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-url-form`,children:[(0,t.jsx)(`img`,{src:ye??void 0,alt:`Preview`,className:`pretext-plus-editor__am-url-preview`}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-upload-title`,children:[`Title `,(0,t.jsx)(`span`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`(optional)`})]}),(0,t.jsx)(`input`,{id:`am-upload-title`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:_e.name,value:xe,onChange:e=>Se(e.target.value),disabled:pe,autoFocus:!0}),he&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:he}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:qe,disabled:pe,children:`Choose a different file`})]}):(0,t.jsxs)(`div`,{className:[`pretext-plus-editor__am-drop-zone`,F?`pretext-plus-editor__am-drop-zone--active`:``].filter(Boolean).join(` `),onDragOver:e=>{e.preventDefault(),fe(!0)},onDragLeave:()=>fe(!1),onDrop:e=>{e.preventDefault(),fe(!1);let t=e.dataTransfer.files[0];t&&V(t)},onClick:()=>I.current?.click(),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I.current?.click())},"aria-label":`Upload image — click or drag and drop`,children:[(0,t.jsx)(`input`,{ref:I,type:`file`,accept:`image/*`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&V(t)}}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-drop-icon`,"aria-hidden":`true`,children:`↑`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-drop-text`,children:`Drag & drop an image, or click to browse`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`PNG, JPEG, GIF, SVG, WebP`})]})}),se===`url`&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-url-form`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-url-value`,children:`Image URL`}),(0,t.jsx)(`input`,{id:`am-url-value`,type:`url`,className:`pretext-plus-editor__am-input`,placeholder:`https://example.com/image.png`,value:Ce,onChange:e=>L(e.target.value),disabled:Ee,autoFocus:!0}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-url-title`,children:[`Title `,(0,t.jsx)(`span`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`(optional)`})]}),(0,t.jsx)(`input`,{id:`am-url-title`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`My image`,value:we,onChange:e=>Te(e.target.value),disabled:Ee}),De&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:De}),Ce.trim()&&(0,t.jsx)(`img`,{src:Ce.trim(),alt:`Preview`,className:`pretext-plus-editor__am-url-preview`,onError:e=>{e.currentTarget.style.display=`none`}})]})]})]}),nt=()=>(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:Ye,disabled:!Ce.trim()||Ee,children:Ee?`Adding…`:u&&l?`Add to Project`:`Add`}),rt=()=>(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:Je,disabled:!_e||pe,children:pe?`Uploading…`:`Add to Project`}),it=e=>(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>oe(null),children:`← Back`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar pretext-plus-editor__am-sub-tabs`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${ce===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>le(`library`),children:`Library`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${ce===`create`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>le(`create`),children:`Create New`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[ce===`library`&&Ze(`doenet`),ce===`create`&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-create-form`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-doenet-title`,children:`Title`}),(0,t.jsx)(`input`,{id:`am-doenet-title`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`My Activity`,value:ke,onChange:e=>z(e.target.value),disabled:Me,autoFocus:!0}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-doenet-ref`,children:`Id`}),(0,t.jsx)(`input`,{id:`am-doenet-ref`,type:`text`,className:`pretext-plus-editor__am-input`,placeholder:`my-activity`,value:Ae,onChange:e=>je(e.target.value),disabled:Me}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`The id is used in the embed code: `,(0,t.jsx)(`code`,{children:b(`doenet`,Ae||`my-activity`)})]}),Pe&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:Pe}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:Xe,disabled:!ke.trim()||!Ae.trim()||Me,children:Me?`Creating…`:d?`Create`:`Add`})]})]})]}),at=(e,n,i)=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:n}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:[(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy pretext-plus-editor__am-resolve-hint`,children:i}),e===`doenet`?it(!1):tt(!1)]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:r,children:`Cancel`}),e===`image`&&se===`url`&&nt(),e===`image`&&se===`upload`&&l&&rt()]})]});return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&r(),children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__dialog--asset-manager`,role:`dialog`,"aria-modal":`true`,"aria-label":`Asset manager`,children:i?(e=>at(e.kind,`Link asset`,(0,t.jsxs)(t.Fragment,{children:[`The reference `,(0,t.jsx)(`code`,{children:e.ref}),` has no asset yet. Choose or create one — the reference in your document will be updated to match.`]})))(i):a?(e=>at(e.kind,`Replace asset`,(0,t.jsxs)(t.Fragment,{children:[`Choose or upload a new asset to replace `,(0,t.jsx)(`code`,{children:e.title}),`. Every place it’s used in your document will show the new asset.`]})))(a):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:`Assets`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:r,"aria-label":`Close`,children:`✕`})]}),Be?(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:$e(Be)}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${re===`in-document`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ie(`in-document`),children:[`Assets`,B.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-tab-count`,children:B.length})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${re===`add`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>{ie(`add`),oe(null)},children:`Add Asset`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:re===`in-document`?Qe():ae===null?et():ae===`image`?tt(!0):it(!0)})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:r,children:`Close`}),!Be&&re===`add`&&ae===`image`&&se===`url`&&nt(),!Be&&re===`add`&&ae===`image`&&se===`upload`&&l&&rt()]})]})})})},B5={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10},scrollBeyondLastLine:!1},V5=160,H5={image:`image`,doenet:`interactive`},U5=({asset:e,projectAssets:r,onClose:i,onSave:a,onReplace:o,onDuplicate:s})=>{let c=m6(e=>e.divisions),l=m6(e=>e.activeDivisionId),u=c?.find(e=>e.xmlId===l)?.sourceFormat??`pretext`,d=e.ref??``,[f,p]=(0,n.useState)(e.title),[m,h]=(0,n.useState)(d),[g,_]=(0,n.useState)(e.source??``),[v,y]=(0,n.useState)(!1),[b,x]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),[w,T]=(0,n.useState)(!1),[E,D]=(0,n.useState)(V5),O=(0,n.useRef)(null);(0,n.useEffect)(()=>{O.current?.scrollTo({top:0})},[]);let k=e=>{let t=()=>D(Math.max(V5,e.getContentHeight()));e.onDidContentSizeChange(t),t()},A=l5(e.kind,m.trim()||d,u),ee=()=>{navigator.clipboard.writeText(A).catch(()=>{}),T(!0),setTimeout(()=>T(!1),2e3)},te=async()=>{let t=m.trim();if(!t){C(`Reference can't be empty — it identifies the asset and is used by every embed of it.`);return}if(t!==d&&r.some(n=>n.kind===e.kind&&n.ref===t)){C(`Reference "${t}" is already used by another asset. Choose a unique reference.`);return}C(null),y(!0);try{await a({...e,title:f.trim()||t,ref:t,source:g},d),i()}catch(e){C(e instanceof Error?e.message:`Failed to save asset.`),y(!1)}},j=async()=>{if(s){C(null),x(!0);try{await s(e)}catch(e){C(e instanceof Error?e.message:`Failed to duplicate asset.`),x(!1)}}},M=v||b,ne=e.kind===`image`&&!!e.url,N=e.kind===`image`&&!!o;return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&i(),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Edit asset ${e.title}`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-header`,children:[(0,t.jsx)(`h2`,{className:`pretext-plus-editor__dialog-title`,children:`Edit asset`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-close`,onClick:i,"aria-label":`Close`,children:`✕`})]}),(0,t.jsx)(`div`,{ref:O,className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single pretext-plus-editor__am-edit-content`,children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-section`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-grid`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-col`,children:[ne&&(0,t.jsx)(`img`,{src:e.url,alt:f,className:`pretext-plus-editor__am-url-preview`,onError:e=>{e.currentTarget.style.display=`none`}}),N&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-replace-row`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:()=>o?.(e),disabled:M,title:`Choose or upload a different asset to use here`,children:`Replace image…`})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-edit-col`,children:[(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-edit-title`,children:`Title`}),(0,t.jsx)(`input`,{id:`am-edit-title`,type:`text`,className:`pretext-plus-editor__am-input`,value:f,onChange:e=>p(e.target.value),disabled:M}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,htmlFor:`am-edit-ref`,children:`Id`}),(0,t.jsx)(`input`,{id:`am-edit-ref`,type:`text`,className:`pretext-plus-editor__am-input`,value:m,onChange:e=>h(e.target.value),disabled:M}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:`Used in the embed code. Changing it updates every reference to this asset already in your document.`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-embed-row`,children:[(0,t.jsx)(`code`,{className:`pretext-plus-editor__am-embed-code`,children:A}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${w?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:ee,title:`Copy embed code to clipboard`,children:w?`Copied!`:`Copy embed code`})]})]})]}),(0,t.jsx)(`label`,{className:`pretext-plus-editor__dialog-label`,children:`Asset content`}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`Inserted verbatim inside the generated `,(0,t.jsx)(`code`,{children:`<${H5[e.kind]}>`}),` element — e.g. `,(0,t.jsx)(`code`,{children:`<shortdescription>...</shortdescription>`}),`.`]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-editor pretext-plus-editor__am-edit-editor`,style:{height:E},children:(0,t.jsx)(Yn,{options:{...B5,readOnly:M},height:`100%`,language:`xml`,value:g,onMount:k,onChange:e=>_(e??``)})}),S&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:S})]})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-actions`,children:[s&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary pretext-plus-editor__am-duplicate-btn`,onClick:j,disabled:M,title:`Create a copy of this asset under a new reference`,children:b?`Duplicating…`:`Duplicate`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button pretext-plus-editor__dialog-button--secondary`,onClick:i,disabled:M,children:`Cancel`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:te,disabled:M,children:v?`Saving…`:`Save`})]})]})})},W5=e=>{let n=m6(e=>e.showFullPreview),r=m6(e=>e.setShowFullPreview),i=m6(e=>e.title),a=m6(e=>e.updateTitle),o;return o=e.showPreviewModeToggle===!1?null:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__preview-toggle`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:!n,onChange:()=>r(!n),className:`pretext-plus-editor__preview-toggle-input`}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__preview-toggle-container`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-label`,children:`Simple`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-slider ${n?`pretext-plus-editor__preview-toggle-slider--active`:``}`,children:(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-dot ${n?`pretext-plus-editor__preview-toggle-dot--active`:``}`})}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-label`,children:`Full`})]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__preview-toggle-caption`,children:`Preview Mode`}),(0,t.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(!n),className:`pretext-plus-editor__preview-toggle-input`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-bar`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__menu-left`,children:(0,t.jsxs)(`label`,{className:`pretext-plus-editor__title-label`,children:[`Title`,` `,(0,t.jsx)(`input`,{className:`pretext-plus-editor__title-input`,type:`text`,value:i,onChange:e=>a(e.target.value)})]})}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__menu-right`,children:[e.onSaveButton&&(0,t.jsx)(`button`,{className:`pretext-plus-editor__button pretext-plus-editor__button--save`,onClick:e.onSaveButton,children:e.saveButtonLabel||`Save`}),e.onCancelButton&&(0,t.jsx)(`button`,{className:`pretext-plus-editor__button pretext-plus-editor__button--cancel`,onClick:e.onCancelButton,children:e.cancelButtonLabel||`Cancel`}),(0,t.jsx)(h6,{label:`Give feedback`,context:`main-editor`}),o]})]})},G5={pretext:`PreTeXt`,latex:`LaTeX`,markdown:`Markdown`},K5={book:`bk`,article:`art`,slideshow:`slides`,part:`pt`,chapter:`ch`,section:`sec`,subsection:`subsec`,subsubsection:`subsubsec`,introduction:`intro`,conclusion:`conc`,worksheet:`ws`,handout:`ho`,exercises:`ex`,references:`ref`,glossary:`gloss`,solutions:`sol`,"reading-questions":`rq`,paragraphs:`para`},q5={book:`Book`,article:`Article`,slideshow:`Slideshow`,part:`Part`,chapter:`Chapter`,section:`Section`,worksheet:`Worksheet`,handout:`Handout`,exercises:`Exercises`,references:`References`,glossary:`Glossary`,solutions:`Solutions`,"reading-questions":`Reading Questions`,introduction:`Introduction`,conclusion:`Conclusion`,subsection:`Subsection`,subsubsection:`Subsubsection`,paragraphs:`Paragraphs`},J5=[`article`,`book`],Y5=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`paragraphs`],X5=[`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`paragraphs`],Z5={book:[`part`,`chapter`],article:[`section`,...X5],slideshow:[`section`],part:[`chapter`],chapter:[`section`,...X5],section:[`subsection`,...X5],subsection:[`subsubsection`,...X5],subsubsection:[...X5],worksheet:[`paragraphs`],handout:[`paragraphs`]};function Q5(e){return e?Z5[e]??Y5:Y5}function $5(e,t){let n=K5[e]??`sec`,r=I8(t);return r?`${n}-${r}`:n}var e7=({draft:e,isNew:r=!1,isRoot:i=!1,parentType:a=null,onDraftChange:o,onCommit:s,onCancel:c})=>{let l=Q5(a),u=J5.includes(e.type)?J5:[e.type,...J5],d=(0,n.useRef)(r);return(0,n.useEffect)(()=>{i||l.length>0&&!l.includes(e.type)&&o({...e,type:l[0]})},[e,i,o,l]),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-edit-form`,children:[(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Title`}),(0,t.jsx)(`input`,{type:`text`,value:e.title,onChange:t=>{let n=t.target.value;o(d.current?{...e,title:n,xmlId:$5(e.type,n)}:{...e,title:n})},onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&c()},autoFocus:!0})]}),r?(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Format`}),(0,t.jsx)(`select`,{value:e.sourceFormat,onChange:t=>o({...e,sourceFormat:t.target.value}),children:Object.keys(G5).map(e=>(0,t.jsx)(`option`,{value:e,children:G5[e]},e))})]}):void 0,(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Type`}),(0,t.jsx)(`select`,{value:e.type,onChange:t=>{let n=t.target.value;o(d.current?{...e,type:n,xmlId:$5(n,e.title)}:{...e,type:n})},children:(i?u:l).map(e=>(0,t.jsx)(`option`,{value:e,children:q5[e]},e))})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`Id`}),(0,t.jsx)(`input`,{type:`text`,value:e.xmlId,placeholder:`unique identifier`,onChange:t=>{d.current=!1,o({...e,xmlId:t.target.value})}})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-edit-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-save`,onClick:s,children:`Save`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-cancel`,onClick:c,children:`Cancel`})]})]})},t7=({items:e})=>{let[i,a]=(0,n.useState)(!1),[o,s]=(0,n.useState)(null),c=(0,n.useRef)(null),l=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;c.current&&!c.current.contains(t)&&l.current&&!l.current.contains(t)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)},n=()=>a(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[i]),(0,n.useLayoutEffect)(()=>{if(!i)return;let e=c.current,t=l.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=window.innerHeight-n.bottom,o=r.height+4>a&&n.top>a;s({right:Math.max(4,window.innerWidth-n.right),...o?{bottom:window.innerHeight-n.top+3}:{top:n.bottom+3}})},[i]);let u=e=>{a(!1),e()};return(0,t.jsxs)(`div`,{ref:c,className:`pretext-plus-editor__toc-div-menu`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-div-menu-trigger`,onClick:e=>{e.stopPropagation(),a(e=>(e||s(null),!e))},"aria-haspopup":`true`,"aria-expanded":i,title:`More options`,children:`⋮`}),i&&(0,r.createPortal)((0,t.jsx)(`div`,{ref:l,className:`pretext-plus-editor__toc-div-menu-popup pretext-plus-editor__toc-div-menu-popup--portal`,style:{visibility:o?`visible`:`hidden`,right:o?.right,top:o?.top,bottom:o?.bottom},children:e.map(e=>(0,t.jsx)(`button`,{type:`button`,className:[`pretext-plus-editor__toc-div-menu-item`,e.danger?`pretext-plus-editor__toc-div-menu-item--danger`:``].filter(Boolean).join(` `),onClick:()=>u(e.onClick),children:e.label},e.label))}),document.body)]})},n7=({division:e,depth:n,isActive:r,hasChildren:i,isExpanded:a,onToggleExpand:o,editDraft:s,onSelect:c,onDraftChange:l,onEditCommit:u,onEditCancel:d,menuItems:f,isNew:p=!1,isRoot:m=!1,parentType:h=null})=>{let g=s!==null,_=e.type===`introduction`||e.type===`conclusion`?q5[e.type]:null;return(0,t.jsxs)(`li`,{className:[`pretext-plus-editor__toc-item`,`pretext-plus-editor__toc-item--${e.type}`,r?`pretext-plus-editor__toc-item--active`:``,g?`pretext-plus-editor__toc-item--editing`:``].filter(Boolean).join(` `),children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-item-row`,style:n>0?{paddingLeft:`${n*14}px`}:void 0,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-expand-btn`,onClick:o,"aria-label":a?`Collapse`:`Expand`,tabIndex:i?0:-1,style:{visibility:i?`visible`:`hidden`},children:a?`▾`:`▸`}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-select`,onClick:c,"aria-current":r?`true`:void 0,title:q5[e.type]??e.type,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-title`,children:e.title||_||(0,t.jsx)(`em`,{children:`Untitled`})}),e.xmlId&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-xmlid`,children:e.xmlId})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:(0,t.jsx)(t7,{items:f})})]}),g&&s&&(0,t.jsx)(e7,{draft:s,isNew:p,isRoot:m,parentType:h,onDraftChange:l,onCommit:u,onCancel:d})]})},r7=({onOpenAssetPicker:e})=>{let r=m6(e=>e.divisions),i=m6(e=>e.rootDivisionId),a=m6(e=>e.activeDivisionId),o=m6(e=>e.projectAssets)??[],s=m6(e=>e.selectSection),c=m6(e=>e.addSection),l=m6(e=>e.removeSection),u=m6(e=>e.divisionContentChange),d=m6(e=>e.insertAtCursor),f=m6(e=>e.openAssetEditor),p=m6(e=>e.openAssetResolver),m=m6(e=>e.removeAsset),h=m6(e=>e.removeAssetRefFromDocument),g=m6(e=>e.duplicateAsset),_=m6(e=>e.hasAssetDuplicate),v=m6(e=>e.startSectionEdit),y=m6(e=>e.setEditDraft),b=m6(e=>e.commitSectionEdit),x=m6(e=>e.cancelSectionEdit),S=m6(e=>e.editingId),C=m6(e=>e.editDraft),w=m6(e=>e.editingIsNew),T=r?r.find(e=>e.xmlId===i)??r.find(e=>e.type===`book`||e.type===`article`||e.type===`slideshow`)??r[0]??null:null,E=T&&r?b5(r,T.xmlId):[],D=T&&r?x5(r,T.xmlId):[],O=P5(r,o),k=L5.map(e=>({kind:e,rows:O.filter(t=>t.kind===e)})).filter(e=>e.rows.length>0),[A,ee]=(0,n.useState)(!1),[te,j]=(0,n.useState)(null),M=async e=>{if(!(!e.asset||te)){j(e.ref);try{await g(e.asset)}finally{j(null)}}},[ne,N]=(0,n.useState)(new Set),re=e=>!ne.has(e),ie=e=>{N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[ae,oe]=(0,n.useState)(a);if(a!==ae&&(oe(a),a&&T)){let e=new Map(E.map(e=>[e.division.xmlId,e])),t=new Set;t.add(T.xmlId);let n=a;for(;n;){let r=e.get(n);if(!r?.parentXmlId)break;t.add(r.parentXmlId),n=r.parentXmlId}N(e=>{if([...t].every(t=>!e.has(t)))return e;let n=new Set(e);return t.forEach(e=>n.delete(e)),n})}let se=new Set(E.map(e=>e.parentXmlId).filter(Boolean)),P=[];if(T){let e=new Set;re(T.xmlId)&&e.add(T.xmlId);for(let t of E)t.parentXmlId&&e.has(t.parentXmlId)&&(P.push(t),re(t.division.xmlId)&&e.add(t.division.xmlId))}let ce=(e,t)=>{if(!r)return;let n=r.find(e=>e.xmlId===t);n&&u(n.xmlId,p5(n.source,e))},le=(e,t)=>{if(window.confirm(`Delete "${e.title||`Untitled`}"? This permanently removes the division.`)){if(t&&r){let n=r.find(e=>e.xmlId===t);n&&u(n.xmlId,p5(n.source,e.xmlId))}l(e.xmlId)}},ue=r?.find(e=>e.xmlId===a)?.sourceFormat??`pretext`,de=e=>{d(ue===`markdown`?`::${e.type}{ref="${e.xmlId}"}`:ue===`latex`?`\\plus{${e.type}}{${e.xmlId}}`:`<plus:${e.type} ref="${e.xmlId}"/>`)},F=e=>{T&&u(T.xmlId,f5(T.source,e.xmlId,e.type,null,T.sourceFormat))},fe=e=>e&&r?.find(t=>t.xmlId===e)?.type||null,pe=e=>e.status===`unlinked`?p(e.kind,e.ref):f(e.kind,e.ref),me=(e,t)=>{navigator.clipboard.writeText(l5(e,t,ue)).catch(()=>{})},he=e=>{let t=[{label:e.status===`unlinked`?`Link / create asset`:`Edit asset`,onClick:()=>pe(e)},{label:`Copy embed code`,onClick:()=>me(e.kind,e.ref)}];return _&&e.asset&&t.push({label:`Duplicate asset`,onClick:()=>M(e)}),e.status===`unlinked`?t.push({label:`Remove from document`,onClick:()=>h(e.kind,e.ref),danger:!0}):e.asset&&t.push({label:`Remove from project`,onClick:()=>{e.inDocument&&!window.confirm(`Remove "${e.asset.title}" from the project? This also deletes its ${e.inDocument?`reference(s)`:`reference`} from the document.`)||(m(e.asset),h(e.kind,e.ref))},danger:!0}),t};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`ul`,{className:`pretext-plus-editor__toc-list`,role:`list`,children:[T&&(0,t.jsx)(n7,{division:T,depth:0,isActive:a===T.xmlId,hasChildren:se.has(T.xmlId),isExpanded:re(T.xmlId),onToggleExpand:()=>ie(T.xmlId),editDraft:S===T.xmlId?C:null,onSelect:()=>s(T.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(T)},...J8(T.sourceFormat)?[{label:`Add new division`,onClick:()=>c(T.xmlId)}]:[]],isNew:S===T.xmlId&&w,isRoot:!0}),P.length===0&&T&&re(T.xmlId)&&(0,t.jsx)(`li`,{className:`pretext-plus-editor__toc-no-sections`,children:(0,t.jsx)(`span`,{children:`No placed divisions`})}),P.map(e=>(0,t.jsx)(n7,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:se.has(e.division.xmlId),isExpanded:re(e.division.xmlId),onToggleExpand:()=>ie(e.division.xmlId),editDraft:S===e.division.xmlId?C:null,onSelect:()=>s(e.division.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e.division)},...J8(e.division.sourceFormat)?[{label:`Add new division`,onClick:()=>c(e.division.xmlId)}]:[],{label:`Remove from document`,onClick:()=>ce(e.division.xmlId,e.parentXmlId)},{label:`Delete from project`,onClick:()=>le(e.division,e.parentXmlId),danger:!0}],isNew:S===e.division.xmlId&&w,parentType:fe(e.parentXmlId)},e.division.xmlId))]}),D.length>0&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-orphans`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-orphans-heading`,children:`Unplaced divisions`}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-list`,children:D.map(e=>{let i=r?b5(r,e.xmlId):[],o=new Set(i.map(e=>e.parentXmlId).filter(Boolean));return(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)(n7,{division:e,depth:0,isActive:a===e.xmlId,hasChildren:o.has(e.xmlId),isExpanded:re(e.xmlId),onToggleExpand:()=>ie(e.xmlId),editDraft:S===e.xmlId?C:null,onSelect:()=>s(e.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e)},{label:`Place in document`,onClick:()=>F(e)},{label:`Insert at cursor`,onClick:()=>de(e)},{label:`Delete from project`,onClick:()=>le(e,null),danger:!0}],parentType:null}),re(e.xmlId)&&i.map(e=>(0,t.jsx)(n7,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:o.has(e.division.xmlId),isExpanded:re(e.division.xmlId),onToggleExpand:()=>ie(e.division.xmlId),editDraft:S===e.division.xmlId?C:null,onSelect:()=>s(e.division.xmlId),onDraftChange:y,onEditCommit:b,onEditCancel:x,menuItems:[{label:`Edit properties`,onClick:()=>v(e.division)},{label:`Insert at cursor`,onClick:()=>de(e.division)},{label:`Delete from project`,onClick:()=>le(e.division,e.parentXmlId),danger:!0}],parentType:fe(e.parentXmlId)},e.division.xmlId))]},e.xmlId)})})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-assets`,children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-header`,children:(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-toggle`,onClick:()=>ee(e=>!e),"aria-expanded":A,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-chevron`,children:A?`▾`:`▸`}),(0,t.jsx)(`span`,{children:`Assets`}),O.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-count`,children:O.length})]})}),A&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-body`,children:O.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__toc-assets-empty`,children:[`No assets in this project yet.`,` `,e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-add-link`,onClick:e,children:`Add one`})]}):(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-groups`,children:k.map(({kind:e,rows:n})=>(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-group-header`,children:I5[e]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-assets-list`,children:n.map(e=>(0,t.jsxs)(`li`,{className:[`pretext-plus-editor__toc-asset-item`,e.status===`unlinked`?`pretext-plus-editor__toc-asset-item--unlinked`:``,e.status===`unused`?`pretext-plus-editor__toc-asset-item--unused`:``,te===e.ref?`pretext-plus-editor__toc-asset-item--busy`:``].filter(Boolean).join(` `),children:[e.asset?.url?(0,t.jsx)(`img`,{src:e.asset.url,className:`pretext-plus-editor__toc-asset-img`,onClick:()=>pe(e)}):(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-img pretext-plus-editor__toc-asset-img--placeholder`,onClick:()=>pe(e),title:e.status===`unlinked`?`No asset — click to link`:void 0,"aria-hidden":`true`,children:e.status===`unlinked`?`⚠`:`🖼`}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__toc-asset-name`,onClick:()=>pe(e),title:e.status===`unlinked`?`No asset for this reference — click to link or create one`:`Edit asset`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-label`,children:e.asset?.title??e.ref}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-filename`,children:e.status===`unlinked`?`${e.ref} — needs asset`:e.status===`unused`?`${e.ref} — not placed`:e.ref})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:te===e.ref?(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-spinner`,role:`status`,"aria-label":`Duplicating asset`,title:`Duplicating…`}):(0,t.jsx)(t7,{items:he(e)})})]},e.ref))})]},e))})})]}),e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-btn`,onClick:e,children:`Manage Assets`})]})},i7=({isCollapsed:e,onToggleCollapse:n,onOpenAssetPicker:r})=>e?(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc pretext-plus-editor__toc--collapsed`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-toggle`,onClick:n,"aria-label":`Expand table of contents`,title:`Expand table of contents`,children:`☰`})}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-header`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-heading`,children:`Contents`}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-header-actions`,children:(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-toggle`,onClick:n,"aria-label":`Collapse table of contents`,title:`Collapse table of contents`,children:`✕`})})]}),(0,t.jsx)(r7,{onOpenAssetPicker:r})]}),a7=class extends n.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t),console.error(`ErrorBoundary caught an error:`,e,t)}componentDidUpdate(e){if(this.state.error===null)return;let{resetKeys:t}=this.props,n=e.resetKeys;t&&n&&(t.length!==n.length||t.some((e,t)=>!Object.is(e,n[t])))&&this.reset()}reset=()=>{this.setState({error:null})};render(){let{error:e}=this.state;return e===null?this.props.children:this.props.fallback?this.props.fallback(e,this.reset):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__error-boundary`,role:`alert`,children:[(0,t.jsx)(`strong`,{children:`Something went wrong rendering this view.`}),(0,t.jsx)(`p`,{className:`pretext-plus-editor__error-boundary-detail`,children:e.message}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__error-boundary-retry`,onClick:this.reset,children:`Try again`})]})}},o7=(e,t)=>e.kind===t.kind&&e.ref===t.ref;function s7(e){let t=()=>{},n={cbs:{selectDivision:t,addDivision:t,removeDivision:t,updateDivision:t,divisionContentChange:t,handleDivisionContentChange:t,assetInsert:t,updateTitle:t}};return{store:u6()((t,r)=>({source:e.source,sourceFormat:e.sourceFormat,projectAssets:e.projectAssets,libraryAssets:void 0,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,projectType:e.projectType,projectUrl:void 0,divisions:e.divisions,rootDivisionId:void 0,activeDivisionId:e.activeDivisionId,canConvertToPretext:!0,activeEditorSource:e.source,hasFeedback:!1,hasAssetDuplicate:!1,isTocCollapsed:!1,showFullPreview:!0,isNarrowScreen:typeof window<`u`?window.innerWidth<800:!1,activeTab:`editor`,isLatexDialogOpen:!1,isConvertDialogOpen:!1,isDocinfoEditorOpen:!1,isAssetPickerOpen:!1,isFullSourceOpen:!1,editingId:null,editDraft:null,editingIsNew:!1,editingAssetRef:null,assetResolveTarget:null,syncState:e=>t(e),applyExternalUpdate:e=>t(e),setDivisionContent:(e,n)=>t(t=>{if(!t.divisions)return{};let r=!1,i=t.divisions.map(t=>t.xmlId===e&&t.source!==n?(r=!0,{...t,source:n}):t);return r?{divisions:i}:{}}),patchDivision:(e,n)=>t(t=>t.divisions?{divisions:t.divisions.map(t=>t.xmlId===e?{...t,...n.id!==void 0&&{id:n.id},...n.title!==void 0&&{title:n.title},...n.type!==void 0&&{type:n.type},...n.xmlId!=null&&{xmlId:n.xmlId},...n.sourceFormat!==void 0&&{sourceFormat:n.sourceFormat}}:t)}:{}),addDivisionToPool:e=>t(t=>{let n=t.divisions??[];return n.some(t=>t.xmlId===e.xmlId)?{}:{divisions:[...n,e]}}),removeDivisionFromPool:e=>t(t=>({divisions:(t.divisions??[]).filter(t=>t.xmlId!==e)})),setActiveDivisionId:e=>t({activeDivisionId:e}),setTitle:e=>t({title:e}),setDocinfo:({docinfo:e,commonDocinfo:n,useCommonDocinfo:r})=>t({docinfo:e,commonDocinfo:n,useCommonDocinfo:r}),setShowFullPreview:e=>t({showFullPreview:e}),setActiveTab:e=>t({activeTab:e}),setIsNarrowScreen:e=>t({isNarrowScreen:e}),setIsTocCollapsed:e=>t(t=>({isTocCollapsed:typeof e==`function`?e(t.isTocCollapsed):e})),openModal:e=>t({[e]:!0}),closeModal:e=>t({[e]:!1}),selectSection:e=>n.cbs.selectDivision(e),addSection:e=>n.cbs.addDivision(e),removeSection:e=>n.cbs.removeDivision(e),updateSection:(e,t)=>n.cbs.updateDivision(e,t),divisionContentChange:(e,t)=>n.cbs.divisionContentChange?.(e,t),startSectionEdit:(e,n)=>{let{xmlId:r,label:i}=e.sourceFormat===`markdown`?G8(e.source)??{xmlId:e.xmlId,label:``}:e.sourceFormat===`latex`?{xmlId:D8(e.source)||e.xmlId,label:``}:(()=>{let t=P8(e.source);return{xmlId:t.xmlId||e.xmlId,label:t.label}})();t({editingId:e.xmlId,editDraft:{title:e.title,type:e.type,xmlId:r,label:i,sourceFormat:e.sourceFormat},editingIsNew:n?.isNew??!1})},setEditDraft:e=>t({editDraft:e}),commitSectionEdit:()=>{let{editingId:e,editDraft:i,divisions:a}=r();if(e&&i){let t=(a??[]).find(t=>t.xmlId===e),r=null;if(t){let t=F8(i.xmlId);if(!t){window.alert(`xml:id can't be empty — it identifies the division and is used by references to it.`);return}if((a??[]).some(n=>n.xmlId!==e&&n.xmlId===t)){window.alert(`xml:id "${t}" is already used by another division. Choose a unique id.`);return}r=t}n.cbs.updateDivision(e,{title:i.title.trim()||void 0,type:i.type,xmlId:r,label:i.label.trim()||null,sourceFormat:i.sourceFormat})}t({editingId:null,editDraft:null,editingIsNew:!1})},cancelSectionEdit:()=>t({editingId:null,editDraft:null,editingIsNew:!1}),insertAsset:e=>n.cbs.assetInsert(e),insertAtCursor:e=>n.cbs.insertContentAtCursor?.(e),openAssetEditor:(e,n)=>t({editingAssetRef:{kind:e,ref:n}}),closeAssetEditor:()=>t({editingAssetRef:null}),openAssetResolver:(e,n)=>t({assetResolveTarget:{kind:e,ref:n}}),closeAssetResolver:()=>t({assetResolveTarget:null}),removeAsset:e=>n.cbs.assetRemove?.(e),removeAssetRefFromDocument:(e,t)=>n.cbs.assetRefRemove?.(e,t),duplicateAsset:async e=>{await n.cbs.assetDuplicate?.(e)},setProjectAssets:e=>t({projectAssets:e}),addAssetToPool:e=>t(t=>{let n=t.projectAssets??[];return n.some(t=>o7(t,e))?{}:{projectAssets:[...n,e]}}),updateAssetInPool:e=>t(t=>{let n=t.projectAssets??[];return n.some(t=>o7(t,e))?{projectAssets:n.map(t=>o7(t,e)?e:t)}:{projectAssets:[...n,e]}}),renameAssetInPool:(e,n,r)=>t(t=>({projectAssets:[...(t.projectAssets??[]).filter(t=>!(t.kind===e&&t.ref===n)&&!o7(t,r)),r]})),removeAssetFromPool:e=>t(t=>({projectAssets:(t.projectAssets??[]).filter(t=>!o7(t,e))})),updateTitle:e=>n.cbs.updateTitle(e),feedbackSubmit:e=>n.cbs.feedbackSubmit?.(e)})),bindCallbacks:e=>{n.cbs=e}}}function c7({store:e,children:n}){return(0,t.jsx)(p6.Provider,{value:e,children:n})}var l7=(e,t)=>e.find(e=>t?e.xmlId===t:e.type===`book`||e.type===`article`||e.type===`slideshow`)??e[0]??null,u7=e=>{let[r]=(0,n.useState)(()=>{let t=l7(e.divisions,e.rootDivisionId),n=N5(e.divisions,t?.xmlId,e.projectType,e.title),r=n.find(e=>e.xmlId===t?.xmlId)??t,i=e.activeDivisionId??r?.xmlId??null,a=n.find(e=>e.xmlId===i)??r;return s7({source:a?.source??``,sourceFormat:a?.sourceFormat??`pretext`,title:e.title||r?.title||`Document Title`,docinfo:e.docinfo??``,commonDocinfo:e.commonDocinfo??``,useCommonDocinfo:e.useCommonDocinfo??!1,projectType:e.projectType,divisions:n,activeDivisionId:i,projectAssets:e.projectAssets})});return(0,t.jsx)(c7,{store:r.store,children:(0,t.jsx)(d7,{...e,bindCallbacks:r.bindCallbacks})})},d7=e=>{let{bindCallbacks:r}=e,i=m6(e=>e.showFullPreview),a=m6(e=>e.isNarrowScreen),o=m6(e=>e.setIsNarrowScreen),s=m6(e=>e.activeTab),c=m6(e=>e.setActiveTab),l=m6(e=>e.isTocCollapsed),u=m6(e=>e.setIsTocCollapsed),d=m6(e=>e.isLatexDialogOpen),f=m6(e=>e.isConvertDialogOpen),p=m6(e=>e.isDocinfoEditorOpen),m=m6(e=>e.isAssetPickerOpen),h=m6(e=>e.isFullSourceOpen),g=m6(e=>e.editingAssetRef),_=m6(e=>e.openAssetEditor),v=m6(e=>e.closeAssetEditor),y=m6(e=>e.assetResolveTarget),b=m6(e=>e.closeAssetResolver),[x,S]=(0,n.useState)(null),C=m6(e=>e.openModal),w=m6(e=>e.closeModal),T=m6(e=>e.syncState),E=m6(e=>e.projectAssets),D=m6(e=>e.addAssetToPool),O=m6(e=>e.updateAssetInPool),k=m6(e=>e.renameAssetInPool),A=m6(e=>e.removeAssetFromPool),ee=g?E?.find(e=>e.kind===g.kind&&e.ref===g.ref):void 0,te=m6(e=>e.divisions),j=(0,n.useMemo)(()=>te??[],[te]),M=m6(e=>e.activeDivisionId),ne=m6(e=>e.title),N=m6(e=>e.docinfo),re=m6(e=>e.commonDocinfo),ie=m6(e=>e.useCommonDocinfo),ae=m6(e=>e.applyExternalUpdate),oe=m6(e=>e.setDivisionContent),se=m6(e=>e.patchDivision),P=m6(e=>e.addDivisionToPool),ce=m6(e=>e.removeDivisionFromPool),le=m6(e=>e.setActiveDivisionId),ue=m6(e=>e.startSectionEdit),de=m6(e=>e.setTitle),F=m6(e=>e.setDocinfo),fe=m6(e=>e.editingId),pe=m6(e=>e.editingIsNew),me=(0,n.useRef)(null),he=(0,n.useRef)(null),ge=(0,n.useRef)(!1);(0,n.useEffect)(()=>{fe&&pe?ge.current=!0:ge.current&&(ge.current=!1,he.current?.focus())},[fe,pe]);let I=l7(j,e.rootDivisionId),_e=j.find(e=>e.xmlId===M)??j[0]??null,ve=_e?.sourceFormat??`pretext`,ye=_e?.source??``,be=(t,n,r,i)=>{oe(t,n),e.onContentChange({xmlId:t,source:n,sourceFormat:r,pretextSource:r===`pretext`?n:void 0,...i})},xe=(t,n)=>{se(t,n),e.onDivisionUpdate?.(t,n)},Se=(e,t)=>{let n=j.find(t=>t.xmlId===e);if(!n){xe(e,t);return}let r;if(t.sourceFormat!==void 0&&t.sourceFormat!==n.sourceFormat){let e=t.type??n.type,i=t.title??n.title,a=t.xmlId||n.xmlId;r={...n,sourceFormat:t.sourceFormat,type:e,title:i,xmlId:a,source:d5(e,t.sourceFormat,i,a)}}else r=n.sourceFormat===`markdown`?K8(n,t):n.sourceFormat===`latex`?O8(n,t):R8(n,t);let i=r.xmlId;if(r.source!==n.source&&be(n.xmlId,r.source,r.sourceFormat),xe(e,{...t,xmlId:i}),i!==n.xmlId||r.type!==n.type){let e=g5(j,n.xmlId);if(e){let t=h5(e.source,n.xmlId,i,r.type);t!==e.source&&be(e.xmlId,t,e.sourceFormat)}}i!==n.xmlId&&we(i)},Ce=t=>{P(t),(e.onDivisionAdd?.(t))?.then(e=>se(t.xmlId,{id:e})).catch(()=>{})},L=t=>{ce(t),e.onDivisionRemove?.(t)},we=t=>{le(t),e.onDivisionSelect?.(t)},Te=(0,n.useMemo)(()=>{if(!_e||ve===`pretext`)return;if(ve===`latex`)return k8(_e)??void 0;let e=o6(ye,ve);return e.pretextError?void 0:e.pretextSource},[_e,ve,ye]),Ee=e=>{if(!_e)return;let t=e||``;if(ve===`pretext`){let e=L8(t);e&&e.xmlId!==_e.xmlId&&(t=R8({..._e,source:t,title:e.title,type:e.type},{xmlId:_e.xmlId,label:e.label||null}).source)}else if(ve===`markdown`){let e=G8(t);e&&e.xmlId!==_e.xmlId&&(t=K8({..._e,source:t},{xmlId:_e.xmlId}).source)}if(t===_e.source)return;if(be(_e.xmlId,t,ve),ve===`pretext`){let e=L8(t);if(e&&(xe(_e.xmlId,{title:e.title,type:e.type,label:e.label||null}),e.type!==_e.type)){let t=g5(j,_e.xmlId);if(t){let n=h5(t.source,_e.xmlId,_e.xmlId,e.type);n!==t.source&&be(t.xmlId,n,t.sourceFormat)}}}else if(ve===`markdown`){let e=G8(t);if(e&&(xe(_e.xmlId,{title:e.title,type:e.type,label:e.label||null}),e.type!==_e.type)){let t=g5(j,_e.xmlId);if(t){let n=h5(t.source,_e.xmlId,_e.xmlId,e.type);n!==t.source&&be(t.xmlId,n,t.sourceFormat)}}}else if(ve===`latex`){let e=E8(t);e!==null&&xe(_e.xmlId,{title:e})}let n=new Set(j.map(e=>e.xmlId));for(let{xmlId:e,type:r}of a5(t,ve))n.has(e)||(Ce(u5(e,r,ve)),n.add(e))},R=e=>{we(e)},De=()=>{_e&&(u(!1),ue(_e))},Oe=e=>{let t=h8();if(Ce(t),e){let n=j.find(t=>t.xmlId===e);n&&be(n.xmlId,f5(n.source,t.xmlId,t.type,null,n.sourceFormat),n.sourceFormat)}le(t.xmlId),ue(t,{isNew:!0})},ke=e=>{D(e)},z=t=>{A(t),e.onAssetRemove?.(t)},Ae=!!(e.onAssetUpload&&e.onAssetFetchUrl&&e.onAssetUpdate),je=!!(e.onAssetRemove&&(e.onAssetUpload||e.onAssetAddFromLibrary)),Me=async t=>{if(!e.onAssetUpload||!e.onAssetFetchUrl||!t.ref||!t.url)return;let n=new Set(P5(j,E).map(e=>e.ref)),r=F5(t.ref,n),i=await e.onAssetFetchUrl(t.url),a=/\.[^./\\]+$/.exec(i.name)?.[0]??``,o=new File([i],`${r}${a}`,{type:i.type}),s={...await e.onAssetUpload(o),ref:r,title:`${t.title} (copy)`,source:t.source};await e.onAssetUpdate?.(s),D(s),_(s.kind,r)},Ne=async(t,n,r)=>{if(r)n.ref&&t.ref&&Pe(t.kind,t.ref,n.ref),D(n);else{let r={...n,ref:t.ref,title:t.title,source:t.source};await e.onAssetUpdate?.(r),O(r)}e.onAssetRemove?.(t),A(t)},Pe=(e,t,n)=>{if(t!==n)for(let r of j){let i=s5(r.source,e,t,n);i!==r.source&&be(r.xmlId,i,r.sourceFormat)}},Fe=(e,t)=>{for(let n of j){let r=c5(n.source,e,t);r!==n.source&&be(n.xmlId,r,n.sourceFormat)}};(0,n.useEffect)(()=>{let e=()=>o(window.innerWidth<800);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let Ie=ve!==`pretext`;(0,n.useLayoutEffect)(()=>{r({selectDivision:R,addDivision:e=>Oe(e),removeDivision:e=>L(e),updateDivision:(e,t)=>Se(e,t),divisionContentChange:(e,t)=>{be(e,t,j.find(t=>t.xmlId===e)?.sourceFormat??`pretext`)},handleDivisionContentChange:Ee,assetInsert:ke,assetRemove:z,assetRefRemove:Fe,assetDuplicate:Ae?Me:void 0,insertContentAtCursor:e=>he.current?.insertAtCursor(e),updateTitle:t=>{de(t),e.onTitleChange?.(t)},feedbackSubmit:e.onFeedbackSubmit})}),(0,n.useEffect)(()=>{T({source:ye,sourceFormat:ve,libraryAssets:e.libraryAssets,projectType:e.projectType,projectUrl:e.projectUrl,rootDivisionId:I?.xmlId,canConvertToPretext:Te!==void 0,activeEditorSource:ye,hasFeedback:e.onFeedbackSubmit!==void 0,hasAssetDuplicate:Ae})});let Le=(0,n.useRef)({divisions:e.divisions,projectAssets:e.projectAssets,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId});(0,n.useEffect)(()=>{let t=Le.current,n={},r=!1;if(e.projectAssets!==void 0&&e.projectAssets!==t.projectAssets&&(n.projectAssets=e.projectAssets,r=!0),e.divisions!==t.divisions){let t=l7(e.divisions,e.rootDivisionId),i=N5(e.divisions,t?.xmlId,e.projectType,e.title);n.divisions=i;let a=i.find(e=>e.xmlId===t?.xmlId)??t;(M==null||!e.divisions.some(e=>e.xmlId===M))&&(n.activeDivisionId=a?.xmlId??null),!e.title&&a?.title&&(n.title=a.title),r=!0}e.title!==void 0&&e.title!==t.title&&(n.title=e.title,r=!0),e.docinfo!==void 0&&e.docinfo!==t.docinfo&&(n.docinfo=e.docinfo,r=!0),e.commonDocinfo!==void 0&&e.commonDocinfo!==t.commonDocinfo&&(n.commonDocinfo=e.commonDocinfo,r=!0),e.useCommonDocinfo!==void 0&&e.useCommonDocinfo!==t.useCommonDocinfo&&(n.useCommonDocinfo=e.useCommonDocinfo,r=!0),e.activeDivisionId!==void 0&&e.activeDivisionId!==t.activeDivisionId&&(n.activeDivisionId=e.activeDivisionId,r=!0),r&&ae(n),Le.current={divisions:e.divisions,projectAssets:e.projectAssets,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId}});let Re=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(Re.current===e.divisions)return;Re.current=e.divisions;let t=l7(e.divisions,e.rootDivisionId),n=N5(e.divisions,t?.xmlId,e.projectType,e.title);for(let t of n){if(t.sourceFormat!==`pretext`)continue;let n=e.divisions.find(e=>e.xmlId===t.xmlId);!n||t.source===n.source||e.onContentChange({xmlId:t.xmlId,source:t.source,sourceFormat:`pretext`,pretextSource:t.source})}});let ze=ie?re:N,Be=(0,n.useMemo)(()=>{if(!h||!I)return``;try{return k5(j,I.xmlId,ze,E??[])}catch(e){return`<!-- Unable to assemble document source: ${e instanceof Error?e.message:String(e)} -->`}},[h,I,j,ze,E]),Ve=_e?D5(j,_e.xmlId,E):void 0,He=_e&&Ve!==void 0?j5(_e.type,Ve,ze,_e.title):void 0,Ue=()=>me.current?.rebuild(),B=()=>{e.onSave?.(),me.current?.rebuild()},We=t=>{let n=t.ctrlKey||t.metaKey;n&&t.key===`Enter`&&e.onPreviewRebuild?(t.preventDefault(),Ue()):n&&t.key===`s`&&(t.preventDefault(),B())},Ge=()=>{if(!_e||!Te)return;let e=h8(),t={id:e.xmlId,xmlId:_e.xmlId,title:_e.title,type:_e.type,sourceFormat:ve,source:_e.source};Ce(ve===`markdown`?K8(t,{xmlId:e.xmlId}):O8(t,{xmlId:e.xmlId})),be(_e.xmlId,Te,`pretext`),xe(_e.xmlId,{sourceFormat:`pretext`})},Ke=(0,t.jsx)(Ws,{ref:he,content:ye,sourceFormat:ve,onChange:Ee,onRebuild:e.onPreviewRebuild?Ue:void 0,onSave:B,onOpenLatexImport:()=>C(`isLatexDialogOpen`),onOpenDocinfoEditor:()=>C(`isDocinfoEditorOpen`),onOpenConvertToPretext:Ie&&Te!==void 0?()=>C(`isConvertDialogOpen`):void 0,canConvertToPretext:Te!==void 0,onOpenAssets:e.projectAssets!==void 0&&ve===`pretext`?()=>C(`isAssetPickerOpen`):void 0,onShowFullSource:()=>C(`isFullSourceOpen`),onRequestWrapperEdit:De}),V;V=i&&e.onPreviewRebuild?(0,t.jsx)(lR,{ref:me,content:He||``,title:ne,onRebuild:e.onPreviewRebuild}):(0,t.jsx)(oR,{content:ye,canEdit:ve===`pretext`,editDisabledReason:ve===`markdown`?`Visual editing is not available for Markdown documents.`:ve===`latex`?`Visual editing is not available for LaTeX documents.`:``,onChange:e=>Ee(e)});let qe=(0,t.jsx)(i7,{isCollapsed:l,onToggleCollapse:()=>u(e=>!e),onOpenAssetPicker:e.projectAssets===void 0?void 0:()=>C(`isAssetPickerOpen`)}),Je=`pretext-plus-tab-editor`,Ye=`pretext-plus-tab-preview`,Xe=`pretext-plus-tabpanel`,Ze;return Ze=a?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs`,children:[qe,(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs-main`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tab-list`,role:`tablist`,children:[(0,t.jsx)(`button`,{type:`button`,id:Je,role:`tab`,"aria-controls":Xe,"aria-selected":s===`editor`,tabIndex:s===`editor`?0:-1,className:`pretext-plus-editor__tab-button ${s===`editor`?`is-active`:``}`,onClick:()=>c(`editor`),children:`Editor`}),(0,t.jsx)(`button`,{type:`button`,id:Ye,role:`tab`,"aria-controls":Xe,"aria-selected":s===`preview`,tabIndex:s===`preview`?0:-1,className:`pretext-plus-editor__tab-button ${s===`preview`?`is-active`:``}`,onClick:()=>c(`preview`),children:`Preview`})]}),(0,t.jsx)(`div`,{id:Xe,className:`pretext-plus-editor__tab-panel`,role:`tabpanel`,"aria-labelledby":s===`editor`?Je:Ye,children:(0,t.jsx)(`div`,{style:{height:`100%`},children:s===`editor`?Ke:V})})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__sectioned-layout`,children:[qe,(0,t.jsxs)(gt,{orientation:`horizontal`,className:`pretext-plus-editor__splitter`,children:[(0,t.jsx)(yt,{className:`pretext-plus-editor__editor-panel`,children:Ke}),(0,t.jsx)(St,{className:`pretext-plus-editor__resize-handle`,children:(0,t.jsx)(`div`,{className:`pretext-plus-editor__resize-dots`})}),(0,t.jsx)(yt,{className:`pretext-plus-editor__preview-panel`,children:V})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor`,onKeyDown:We,children:[(0,t.jsx)(W5,{onSaveButton:e.onSaveButton,saveButtonLabel:e.saveButtonLabel,onCancelButton:e.onCancelButton,cancelButtonLabel:e.cancelButtonLabel,showPreviewModeToggle:e.onPreviewRebuild!==void 0}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__editor-displays`,children:[(0,t.jsx)(a7,{resetKeys:[ye,M],children:Ze}),d?(0,t.jsx)(g6,{onClose:()=>w(`isLatexDialogOpen`)}):null,f&&_e&&Te?(0,t.jsx)(b6,{source:ye,sourceFormat:ve,pretextSource:Te,onConfirm:Ge,onClose:()=>w(`isConvertDialogOpen`)}):null,p?(0,t.jsx)(M6,{docinfo:N,showCommonDocinfoControls:!0,commonDocinfo:re,initialUseCommonDocinfo:ie,onClose:t=>{if(w(`isDocinfoEditorOpen`),t!==void 0){F({docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo}),e.onCommonDocinfoChange?.(t.commonDocinfo),e.onUseCommonDocinfoChange?.(t.useCommonDocinfo);let n=I??_e;be(n?.xmlId??``,n?.source??``,n?.sourceFormat??`pretext`,{docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo})}}}):null,(m||y||x)&&e.projectAssets!==void 0?(0,t.jsx)(z5,{open:m||!!y||!!x,resolveTarget:y,replaceTarget:x,onClose:()=>{w(`isAssetPickerOpen`),b(),S(null)},onLoadAssets:e.onLoadAssets,onLoadLibraryAssets:e.onLoadLibraryAssets,onAddFromLibrary:e.onAssetAddFromLibrary,onUpload:e.onAssetUpload,onFetchUrl:e.onAssetFetchUrl,onCreateDoenet:e.onCreateDoenet,onRemoveAsset:e.onAssetRemove?z:void 0,onDuplicateAsset:Ae?Me:void 0,onAssetAdded:ke,onResolveRef:Pe,onReplaceAsset:Ne}):null,h?(0,t.jsx)(P6,{source:Be,onClose:()=>w(`isFullSourceOpen`)}):null,ee?(0,t.jsx)(U5,{asset:ee,projectAssets:E??[],onClose:v,onReplace:je?e=>{v(),S(e)}:void 0,onDuplicate:Ae?e=>Me(e):void 0,onSave:async(t,n)=>{t.ref&&t.ref!==n?(Pe(t.kind,n,t.ref),k(t.kind,n,t)):O(t),await e.onAssetUpdate?.(t)}},`${ee.kind}:${ee.ref}`):null]})]})};e.CodeEditor=Ws,e.DocinfoEditor=M6,e.Editors=u7,e.FeedbackLink=c6,e.FullPreview=lR,e.VisualEditor=oR,e.assembleFullProjectSource=k5,e.assembleProjectSource=D5,e.buildDivisionTree=b5,e.convertLatexToPretext=r6,e.createConclusion=_8,e.createIntroduction=g8,e.createLatexConclusion=M8,e.createLatexIntroduction=j8,e.createNewLatexSection=A8,e.createNewSection=h8,e.derivePretextContent=o6,e.detectSourceFormat=n6,e.ensureLatexSectionWrapper=C8,e.ensureSectionWrapper=b8,e.extractDivisionMetadata=L8,e.extractLatexDivisionTitle=E8,e.findDivisionParent=g5,e.getOrphanRoots=x5,e.getOrphanedDivisions=y5,e.getSectionAttributes=P8,e.insertDivisionRef=f5,e.mergeTwoSections=N8,e.moveDivisionRef=m5,e.parseDivisionRefs=i5,e.postToIframe=cR,e.removeDivisionRef=p5,e.renameDivisionRef=h5,e.reorderDivisionRefs=_5,e.rewrapLatexSection=S8,e.rewrapSection=y8,e.stripLatexSectionWrapper=x8,e.stripSectionWrapper=v8,e.updateDivisionTitle=m8,e.updateLatexSectionTitle=T8,e.updateSectionMetadata=R8,e.wrapDivisionForPreview=j5});
|
|
1093
1093
|
//# sourceMappingURL=index.js.map
|