@pretextbook/web-editor 0.5.4 → 0.6.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/dist/components/AssetManagerModal.d.ts +8 -3
- package/dist/components/Editors.d.ts +19 -4
- package/dist/index.es.js +3690 -510
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/sectionUtils.d.ts +1 -0
- package/dist/store/editorStore.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("use-sync-external-store/shim/index.js"),require("use-sync-external-store/shim/with-selector.js")):typeof define==`function`&&define.amd?define([`exports`,`react/jsx-runtime`,`react`,`react-dom`,`use-sync-external-store/shim/index.js`,`use-sync-external-store/shim/with-selector.js`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.PretextWebEditor={},e.react_jsx_runtime,e.React,e.ReactDOM,e.use_sync_external_store_shim_index_js,e.use_sync_external_store_shim_with_selector_js))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(e&&(t=e(e=0)),t),p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:o(u(e)),h(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)),_=e=>d.call(e,`module.exports`)?e[`module.exports`]:h(s({},`__esModule`,{value:!0}),e);n=g(n,1),r=g(r,1);function v(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function y(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function b(e){return e/100*window.innerHeight}function x(e){return e/100*window.innerWidth}function S(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function C({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=S(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=y(t,i);break;case`em`:r=v(t,i);break;case`vh`:r=b(i);break;case`vw`:r=x(i);break}return r}function w(e){return parseFloat(e.toFixed(3))}function T({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function E(e){let{panels:t}=e,n=T({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=w(C({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=w(C({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=w(C({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=w(C({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function D(e,t=`Assertion error`){if(!e)throw Error(t)}function O(e,t){return Array.from(t).sort(e===`horizontal`?k:A)}function k(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function A(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function j(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function ee(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function te({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=ee(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return D(i,`No rect found`),i}var ne;function re(){return ne===void 0&&(ne=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),ne}function M(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=O(n,Array.from(t.children).filter(j).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,te({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=re()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:T({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var ie=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},ae=new Map,oe=new ie;function N(e){ae=new Map(ae),ae.delete(e)}function se(e,t){for(let[t]of ae)if(t.id===e)return t}function P(e,t){for(let[t,n]of ae)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ce(){return ae}function le(e,t){return oe.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ue(e,t){let n=ae.get(e);ae=new Map(ae),ae.set(e,t),oe.emit(`groupChange`,{group:e,prev:n,next:t})}function de(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=ee(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function F(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function fe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:_e(e),b:_e(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();D(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:I(ge(n.a)),b:I(ge(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var pe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function me(e){let t=getComputedStyle(ve(e)??e).display;return t===`flex`||t===`inline-flex`}function he(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||me(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||pe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ge(e){let t=e.length;for(;t--;){let n=e[t];if(D(n,`Missing node`),he(n))return n}return null}function I(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _e(e){let t=[];for(;e;)t.push(e),e=ve(e);return t}function ve(e){let{parentNode:t}=e;return F(t)?t.host:t}function ye(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function be({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!j(n)||n.contains(e)||e.contains(n))return!0;if(fe(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ye(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function xe(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=M(r),a=de(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&be({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Se(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ce(e,t,n=0){return Math.abs(w(e)-w(t))<=n}function L(e,t){return Ce(e,t)?0:e>t?1:-1}function we({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(L(r,c)<0)if(a){let e=(i+c)/2;r=L(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=w(r),r}function Te({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ce(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;D(u!=null,`Invalid first pivot index`),D(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];D(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(D(n!=null,`Previous layout not found for panel index ${t}`),Ce(n,i)){let t=o-n;L(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];D(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(D(n!=null,`Previous layout not found for panel index ${t}`),Ce(n,o)){let t=n-i;L(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];D(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&L(i,c)<0)if(e>0){let t=c-o,n=t/2;L(i+e,c)<0&&(e=L(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;L(i-e,c)<0&&(e=L(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];D(e!=null,`Previous layout not found for panel index ${r}`);let a=we({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];D(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=we({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ce(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Se(c,l))return i;{let t=e<0?d:u,r=s[t];D(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=we({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ce(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];D(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=we({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ce(i,s)||(t-=s-i,l[r]=s),Ce(t,0))break;e>0?r--:r++}}}if(!Ce(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Ee(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||L(e[n],t[n])!==0)return!1;return!0}function R({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Ce(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];D(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];D(i!=null,`No layout data found for index ${e}`);let o=r[e];D(o!=null,`No layout data found for index ${e}`);let s=we({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ce(a,0))for(let e=0;e<t.length;e++){let n=r[e];D(n!=null,`No layout data found for index ${e}`);let i=n+a,o=we({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ce(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function De({groupId:e,panelId:t}){let n=()=>{let t=ce();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Ce(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:w(100-e)}}return Te({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=R({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Ee(c,u)||ue(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Ce(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=T({group:t});s(w(C({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Oe(e){e.defaultPrevented||xe(e,ce()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=De({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ke(e){let t=ce();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function z({groupId:e}){let t=()=>{let t=ce();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=R({layout:e,panelConstraints:r});return n?o:(Ee(o,c)||ue(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Ae(e,t){let n=ke(e),r=P(n.id,!0),i=n.separators.find(t=>t.element===e);D(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);D(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=z({groupId:n.id}).getLayout(),c=R({layout:Te({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Ee(s,c)||ue(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function je(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ke(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Ae(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Ae(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Ae(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Ae(t,-5);break;case`End`:e.preventDefault(),Ae(t,100);break;case`Enter`:{e.preventDefault();let n=ke(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=P(n.id,!0),o=n.separators.find(e=>e.element===t);D(o,`Matching separator not found`);let s=a.get(o);D(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(D(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Ae(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ke(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);D(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Ae(t,-100);break}}var Me={cursorFlags:0,state:`inactive`},Ne=new ie;function Pe(){return Me}function Fe(e){return Ne.addListener(`change`,e)}function Ie(e){let t=Me,n={...Me};n.cursorFlags=e,Me=n,Ne.emit(`change`,{prev:t,next:n})}function Le(e){let t=Me;Me=e,Ne.emit(`change`,{prev:t,next:e})}function Re(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ce(),n=xe(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Le({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ze=e=>e,Be=()=>{},Ve=1,He=2,Ue=4,B=8,We=3,Ge=12,Ke;function V(){return Ke===void 0&&(Ke=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Ke=!0)),Ke}function qe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&V()){let t=(e&Ve)!==0,n=(e&He)!==0,r=(e&Ue)!==0,i=(e&B)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return V()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Je=new WeakMap;function Ye(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Je.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Pe();switch(r.state){case`active`:case`hover`:{let e=qe({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Je.set(e,{prevStyle:t,styleSheet:n})}function Xe({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Te({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Ee(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ve:He;break;case`vertical`:s|=d<0?Ue:B;break}}else ue(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&We:c|=s&We,t.movementY===0?c|=o&Ge:c|=s&Ge,Ie(c),Ye(e)}function Ze(e){let t=ce(),n=Pe();switch(n.state){case`active`:Xe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Qe(e){if(e.defaultPrevented)return;let t=Pe(),n=ce();switch(t.state){case`active`:if(e.buttons===0){Le({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=P(e.group.id,!0);ue(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Xe({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=xe(e,n);r.length===0?t.state!==`inactive`&&Le({cursorFlags:0,state:`inactive`}):Le({cursorFlags:0,hitRegions:r,state:`hover`}),Ye(e.currentTarget);break}}}function $e(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Pe().state){case`hover`:Le({cursorFlags:0,state:`inactive`})}}function et(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Pe();switch(t.state){case`active`:Le({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ye(e.currentTarget),t.hitRegions.forEach(e=>{let t=P(e.group.id,!0);ue(e.group,t)}),e.preventDefault())}}function tt(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=w(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=w((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function nt(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=T({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:w(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function rt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function it({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=w(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=w((r[e]??0)/a*l);else{let e=w(l/c.length);for(let t of c)u[t]=e}return u}function at(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ot=new Map;function st(e){let t=!0;D(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=T({group:e});if(t===0)return;let n=P(e.id);if(!n)return;let r=E(e),i=n.defaultLayoutDeferred?tt(r):n.layout,a=R({layout:it({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Ee(n.layout,a)&&rt(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ue(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else nt(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{D(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=T({group:e}),s=E(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(at(e.panels,l)||(l=void 0));let u=R({layout:e.mutableState.layouts[c]??l??tt(s),panelConstraints:s}),d=e.element.ownerDocument;ot.set(d,(ot.get(d)??0)+1);let f=new Map;return M(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ue(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{D(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,je)}),ot.get(d)===1&&(d.addEventListener(`dblclick`,Oe,!0),d.addEventListener(`pointerdown`,Re,!0),d.addEventListener(`pointerleave`,Ze),d.addEventListener(`pointermove`,Qe),d.addEventListener(`pointerout`,$e),d.addEventListener(`pointerup`,et,!0)),function(){t=!1,ot.set(d,Math.max(0,(ot.get(d)??0)-1)),N(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,je)}),ot.get(d)||(d.removeEventListener(`dblclick`,Oe,!0),d.removeEventListener(`pointerdown`,Re,!0),d.removeEventListener(`pointerleave`,Ze),d.removeEventListener(`pointermove`,Qe),d.removeEventListener(`pointerout`,$e),d.removeEventListener(`pointerup`,et,!0)),a.disconnect()}}function ct(){let[e,t]=(0,n.useState)({});return[e,(0,n.useCallback)(()=>t({}),[])]}function lt(e){let t=(0,n.useId)();return`${e??t}`}var ut=typeof window<`u`?n.useLayoutEffect:n.useEffect;function dt(e){let t=(0,n.useRef)(e);return ut(()=>{t.current=e},[e]),(0,n.useCallback)((...e)=>t.current?.(...e),[t])}function ft(...e){return dt(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function pt(e){let t=(0,n.useRef)({...e});return ut(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var mt=(0,n.createContext)(null);function ht(e,t){let r=(0,n.useRef)({getLayout:()=>({}),setLayout:ze});(0,n.useImperativeHandle)(t,()=>r.current,[]),ut(()=>{Object.assign(r.current,z({groupId:e}))})}function gt({children:e,className:r,defaultLayout:i,disableCursor:a,disabled:o,elementRef:s,groupRef:c,id:l,onLayoutChange:u,onLayoutChanged:d,orientation:f=`horizontal`,resizeTargetMinimumSize:p={coarse:20,fine:10},style:m,...h}){let g=(0,n.useRef)({onLayoutChange:{},onLayoutChanged:{}}),_=dt(e=>{Ee(g.current.onLayoutChange,e)||(g.current.onLayoutChange=e,u?.(e))}),v=dt(e=>{Ee(g.current.onLayoutChanged,e)||(g.current.onLayoutChanged=e,d?.(e))}),y=lt(l),b=(0,n.useRef)(null),[x,S]=ct(),C=(0,n.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),w=ft(b,s);ht(y,c);let T=dt((e,t)=>{let n=Pe(),r=se(e),a=P(e);if(a){let e=!1;switch(n.state){case`active`:e=n.hitRegions.some(e=>e.group===r);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(i?.[t])return{flexGrow:i?.[t]}}),D=pt({defaultLayout:i,disableCursor:a}),k=(0,n.useMemo)(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:T,id:y,orientation:f,registerPanel:e=>{let t=C.current;return t.panels=O(f,[...t.panels,e]),S(),()=>{t.panels=t.panels.filter(t=>t!==e),S()}},registerSeparator:e=>{let t=C.current;return t.separators=O(f,[...t.separators,e]),S(),()=>{t.separators=t.separators.filter(t=>t!==e),S()}},updatePanelProps:(e,{disabled:t})=>{let n=C.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=se(y),i=P(y);r&&i&&ue(r,{...i,derivedPanelConstraints:E(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=C.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[T,y,S,f,D]),A=(0,n.useRef)(null);return ut(()=>{let e=b.current;if(e===null)return;let t=C.current,n;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=D.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!o,element:e,id:y,mutableState:{defaultLayout:n,disableCursor:!!D.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:f,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};A.current=r;let i=st(r),{defaultLayoutDeferred:a,derivedPanelConstraints:s,layout:c}=P(r.id,!0);!a&&s.length>0&&(_(c),v(c));let l=le(y,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Ce(t.collapsedSize,i[t.panelId]),a=Ce(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Pe().state!==`active`;_(i),o&&v(i)});return()=>{A.current=null,i(),l()}},[o,y,v,_,f,x,D]),(0,n.useEffect)(()=>{let e=A.current;e&&(e.mutableState.defaultLayout=i,e.mutableState.disableCursor=!!a)}),(0,t.jsx)(mt.Provider,{value:k,children:(0,t.jsx)(`div`,{...h,className:r,"data-group":!0,"data-testid":y,id:y,ref:w,style:{height:`100%`,width:`100%`,overflow:`hidden`,...m,display:`flex`,flexDirection:f===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:f===`horizontal`?`pan-y`:`pan-x`},children:e})})}gt.displayName=`Group`;function _t(){let e=(0,n.useContext)(mt);return D(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function vt(e,t){let{id:r}=_t(),i=(0,n.useRef)({collapse:Be,expand:Be,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Be});(0,n.useImperativeHandle)(t,()=>i.current,[]),ut(()=>{Object.assign(i.current,De({groupId:r,panelId:e}))})}function yt({children:e,className:r,collapsedSize:i=`0%`,collapsible:a=!1,defaultSize:o,disabled:s,elementRef:c,groupResizeBehavior:l=`preserve-relative-size`,id:u,maxSize:d=`100%`,minSize:f=`0%`,onResize:p,panelRef:m,style:h,...g}){let _=!!u,v=lt(u),y=pt({disabled:s}),b=(0,n.useRef)(null),x=ft(b,c),{getPanelStyles:S,id:C,orientation:w,registerPanel:T,updatePanelProps:E}=_t(),D=p!==null,O=dt((e,t,n)=>{p?.(e,u,n)});ut(()=>{let e=b.current;if(e!==null)return T({element:e,id:v,idIsStable:_,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?O:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:i,collapsible:a,defaultSize:o,disabled:y.disabled,maxSize:d,minSize:f}})},[l,i,a,o,D,v,_,d,f,O,T,y]),(0,n.useEffect)(()=>{E(v,{disabled:s})},[s,v,E]),vt(v,m);let k=()=>{let e=S(C,v);if(e)return JSON.stringify(e)},A=(0,n.useSyncExternalStore)(e=>le(C,e),k,k),j;return j=A?JSON.parse(A):o===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:o},(0,t.jsx)(`div`,{...g,"data-disabled":s||void 0,"data-panel":!0,"data-testid":v,id:v,ref:x,style:{...bt,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...j},children:(0,t.jsx)(`div`,{className:r,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...h,touchAction:w===`horizontal`?`pan-y`:`pan-x`},children:e})})}yt.displayName=`Panel`;var bt={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function xt({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=R({layout:Te({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=R({layout:Te({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function St({children:e,className:r,disabled:i,disableDoubleClick:a,elementRef:o,id:s,style:c,...l}){let u=lt(s),d=pt({disabled:i,disableDoubleClick:a}),[f,p]=(0,n.useState)({}),[m,h]=(0,n.useState)(`inactive`),[g,_]=(0,n.useState)(!1),v=(0,n.useRef)(null),y=ft(v,o),{disableCursor:b,id:x,orientation:S,registerSeparator:C,updateSeparatorProps:w}=_t(),T=S===`horizontal`?`vertical`:`horizontal`;ut(()=>{let e=v.current;if(e!==null){let t={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:e,id:u},n=C(t),r=Fe(e=>{h(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=le(x,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);p(xt({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[x,u,C,d]),(0,n.useEffect)(()=>{w(u,{disabled:i,disableDoubleClick:a})},[i,a,u,w]);let E;i&&!b&&(E=`not-allowed`);let D;if(i)D=`disabled`;else switch(m){case`active`:D=`active`;break;default:D=g?`focus`:m}return(0,t.jsx)(`div`,{...l,"aria-controls":f.valueControls,"aria-disabled":i||void 0,"aria-orientation":T,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:r,"data-separator":D,"data-testid":u,id:u,onBlur:()=>_(!1),onFocus:()=>_(!0),ref:y,role:`separator`,style:{flexBasis:`auto`,cursor:E,...c,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:i?void 0:0})}St.displayName=`Separator`;function Ct(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wt(e){if(Array.isArray(e))return e}function Tt(e,t,n){return(t=Pt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Dt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("use-sync-external-store/shim/index.js"),require("use-sync-external-store/shim/with-selector.js")):typeof define==`function`&&define.amd?define([`exports`,`react/jsx-runtime`,`react`,`react-dom`,`use-sync-external-store/shim/index.js`,`use-sync-external-store/shim/with-selector.js`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.PretextWebEditor={},e.React,e.React,e.ReactDOM,e.useSyncExternalStoreShim,e.useSyncExternalStoreShimWithSelector))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(e&&(t=e(e=0)),t),p=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),m=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:o(u(e)),h(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)),_=e=>d.call(e,`module.exports`)?e[`module.exports`]:h(s({},`__esModule`,{value:!0}),e);n=g(n,1),r=g(r,1);function v(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function y(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function b(e){return e/100*window.innerHeight}function x(e){return e/100*window.innerWidth}function S(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function C({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=S(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=y(t,i);break;case`em`:r=v(t,i);break;case`vh`:r=b(i);break;case`vw`:r=x(i);break}return r}function w(e){return parseFloat(e.toFixed(3))}function T({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function E(e){let{panels:t}=e,n=T({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=w(C({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=w(C({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=w(C({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=w(C({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function D(e,t=`Assertion error`){if(!e)throw Error(t)}function O(e,t){return Array.from(t).sort(e===`horizontal`?k:A)}function k(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function A(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function j(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function ee(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function te({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=ee(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return D(i,`No rect found`),i}var ne;function re(){return ne===void 0&&(ne=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),ne}function M(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=O(n,Array.from(t.children).filter(j).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,te({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=re()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:T({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var ie=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},ae=new Map,oe=new ie;function N(e){ae=new Map(ae),ae.delete(e)}function se(e,t){for(let[t]of ae)if(t.id===e)return t}function P(e,t){for(let[t,n]of ae)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ce(){return ae}function le(e,t){return oe.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ue(e,t){let n=ae.get(e);ae=new Map(ae),ae.set(e,t),oe.emit(`groupChange`,{group:e,prev:n,next:t})}function de(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=ee(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function F(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function fe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:_e(e),b:_e(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();D(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:I(ge(n.a)),b:I(ge(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var pe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function me(e){let t=getComputedStyle(ve(e)??e).display;return t===`flex`||t===`inline-flex`}function he(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||me(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||pe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ge(e){let t=e.length;for(;t--;){let n=e[t];if(D(n,`Missing node`),he(n))return n}return null}function I(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _e(e){let t=[];for(;e;)t.push(e),e=ve(e);return t}function ve(e){let{parentNode:t}=e;return F(t)?t.host:t}function ye(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function be({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!j(n)||n.contains(e)||e.contains(n))return!0;if(fe(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ye(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function xe(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=M(r),a=de(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&be({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Se(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ce(e,t,n=0){return Math.abs(w(e)-w(t))<=n}function L(e,t){return Ce(e,t)?0:e>t?1:-1}function we({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(L(r,c)<0)if(a){let e=(i+c)/2;r=L(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=w(r),r}function Te({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ce(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;D(u!=null,`Invalid first pivot index`),D(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];D(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(D(n!=null,`Previous layout not found for panel index ${t}`),Ce(n,i)){let t=o-n;L(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];D(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(D(n!=null,`Previous layout not found for panel index ${t}`),Ce(n,o)){let t=n-i;L(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];D(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&L(i,c)<0)if(e>0){let t=c-o,n=t/2;L(i+e,c)<0&&(e=L(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;L(i-e,c)<0&&(e=L(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];D(e!=null,`Previous layout not found for panel index ${r}`);let a=we({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];D(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=we({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ce(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Se(c,l))return i;{let t=e<0?d:u,r=s[t];D(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=we({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ce(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];D(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=we({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ce(i,s)||(t-=s-i,l[r]=s),Ce(t,0))break;e>0?r--:r++}}}if(!Ce(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Ee(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||L(e[n],t[n])!==0)return!1;return!0}function R({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Ce(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];D(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];D(i!=null,`No layout data found for index ${e}`);let o=r[e];D(o!=null,`No layout data found for index ${e}`);let s=we({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ce(a,0))for(let e=0;e<t.length;e++){let n=r[e];D(n!=null,`No layout data found for index ${e}`);let i=n+a,o=we({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ce(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function De({groupId:e,panelId:t}){let n=()=>{let t=ce();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Ce(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:w(100-e)}}return Te({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=R({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Ee(c,u)||ue(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Ce(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=T({group:t});s(w(C({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Oe(e){e.defaultPrevented||xe(e,ce()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=De({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ke(e){let t=ce();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function z({groupId:e}){let t=()=>{let t=ce();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=R({layout:e,panelConstraints:r});return n?o:(Ee(o,c)||ue(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Ae(e,t){let n=ke(e),r=P(n.id,!0),i=n.separators.find(t=>t.element===e);D(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);D(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=z({groupId:n.id}).getLayout(),c=R({layout:Te({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Ee(s,c)||ue(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function je(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ke(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Ae(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Ae(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Ae(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Ae(t,-5);break;case`End`:e.preventDefault(),Ae(t,100);break;case`Enter`:{e.preventDefault();let n=ke(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=P(n.id,!0),o=n.separators.find(e=>e.element===t);D(o,`Matching separator not found`);let s=a.get(o);D(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(D(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Ae(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ke(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);D(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Ae(t,-100);break}}var Me={cursorFlags:0,state:`inactive`},Ne=new ie;function Pe(){return Me}function Fe(e){return Ne.addListener(`change`,e)}function Ie(e){let t=Me,n={...Me};n.cursorFlags=e,Me=n,Ne.emit(`change`,{prev:t,next:n})}function Le(e){let t=Me;Me=e,Ne.emit(`change`,{prev:t,next:e})}function Re(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ce(),n=xe(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Le({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ze=e=>e,Be=()=>{},Ve=1,He=2,Ue=4,B=8,We=3,Ge=12,Ke;function V(){return Ke===void 0&&(Ke=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Ke=!0)),Ke}function qe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&V()){let t=(e&Ve)!==0,n=(e&He)!==0,r=(e&Ue)!==0,i=(e&B)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return V()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Je=new WeakMap;function Ye(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Je.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Pe();switch(r.state){case`active`:case`hover`:{let e=qe({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Je.set(e,{prevStyle:t,styleSheet:n})}function Xe({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Te({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Ee(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ve:He;break;case`vertical`:s|=d<0?Ue:B;break}}else ue(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&We:c|=s&We,t.movementY===0?c|=o&Ge:c|=s&Ge,Ie(c),Ye(e)}function Ze(e){let t=ce(),n=Pe();switch(n.state){case`active`:Xe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Qe(e){if(e.defaultPrevented)return;let t=Pe(),n=ce();switch(t.state){case`active`:if(e.buttons===0){Le({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=P(e.group.id,!0);ue(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Xe({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=xe(e,n);r.length===0?t.state!==`inactive`&&Le({cursorFlags:0,state:`inactive`}):Le({cursorFlags:0,hitRegions:r,state:`hover`}),Ye(e.currentTarget);break}}}function $e(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Pe().state){case`hover`:Le({cursorFlags:0,state:`inactive`})}}function et(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Pe();switch(t.state){case`active`:Le({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ye(e.currentTarget),t.hitRegions.forEach(e=>{let t=P(e.group.id,!0);ue(e.group,t)}),e.preventDefault())}}function tt(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=w(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=w((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function nt(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=T({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:w(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function rt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function it({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=w(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=w((r[e]??0)/a*l);else{let e=w(l/c.length);for(let t of c)u[t]=e}return u}function at(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ot=new Map;function st(e){let t=!0;D(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=T({group:e});if(t===0)return;let n=P(e.id);if(!n)return;let r=E(e),i=n.defaultLayoutDeferred?tt(r):n.layout,a=R({layout:it({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Ee(n.layout,a)&&rt(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ue(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else nt(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{D(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=T({group:e}),s=E(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(at(e.panels,l)||(l=void 0));let u=R({layout:e.mutableState.layouts[c]??l??tt(s),panelConstraints:s}),d=e.element.ownerDocument;ot.set(d,(ot.get(d)??0)+1);let f=new Map;return M(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ue(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{D(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,je)}),ot.get(d)===1&&(d.addEventListener(`dblclick`,Oe,!0),d.addEventListener(`pointerdown`,Re,!0),d.addEventListener(`pointerleave`,Ze),d.addEventListener(`pointermove`,Qe),d.addEventListener(`pointerout`,$e),d.addEventListener(`pointerup`,et,!0)),function(){t=!1,ot.set(d,Math.max(0,(ot.get(d)??0)-1)),N(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,je)}),ot.get(d)||(d.removeEventListener(`dblclick`,Oe,!0),d.removeEventListener(`pointerdown`,Re,!0),d.removeEventListener(`pointerleave`,Ze),d.removeEventListener(`pointermove`,Qe),d.removeEventListener(`pointerout`,$e),d.removeEventListener(`pointerup`,et,!0)),a.disconnect()}}function ct(){let[e,t]=(0,n.useState)({});return[e,(0,n.useCallback)(()=>t({}),[])]}function lt(e){let t=(0,n.useId)();return`${e??t}`}var ut=typeof window<`u`?n.useLayoutEffect:n.useEffect;function dt(e){let t=(0,n.useRef)(e);return ut(()=>{t.current=e},[e]),(0,n.useCallback)((...e)=>t.current?.(...e),[t])}function ft(...e){return dt(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function pt(e){let t=(0,n.useRef)({...e});return ut(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var mt=(0,n.createContext)(null);function ht(e,t){let r=(0,n.useRef)({getLayout:()=>({}),setLayout:ze});(0,n.useImperativeHandle)(t,()=>r.current,[]),ut(()=>{Object.assign(r.current,z({groupId:e}))})}function gt({children:e,className:r,defaultLayout:i,disableCursor:a,disabled:o,elementRef:s,groupRef:c,id:l,onLayoutChange:u,onLayoutChanged:d,orientation:f=`horizontal`,resizeTargetMinimumSize:p={coarse:20,fine:10},style:m,...h}){let g=(0,n.useRef)({onLayoutChange:{},onLayoutChanged:{}}),_=dt(e=>{Ee(g.current.onLayoutChange,e)||(g.current.onLayoutChange=e,u?.(e))}),v=dt(e=>{Ee(g.current.onLayoutChanged,e)||(g.current.onLayoutChanged=e,d?.(e))}),y=lt(l),b=(0,n.useRef)(null),[x,S]=ct(),C=(0,n.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),w=ft(b,s);ht(y,c);let T=dt((e,t)=>{let n=Pe(),r=se(e),a=P(e);if(a){let e=!1;switch(n.state){case`active`:e=n.hitRegions.some(e=>e.group===r);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(i?.[t])return{flexGrow:i?.[t]}}),D=pt({defaultLayout:i,disableCursor:a}),k=(0,n.useMemo)(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:T,id:y,orientation:f,registerPanel:e=>{let t=C.current;return t.panels=O(f,[...t.panels,e]),S(),()=>{t.panels=t.panels.filter(t=>t!==e),S()}},registerSeparator:e=>{let t=C.current;return t.separators=O(f,[...t.separators,e]),S(),()=>{t.separators=t.separators.filter(t=>t!==e),S()}},updatePanelProps:(e,{disabled:t})=>{let n=C.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=se(y),i=P(y);r&&i&&ue(r,{...i,derivedPanelConstraints:E(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=C.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[T,y,S,f,D]),A=(0,n.useRef)(null);return ut(()=>{let e=b.current;if(e===null)return;let t=C.current,n;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=D.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!o,element:e,id:y,mutableState:{defaultLayout:n,disableCursor:!!D.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:f,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};A.current=r;let i=st(r),{defaultLayoutDeferred:a,derivedPanelConstraints:s,layout:c}=P(r.id,!0);!a&&s.length>0&&(_(c),v(c));let l=le(y,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Ce(t.collapsedSize,i[t.panelId]),a=Ce(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Pe().state!==`active`;_(i),o&&v(i)});return()=>{A.current=null,i(),l()}},[o,y,v,_,f,x,D]),(0,n.useEffect)(()=>{let e=A.current;e&&(e.mutableState.defaultLayout=i,e.mutableState.disableCursor=!!a)}),(0,t.jsx)(mt.Provider,{value:k,children:(0,t.jsx)(`div`,{...h,className:r,"data-group":!0,"data-testid":y,id:y,ref:w,style:{height:`100%`,width:`100%`,overflow:`hidden`,...m,display:`flex`,flexDirection:f===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:f===`horizontal`?`pan-y`:`pan-x`},children:e})})}gt.displayName=`Group`;function _t(){let e=(0,n.useContext)(mt);return D(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function vt(e,t){let{id:r}=_t(),i=(0,n.useRef)({collapse:Be,expand:Be,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Be});(0,n.useImperativeHandle)(t,()=>i.current,[]),ut(()=>{Object.assign(i.current,De({groupId:r,panelId:e}))})}function yt({children:e,className:r,collapsedSize:i=`0%`,collapsible:a=!1,defaultSize:o,disabled:s,elementRef:c,groupResizeBehavior:l=`preserve-relative-size`,id:u,maxSize:d=`100%`,minSize:f=`0%`,onResize:p,panelRef:m,style:h,...g}){let _=!!u,v=lt(u),y=pt({disabled:s}),b=(0,n.useRef)(null),x=ft(b,c),{getPanelStyles:S,id:C,orientation:w,registerPanel:T,updatePanelProps:E}=_t(),D=p!==null,O=dt((e,t,n)=>{p?.(e,u,n)});ut(()=>{let e=b.current;if(e!==null)return T({element:e,id:v,idIsStable:_,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?O:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:i,collapsible:a,defaultSize:o,disabled:y.disabled,maxSize:d,minSize:f}})},[l,i,a,o,D,v,_,d,f,O,T,y]),(0,n.useEffect)(()=>{E(v,{disabled:s})},[s,v,E]),vt(v,m);let k=()=>{let e=S(C,v);if(e)return JSON.stringify(e)},A=(0,n.useSyncExternalStore)(e=>le(C,e),k,k),j;return j=A?JSON.parse(A):o===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:o},(0,t.jsx)(`div`,{...g,"data-disabled":s||void 0,"data-panel":!0,"data-testid":v,id:v,ref:x,style:{...bt,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...j},children:(0,t.jsx)(`div`,{className:r,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...h,touchAction:w===`horizontal`?`pan-y`:`pan-x`},children:e})})}yt.displayName=`Panel`;var bt={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function xt({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=R({layout:Te({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=R({layout:Te({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function St({children:e,className:r,disabled:i,disableDoubleClick:a,elementRef:o,id:s,style:c,...l}){let u=lt(s),d=pt({disabled:i,disableDoubleClick:a}),[f,p]=(0,n.useState)({}),[m,h]=(0,n.useState)(`inactive`),[g,_]=(0,n.useState)(!1),v=(0,n.useRef)(null),y=ft(v,o),{disableCursor:b,id:x,orientation:S,registerSeparator:C,updateSeparatorProps:w}=_t(),T=S===`horizontal`?`vertical`:`horizontal`;ut(()=>{let e=v.current;if(e!==null){let t={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:e,id:u},n=C(t),r=Fe(e=>{h(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=le(x,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);p(xt({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[x,u,C,d]),(0,n.useEffect)(()=>{w(u,{disabled:i,disableDoubleClick:a})},[i,a,u,w]);let E;i&&!b&&(E=`not-allowed`);let D;if(i)D=`disabled`;else switch(m){case`active`:D=`active`;break;default:D=g?`focus`:m}return(0,t.jsx)(`div`,{...l,"aria-controls":f.valueControls,"aria-disabled":i||void 0,"aria-orientation":T,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:r,"data-separator":D,"data-testid":u,id:u,onBlur:()=>_(!1),onFocus:()=>_(!0),ref:y,role:`separator`,style:{flexBasis:`auto`,cursor:E,...c,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:i?void 0:0})}St.displayName=`Separator`;function Ct(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wt(e){if(Array.isArray(e))return e}function Tt(e,t,n){return(t=Pt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Dt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ot(Object(n),!0).forEach(function(t){Tt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function At(e,t){if(e==null)return{};var n,r,i=jt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function jt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Mt(e,t){return wt(e)||Et(e,t)||Ft(e,t)||Dt()}function Nt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Pt(e){var t=Nt(e,`string`);return typeof t==`symbol`?t:t+``}function Ft(e,t){if(e){if(typeof e==`string`)return Ct(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}function It(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Lt(Object(n),!0).forEach(function(t){It(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zt(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}function Bt(e){return function t(){for(var n=this,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];return t.apply(n,[].concat(i,r))}}}function Vt(e){return{}.toString.call(e).includes(`Object`)}function Ht(e){return!Object.keys(e).length}function Ut(e){return typeof e==`function`}function Wt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Gt(e,t){return Vt(t)||Xt(`changeType`),Object.keys(t).some(function(t){return!Wt(e,t)})&&Xt(`changeField`),t}function Kt(e){Ut(e)||Xt(`selectorType`)}function qt(e){Ut(e)||Vt(e)||Xt(`handlerType`),Vt(e)&&Object.values(e).some(function(e){return!Ut(e)})&&Xt(`handlersType`)}function Jt(e){e||Xt(`initialIsRequired`),Vt(e)||Xt(`initialType`),Ht(e)&&Xt(`initialContent`)}function Yt(e,t){throw Error(e[t]||e.default)}var Xt=Bt(Yt)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),Zt={changes:Gt,selector:Kt,handler:qt,initial:Jt};function Qt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Zt.initial(e),Zt.handler(t);var n={current:e},r=Bt(tn)(n,t),i=Bt(en)(n),a=Bt(Zt.changes)(e),o=Bt($t)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return Zt.selector(e),e(n.current)}function c(e){zt(r,i,a,o)(e)}return[s,c]}function $t(e,t){return Ut(t)?t(e.current):t}function en(e,t){return e.current=Rt(Rt({},e.current),t),t}function tn(e,t,n){return Ut(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var nn={create:Qt},rn={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function an(e){return function t(){for(var n=this,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];return t.apply(n,[].concat(i,r))}}}function on(e){return{}.toString.call(e).includes(`Object`)}function sn(e){return e||dn(`configIsRequired`),on(e)||dn(`configType`),e.urls?(cn(),{paths:{vs:e.urls.monacoBase}}):e}function cn(){console.warn(un.deprecation)}function ln(e,t){throw Error(e[t]||e.default)}var un={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|
|
@@ -1048,37 +1048,37 @@ Expected it to be ${r}.`}var QU=class extends Error{name=`InvalidDocError`;const
|
|
|
1048
1048
|
`,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=y0(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=v0(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;v0(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
|
|
1049
1049
|
`),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
|
|
1050
1050
|
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(Z1.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&$1.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&&$1.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&&e0.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&uY(n,a)>uY(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
|
|
1051
|
-
`,`\r`];return e+`=`+s+eY(n,{subset:c})+s}}function r0(e){o0.call(this,`containerDirective`,e)}function i0(e){o0.call(this,`leafDirective`,e)}function a0(e){o0.call(this,`textDirective`,e)}function o0(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function s0(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function c0(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function l0(e){this.exit(e)}function u0(){this.data.directiveAttributes=[],this.buffer()}function d0(e){this.data.directiveAttributes.push([`id`,L1(this.sliceSerialize(e),{attribute:!0})])}function f0(e){this.data.directiveAttributes.push([`class`,L1(this.sliceSerialize(e),{attribute:!0})])}function p0(e){let t=this.data.directiveAttributes;t[t.length-1][1]=L1(this.sliceSerialize(e),{attribute:!0})}function m0(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function h0(){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 g0(e){this.exit(e)}function _0(){return`:`}function v0(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function y0(e){let t=0;return e.type===`containerDirective`?(Y1(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 b0(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&&eQ(t)?iQ(e,v,`whitespace`)(t):!m&&$Z(t)?$Q(e,v)(t):t===null||QZ(t)||nQ(t)||tQ(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||$Z(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||$Z(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||QZ(t)||nQ(t)||tQ(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&eQ(t)?iQ(e,C,`whitespace`)(t):!m&&$Z(t)?$Q(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&&QZ(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&eQ(t)?iQ(e,w,`whitespace`)(t):!m&&$Z(t)?$Q(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||$Z(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):QZ(t)?m?n(t):$Q(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||QZ(t)?(e.exit(p),D(t)):(e.consume(t),O)}function k(e){return e===125||$Z(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 x0(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)):QZ(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 S0(e,t,n,r){let i=this;return a;function a(t){return t===null||QZ(t)||tQ(t)||nQ(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||QZ(a)||nQ(a)||tQ(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var C0={tokenize:D0,concrete:!0},w0={tokenize:O0,partial:!0},T0={tokenize:k0,partial:!0},E0={tokenize:A0,partial:!0};function D0(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`),S0.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(w0,d,d)(t):d(t)}function d(t){return t===123?e.attempt(T0,f,f)(t):f(t)}function f(t){return iQ(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):QZ(i)?r.interrupt?t(i):e.attempt(E0,m,C)(i):n(i)}function m(t){return t===null?C(t):QZ(t)?e.check(E0,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?iQ(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):QZ(t)?e.check(E0,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 QZ(t)?e.check(E0,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 iQ(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`),iQ(e,c,`whitespace`)(t))}function c(r){return r===null||QZ(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function O0(e,t,n){return x0(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function k0(e,t,n){return b0(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function A0(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 j0={tokenize:P0},M0={tokenize:F0,partial:!0},N0={tokenize:I0,partial:!0};function P0(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`),S0.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(M0,s,s)(t):s(t)}function s(t){return t===123?e.attempt(N0,c,c)(t):c(t)}function c(t){return iQ(e,l,`whitespace`)(t)}function l(r){return r===null||QZ(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function F0(e,t,n){return x0(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function I0(e,t,n){return b0(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var L0={tokenize:V0,previous:B0},R0={tokenize:H0,partial:!0},z0={tokenize:U0,partial:!0};function B0(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function V0(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),S0.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(R0,o,o)(t):o(t)}function o(t){return t===123?e.attempt(z0,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function H0(e,t,n){return x0(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function U0(e,t,n){return b0(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function W0(){return{text:{58:L0},flow:{58:[C0,j0]}}}function G0(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(W0()),n.push(t0()),r.push(n0())}function K0(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),Y1(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)}}var q0={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 J0(e){return q0[e.toLowerCase()]}var Y0=new Set(Object.entries(q0).filter(([e,t])=>t.category===`proof-like`||t.category===`solution-like`).map(([e])=>e));function X0(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function Z0(e){return e.type===`containerDirective`&&e.name===`task`}function Q0(e){return e.type===`containerDirective`&&Y0.has(e.name)}function $0(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(X0(`p`,[n])):t.push(n);return t}function e2(e,t,n,r,i,a,o){let s=[];if(n&&s.push(n),e.hasNestedTasks){let t=r.findIndex(Z0);if(t!==-1){let n=[];for(let e=0;e<r.length;e++)Z0(r[e])&&n.push(e);let c=n[n.length-1],l=r.slice(0,t),u=r.slice(t).filter(Z0),d=[],f=[],p=[];for(let e=t;e<r.length;e++){let t=r[e];if(!Z0(t)){if(e<c){d.push(t);continue}if(Q0(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=$0(l.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(X0(`introduction`,e))}for(let e of u){let t=o(e,i);t&&s.push(t)}if(f.length>0){let e=$0(f.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(X0(`conclusion`,e))}for(let e of p){let t=o(e,i);t&&s.push(t)}}else t2(s,e,r,i,a,o)}else t2(s,e,r,i,a,o);return X0(e.type,s,t)}function t2(e,t,n,r,i,a){if(t.requiresStatement){let t=[],o=[];for(let e of n)if(e.type===`containerDirective`&&Y0.has(e.name)){let t=a(e,r);t&&o.push(t)}else t.push(e);if(t.length>0){let n=$0(t.map(e=>i(e,r)).filter(e=>e!==null));n.length>0&&e.push(X0(`statement`,n))}e.push(...o)}else{let t=$0(n.map(e=>i(e,r)).filter(e=>e!==null));e.push(...t)}}function n2(e){return{type:`text`,value:e}}function r2(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function i2(e,t,n){return r2(e,[n2(t)],n)}function a2(e){return{type:`comment`,value:e.replace(/--/g,`- -`)}}function o2(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 s2(e,t,n){return r2(`TODO`,[a2(`todo: ${t}`),i2(`pre`,n)],{type:e})}function c2(e,t,n){return r2(`TODO`,[a2(`todo: ${t}`),i2(`c`,n)],{type:e})}function l2(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(r2(`p`,[n])):t.push(n);return t}function u2(e,t){return d2(e,t).tree}function d2(e,t){let n=[],r={ancestors:[],depth:0,messages:n,source:t},i=e.children;return{tree:{type:`root`,children:m2(i,r)},messages:n}}var f2=[`chapter`,`section`,`subsection`,`subsubsection`,`paragraphs`];function p2(e){return f2[Math.min(e-1,f2.length-1)]}function m2(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 h2(e,t,n);let i=[],a=null,o=[],s=[],c=()=>{a&&(i.push(g2(a,s,t)),a=null,s=[])};for(let l of e)l.type===`heading`&&l.depth===r?(!a&&o.length>0&&(i.push(...h2(o,t,n)),o=[]),c(),a=l,s=[]):a?s.push(l):o.push(l);return!a&&o.length>0&&i.push(...h2(o,t,n)),c(),i}function h2(e,t,n=!1){let r=[];for(let n=0;n<e.length;n+=1){let i=e[n],a=y2(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?y2(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(r2(`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?l2(r):r}function g2(e,t,n){let r=p2(e.depth),i=r2(`title`,M2(e.children,n)),a=_2(e);return r2(r,[i,...l2(m2(t,{...n,depth:n.depth+1},!0))],a)}function _2(e){let t=e.data;return t?.id?{"xml:id":t.id}:void 0}var v2={paragraph:(e,t)=>b2(e,t),blockquote:(e,t)=>x2(e,t),list:(e,t)=>S2(e,t),code:(e,t)=>w2(e),containerDirective:(e,t)=>D2(e,t)};function y2(e,t){let n=v2[e.type];return n?n(e,t):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown block type: ${e.type}`,category:`unknown-block-type`}),s2(`unknown-block-type`,`unknown block type "${e.type}"`,o2(e,t)))}function b2(e,t){return r2(`p`,M2(e.children,t))}function x2(e,t){return r2(`blockquote`,e.children.filter(e=>e.type===`paragraph`).map(n=>b2(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1})))}function S2(e,t){let n=e.children.map(n=>C2(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1}));return r2(e.ordered?`ol`:`ul`,n)}function C2(e,t){return r2(`li`,h2(e.children,t))}function w2(e,t){return i2(`program`,e.value,e.lang?{language:e.lang}:void 0)}function T2(e,t){let n=e.value.split(/\\\\|[\r\n]+/).map(e=>e.trim()).filter(e=>e.length>0);return n.length>1?r2(`md`,n.map(e=>i2(`mrow`,e))):i2(`md`,n[0]??``)}function E2(e,t){return e.meta===`inline`?i2(`m`,e.value):T2(e)}function D2(e,t){let n=J0(e.name);if(!n)return t.messages&&t.messages.push({type:`warning`,reason:`Unknown directive: ${e.name}`,category:`unknown-directive`}),s2(`unknown-directive`,`unknown directive "${e.name}"`,o2(e,t));let r=k2(e),i=e.children,{title:a,body:o}=O2(i,t);return e2(n,r,a,o,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1},(e,t)=>y2(e,t),(e,t)=>D2(e,t))}function O2(e,t){let n=e[0];return n?.type===`paragraph`&&n.data?.directiveLabel===!0?{title:r2(`title`,M2(n.children,t)),body:e.slice(1)}:{title:null,body:e}}function k2(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 A2(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 j2={text:(e,t)=>n2(e.value),emphasis:(e,t)=>r2(A2(e,t.source)===`underscore`?`term`:`em`,M2(e.children,t)),strong:(e,t)=>r2(`alert`,M2(e.children,t)),inlineCode:(e,t)=>i2(`c`,e.value),math:(e,t)=>E2(e)};function M2(e,t){return e.flatMap(e=>N2(e,t)).filter(e=>e!==null)}function N2(e,t){let n=j2[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`}),c2(`unknown-inline-type`,`unknown inline type "${e.type}"`,o2(e,t)))}var P2=[{open:`$$`,close:`$$`,isDisplay:!0},{open:`\\[`,close:`\\]`,isDisplay:!0},{open:`$`,close:`$`,isDisplay:!1},{open:`\\(`,close:`\\)`,isDisplay:!1}],F2=`PTX_MATH_TOKEN_`,I2=RegExp(`${F2}(\\d+)`,`g`);function L2(e,t){let n=null;for(let r of P2){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 R2(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 z2(e){let t=new Map,n=``,r=0,i=0;for(;r<e.length;){let a=R2(e,r),o=L2(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=`${F2}${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 B2(e){let t=[],n=0;for(;n<e.length;){let r=L2(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 V2(e,t){let n=[],r=0;I2.lastIndex=0;let i=I2.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=I2.exec(e)}return r<e.length&&n.push({type:`text`,value:e.substring(r)}),n.length===0?[{type:`text`,value:e}]:n}function H2(e){K0(e,`paragraph`,e=>{let t=e.children||[],n=[];for(let e of t)if(e.type===`text`){let t=B2(e.value);n.push(...t)}else n.push(e);e.children=n})}function U2(e,t){K0(e,`paragraph`,e=>{let n=e.children||[],r=[];for(let e of n)if(e.type===`text`){let n=V2(e.value,t);r.push(...n)}else r.push(e);e.children=r})}function W2(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 G2(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 K2(e){if(e.children.length===0)e.finalColons=e.colons;else{let t=Math.max(...e.children.map(K2));e.finalColons=Math.max(e.colons,t+1)}return e.finalColons}function q2(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 J2(e){let t=e.split(`
|
|
1052
|
-
`),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=
|
|
1053
|
-
`)}function
|
|
1054
|
-
`),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=
|
|
1055
|
-
`)}var
|
|
1056
|
-
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function b4(e){return p4(e,y4)}function x4(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 S4(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;x4(n,r)>x4(n,e)&&(r=e)}return r+p4(n,[`<`,`&`,r])+r}function C4(e,t){let n=b4(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+S4(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+S4(i,t)),a+`>`}var w4={}.hasOwnProperty;function T4(e,t){let n=b4(e.name),r=F4(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(w4.call(i,s)){let e=i[s];e!=null&&o.push(b4(s)+`=`+S4(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var E4=/\?>/g,D4=[`>`];function O4(e){let t=b4(e.name)||`x`,n=p4(e.value,D4,E4);return`<?`+t+(n?` `+n:``)+`?>`}var k4=[`&`,`<`];function A4(e){return p4(e.value,k4)}function j4(e,t){return t.options.allowDangerousXml?e.value:A4(e)}var M4={}.hasOwnProperty,N4={cdata:_4,comment:v4,doctype:C4,element:T4,instruction:O4,raw:j4,root:F4,text:A4};function P4(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!M4.call(N4,n))throw Error("Cannot compile unknown node `"+n+"`");let r=N4[n];return r(e,t)}function F4(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=P4(n[r],t);return i.join(``)}function I4(e,t){let n={options:{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return P4(Array.isArray(e)?{type:`root`,children:e}:e,n)}function L4(e){let t=bZ().use(A1).use(G0).use(t4),n=t.parse(e);return I4(t.runSync(n,{value:e}).children)}var R4=[`\\documentclass`,`\\begin{document}`,`\\begin{`,`\\section`,`\\chapter`,`\\title`,`\\author`],z4=[`# `,`## `,`### `,`#### `];function B4(e){let t=e.trim();return!t||t.startsWith(`<`)?`pretext`:R4.some(e=>t.includes(e))?`latex`:z4.some(e=>t.startsWith(e))?`markdown`:`pretext`}function V4(e){let t=e.trim();if(!t)return``;let n=String(QX(t)).trim();return n?ss(n):``}function H4(e){let t=e.trim();if(!t)return``;let n=String(L4(t)).trim();return n?ss(n):``}function U4(e){return e instanceof Error&&e.message.trim()?e.message.trim():`Could not convert LaTeX to PreTeXt.`}function W4(e,t){if(t===`pretext`)return{pretextSource:e};if(t===`markdown`)try{return{pretextSource:H4(e)}}catch(e){return{pretextError:U4(e)}}try{return{pretextSource:V4(e)}}catch(e){return{pretextError:U4(e)}}}var G4=()=>typeof window>`u`?void 0:window.location.href||void 0,K4=({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()||G4(),[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]})},q4=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},J4=(e=>e?q4(e):q4),Y4=e=>e;function X4(e,t=Y4){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 Z4=(0,n.createContext)(null);function Q4(e){let t=(0,n.useContext)(Z4);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return X4(t,e)}var $4=({label:e,context:n,className:r})=>{let i=Q4(e=>e.hasFeedback),a=Q4(e=>e.projectUrl),o=Q4(e=>e.source),s=Q4(e=>e.sourceFormat),c=Q4(e=>e.title),l=Q4(e=>e.feedbackSubmit);return i?(0,t.jsx)(K4,{label:e,context:n,className:r,projectUrl:a,currentSource:o,sourceFormat:s,title:c,onSubmit:l}):null},e3=({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(V4(e)),u(`idle`)}catch(e){console.error(`Error converting LaTeX:`,e),alert(U4(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)($4,{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`})]})]})})},t3={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},n3={latex:`LaTeX`,markdown:`Markdown`,pretext:`PreTeXt`},r3={latex:`latex`,markdown:`markdown`,pretext:`xml`},i3=({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=n3[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:t3,height:`100%`,language:r3[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:t3,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`})]})]})})},a3={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},o3={...a3,language:`xml`},s3=(e,t)=>e.querySelector(t)?.textContent??``,c3=(e,t)=>{let n=new XMLSerializer;return Array.from(e.documentElement.children).filter(e=>!t.includes(e.tagName)).map(e=>n.serializeToString(e)).join(`
|
|
1057
|
-
`)},
|
|
1051
|
+
`,`\r`];return e+`=`+s+eY(n,{subset:c})+s}}function r0(e){o0.call(this,`containerDirective`,e)}function i0(e){o0.call(this,`leafDirective`,e)}function a0(e){o0.call(this,`textDirective`,e)}function o0(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function s0(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function c0(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function l0(e){this.exit(e)}function u0(){this.data.directiveAttributes=[],this.buffer()}function d0(e){this.data.directiveAttributes.push([`id`,L1(this.sliceSerialize(e),{attribute:!0})])}function f0(e){this.data.directiveAttributes.push([`class`,L1(this.sliceSerialize(e),{attribute:!0})])}function p0(e){let t=this.data.directiveAttributes;t[t.length-1][1]=L1(this.sliceSerialize(e),{attribute:!0})}function m0(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function h0(){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 g0(e){this.exit(e)}function _0(){return`:`}function v0(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function y0(e){let t=0;return e.type===`containerDirective`?(Y1(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 b0(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&&eQ(t)?iQ(e,v,`whitespace`)(t):!m&&$Z(t)?$Q(e,v)(t):t===null||QZ(t)||nQ(t)||tQ(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||$Z(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||$Z(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||QZ(t)||nQ(t)||tQ(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&eQ(t)?iQ(e,C,`whitespace`)(t):!m&&$Z(t)?$Q(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&&QZ(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&eQ(t)?iQ(e,w,`whitespace`)(t):!m&&$Z(t)?$Q(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||$Z(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):QZ(t)?m?n(t):$Q(e,D)(t):(e.enter(p),e.consume(t),O)}function O(t){return t===g||t===null||QZ(t)?(e.exit(p),D(t)):(e.consume(t),O)}function k(e){return e===125||$Z(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 x0(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)):QZ(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 S0(e,t,n,r){let i=this;return a;function a(t){return t===null||QZ(t)||tQ(t)||nQ(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||QZ(a)||nQ(a)||tQ(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var C0={tokenize:D0,concrete:!0},w0={tokenize:O0,partial:!0},T0={tokenize:k0,partial:!0},E0={tokenize:A0,partial:!0};function D0(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`),S0.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(w0,d,d)(t):d(t)}function d(t){return t===123?e.attempt(T0,f,f)(t):f(t)}function f(t){return iQ(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):QZ(i)?r.interrupt?t(i):e.attempt(E0,m,C)(i):n(i)}function m(t){return t===null?C(t):QZ(t)?e.check(E0,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?iQ(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):QZ(t)?e.check(E0,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 QZ(t)?e.check(E0,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 iQ(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`),iQ(e,c,`whitespace`)(t))}function c(r){return r===null||QZ(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function O0(e,t,n){return x0(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function k0(e,t,n){return b0(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function A0(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 j0={tokenize:P0},M0={tokenize:F0,partial:!0},N0={tokenize:I0,partial:!0};function P0(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`),S0.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(M0,s,s)(t):s(t)}function s(t){return t===123?e.attempt(N0,c,c)(t):c(t)}function c(t){return iQ(e,l,`whitespace`)(t)}function l(r){return r===null||QZ(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function F0(e,t,n){return x0(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function I0(e,t,n){return b0(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var L0={tokenize:V0,previous:B0},R0={tokenize:H0,partial:!0},z0={tokenize:U0,partial:!0};function B0(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function V0(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),S0.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(R0,o,o)(t):o(t)}function o(t){return t===123?e.attempt(z0,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function H0(e,t,n){return x0(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function U0(e,t,n){return b0(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function W0(){return{text:{58:L0},flow:{58:[C0,j0]}}}function G0(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(W0()),n.push(t0()),r.push(n0())}var K0={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:[]}},q0=[],J0=Object.freeze(Object.keys(K0));new Set(J0),new Set(q0);var Y0=[`part`,`chapter`,`section`,`subsection`,`subsubsection`,`paragraphs`];function X0(e){return Y0.includes(e)}function Z0(e,t){let n=Y0.indexOf(e)+(t-1);return Y0[Math.min(n,Y0.length-1)]}function Q0(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),Y1(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)}}var $0={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 e2(e){return $0[e.toLowerCase()]}var t2=new Set(Object.entries($0).filter(([e,t])=>t.category===`proof-like`||t.category===`solution-like`).map(([e])=>e));function n2(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function r2(e){return e.type===`containerDirective`&&e.name===`task`}function i2(e){return e.type===`containerDirective`&&t2.has(e.name)}function a2(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(n2(`p`,[n])):t.push(n);return t}function o2(e,t,n,r,i,a,o){let s=[];if(n&&s.push(n),e.hasNestedTasks){let t=r.findIndex(r2);if(t!==-1){let n=[];for(let e=0;e<r.length;e++)r2(r[e])&&n.push(e);let c=n[n.length-1],l=r.slice(0,t),u=r.slice(t).filter(r2),d=[],f=[],p=[];for(let e=t;e<r.length;e++){let t=r[e];if(!r2(t)){if(e<c){d.push(t);continue}if(i2(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=a2(l.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(n2(`introduction`,e))}for(let e of u){let t=o(e,i);t&&s.push(t)}if(f.length>0){let e=a2(f.map(e=>a(e,i)).filter(e=>e!==null));e.length>0&&s.push(n2(`conclusion`,e))}for(let e of p){let t=o(e,i);t&&s.push(t)}}else s2(s,e,r,i,a,o)}else s2(s,e,r,i,a,o);return n2(e.type,s,t)}function s2(e,t,n,r,i,a){if(t.requiresStatement){let t=[],o=[];for(let e of n)if(e.type===`containerDirective`&&t2.has(e.name)){let t=a(e,r);t&&o.push(t)}else t.push(e);if(t.length>0){let n=a2(t.map(e=>i(e,r)).filter(e=>e!==null));n.length>0&&e.push(n2(`statement`,n))}e.push(...o)}else{let t=a2(n.map(e=>i(e,r)).filter(e=>e!==null));e.push(...t)}}function c2(e){return{type:`text`,value:e}}function l2(e,t,n){return{type:`element`,name:e,attributes:n??{},children:t}}function u2(e,t,n){return l2(e,[c2(t)],n)}function d2(e){return{type:`comment`,value:e.replace(/--/g,`- -`)}}function f2(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 p2(e,t,n){return l2(`TODO`,[d2(`todo: ${t}`),u2(`pre`,n)],{type:e})}function m2(e,t,n){return l2(`TODO`,[d2(`todo: ${t}`),u2(`c`,n)],{type:e})}function h2(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(l2(`p`,[n])):t.push(n);return t}function g2(e,t,n){return _2(e,t,n).tree}function _2(e,t,n){let r=[],i={ancestors:[],depth:0,messages:r,source:t,topLevelDivision:n?.topLevelDivision??`chapter`},a=e.children;return{tree:{type:`root`,children:v2(a,i)},messages:r}}function v2(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 y2(e,t,n);let i=[],a=null,o=[],s=[],c=()=>{a&&(i.push(b2(a,s,t)),a=null,s=[])};for(let l of e)l.type===`heading`&&l.depth===r?(!a&&o.length>0&&(i.push(...y2(o,t,n)),o=[]),c(),a=l,s=[]):a?s.push(l):o.push(l);return!a&&o.length>0&&i.push(...y2(o,t,n)),c(),i}function y2(e,t,n=!1){let r=[];for(let n=0;n<e.length;n+=1){let i=e[n],a=C2(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?C2(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(l2(`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?h2(r):r}function b2(e,t,n){let r=Z0(n.topLevelDivision,e.depth),i=l2(`title`,I2(e.children,n)),a=x2(e);return l2(r,[i,...h2(v2(t,{...n,depth:n.depth+1},!0))],a)}function x2(e){let t=e.data;return t?.id?{"xml:id":t.id}:void 0}var S2={paragraph:(e,t)=>w2(e,t),blockquote:(e,t)=>T2(e,t),list:(e,t)=>E2(e,t),code:(e,t)=>O2(e),containerDirective:(e,t)=>j2(e,t)};function C2(e,t){let n=S2[e.type];return n?n(e,t):(t.messages&&t.messages.push({type:`warning`,reason:`Unknown block type: ${e.type}`,category:`unknown-block-type`}),p2(`unknown-block-type`,`unknown block type "${e.type}"`,f2(e,t)))}function w2(e,t){return l2(`p`,I2(e.children,t))}function T2(e,t){return l2(`blockquote`,e.children.filter(e=>e.type===`paragraph`).map(n=>w2(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1})))}function E2(e,t){let n=e.children.map(n=>D2(n,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1}));return l2(e.ordered?`ol`:`ul`,n)}function D2(e,t){return l2(`li`,y2(e.children,t))}function O2(e,t){return u2(`program`,e.value,e.lang?{language:e.lang}:void 0)}function k2(e,t){let n=e.value.split(/\\\\|[\r\n]+/).map(e=>e.trim()).filter(e=>e.length>0);return n.length>1?l2(`md`,n.map(e=>u2(`mrow`,e))):u2(`md`,n[0]??``)}function A2(e,t){return e.meta===`inline`?u2(`m`,e.value):k2(e)}function j2(e,t){let n=e2(e.name);if(!n)return t.messages&&t.messages.push({type:`warning`,reason:`Unknown directive: ${e.name}`,category:`unknown-directive`}),p2(`unknown-directive`,`unknown directive "${e.name}"`,f2(e,t));let r=N2(e),i=e.children,{title:a,body:o}=M2(i,t);return o2(n,r,a,o,{...t,ancestors:[...t.ancestors,e],depth:t.depth+1},(e,t)=>C2(e,t),(e,t)=>j2(e,t))}function M2(e,t){let n=e[0];return n?.type===`paragraph`&&n.data?.directiveLabel===!0?{title:l2(`title`,I2(n.children,t)),body:e.slice(1)}:{title:null,body:e}}function N2(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 P2(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 F2={text:(e,t)=>c2(e.value),emphasis:(e,t)=>l2(P2(e,t.source)===`underscore`?`term`:`em`,I2(e.children,t)),strong:(e,t)=>l2(`alert`,I2(e.children,t)),inlineCode:(e,t)=>u2(`c`,e.value),math:(e,t)=>A2(e)};function I2(e,t){return e.flatMap(e=>L2(e,t)).filter(e=>e!==null)}function L2(e,t){let n=F2[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`}),m2(`unknown-inline-type`,`unknown inline type "${e.type}"`,f2(e,t)))}var R2=[{open:`$$`,close:`$$`,isDisplay:!0},{open:`\\[`,close:`\\]`,isDisplay:!0},{open:`$`,close:`$`,isDisplay:!1},{open:`\\(`,close:`\\)`,isDisplay:!1}],z2=`PTX_MATH_TOKEN_`,B2=RegExp(`${z2}(\\d+)`,`g`);function V2(e,t){let n=null;for(let r of R2){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 H2(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 U2(e){let t=new Map,n=``,r=0,i=0;for(;r<e.length;){let a=H2(e,r),o=V2(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=`${z2}${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 W2(e){let t=[],n=0;for(;n<e.length;){let r=V2(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 G2(e,t){let n=[],r=0;B2.lastIndex=0;let i=B2.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=B2.exec(e)}return r<e.length&&n.push({type:`text`,value:e.substring(r)}),n.length===0?[{type:`text`,value:e}]:n}function K2(e){Q0(e,`paragraph`,e=>{let t=e.children||[],n=[];for(let e of t)if(e.type===`text`){let t=W2(e.value);n.push(...t)}else n.push(e);e.children=n})}function q2(e,t){Q0(e,`paragraph`,e=>{let n=e.children||[],r=[];for(let e of n)if(e.type===`text`){let n=G2(e.value,t);r.push(...n)}else r.push(e);e.children=r})}function J2(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 Y2(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 X2(e){if(e.children.length===0)e.finalColons=e.colons;else{let t=Math.max(...e.children.map(X2));e.finalColons=Math.max(e.colons,t+1)}return e.finalColons}function Z2(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 Q2(e){let t=e.split(`
|
|
1052
|
+
`),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=J2(a);s&&n.push({...s,lineIndex:e})}if(n.length===0)return e;let a=Y2(n);for(let e of a)X2(e);return Z2(t,a).join(`
|
|
1053
|
+
`)}function $2(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)||!$0[i.toLowerCase()]?null:n}function e4(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 t4(e,t){let n=e4(e[t]);for(let r=t+1;r<e.length;r++)if(!n4(e[r]))return e4(e[r])>n;return!1}function n4(e){return e.trim()===``}function r4(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 i4(e){let t=e.split(`
|
|
1054
|
+
`),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=e4(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(n4(i)){n.push(``);continue}let c=$2(a);if(c&&t4(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(r4(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(`
|
|
1055
|
+
`)}var a4=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/,o4=/^division:\s*(\S+)\s*$/m;function s4(e){let t=e.match(a4);if(!t)return{body:e};let n=t[1],r=e.slice(t[0].length),i=n.match(o4)?.[1];return{division:i&&X0(i)?i:void 0,body:r}}var c4=function(e){return function(t,n){if(typeof n?.value==`string`){let t=s4(n.value),r=e?.topLevelDivision??t.division??`chapter`,i=U2(Q2(i4(t.body))),a=bZ().data(`micromarkExtensions`,[{disable:{null:[`codeIndented`]}}]).use(A1).use(G0).parse(i.markdown);return q2(a,i.tokens),g2(a,i.markdown,{topLevelDivision:r})}return K2(t),g2(t,void 0,{topLevelDivision:e?.topLevelDivision??`chapter`})}},l4=/["&'<>`]/g,u4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,d4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,f4=/[|\\{}()[\]^$+*?.]/g,p4=new WeakMap;function m4(e,t){if(e=e.replace(t.subset?h4(t.subset):l4,r),t.subset||t.escapeOnly)return e;return e.replace(u4,n).replace(d4,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 h4(e){let t=p4.get(e);return t||(t=g4(e),p4.set(e,t)),t}function g4(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(f4,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function _4(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function v4(e,t){return m4(e,Object.assign({format:_4},t))}var y4=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function b4(e,t,n){let r=x4(e);return n?r.replace(n,i):i(r);function i(e){return v4(e,{subset:t})}}function x4(e){return String(e||``).replace(y4,``)}var S4=/]]>/g,C4=[`>`];function w4(e){return`<![CDATA[`+b4(e.value,C4,S4)+`]]>`}function T4(e){return`<!--`+b4(e.value,[`-`])+`-->`}var E4=[` `,`
|
|
1056
|
+
`,` `,`"`,`&`,`'`,`/`,`<`,`=`,`>`];function D4(e){return b4(e,E4)}function O4(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 k4(e,t){let n=String(e),r=t.options.quote||`"`;if(t.options.quoteSmart){let e=r===`"`?`'`:`"`;O4(n,r)>O4(n,e)&&(r=e)}return r+b4(n,[`<`,`&`,r])+r}function A4(e,t){let n=D4(e.name),r=e.public,i=e.system,a=`<!DOCTYPE`;return n!==``&&(a+=` `+n),r?a+=` PUBLIC `+k4(r,t):i&&(a+=` SYSTEM`),i&&(a+=` `+k4(i,t)),a+`>`}var j4={}.hasOwnProperty;function M4(e,t){let n=D4(e.name),r=H4(e,t),i=e.attributes||{},a=r?!1:t.options.closeEmptyElements,o=[],s;for(s in i)if(j4.call(i,s)){let e=i[s];e!=null&&o.push(D4(s)+`=`+k4(e,t))}return`<`+n+(o.length===0?``:` `+o.join(` `))+(a?(t.options.tightClose?``:` `)+`/`:``)+`>`+r+(a?``:`</`+n+`>`)}var N4=/\?>/g,P4=[`>`];function F4(e){let t=D4(e.name)||`x`,n=b4(e.value,P4,N4);return`<?`+t+(n?` `+n:``)+`?>`}var I4=[`&`,`<`];function L4(e){return b4(e.value,I4)}function R4(e,t){return t.options.allowDangerousXml?e.value:L4(e)}var z4={}.hasOwnProperty,B4={cdata:w4,comment:T4,doctype:A4,element:M4,instruction:F4,raw:R4,root:H4,text:L4};function V4(e,t){let n=e&&e.type;if(!n)throw Error("Expected node, not `"+e+"`");if(!z4.call(B4,n))throw Error("Cannot compile unknown node `"+n+"`");let r=B4[n];return r(e,t)}function H4(e,t){let n=e&&e.children||[],r=-1,i=[];for(;++r<n.length;)i[r]=V4(n[r],t);return i.join(``)}function U4(e,t){let n={options:{}};if(typeof n.options.quote==`string`&&n.options.quote!==`"`&&n.options.quote!==`'`)throw Error("Invalid quote `"+n.options.quote+"`, expected `'` or `\"`");return V4(Array.isArray(e)?{type:`root`,children:e}:e,n)}function W4(e,t){let n=bZ().use(A1).use(G0).use(c4,t),r=n.parse(e);return U4(n.runSync(r,{value:e}).children)}var G4=[`\\documentclass`,`\\begin{document}`,`\\begin{`,`\\section`,`\\chapter`,`\\title`,`\\author`],K4=[`# `,`## `,`### `,`#### `];function q4(e){let t=e.trim();return!t||t.startsWith(`<`)?`pretext`:G4.some(e=>t.includes(e))?`latex`:K4.some(e=>t.startsWith(e))?`markdown`:`pretext`}function J4(e){let t=e.trim();if(!t)return``;let n=String(QX(t)).trim();return n?ss(n):``}function Y4(e){let t=e.trim();if(!t)return``;let n=String(W4(t)).trim();return n?ss(n):``}function X4(e){return e instanceof Error&&e.message.trim()?e.message.trim():`Could not convert LaTeX to PreTeXt.`}function Z4(e,t){if(t===`pretext`)return{pretextSource:e};if(t===`markdown`)try{return{pretextSource:Y4(e)}}catch(e){return{pretextError:X4(e)}}try{return{pretextSource:J4(e)}}catch(e){return{pretextError:X4(e)}}}var Q4=()=>typeof window>`u`?void 0:window.location.href||void 0,$4=({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()||Q4(),[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]})},e3=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},t3=(e=>e?e3(e):e3),n3=e=>e;function r3(e,t=n3){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 i3=(0,n.createContext)(null);function a3(e){let t=(0,n.useContext)(i3);if(!t)throw Error(`useEditorStore must be used within an EditorStoreProvider`);return r3(t,e)}var o3=({label:e,context:n,className:r})=>{let i=a3(e=>e.hasFeedback),a=a3(e=>e.projectUrl),o=a3(e=>e.source),s=a3(e=>e.sourceFormat),c=a3(e=>e.title),l=a3(e=>e.feedbackSubmit);return i?(0,t.jsx)($4,{label:e,context:n,className:r,projectUrl:a,currentSource:o,sourceFormat:s,title:c,onSubmit:l}):null},s3=({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(J4(e)),u(`idle`)}catch(e){console.error(`Error converting LaTeX:`,e),alert(X4(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)(o3,{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`})]})]})})},c3={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,readOnly:!0,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},l3={latex:`LaTeX`,markdown:`Markdown`,pretext:`PreTeXt`},u3={latex:`latex`,markdown:`markdown`,pretext:`xml`},d3=({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=l3[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:c3,height:`100%`,language:u3[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:c3,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`})]})]})})},f3={automaticLayout:!0,minimap:{enabled:!1},wordWrap:`on`,lineNumbers:`on`,scrollBeyondLastLine:!1,tabSize:2,fontSize:13,padding:{top:10,bottom:10}},p3={...f3,language:`xml`},m3=(e,t)=>e.querySelector(t)?.textContent??``,h3=(e,t)=>{let n=new XMLSerializer;return Array.from(e.documentElement.children).filter(e=>!t.includes(e.tagName)).map(e=>n.serializeToString(e)).join(`
|
|
1057
|
+
`)},g3=e=>e.trim()?new DOMParser().parseFromString(e,`application/xml`):new DOMParser().parseFromString(`<docinfo/>`,`application/xml`),_3=e=>e.getElementsByTagName(`parsererror`).length>0,v3=(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},y3=(e,t)=>{if(_3(t))return e;let n=new DOMParser().parseFromString(`<docinfo>${e}</docinfo>`,`application/xml`);if(_3(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(`
|
|
1058
1058
|
`)}`:a.join(`
|
|
1059
|
-
`)},
|
|
1059
|
+
`)},b3=(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(`
|
|
1060
1060
|
`))r.push(` ${e}`);return r.length===0?``:`<docinfo>\n${r.join(`
|
|
1061
|
-
`)}\n</docinfo>`},
|
|
1061
|
+
`)}\n</docinfo>`},x3={macros:`LaTeX Macros`,preamble:`Image Macros`,other:`Other Elements`},S3={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.`},C3=({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=g3(e),[f,p]=(0,n.useState)(()=>m3(d,`macros`)),[m,h]=(0,n.useState)(()=>m3(d,`latex-image-preamble`)),[g,_]=(0,n.useState)(()=>h3(d,[`macros`,`latex-image-preamble`])),v=g3(a),[y,b]=(0,n.useState)(()=>m3(v,`macros`)),[x,S]=(0,n.useState)(()=>m3(v,`latex-image-preamble`)),[C,w]=(0,n.useState)(()=>h3(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:b3(f,m,g),commonDocinfo:b3(y,x,C),useCommonDocinfo:l})},D=()=>{if(!T)return;let e=g3(a);_3(e)||(p(t=>v3(t,m3(e,`macros`))),h(t=>v3(t,m3(e,`latex-image-preamble`))),_(t=>y3(t,e)))},O=s===`macros`?l?y:f:s===`preamble`?l?x:m:l?C:g,k=s===`other`?`xml`:`latex`,A=i&&l,j=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:S3[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:x3[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`?p3:f3,height:`100%`,language:k,value:O,onChange:e=>j(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`})]})]})})},w3=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:()=>j,XmlElement:()=>k,XmlError:()=>ee,XmlNode:()=>w,XmlProcessingInstruction:()=>te,XmlText:()=>T,parseXml:()=>ie}),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())})}},j=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}},ee=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===`
|
|
1062
1062
|
`?(r=1,i=``,a+=1):(r+=1,i+=t)}let o=n.indexOf(`
|
|
1063
1063
|
`,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})
|
|
1064
1064
|
${i}
|
|
1065
1065
|
`+` `.repeat(r-s+1)+`^
|
|
1066
1066
|
`),this.column=r,this.excerpt=i,this.line=a,this.name=`XmlError`,this.pos=t}},te=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})}},ne=``,re=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=M(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=ne,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(M(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(M(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 j(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):ne}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 te(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 te(n,M(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 ee(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 M(e){let t=0;for(;(t=e.indexOf(`\r`,t))!==-1;)e=e[t+1]===`
|
|
1067
1067
|
`?e.slice(0,t)+e.slice(t+1):e.slice(0,t)+`
|
|
1068
|
-
`+e.slice(t+1);return e}function ie(e,t){return new re(e,t).document}}));function
|
|
1069
|
-
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var
|
|
1068
|
+
`+e.slice(t+1);return e}function ie(e,t){return new re(e,t).document}}));function T3(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=E3(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=E3(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 E3(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
1069
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var D3=w3();function O3(e){let t=T3(e),n;try{n=(0,D3.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=j3(n,r);return R3(n,i,r),i}function k3(e){return{type:`cdata`,value:e.text}}function A3(e){return{type:`comment`,value:e.content}}function j3(e,t){return{type:`root`,children:L3(e.children,t)}}function M3(e){return{type:`doctype`,name:e.name,public:e.publicId||void 0,system:e.systemId||void 0}}function N3(e,t){let n=L3(e.children,t);return{type:`element`,name:e.name,attributes:{...e.attributes},children:n}}function P3(e){return{type:`instruction`,name:e.name,value:e.content}}function F3(e){return{type:`text`,value:e.text}}function I3(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 L3(e,t){let n=[],r=-1;for(;++r<e.length;){let i=e[r],a;i.type===`cdata`?a=k3(i):i.type===`comment`?a=A3(i):i.type===`doctype`?a=M3(i):i.type===`element`?a=N3(i,t):i.type===`pi`?a=P3(i):i.type===`text`?a=F3(i):i.type===`xmldecl`&&(a=I3(i)),a&&(R3(i,a,t),n.push(a))}return n}function R3(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 z3(){return`sec-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function B3(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 V3=new Set([`book`,`article`,`slideshow`,`part`,`chapter`,...new Set([`introduction`,`section`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`,`conclusion`])]);function H3(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 U3(e){return e.replace(/^(?:[ \t]*\r?\n)+/,``).replace(/(?:\r?\n[ \t]*)+$/,``)}function W3(e){try{return O3(e)}catch{return null}}function G3(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*</${d6(t[1])}\\s*>\\s*$`);return U3(n.replace(r,``))}function K3(e,t){let n=W3(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:[{type:`text`,value:t}]};return i===-1?r.children.unshift(a):r.children.splice(i,1,a),TY(n)}function q3(e=`New Section`){let t=z3();return{id:t,xmlId:t,title:e,content:`<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 J3(){let e=z3();return{id:e,xmlId:e,title:`Introduction`,content:`<introduction xml:id="${e}">\n\n\t<p>\n\n\t</p>\n\n</introduction>`,type:`introduction`,sourceFormat:`pretext`}}function Y3(){let e=z3();return{id:e,xmlId:e,title:`Conclusion`,content:`<conclusion xml:id="${e}">\n\n\t<p>\n\n\t</p>\n\n</conclusion>`,type:`conclusion`,sourceFormat:`pretext`}}function X3(e){let t=W3(e);if(!t)return G3(e);let n=t.children.find(e=>e.type===`element`);return n?T6(TY({type:`root`,children:H3(n.children)})):e}function Z3(e,t){return`<${t}>\n${U3(e)}\n</${t}>`}function Q3(e,t){return e.trimStart().startsWith(`<${t}`)?e:Z3(e,t)}function $3(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 e6(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 t6(e,t,n,r){if(t===`introduction`||t===`conclusion`)return e;let i=e.trimStart();return i.startsWith(`\\section`)||i.startsWith(`\\begin{section}`)?e:e6(e,t,n,r)}function n6(e,t){return/\\section[*]?\{/.test(e)?e.replace(/^(\\section\*?\{)[^}]*/,(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 r6(e){let t=/^\\section\*?\{([^}]*)\}/.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 i6(e=`New Section`){let t=z3();return{id:t,xmlId:t,title:e,content:`\\section{${e}}\n\n`,type:`section`,sourceFormat:`latex`}}function a6(){let e=z3();return{id:e,xmlId:e,title:`Introduction`,content:`% Introduction
|
|
1070
1070
|
|
|
1071
|
-
`,type:`introduction`,sourceFormat:`latex`}}function
|
|
1071
|
+
`,type:`introduction`,sourceFormat:`latex`}}function o6(){let e=z3();return{id:e,xmlId:e,title:`Conclusion`,content:`% Conclusion
|
|
1072
1072
|
|
|
1073
|
-
`,type:`conclusion`,sourceFormat:`latex`}}function
|
|
1073
|
+
`,type:`conclusion`,sourceFormat:`latex`}}function s6(e,t,n){if(n){let n=$3(t.content,t.type);return{...e,content:e.content.trimEnd()+`
|
|
1074
1074
|
|
|
1075
|
-
`+n.trimStart()}}let r=
|
|
1075
|
+
`+n.trimStart()}}let r=W3(e.content),i=W3(t.content),a=r?.children.find(e=>e.type===`element`),o=i?.children.find(e=>e.type===`element`);if(!a||!o)return{...e,content:e.content+`
|
|
1076
1076
|
|
|
1077
|
-
`+t.content};let s=o.children.filter(e=>!(e.type===`element`&&e.name===`title`)),c={...a,children:[...a.children,...s]};return{...e,content:TY({type:`root`,children:[c]})}}function
|
|
1077
|
+
`+t.content};let s=o.children.filter(e=>!(e.type===`element`&&e.name===`title`)),c={...a,children:[...a.children,...s]};return{...e,content:TY({type:`root`,children:[c]})}}function c6(e){try{let t=O3(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 l6(e){let t=W3(e);if(!t)return null;let n=t.children.find(e=>e.type===`element`);return!n||!V3.has(n.name)?null:{title:B3(n),type:n.name,xmlId:n.attributes?.[`xml:id`]??``,label:n.attributes?.label??``}}function u6(e,t){let n=t.type??e.type,r=t.title??e.title;try{let i=O3(e.content).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:[{type:`text`,value:r}]};o===-1?a.children=[s,...a.children]:a.children=[...a.children.slice(0,o),s,...a.children.slice(o+1)];let c=TY({type:`root`,children:[a]}),l=t.xmlId!==void 0&&t.xmlId!==null&&t.xmlId!==``?t.xmlId:e.xmlId;return{...e,title:r,type:n,xmlId:l,content:c}}catch{return{...e,title:r,type:n}}}function d6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var f6=new Set([`division`,...V3]),p6=Array.from(f6).join(`|`);function m6(e){let t=e===null?`ref="([^"]+)"`:`ref="${d6(e)}"`,n=`(?:${p6})`;return`<plus:${n}\\s[^>]*${t}[^>]*?(?:/>|>\\s*</plus:${n}>)`}function h6(e){let t=[],n=new RegExp(m6(null),`g`),r;for(;(r=n.exec(e))!==null;)t.push(r[1]);return t}function g6(e){let t=[],n=`(?:${p6})`,r=RegExp(`<plus:(${p6})\\s[^>]*ref="([^"]+)"[^>]*?(?:/>|>\\s*</plus:${n}>)`,`g`),i;for(;(i=r.exec(e))!==null;){let e=i[1],n=e===`division`?`section`:e;t.push({type:n,xmlId:i[2]})}return t}function _6(e){let t=[],n=/<plus:(image|doenet)\b[^>]*\bref="([^"]+)"/g,r;for(;(r=n.exec(e))!==null;)t.push({kind:r[1],ref:r[2]});return t}function v6(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,content:n===`pretext`?`<${t} xml:id="${e}">\n<title>${r}</title>\n\n<p></p>\n\n</${t}>`:`\\section{${r}}\n\n`}}function y6(e,t,n,r){let i=`<plus:${n} ref="${t}"/>`;if(r!==null){let t=new RegExp(m6(r)).exec(e);if(t){let n=t.index+t[0].length;return e.slice(0,n)+`
|
|
1078
1078
|
`+i+e.slice(n)}}let a=e.lastIndexOf(`</`);return a===-1?e+`
|
|
1079
1079
|
`+i:e.slice(0,a)+i+`
|
|
1080
|
-
`+e.slice(a)}function
|
|
1080
|
+
`+e.slice(a)}function b6(e,t){let n=RegExp(`[ \t]*${m6(t)}[ \t]*\n?`,`g`);return e.replace(n,``)}function x6(e,t,n){let r=new RegExp(m6(t)).exec(e),i=r?T6(r[0]):`<plus:division ref="${t}"/>`,a=b6(e,t);if(n!==null){let e=new RegExp(m6(n)).exec(a);if(e){let t=e.index+e[0].length;return a.slice(0,t)+`
|
|
1081
1081
|
`+i+a.slice(t)}}let o=a.lastIndexOf(`</`);return o===-1?a+`
|
|
1082
1082
|
`+i:a.slice(0,o)+i+`
|
|
1083
|
-
`+a.slice(o)}function h6(e,t,n,r){let i=new RegExp(s6(t));return i.test(e)?e.replace(i,`<plus:${r} ref="${n}"/>`):e}function g6(e,t){let n=new RegExp(s6(t));return e.find(e=>n.test(e.content))??null}function _6(e,t){let n=e,r=null;for(let e of t)n=m6(n,e,r),r=e;return n}function v6(e){return e.replace(/<plus:([a-z-]+)((?:\s[^>]*?)?)>\s*<\/plus:\1>/g,(e,t,n)=>`<plus:${t}${n}/>`)}function y6(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 c6(i.content))r.push(e)}return n}function b6(e,t){let n=y6(e,t);return e.filter(e=>!n.has(e.xmlId))}function x6(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 c6(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 S6(e,t){let n=b6(e,t),r=new Set(n.map(e=>e.xmlId)),i=new Set;for(let e of n)for(let t of c6(e.content))r.has(t)&&i.add(t);return n.filter(e=>!i.has(e.xmlId))}var C6=new Set([`book`,`article`,`slideshow`]);function w6(e){try{let t=x3(e),n=t.children.find(e=>e.type===`element`),r=n?.name===`pretext`?n.children.find(e=>e.type===`element`&&C6.has(e.name)):n&&C6.has(n.name)?n:void 0;if(!r)return e;if(!r.attributes.label){let e=E6(t,`pretext-plus-preview`);return r.attributes.label=e,TY(t)}return e}catch(t){return console.error(`Error ensuring label:`,t),e}}function T6(e,t){return e.type===`element`&&e.attributes?.label===t?!0:`children`in e&&e.children?e.children.some(e=>e.type===`element`?T6(e,t):!1):!1}function E6(e,t){let n=t,r=1;for(;T6(e,n);)n=`${t}-${r}`,r++;return n}function D6(e,t,n){let r=t.find(t=>t.xmlId===e);if(!r)return`<!-- missing division: ${e} -->`;if(n.has(e))return`<!-- circular reference: ${e} -->`;let i;if(r.sourceFormat===`pretext`)i=r.content;else{let{pretextSource:e,pretextError:t}=W4(r.sourceFormat===`latex`?K3(r.content,r.type):U3(r.content),r.sourceFormat),n=e??`<!-- conversion error: ${t} -->`;i=`<${r.type} xml:id="${r.xmlId}">\n<title>${r.title}</title>\n\n${n}\n</${r.type}>`}if(r.sourceFormat!==`pretext`)return i;let a=new Set(n).add(e);return i.replace(/<plus:[a-z-]+\s[^>]*ref="([^"]+)"[^>]*?(?:\/>|>\s*<\/plus:[a-z-]+>)/g,(e,n)=>D6(n,t,a))}function O6(e,t){return w6(D6(t,e,new Set))}function k6(e,t){return w6(`<pretext>\n${t.trim()?`${t.trim()}\n`:``}${e}\n</pretext>`)}function A6(e,t,n){return k6(D6(t,e,new Set),n)}var j6=new Set([`part`,`chapter`]);function M6(e,t,n,r){return k6(C6.has(e)?t:j6.has(e)?`<book>\n<title>${r}</title>\n${t}\n</book>`:`<article>\n<title>${r}</title>\n${t}\n</article>`,n)}var N6=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAJZ0lEQVR4nJxXe3BU1Rn/nXNf+8oueUgSdpckEALhpc1KJBEskkGc0Uqp2o6C7VSqM/5RGWsHnTLMOI51qgxCyzhtRx1ktFOslZZaC8UkFC2CKCEkaCSKCXmHbDabTbLZ+zj3dM7dDYZACuM3c7Kbc/d+v+91vu93ZFynaJqGmpoasUhFRQUpKioieXl5RDwbHBzkFy5c4KdPn+Z1dXW8trYWqVTqelX/fwmFQnjppZdILBaTOeca59zNOfdanAeSjAfFsjifIfYyz7ShoSF5165dwshr6ifTPVAUBVu3bsWWLVtkt9stm4C3JYU153TUdJiIxBnCHJAzSqwZFF1hFQ1lKuoWunFYBcZ0XTd37NjBnn32Wa7r+vUbILzev38/XbZsmWICvmOj+NmxJB5JceSKFyhACPnmZS4WB+z0B1wEsWoPXr3Vg1dUipFTp06Z69evtzs7O69tQGlpKerr66VwOKx2GLj57QR2xRnmSAChxAF3XiKYYkBm2WJxgAHcT9FxXwBPlKg43t3dbaxZs4a1tLRMb4Dw/KOPPhLg2idJPPDuCJ4ngCoRECntOSgBodMYkAHn4pOJxZ19864sbL3Fgzd7e3v16upq1t7efqUBIufHjh0TYRfgDx4YwXYZoBIBBLicAZ6IQmpwgPq6vlTnuqgUUCQpYdn2+ZRtxgpKDO2GAm5lDLE4YAH2PVl4qtKDN5uamvTKykp7oiakCQO2bduGDRs2iLAv2zeMP0qAIpN0lakEhI0Mk/i5s7IiS2ADfXQNH/Z9vyoizZsdouFgEKXhEKksCcs50S6tpbObaXkFoh6cWhGOnjOwqkjByQXB/G4RnCNHjnwTARH61tZWWXa7A7+L4nCCYY7wWIArBMRuPqGunZnlunHxIpxsOI2hsaS9duWt9KplDaCruxuvd8THXKWLWCYC3OSAj6Lj8VzUcCM1VFZWZomidCLwzDPPkJUrV2ofjuKxFh3fmww+1vE1vf8GzbOovNxRHiwsRHFwFqGUwjAMcM4hvk8Wv98Po6tN7s+aaVBJcmpDuDrO4RdZme+VTyiKwg4ePAgiOlxvb6/sy84OvHgRH5sceQpJg4sUDDd+LG+umOfJyclxlIvcvbdvH07++zCGo1EQShGcOxer778PVatWXTLCsiw8/2Fj0rfkZktEweTpKEgE8S15qDTGRmIFBQWWtHbtWmzatEn5bBx3ndFx/4T3ctoAwhlDwciAmp+fD9M08eKTv8TZunpYyWQaybaRHBxE84f/xbjNsPCmm5xtEZXmjm6GmUEnAOIPJ44hWp6M1iKv1tLQ0MDo6tWrnd5yzkANzRw1YjOin6jVgsff8y640Ozr6+tzPDpaW4vOs2edyiotzsbP183HD28vguyiTjHV/nkf+np7HAOGhobQ+/VXNPb5GQk2m3x8SauO2wWUwJbFYBH/dBiIOB1OhO/To+rDFeVaTm4uVFW9lONktBu27TiEEYsiOv9OxHu6IUs9YLAgU/GbHqBwFrKzs/Hrnz6gjo+Pq/86foy1hBePkUCO42CXiQqBGYlECC0uLiYMkOM2Qg66bWMJNVwFhYVwuVyXFdjc4tmYNcsP07LQ3zWIt178Lere/Cv0pOWEuGpxPrw5+ZcVpNvtxr2rb5OyO7/QnOZFAIElMMVElXNzc4luw8udugPM0QTJz5lxRWULKYmsQM2Ko2j94jzOdSYwOs6gyhSFOR5UL7wB2YurkB8MX/Vo5stESqTxRX+QdRu+vLy8MTnTKS51RDXLzwe+jF9VicfjwXceegru9/+CsvOnkK1wyJKEpOKDd9FtmHfrndO1BgyamdxNETkajfJwVtYoSXdNRZTKVyY1hoeH1UAgcMULPp8PkfUPwzA2YmBgABKlmJeff6nlMcac3jAhomY+aTyD3pyQrmampcBSKcaiFwe5LJhMSUmJM89HbJSIozK2cFnqT7VH6fyARxapEErEmqxYfL+0nxlGQjXPHDcOAsvmdpRLbCBUpntDRdzgaQsCFF0yYLa3t3NZ0KhVq1bZYQUNZ3UUi/6tBLKR+u49yabxJJG5TVSJQpEoUQiZ6A+O55JEQYiUnoTplivC6DScTPsVQwneTCuemJghBY3ia2NjI6f19fXOfpmGuskjVVhK3R5IXh+nLg+I6uJQNUDVOFc0bksKGJEcUKHcBLiVXg4XMBnD6OCAOGFpspKZjsKOMhX/ETCCP1JBIOPxOFvowmHBZOw0s3Hm+ejgAN566G7v/sd/4h6+2EdSKZ2nUroDGLvYh5Rp8bHkONcty/FQ1Fm8vw+GaeLEa7vVdx79ka//8ybKJhEVhSCxyIVDIyMj7NChQ5AFe927dy/bvHnzWJUHrx4ZwxanIXHwoY42KRm9SJlh2KfffkNpPfyuKobLTT94UD/zt31a6MaIGetoo8l4TPJk57Li5SvZZwf/LociVSx24Tw1RhNo/+B9ecmCpRbLRKbajT0aReK1N95go6OjTmPCzp07BWk0V3jwiqBRLBMFJ9y2jVQ8RtUZObbIi1ixnk5qjCehZedwy7KI4vbYQ53t0nB/H7FS49RfNIdVPPJEisoylj76pD7BjnwUPbd58XuBtX37dn7Z+X/uuecEC9baDFTvGcJbFFDFUBr6rEHWXG6eV1ZuD35+RhLMKW/OPLu38VPJNzPfUaJ4fDwZixL/7BK750yD5JtdbLtyZ9oDX35BAwuWOJyAAdaPZ2DDPA1HX3jhhdTTTz+NywwQY1lQskgkop1M4qF/jOA3gpLJGQomZ3gh+YaYkimcMF1kaTBMpWR3Z+FXyz3Y29zc7FCyiYvLZaQ0HA7j+PHjUjAYFEZs+GealCoTvPDbkFIbsO7KwjYB3t/fr1dVVbG2trZLmFfQ8vLyctTV1UmFhYXq1waq3xnGzoSN8DS0nGQM4JOpOcvQcpHze/34RamGD/r7+4077riDNTU1XYZ31YtJcXExDhw4QJcuXaoYNvxHk3jsRBKbDA6/AKWZVFzlYuIYI47acjf2iIJzUQw3Nzcb69atsyd7PiHS1QyIx+PYs2cPJ4TYVbdU6vM98onlbrwumIxMMJ6y4U5y+BjgnHGRZj9F51wVR1Z48Yf1fmyZ70I9M/TRHTt2mBs3buRibnwrEXWxe/dukkgkpl5OZ2Qup6Gpl1Px25dffpmISF5Lpr2cThWv1wvBH6dez8UUFBN14nouWrtgu6LJXI/8LwAA//98WriRDELEmAAAAABJRU5ErkJggg==`,P6={image:`Images`,doenet:`Doenet`},F6=[`image`,`doenet`];function I6(e){let t=new Set,n=[];for(let{kind:r,ref:i}of u6(e)){let e=`${r}:${i}`;t.has(e)||(t.add(e),n.push({kind:r,ref:i}))}return n}var L6=({open:e,onClose:r,onLoadAssets:i,onLoadLibraryAssets:a,onInsert:o,onAddFromLibrary:s,onUpload:c,onAddUrl:l,onCreateDoenet:u,onRemoveAsset:d})=>{let f=Q4(e=>e.activeEditorSource),p=Q4(e=>e.projectAssets)??[],m=Q4(e=>e.libraryAssets),h=!!(i||a),[g,_]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),w=g??p,T=v??m??w,E=new Set(w.map(e=>e.id)),[D,O]=(0,n.useState)(`in-document`),[k,A]=(0,n.useState)(null),[j,ee]=(0,n.useState)(`library`),[te,ne]=(0,n.useState)(`library`),[re,M]=(0,n.useState)(null),[ie,ae]=(0,n.useState)(!1),[oe,N]=(0,n.useState)(!1),[se,P]=(0,n.useState)(null),ce=(0,n.useRef)(null),[le,ue]=(0,n.useState)(``),[de,F]=(0,n.useState)(``),[fe,pe]=(0,n.useState)(!1),[me,he]=(0,n.useState)(null),[ge,I]=(0,n.useState)(``),[_e,ve]=(0,n.useState)(``),[ye,be]=(0,n.useState)(!1),[xe,Se]=(0,n.useState)(null),[Ce,L]=(0,n.useState)(null),we=(0,n.useCallback)(()=>{!i&&!a||(x(!0),C(null),Promise.all([i?.()??Promise.resolve(null),a?.()??Promise.resolve(null)]).then(([e,t])=>{e!==null&&_(e),t!==null&&y(t)}).catch(e=>{C(e instanceof Error?e.message:`Failed to load assets.`)}).finally(()=>x(!1)))},[i,a]);if((0,n.useEffect)(()=>{if(!e)return;we();let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,we]),!e)return null;let Te=I6(f),Ee=e=>{o(e),r()},R=(e,t)=>{let n=`${e}:${t}`;navigator.clipboard.writeText(`<plus:${e} ref="${t}"/>`).catch(()=>{}),L(n),setTimeout(()=>L(e=>e===n?null:e),2e3)},De=async e=>{if(!E.has(e.id)&&s){M(e.id);try{await s(e)}finally{M(null)}}Ee(e)},Oe=async e=>{if(c){P(null),N(!0);try{Ee(await c(e))}catch(e){P(e instanceof Error?e.message:`Upload failed.`),N(!1)}}},ke=async()=>{let e=le.trim();if(!e)return;let t=de.trim()||e;if(l){he(null),pe(!0);try{Ee(await l(e,t))}catch(e){he(e instanceof Error?e.message:`Failed to add URL.`),pe(!1)}}else Ee({id:`url-${Date.now()}`,name:t,ref:e.split(`/`).pop()??`image`,kind:`image`})},z=async()=>{let e=ge.trim(),t=_e.trim();if(!(!e||!t))if(u){Se(null),be(!0);try{Ee(await u(e,t))}catch(e){Se(e instanceof Error?e.message:`Failed to create activity.`),be(!1)}}else Ee({id:`doenet-${Date.now()}`,name:e,ref:t,kind:`doenet`})},Ae=e=>{let n=T.filter(t=>t.kind===e);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-library`,children:[h&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-toolbar`,children:[S&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-load-error`,children:S}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__asset-library-refresh`,onClick:we,disabled:b,children:b?`Loading…`:`Refresh`})]}),b&&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 `,P6[e].toLowerCase(),` assets in your library.`]}):(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:n.map(e=>{let n=E.has(e.id),r=re===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:()=>De(e),disabled:r||!e.ref,title:e.ref?n?`Insert "${e.ref}"`:`Add to project & insert "${e.ref}"`:`Asset has no reference — cannot insert`,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)})})]})};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&r(),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__dialog--asset-manager`,role:`dialog`,"aria-modal":`true`,"aria-label":`Asset manager`,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:`✕`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${D===`in-document`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>O(`in-document`),children:[`In Document`,Te.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-tab-count`,children:Te.length})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${D===`add`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>{O(`add`),A(null)},children:`Add Asset`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:D===`in-document`?(()=>{if(Te.length===0)return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-placeholder`,children:[(0,t.jsx)(`p`,{children:`No assets referenced in this document yet.`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{O(`add`),A(null)},children:`Add an asset`})]});let e=F6.reduce((e,t)=>(e[t]=Te.filter(e=>e.kind===t).map(e=>({ref:e.ref,asset:w.find(t=>t.kind===e.kind&&t.ref===e.ref)})),e),{image:[],doenet:[]});return(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-in-doc`,children:F6.filter(t=>e[t].length>0).map(n=>(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:P6[n]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-count`,children:e[n].length})]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:e[n].map(({ref:e,asset:i})=>{let a=`${n}:${e}`;return(0,t.jsxs)(`li`,{className:`pretext-plus-editor__am-doc-row`,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:i?.name??e}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:e})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-actions`,children:[i&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:()=>Ee(i),title:`Insert <plus:${n} ref="${e}"/>`,children:`Insert`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ce===a?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>R(n,e),title:`Copy <plus:${n} ref="${e}"/>`,children:Ce===a?`Copied!`:`Copy`}),d&&i&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn pretext-plus-editor__am-action-btn--danger`,onClick:()=>{d(i),r()},title:`Remove from project`,children:`Remove`})]})]},e)})})]},n))})})():k===null?(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:()=>{A(`image`),ee(`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.`})]}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-kind-card`,onClick:()=>{A(`doenet`),ne(`library`)},children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:(0,t.jsx)(`img`,{src:N6,alt:`Doenet`})}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`Doenet`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`Interactive activity`})]})]})]}):k===`image`?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>A(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${j===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`library`),children:`Library`}),c&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${j===`upload`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`upload`),children:`Upload`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${j===`url`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`url`),children:`External URL`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[j===`library`&&Ae(`image`),j===`upload`&&c&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-upload`,children:[(0,t.jsxs)(`div`,{className:[`pretext-plus-editor__am-drop-zone`,ie?`pretext-plus-editor__am-drop-zone--active`:``,oe?`pretext-plus-editor__am-drop-zone--uploading`:``].filter(Boolean).join(` `),onDragOver:e=>{e.preventDefault(),ae(!0)},onDragLeave:()=>ae(!1),onDrop:e=>{e.preventDefault(),ae(!1);let t=e.dataTransfer.files[0];t&&Oe(t)},onClick:()=>!oe&&ce.current?.click(),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce.current?.click())},"aria-label":`Upload image — click or drag and drop`,children:[(0,t.jsx)(`input`,{ref:ce,type:`file`,accept:`image/*`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&Oe(t)}}),oe?(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`})]})]}),se&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:se})]}),j===`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:le,onChange:e=>ue(e.target.value),disabled:fe,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:de,onChange:e=>F(e.target.value),disabled:fe}),me&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:me}),le.trim()&&(0,t.jsx)(`img`,{src:le.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:ke,disabled:!le.trim()||fe,children:fe?`Adding…`:l?`Add to Library & Insert`:`Insert`})]})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>A(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${te===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ne(`library`),children:`Library`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${te===`create`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ne(`create`),children:`Create New`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[te===`library`&&Ae(`doenet`),te===`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:ge,onChange:e=>I(e.target.value),disabled:ye,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:_e,onChange:e=>ve(e.target.value),disabled:ye}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`The reference ID is used in the inserted tag: `,(0,t.jsx)(`code`,{children:`<plus:doenet ref="${_e||`my-activity`}"/>`})]}),xe&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:xe}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:z,disabled:!ge.trim()||!_e.trim()||ye,children:ye?`Creating…`:u?`Create & Insert`:`Insert`})]})]})]})}),(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`})})]})})},R6=e=>{let n=Q4(e=>e.showFullPreview),r=Q4(e=>e.setShowFullPreview),i=Q4(e=>e.title),a=Q4(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)($4,{label:`Give feedback`,context:`main-editor`}),o]})]})},z6={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`},B6=[`part`,`chapter`,`section`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`],V6=({draft:e,isLatex:n,isRoot:r=!1,onDraftChange:i,onCommit:a,onCancel:o})=>(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=>i({...e,title:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&a(),e.key===`Escape`&&o()},autoFocus:!0})]}),!n&&(0,t.jsxs)(t.Fragment,{children:[!r&&(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=>i({...e,type:t.target.value}),children:B6.map(e=>(0,t.jsx)(`option`,{value:e,children:z6[e]},e))})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`xml:id`}),(0,t.jsx)(`input`,{type:`text`,value:e.xmlId,placeholder:`optional`,onChange:t=>i({...e,xmlId:t.target.value})})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`label`}),(0,t.jsx)(`input`,{type:`text`,value:e.label,placeholder:`optional`,onChange:t=>i({...e,label: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:a,children:`Save`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-cancel`,onClick:o,children:`Cancel`})]})]});function H6(e){let t=e?.parentElement??null;for(;t;){let{overflowY:e}=getComputedStyle(t);if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}var U6=({items:e})=>{let[r,i]=(0,n.useState)(!1),[a,o]=(0,n.useState)(`below`),s=(0,n.useRef)(null),c=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!r)return;let e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,n.useLayoutEffect)(()=>{if(!r)return;let e=c.current,t=s.current;if(!e||!t)return;let n=H6(t)??document.documentElement,i=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=t.getBoundingClientRect(),u=a.bottom-l.bottom,d=l.top-a.top;o(i.height>u&&d>u?`above`:`below`)},[r]);let l=e=>{i(!1),e()};return(0,t.jsxs)(`div`,{ref:s,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(),i(e=>(e||o(`below`),!e))},"aria-haspopup":`true`,"aria-expanded":r,title:`More options`,children:`⋮`}),r&&(0,t.jsx)(`div`,{ref:c,className:[`pretext-plus-editor__toc-div-menu-popup`,a===`above`?`pretext-plus-editor__toc-div-menu-popup--above`:`pretext-plus-editor__toc-div-menu-popup--below`].join(` `),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:()=>l(e.onClick),children:e.label},e.label))})]})},W6=({division:e,depth:n,isActive:r,hasChildren:i,isExpanded:a,onToggleExpand:o,editDraft:s,onSelect:c,onDraftChange:l,onEditCommit:u,onEditCancel:d,menuItems:f,isLatex:p,isRoot:m=!1})=>{let h=s!==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`:``,h?`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.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-select`,onClick:c,"aria-current":r?`true`:void 0,title:z6[e.type]??e.type,children:(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-title`,children:e.title||(0,t.jsx)(`em`,{children:`Untitled`})})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:(0,t.jsx)(U6,{items:f})})]}),h&&s&&(0,t.jsx)(V6,{draft:s,isLatex:p,isRoot:m,onDraftChange:l,onCommit:u,onCancel:d})]})},G6={image:`Images`,doenet:`Doenet`},K6=[`image`,`doenet`],q6=({onOpenAssetPicker:e})=>{let r=Q4(e=>e.divisions),i=Q4(e=>e.rootDivisionId),a=Q4(e=>e.activeDivisionId),o=Q4(e=>e.projectAssets)??[],s=Q4(e=>e.selectSection),c=Q4(e=>e.removeSection),l=Q4(e=>e.divisionContentChange),u=Q4(e=>e.insertAtCursor),d=Q4(e=>e.startSectionEdit),f=Q4(e=>e.setEditDraft),p=Q4(e=>e.commitSectionEdit),m=Q4(e=>e.cancelSectionEdit),h=Q4(e=>e.editingId),g=Q4(e=>e.editDraft),_=r?r.find(e=>e.xmlId===i)??r.find(e=>e.type===`book`||e.type===`article`||e.type===`slideshow`)??r[0]??null:null,v=_&&r?x6(r,_.xmlId):[],y=_&&r?S6(r,_.xmlId):[],b=(()=>{if(!r)return[];let e=new Set,t=[];for(let n of r)for(let r of u6(n.content)){let n=`${r.kind}:${r.ref}`;e.has(n)||(e.add(n),t.push(r))}return t})(),x=K6.map(e=>({kind:e,items:b.filter(t=>t.kind===e)})).filter(e=>e.items.length>0),[S,C]=(0,n.useState)(!1),[w,T]=(0,n.useState)(new Set),E=e=>!w.has(e),D=e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,n.useEffect)(()=>{if(!a||!_)return;let e=new Map(v.map(e=>[e.division.xmlId,e])),t=new Set;t.add(_.xmlId);let n=a;for(;n;){let r=e.get(n);if(!r?.parentXmlId)break;t.add(r.parentXmlId),n=r.parentXmlId}T(e=>{if([...t].every(t=>!e.has(t)))return e;let n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[a]);let O=new Set(v.map(e=>e.parentXmlId).filter(Boolean)),k=[];if(_){let e=new Set;E(_.xmlId)&&e.add(_.xmlId);for(let t of v)t.parentXmlId&&e.has(t.parentXmlId)&&(k.push(t),E(t.division.xmlId)&&e.add(t.division.xmlId))}let A=(e,t)=>{if(!r)return;let n=r.find(e=>e.xmlId===t);n&&l(n.xmlId,v6(p6(n.content,e)))},j=(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&&l(n.xmlId,v6(p6(n.content,e.xmlId)))}c(e.xmlId)}},ee=e=>{u(`<plus:${e.type} ref="${e.xmlId}"/>`)},te=e=>{_&&l(_.xmlId,v6(f6(_.content,e.xmlId,e.type,null)))},ne=(e,t)=>{u(`<plus:${e} ref="${t}"/>`)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`ul`,{className:`pretext-plus-editor__toc-list`,role:`list`,children:[_&&(0,t.jsx)(W6,{division:_,depth:0,isActive:a===_.xmlId,hasChildren:O.has(_.xmlId),isExpanded:E(_.xmlId),onToggleExpand:()=>D(_.xmlId),editDraft:h===_.xmlId?g:null,onSelect:()=>s(_.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(_)}],isLatex:_.sourceFormat===`latex`,isRoot:!0}),k.length===0&&_&&E(_.xmlId)&&(0,t.jsx)(`li`,{className:`pretext-plus-editor__toc-no-sections`,children:(0,t.jsx)(`span`,{children:`No placed divisions`})}),k.map(e=>(0,t.jsx)(W6,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:O.has(e.division.xmlId),isExpanded:E(e.division.xmlId),onToggleExpand:()=>D(e.division.xmlId),editDraft:h===e.division.xmlId?g:null,onSelect:()=>s(e.division.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e.division)},{label:`Remove from document`,onClick:()=>A(e.division.xmlId,e.parentXmlId)},{label:`Delete from project`,onClick:()=>j(e.division,e.parentXmlId),danger:!0}],isLatex:e.division.sourceFormat===`latex`},e.division.xmlId))]}),y.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:y.map(e=>{let i=r?x6(r,e.xmlId):[],o=new Set(i.map(e=>e.parentXmlId).filter(Boolean));return(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)(W6,{division:e,depth:0,isActive:a===e.xmlId,hasChildren:o.has(e.xmlId),isExpanded:E(e.xmlId),onToggleExpand:()=>D(e.xmlId),editDraft:h===e.xmlId?g:null,onSelect:()=>s(e.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e)},{label:`Place in document`,onClick:()=>te(e)},{label:`Insert at cursor`,onClick:()=>ee(e)},{label:`Delete from project`,onClick:()=>j(e,null),danger:!0}],isLatex:e.sourceFormat===`latex`}),E(e.xmlId)&&i.map(e=>(0,t.jsx)(W6,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:o.has(e.division.xmlId),isExpanded:E(e.division.xmlId),onToggleExpand:()=>D(e.division.xmlId),editDraft:h===e.division.xmlId?g:null,onSelect:()=>s(e.division.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e.division)},{label:`Insert at cursor`,onClick:()=>ee(e.division)},{label:`Delete from project`,onClick:()=>j(e.division,e.parentXmlId),danger:!0}],isLatex:e.division.sourceFormat===`latex`},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:()=>C(e=>!e),"aria-expanded":S,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-chevron`,children:S?`▾`:`▸`}),(0,t.jsx)(`span`,{children:`Assets`}),b.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-count`,children:b.length})]})}),S&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-body`,children:b.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__toc-assets-empty`,children:[`No assets referenced in this document.`,` `,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:x.map(({kind:e,items:n})=>(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-group-header`,children:G6[e]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-assets-list`,children:n.map(({ref:n})=>(0,t.jsxs)(`li`,{className:`pretext-plus-editor__toc-asset-item`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-asset-name`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-label`,children:o.find(t=>t.kind===e&&t.ref===n)?.name??n}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-filename`,children:n})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-action-btn`,onClick:()=>ne(e,n),title:`Insert <plus:${e} ref="${n}"/> at cursor`,children:`Insert`})]},n))})]},e))})})]}),e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-btn`,onClick:e,children:`Manage Assets`})]})},J6=({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)(q6,{onOpenAssetPicker:r})]}),Y6=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`})]})}};function X6(e){let t=()=>{},n={cbs:{selectDivision:t,addDivision:t,removeDivision:t,updateDivision:t,divisionContentChange:t,handleDivisionContentChange:t,assetInsert:t,updateTitle:t}};return{store:J4()((t,r)=>({source:e.source,sourceFormat:e.sourceFormat,projectAssets:void 0,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,isTocCollapsed:!1,showFullPreview:!0,isNarrowScreen:typeof window<`u`?window.innerWidth<800:!1,activeTab:`editor`,isLatexDialogOpen:!1,isConvertDialogOpen:!1,isDocinfoEditorOpen:!1,isAssetPickerOpen:!1,editingId:null,editDraft: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.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=>{let{xmlId:n,label:r}=t6(e.content);t({editingId:e.xmlId,editDraft:{title:e.title,type:e.type,xmlId:n,label:r}})},setEditDraft:e=>t({editDraft:e}),commitSectionEdit:()=>{let{editingId:e,editDraft:i}=r();e&&i&&n.cbs.updateDivision(e,{title:i.title.trim()||void 0,type:i.type,xmlId:i.xmlId.trim()||null,label:i.label.trim()||null}),t({editingId:null,editDraft:null})},cancelSectionEdit:()=>t({editingId:null,editDraft:null}),insertAsset:e=>n.cbs.assetInsert(e),insertAtCursor:e=>n.cbs.insertContentAtCursor?.(e),updateTitle:e=>n.cbs.updateTitle(e),feedbackSubmit:e=>n.cbs.feedbackSubmit?.(e)})),bindCallbacks:e=>{n.cbs=e}}}function Z6({store:e,children:n}){return(0,t.jsx)(Z4.Provider,{value:e,children:n})}var Q6=(e,t)=>e.find(e=>t?e.xmlId===t:e.type===`book`||e.type===`article`||e.type===`slideshow`)??e[0]??null,$6=e=>{let[r]=(0,n.useState)(()=>{let t=Q6(e.divisions,e.rootDivisionId),n=e.activeDivisionId??t?.xmlId??null,r=e.divisions.find(e=>e.xmlId===n)??t;return X6({source:r?.content??``,sourceFormat:r?.sourceFormat??`pretext`,title:e.title??`Document Title`,docinfo:e.docinfo??``,commonDocinfo:e.commonDocinfo??``,useCommonDocinfo:e.useCommonDocinfo??!1,projectType:e.projectType,divisions:e.divisions,activeDivisionId:n})});return(0,t.jsx)(Z6,{store:r.store,children:(0,t.jsx)(e8,{...e,bindCallbacks:r.bindCallbacks})})},e8=e=>{let{bindCallbacks:r}=e,i=Q4(e=>e.showFullPreview),a=Q4(e=>e.isNarrowScreen),o=Q4(e=>e.setIsNarrowScreen),s=Q4(e=>e.activeTab),c=Q4(e=>e.setActiveTab),l=Q4(e=>e.isTocCollapsed),u=Q4(e=>e.setIsTocCollapsed),d=Q4(e=>e.isLatexDialogOpen),f=Q4(e=>e.isConvertDialogOpen),p=Q4(e=>e.isDocinfoEditorOpen),m=Q4(e=>e.isAssetPickerOpen),h=Q4(e=>e.openModal),g=Q4(e=>e.closeModal),_=Q4(e=>e.syncState),v=Q4(e=>e.divisions)??[],y=Q4(e=>e.activeDivisionId),b=Q4(e=>e.title),x=Q4(e=>e.docinfo),S=Q4(e=>e.commonDocinfo),C=Q4(e=>e.useCommonDocinfo),w=Q4(e=>e.applyExternalUpdate),T=Q4(e=>e.setDivisionContent),E=Q4(e=>e.patchDivision),D=Q4(e=>e.addDivisionToPool),O=Q4(e=>e.removeDivisionFromPool),k=Q4(e=>e.setActiveDivisionId),A=Q4(e=>e.setTitle),j=Q4(e=>e.setDocinfo),ee=(0,n.useRef)(null),te=(0,n.useRef)(null),ne=Q6(v,e.rootDivisionId),re=v.find(e=>e.xmlId===y)??v[0]??null,M=re?.sourceFormat??`pretext`,ie=re?.content??``,ae=(t,n,r,i)=>{T(t,n),e.onContentChange({xmlId:t,sourceContent:n,sourceFormat:r,pretextSource:r===`pretext`?n:void 0,...i})},oe=(t,n)=>{E(t,n),e.onDivisionUpdate?.(t,n)},N=t=>{D(t),e.onDivisionAdd?.(t)},se=t=>{O(t),e.onDivisionRemove?.(t)},P=t=>{k(t),e.onDivisionSelect?.(t)},ce=(0,n.useMemo)(()=>{if(!re||M===`pretext`)return;let e=W4(ie,M);return e.pretextError?void 0:e.pretextSource},[re,M,ie]),le=e=>{if(!re)return;let t=M===`pretext`?v6(e||``):e||``;if(t===re.content)return;if(ae(re.xmlId,t,M),M===`pretext`){let e=n6(t);if(e){oe(re.xmlId,{title:e.title,type:e.type,xmlId:e.xmlId||null,label:e.label||null});let t=e.xmlId||re.xmlId;if(t!==re.xmlId||e.type!==re.type){let n=g6(v,re.xmlId);if(n){let r=h6(n.content,re.xmlId,t,e.type);r!==n.content&&ae(n.xmlId,r,n.sourceFormat)}}e.xmlId&&e.xmlId!==re.xmlId&&P(e.xmlId)}}else if(M===`latex`&&re.type===`section`){let e=X3(t);e!==null&&oe(re.xmlId,{title:e})}let n=new Set(v.map(e=>e.xmlId));for(let{xmlId:e,type:r}of l6(t))n.has(e)||(N(d6(e,r,M)),n.add(e))},ue=e=>{P(e)},de=()=>{let e=B3();N(e),k(e.xmlId)},F=e=>e.ref?`<plus:${e.kind} ref="${e.ref}"/>`:``,fe=t=>{let n=F(t);n&&te.current?.insertAtCursor(n),e.onAssetInsert?.(t)};(0,n.useEffect)(()=>{let e=()=>o(window.innerWidth<800);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let pe=M!==`pretext`;(0,n.useLayoutEffect)(()=>{r({selectDivision:ue,addDivision:()=>de(),removeDivision:e=>se(e),updateDivision:(e,t)=>oe(e,t),divisionContentChange:(e,t)=>{ae(e,t,v.find(t=>t.xmlId===e)?.sourceFormat??`pretext`)},handleDivisionContentChange:le,assetInsert:fe,insertContentAtCursor:e=>te.current?.insertAtCursor(e),updateTitle:t=>{A(t),e.onTitleChange?.(t)},feedbackSubmit:e.onFeedbackSubmit})}),(0,n.useEffect)(()=>{_({source:ie,sourceFormat:M,projectAssets:e.projectAssets,libraryAssets:e.libraryAssets,projectType:e.projectType,projectUrl:e.projectUrl,rootDivisionId:ne?.xmlId,canConvertToPretext:ce!==void 0,activeEditorSource:ie,hasFeedback:e.onFeedbackSubmit!==void 0})});let me=(0,n.useRef)({divisions:e.divisions,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId});(0,n.useEffect)(()=>{let t=me.current,n={},r=!1;if(e.divisions!==t.divisions){n.divisions=e.divisions;let t=Q6(e.divisions,e.rootDivisionId);(y==null||!e.divisions.some(e=>e.xmlId===y))&&(n.activeDivisionId=t?.xmlId??null),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&&w(n),me.current={divisions:e.divisions,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId}});let he=C?S:x,ge=re?M===`pretext`?O6(v,re.xmlId):ce===void 0?void 0:`<${re.type} xml:id="${re.xmlId}">\n<title>${re.title}</title>\n\n${ce}\n</${re.type}>`:void 0,I=re&&ge!==void 0?M6(re.type,ge,he,re.title):void 0,_e=()=>ee.current?.rebuild(),ve=()=>{e.onSave?.(),ee.current?.rebuild()},ye=t=>{let n=t.ctrlKey||t.metaKey;n&&t.key===`Enter`&&e.onPreviewRebuild?(t.preventDefault(),_e()):n&&t.key===`s`&&(t.preventDefault(),ve())},be=()=>{if(!re||!ce)return;let e=B3(),t=v6(W3(ce,re.type));N({id:e.xmlId,xmlId:e.xmlId,title:re.title,type:re.type,sourceFormat:`pretext`,content:t})},xe=(0,t.jsx)(Ps,{ref:te,content:ie,sourceFormat:M,onChange:le,onRebuild:e.onPreviewRebuild?_e:void 0,onSave:ve,onOpenLatexImport:()=>h(`isLatexDialogOpen`),onOpenDocinfoEditor:()=>h(`isDocinfoEditorOpen`),onOpenConvertToPretext:pe&&ce!==void 0?()=>h(`isConvertDialogOpen`):void 0,canConvertToPretext:ce!==void 0,onOpenAssets:e.projectAssets!==void 0&&M===`pretext`?()=>h(`isAssetPickerOpen`):void 0}),Se;Se=i&&e.onPreviewRebuild?(0,t.jsx)($L,{ref:ee,content:I||``,title:b,onRebuild:e.onPreviewRebuild}):(0,t.jsx)(XL,{content:ie,canEdit:M===`pretext`,editDisabledReason:M===`markdown`?`Visual editing is not available for Markdown documents.`:M===`latex`?`Visual editing is not available for LaTeX documents.`:``,onChange:e=>le(e)});let Ce=(0,t.jsx)(J6,{isCollapsed:l,onToggleCollapse:()=>u(e=>!e),onOpenAssetPicker:e.projectAssets===void 0?void 0:()=>h(`isAssetPickerOpen`)}),L=`pretext-plus-tab-editor`,we=`pretext-plus-tab-preview`,Te=`pretext-plus-tabpanel`,Ee;return Ee=a?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs`,children:[Ce,(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:L,role:`tab`,"aria-controls":Te,"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:we,role:`tab`,"aria-controls":Te,"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:Te,className:`pretext-plus-editor__tab-panel`,role:`tabpanel`,"aria-labelledby":s===`editor`?L:we,children:(0,t.jsx)(`div`,{style:{height:`100%`},children:s===`editor`?xe:Se})})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__sectioned-layout`,children:[Ce,(0,t.jsxs)(gt,{orientation:`horizontal`,className:`pretext-plus-editor__splitter`,children:[(0,t.jsx)(yt,{className:`pretext-plus-editor__editor-panel`,children:xe}),(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:Se})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor`,onKeyDown:ye,children:[(0,t.jsx)(R6,{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)(Y6,{resetKeys:[ie,y],children:Ee}),d?(0,t.jsx)(e3,{onClose:()=>g(`isLatexDialogOpen`)}):null,f&&re&&ce?(0,t.jsx)(i3,{sourceContent:ie,sourceFormat:M,pretextSource:ce,onConfirm:be,onClose:()=>g(`isConvertDialogOpen`)}):null,p?(0,t.jsx)(g3,{docinfo:x,showCommonDocinfoControls:!0,commonDocinfo:S,initialUseCommonDocinfo:C,onClose:t=>{if(g(`isDocinfoEditorOpen`),t!==void 0){j({docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo}),e.onCommonDocinfoChange?.(t.commonDocinfo),e.onUseCommonDocinfoChange?.(t.useCommonDocinfo);let n=ne??re;ae(n?.xmlId??``,n?.content??``,n?.sourceFormat??`pretext`,{docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo})}}}):null,m&&e.projectAssets!==void 0?(0,t.jsx)(L6,{open:m,onClose:()=>g(`isAssetPickerOpen`),onLoadAssets:e.onLoadAssets,onLoadLibraryAssets:e.onLoadLibraryAssets,onAddFromLibrary:e.onAssetAddFromLibrary,onUpload:e.onAssetUpload,onAddUrl:e.onAssetAddUrl,onCreateDoenet:e.onCreateDoenet,onRemoveAsset:e.onAssetRemove,onInsert:fe}):null]})]})};e.CodeEditor=Ps,e.DocinfoEditor=g3,e.Editors=$6,e.FeedbackLink=K4,e.FullPreview=$L,e.VisualEditor=XL,e.assembleFullProjectSource=A6,e.assembleProjectSource=O6,e.buildDivisionTree=x6,e.convertLatexToPretext=V4,e.createConclusion=H3,e.createIntroduction=V3,e.createLatexConclusion=$3,e.createLatexIntroduction=Q3,e.createNewLatexSection=Z3,e.createNewSection=B3,e.derivePretextContent=W4,e.detectSourceFormat=B4,e.ensureLatexSectionWrapper=J3,e.ensureSectionWrapper=G3,e.extractDivisionMetadata=n6,e.extractLatexDivisionTitle=X3,e.findDivisionParent=g6,e.getOrphanRoots=S6,e.getOrphanedDivisions=b6,e.getSectionAttributes=t6,e.insertDivisionRef=f6,e.mergeTwoSections=e6,e.moveDivisionRef=m6,e.normalizeSelfClosingRefs=v6,e.parseDivisionRefs=c6,e.postToIframe=QL,e.removeDivisionRef=p6,e.renameDivisionRef=h6,e.reorderDivisionRefs=_6,e.rewrapLatexSection=q3,e.rewrapSection=W3,e.stripLatexSectionWrapper=K3,e.stripSectionWrapper=U3,e.updateDivisionTitle=z3,e.updateLatexSectionTitle=Y3,e.updateSectionMetadata=r6,e.wrapDivisionForPreview=M6});
|
|
1083
|
+
`+a.slice(o)}function S6(e,t,n,r){let i=new RegExp(m6(t));return i.test(e)?e.replace(i,`<plus:${r} ref="${n}"/>`):e}function C6(e,t){let n=new RegExp(m6(t));return e.find(e=>n.test(e.content))??null}function w6(e,t){let n=e,r=null;for(let e of t)n=x6(n,e,r),r=e;return n}function T6(e){return e.replace(/<plus:([a-z-]+)((?:\s[^>]*?)?)>\s*<\/plus:\1>/g,(e,t,n)=>`<plus:${t}${n}/>`)}function E6(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 h6(i.content))r.push(e)}return n}function D6(e,t){let n=E6(e,t);return e.filter(e=>!n.has(e.xmlId))}function O6(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 h6(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 k6(e,t){let n=D6(e,t),r=new Set(n.map(e=>e.xmlId)),i=new Set;for(let e of n)for(let t of h6(e.content))r.has(t)&&i.add(t);return n.filter(e=>!i.has(e.xmlId))}var A6=new Set([`book`,`article`,`slideshow`]);function j6(e){try{let t=O3(e),n=t.children.find(e=>e.type===`element`),r=n?.name===`pretext`?n.children.find(e=>e.type===`element`&&A6.has(e.name)):n&&A6.has(n.name)?n:void 0;if(!r)return e;if(!r.attributes.label){let e=N6(t,`pretext-plus-preview`);return r.attributes.label=e,TY(t)}return e}catch(t){return console.error(`Error ensuring label:`,t),e}}function M6(e,t){return e.type===`element`&&e.attributes?.label===t?!0:`children`in e&&e.children?e.children.some(e=>e.type===`element`?M6(e,t):!1):!1}function N6(e,t){let n=t,r=1;for(;M6(e,n);)n=`${t}-${r}`,r++;return n}function P6(e,t,n){let r=t.find(t=>t.xmlId===e);if(!r)return`<!-- missing division: ${e} -->`;if(n.has(e))return`<!-- circular reference: ${e} -->`;let i;if(r.sourceFormat===`pretext`)i=r.content;else{let{pretextSource:e,pretextError:t}=Z4(r.sourceFormat===`latex`?$3(r.content,r.type):X3(r.content),r.sourceFormat),n=e??`<!-- conversion error: ${t} -->`;i=`<${r.type} xml:id="${r.xmlId}">\n<title>${r.title}</title>\n\n${n}\n</${r.type}>`}if(r.sourceFormat!==`pretext`)return i;let a=new Set(n).add(e);return i.replace(/<plus:[a-z-]+\s[^>]*ref="([^"]+)"[^>]*?(?:\/>|>\s*<\/plus:[a-z-]+>)/g,(e,n)=>P6(n,t,a))}function F6(e,t){return j6(P6(t,e,new Set))}function I6(e,t){return j6(`<pretext>\n${t.trim()?`${t.trim()}\n`:``}${e}\n</pretext>`)}function L6(e,t,n){return I6(P6(t,e,new Set),n)}var R6=new Set([`part`,`chapter`]);function z6(e,t,n,r){return I6(A6.has(e)?t:R6.has(e)?`<book>\n<title>${r}</title>\n${t}\n</book>`:`<article>\n<title>${r}</title>\n${t}\n</article>`,n)}function B6(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 V6(e,t,n){let r=n===`book`?`book`:`article`;return e.map(e=>{if(e.sourceFormat!==`pretext`)return e;let n=l6(e.content);if(e.xmlId===t&&!(n&&A6.has(n.type))){let{title:t,body:n}=B6(e.content),i=e.title||t||`Untitled`;return{...e,type:r,title:i,content:`<${r} xml:id="${e.xmlId}">\n<title>${i}</title>\n\n${n}\n</${r}>`}}return!e.title&&n?.title?{...e,title:n.title}:e})}var H6=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAJZ0lEQVR4nJxXe3BU1Rn/nXNf+8oueUgSdpckEALhpc1KJBEskkGc0Uqp2o6C7VSqM/5RGWsHnTLMOI51qgxCyzhtRx1ktFOslZZaC8UkFC2CKCEkaCSKCXmHbDabTbLZ+zj3dM7dDYZACuM3c7Kbc/d+v+91vu93ZFynaJqGmpoasUhFRQUpKioieXl5RDwbHBzkFy5c4KdPn+Z1dXW8trYWqVTqelX/fwmFQnjppZdILBaTOeca59zNOfdanAeSjAfFsjifIfYyz7ShoSF5165dwshr6ifTPVAUBVu3bsWWLVtkt9stm4C3JYU153TUdJiIxBnCHJAzSqwZFF1hFQ1lKuoWunFYBcZ0XTd37NjBnn32Wa7r+vUbILzev38/XbZsmWICvmOj+NmxJB5JceSKFyhACPnmZS4WB+z0B1wEsWoPXr3Vg1dUipFTp06Z69evtzs7O69tQGlpKerr66VwOKx2GLj57QR2xRnmSAChxAF3XiKYYkBm2WJxgAHcT9FxXwBPlKg43t3dbaxZs4a1tLRMb4Dw/KOPPhLg2idJPPDuCJ4ngCoRECntOSgBodMYkAHn4pOJxZ19864sbL3Fgzd7e3v16upq1t7efqUBIufHjh0TYRfgDx4YwXYZoBIBBLicAZ6IQmpwgPq6vlTnuqgUUCQpYdn2+ZRtxgpKDO2GAm5lDLE4YAH2PVl4qtKDN5uamvTKykp7oiakCQO2bduGDRs2iLAv2zeMP0qAIpN0lakEhI0Mk/i5s7IiS2ADfXQNH/Z9vyoizZsdouFgEKXhEKksCcs50S6tpbObaXkFoh6cWhGOnjOwqkjByQXB/G4RnCNHjnwTARH61tZWWXa7A7+L4nCCYY7wWIArBMRuPqGunZnlunHxIpxsOI2hsaS9duWt9KplDaCruxuvd8THXKWLWCYC3OSAj6Lj8VzUcCM1VFZWZomidCLwzDPPkJUrV2ofjuKxFh3fmww+1vE1vf8GzbOovNxRHiwsRHFwFqGUwjAMcM4hvk8Wv98Po6tN7s+aaVBJcmpDuDrO4RdZme+VTyiKwg4ePAgiOlxvb6/sy84OvHgRH5sceQpJg4sUDDd+LG+umOfJyclxlIvcvbdvH07++zCGo1EQShGcOxer778PVatWXTLCsiw8/2Fj0rfkZktEweTpKEgE8S15qDTGRmIFBQWWtHbtWmzatEn5bBx3ndFx/4T3ctoAwhlDwciAmp+fD9M08eKTv8TZunpYyWQaybaRHBxE84f/xbjNsPCmm5xtEZXmjm6GmUEnAOIPJ44hWp6M1iKv1tLQ0MDo6tWrnd5yzkANzRw1YjOin6jVgsff8y640Ozr6+tzPDpaW4vOs2edyiotzsbP183HD28vguyiTjHV/nkf+np7HAOGhobQ+/VXNPb5GQk2m3x8SauO2wWUwJbFYBH/dBiIOB1OhO/To+rDFeVaTm4uVFW9lONktBu27TiEEYsiOv9OxHu6IUs9YLAgU/GbHqBwFrKzs/Hrnz6gjo+Pq/86foy1hBePkUCO42CXiQqBGYlECC0uLiYMkOM2Qg66bWMJNVwFhYVwuVyXFdjc4tmYNcsP07LQ3zWIt178Lere/Cv0pOWEuGpxPrw5+ZcVpNvtxr2rb5OyO7/QnOZFAIElMMVElXNzc4luw8udugPM0QTJz5lxRWULKYmsQM2Ko2j94jzOdSYwOs6gyhSFOR5UL7wB2YurkB8MX/Vo5stESqTxRX+QdRu+vLy8MTnTKS51RDXLzwe+jF9VicfjwXceegru9/+CsvOnkK1wyJKEpOKDd9FtmHfrndO1BgyamdxNETkajfJwVtYoSXdNRZTKVyY1hoeH1UAgcMULPp8PkfUPwzA2YmBgABKlmJeff6nlMcac3jAhomY+aTyD3pyQrmampcBSKcaiFwe5LJhMSUmJM89HbJSIozK2cFnqT7VH6fyARxapEErEmqxYfL+0nxlGQjXPHDcOAsvmdpRLbCBUpntDRdzgaQsCFF0yYLa3t3NZ0KhVq1bZYQUNZ3UUi/6tBLKR+u49yabxJJG5TVSJQpEoUQiZ6A+O55JEQYiUnoTplivC6DScTPsVQwneTCuemJghBY3ia2NjI6f19fXOfpmGuskjVVhK3R5IXh+nLg+I6uJQNUDVOFc0bksKGJEcUKHcBLiVXg4XMBnD6OCAOGFpspKZjsKOMhX/ETCCP1JBIOPxOFvowmHBZOw0s3Hm+ejgAN566G7v/sd/4h6+2EdSKZ2nUroDGLvYh5Rp8bHkONcty/FQ1Fm8vw+GaeLEa7vVdx79ka//8ybKJhEVhSCxyIVDIyMj7NChQ5AFe927dy/bvHnzWJUHrx4ZwxanIXHwoY42KRm9SJlh2KfffkNpPfyuKobLTT94UD/zt31a6MaIGetoo8l4TPJk57Li5SvZZwf/LociVSx24Tw1RhNo/+B9ecmCpRbLRKbajT0aReK1N95go6OjTmPCzp07BWk0V3jwiqBRLBMFJ9y2jVQ8RtUZObbIi1ixnk5qjCehZedwy7KI4vbYQ53t0nB/H7FS49RfNIdVPPJEisoylj76pD7BjnwUPbd58XuBtX37dn7Z+X/uuecEC9baDFTvGcJbFFDFUBr6rEHWXG6eV1ZuD35+RhLMKW/OPLu38VPJNzPfUaJ4fDwZixL/7BK750yD5JtdbLtyZ9oDX35BAwuWOJyAAdaPZ2DDPA1HX3jhhdTTTz+NywwQY1lQskgkop1M4qF/jOA3gpLJGQomZ3gh+YaYkimcMF1kaTBMpWR3Z+FXyz3Y29zc7FCyiYvLZaQ0HA7j+PHjUjAYFEZs+GealCoTvPDbkFIbsO7KwjYB3t/fr1dVVbG2trZLmFfQ8vLyctTV1UmFhYXq1waq3xnGzoSN8DS0nGQM4JOpOcvQcpHze/34RamGD/r7+4077riDNTU1XYZ31YtJcXExDhw4QJcuXaoYNvxHk3jsRBKbDA6/AKWZVFzlYuIYI47acjf2iIJzUQw3Nzcb69atsyd7PiHS1QyIx+PYs2cPJ4TYVbdU6vM98onlbrwumIxMMJ6y4U5y+BjgnHGRZj9F51wVR1Z48Yf1fmyZ70I9M/TRHTt2mBs3buRibnwrEXWxe/dukkgkpl5OZ2Qup6Gpl1Px25dffpmISF5Lpr2cThWv1wvBH6dez8UUFBN14nouWrtgu6LJXI/8LwAA//98WriRDELEmAAAAABJRU5ErkJggg==`,U6={image:`Images`,doenet:`Doenet`},W6=[`image`,`doenet`];function G6(e){let t=new Set,n=[];for(let{kind:r,ref:i}of _6(e)){let e=`${r}:${i}`;t.has(e)||(t.add(e),n.push({kind:r,ref:i}))}return n}var K6=({open:e,onClose:r,onLoadAssets:i,onLoadLibraryAssets:a,onInsert:o,onAddFromLibrary:s,onUpload:c,onFetchUrl:l,onCreateDoenet:u,onRemoveAsset:d})=>{let f=a3(e=>e.activeEditorSource),p=a3(e=>e.projectAssets)??[],m=a3(e=>e.libraryAssets),h=!!(i||a),[g,_]=(0,n.useState)(null),[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),w=g??p,T=v??m??w,E=new Set(w.map(e=>e.id)),[D,O]=(0,n.useState)(`in-document`),[k,A]=(0,n.useState)(null),[j,ee]=(0,n.useState)(`library`),[te,ne]=(0,n.useState)(`library`),[re,M]=(0,n.useState)(null),[ie,ae]=(0,n.useState)(!1),[oe,N]=(0,n.useState)(!1),[se,P]=(0,n.useState)(null),ce=(0,n.useRef)(null),[le,ue]=(0,n.useState)(``),[de,F]=(0,n.useState)(``),[fe,pe]=(0,n.useState)(!1),[me,he]=(0,n.useState)(null),[ge,I]=(0,n.useState)(``),[_e,ve]=(0,n.useState)(``),[ye,be]=(0,n.useState)(!1),[xe,Se]=(0,n.useState)(null),[Ce,L]=(0,n.useState)(null),we=(0,n.useCallback)(()=>{!i&&!a||(x(!0),C(null),Promise.all([i?.()??Promise.resolve(null),a?.()??Promise.resolve(null)]).then(([e,t])=>{e!==null&&_(e),t!==null&&y(t)}).catch(e=>{C(e instanceof Error?e.message:`Failed to load assets.`)}).finally(()=>x(!1)))},[i,a]);if((0,n.useEffect)(()=>{if(!e)return;we();let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,we]),!e)return null;let Te=G6(f),Ee=e=>{o(e),r()},R=(e,t)=>{let n=`${e}:${t}`;navigator.clipboard.writeText(`<plus:${e} ref="${t}"/>`).catch(()=>{}),L(n),setTimeout(()=>L(e=>e===n?null:e),2e3)},De=async e=>{if(!E.has(e.id)&&s){M(e.id);try{await s(e)}finally{M(null)}}Ee(e)},Oe=async e=>{if(c){P(null),N(!0);try{Ee(await c(e))}catch(e){P(e instanceof Error?e.message:`Upload failed.`),N(!1)}}},ke=async()=>{let e=le.trim();if(!e)return;let t=de.trim();if(l&&c){he(null),pe(!0);try{let n=await l(e);Ee(await c(t?new File([n],t,{type:n.type}):n))}catch(e){he(e instanceof Error?e.message:`Failed to add URL.`),pe(!1)}}else Ee({id:`url-${Date.now()}`,name:t||e,ref:e.split(`/`).pop()??`image`,kind:`image`,url:e})},z=async()=>{let e=ge.trim(),t=_e.trim();if(!(!e||!t))if(u){Se(null),be(!0);try{Ee(await u(e,t))}catch(e){Se(e instanceof Error?e.message:`Failed to create activity.`),be(!1)}}else Ee({id:`doenet-${Date.now()}`,name:e,ref:t,kind:`doenet`})},Ae=e=>{let n=T.filter(t=>t.kind===e);return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-library`,children:[h&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-toolbar`,children:[S&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-load-error`,children:S}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__asset-library-refresh`,onClick:we,disabled:b,children:b?`Loading…`:`Refresh`})]}),b&&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 `,U6[e].toLowerCase(),` assets in your library.`]}):(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:n.map(e=>{let n=E.has(e.id),r=re===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:()=>De(e),disabled:r||!e.ref,title:e.ref?n?`Insert "${e.ref}"`:`Add to project & insert "${e.ref}"`:`Asset has no reference — cannot insert`,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)})})]})};return(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-overlay`,onClick:e=>e.target===e.currentTarget&&r(),children:(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog pretext-plus-editor__dialog--asset-manager`,role:`dialog`,"aria-modal":`true`,"aria-label":`Asset manager`,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:`✕`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__dialog-tab-bar`,children:[(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${D===`in-document`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>O(`in-document`),children:[`In Document`,Te.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__asset-tab-count`,children:Te.length})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${D===`add`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>{O(`add`),A(null)},children:`Add Asset`})]}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__dialog-content pretext-plus-editor__dialog-content--single`,children:D===`in-document`?(()=>{if(Te.length===0)return(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-placeholder`,children:[(0,t.jsx)(`p`,{children:`No assets referenced in this document yet.`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:()=>{O(`add`),A(null)},children:`Add an asset`})]});let e=W6.reduce((e,t)=>(e[t]=Te.filter(e=>e.kind===t).map(e=>({ref:e.ref,asset:w.find(t=>t.kind===e.kind&&t.ref===e.ref)})),e),{image:[],doenet:[]});return(0,t.jsx)(`div`,{className:`pretext-plus-editor__am-in-doc`,children:W6.filter(t=>e[t].length>0).map(n=>(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:U6[n]}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-count`,children:e[n].length})]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__am-list`,children:e[n].map(({ref:e,asset:i})=>{let a=`${n}:${e}`;return(0,t.jsxs)(`li`,{className:`pretext-plus-editor__am-doc-row`,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:i?.name??e}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-row-ref`,children:e})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-row-actions`,children:[i&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn`,onClick:()=>Ee(i),title:`Insert <plus:${n} ref="${e}"/>`,children:`Insert`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn${Ce===a?` pretext-plus-editor__am-action-btn--done`:``}`,onClick:()=>R(n,e),title:`Copy <plus:${n} ref="${e}"/>`,children:Ce===a?`Copied!`:`Copy`}),d&&i&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-action-btn pretext-plus-editor__am-action-btn--danger`,onClick:()=>{d(i),r()},title:`Remove from project`,children:`Remove`})]})]},e)})})]},n))})})():k===null?(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:()=>{A(`image`),ee(`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.`})]}),(0,t.jsxs)(`button`,{type:`button`,className:`pretext-plus-editor__am-kind-card`,onClick:()=>{A(`doenet`),ne(`library`)},children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-icon`,"aria-hidden":`true`,children:(0,t.jsx)(`img`,{src:H6,alt:`Doenet`})}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-label`,children:`Doenet`}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__am-kind-card-hint`,children:`Interactive activity`})]})]})]}):k===`image`?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>A(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${j===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`library`),children:`Library`}),c&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${j===`upload`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`upload`),children:`Upload`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${j===`url`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ee(`url`),children:`External URL`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[j===`library`&&Ae(`image`),j===`upload`&&c&&(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-upload`,children:[(0,t.jsxs)(`div`,{className:[`pretext-plus-editor__am-drop-zone`,ie?`pretext-plus-editor__am-drop-zone--active`:``,oe?`pretext-plus-editor__am-drop-zone--uploading`:``].filter(Boolean).join(` `),onDragOver:e=>{e.preventDefault(),ae(!0)},onDragLeave:()=>ae(!1),onDrop:e=>{e.preventDefault(),ae(!1);let t=e.dataTransfer.files[0];t&&Oe(t)},onClick:()=>!oe&&ce.current?.click(),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce.current?.click())},"aria-label":`Upload image — click or drag and drop`,children:[(0,t.jsx)(`input`,{ref:ce,type:`file`,accept:`image/*`,className:`pretext-plus-editor__dialog-file-input`,onChange:e=>{let t=e.target.files?.[0];t&&Oe(t)}}),oe?(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`})]})]}),se&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:se})]}),j===`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:le,onChange:e=>ue(e.target.value),disabled:fe,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:de,onChange:e=>F(e.target.value),disabled:fe}),me&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:me}),le.trim()&&(0,t.jsx)(`img`,{src:le.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:ke,disabled:!le.trim()||fe,children:fe?`Adding…`:l&&c?`Add to Library & Insert`:`Insert`})]})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure`,children:[(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__am-back-btn`,onClick:()=>A(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${te===`library`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ne(`library`),children:`Library`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-tab${te===`create`?` pretext-plus-editor__dialog-tab--active`:``}`,onClick:()=>ne(`create`),children:`Create New`})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor__am-configure-body`,children:[te===`library`&&Ae(`doenet`),te===`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:ge,onChange:e=>I(e.target.value),disabled:ye,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:_e,onChange:e=>ve(e.target.value),disabled:ye}),(0,t.jsxs)(`p`,{className:`pretext-plus-editor__dialog-helper-copy`,children:[`The reference ID is used in the inserted tag: `,(0,t.jsx)(`code`,{children:`<plus:doenet ref="${_e||`my-activity`}"/>`})]}),xe&&(0,t.jsx)(`p`,{className:`pretext-plus-editor__am-error`,children:xe}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__dialog-button`,onClick:z,disabled:!ge.trim()||!_e.trim()||ye,children:ye?`Creating…`:u?`Create & Insert`:`Insert`})]})]})]})}),(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`})})]})})},q6=e=>{let n=a3(e=>e.showFullPreview),r=a3(e=>e.setShowFullPreview),i=a3(e=>e.title),a=a3(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)(o3,{label:`Give feedback`,context:`main-editor`}),o]})]})},J6={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`},Y6=[`part`,`chapter`,`section`,`worksheet`,`handout`,`exercises`,`references`,`glossary`,`solutions`,`reading-questions`],X6=({draft:e,isLatex:n,isRoot:r=!1,onDraftChange:i,onCommit:a,onCancel:o})=>(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=>i({...e,title:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&a(),e.key===`Escape`&&o()},autoFocus:!0})]}),!n&&(0,t.jsxs)(t.Fragment,{children:[!r&&(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=>i({...e,type:t.target.value}),children:Y6.map(e=>(0,t.jsx)(`option`,{value:e,children:J6[e]},e))})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`xml:id`}),(0,t.jsx)(`input`,{type:`text`,value:e.xmlId,placeholder:`optional`,onChange:t=>i({...e,xmlId:t.target.value})})]}),(0,t.jsxs)(`label`,{className:`pretext-plus-editor__toc-edit-field`,children:[(0,t.jsx)(`span`,{children:`label`}),(0,t.jsx)(`input`,{type:`text`,value:e.label,placeholder:`optional`,onChange:t=>i({...e,label: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:a,children:`Save`}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-edit-cancel`,onClick:o,children:`Cancel`})]})]});function Z6(e){let t=e?.parentElement??null;for(;t;){let{overflowY:e}=getComputedStyle(t);if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}var Q6=({items:e})=>{let[r,i]=(0,n.useState)(!1),[a,o]=(0,n.useState)(`below`),s=(0,n.useRef)(null),c=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!r)return;let e=e=>{s.current&&!s.current.contains(e.target)&&i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,n.useLayoutEffect)(()=>{if(!r)return;let e=c.current,t=s.current;if(!e||!t)return;let n=Z6(t)??document.documentElement,i=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=t.getBoundingClientRect(),u=a.bottom-l.bottom,d=l.top-a.top;o(i.height>u&&d>u?`above`:`below`)},[r]);let l=e=>{i(!1),e()};return(0,t.jsxs)(`div`,{ref:s,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(),i(e=>(e||o(`below`),!e))},"aria-haspopup":`true`,"aria-expanded":r,title:`More options`,children:`⋮`}),r&&(0,t.jsx)(`div`,{ref:c,className:[`pretext-plus-editor__toc-div-menu-popup`,a===`above`?`pretext-plus-editor__toc-div-menu-popup--above`:`pretext-plus-editor__toc-div-menu-popup--below`].join(` `),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:()=>l(e.onClick),children:e.label},e.label))})]})},$6=({division:e,depth:n,isActive:r,hasChildren:i,isExpanded:a,onToggleExpand:o,editDraft:s,onSelect:c,onDraftChange:l,onEditCommit:u,onEditCancel:d,menuItems:f,isLatex:p,isRoot:m=!1})=>{let h=s!==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`:``,h?`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.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-select`,onClick:c,"aria-current":r?`true`:void 0,title:J6[e.type]??e.type,children:(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-title`,children:e.title||(0,t.jsx)(`em`,{children:`Untitled`})})}),(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-actions`,children:(0,t.jsx)(Q6,{items:f})})]}),h&&s&&(0,t.jsx)(X6,{draft:s,isLatex:p,isRoot:m,onDraftChange:l,onCommit:u,onCancel:d})]})},e8={image:`Images`,doenet:`Doenet`},t8=[`image`,`doenet`],n8=({onOpenAssetPicker:e})=>{let r=a3(e=>e.divisions),i=a3(e=>e.rootDivisionId),a=a3(e=>e.activeDivisionId),o=a3(e=>e.projectAssets)??[],s=a3(e=>e.selectSection),c=a3(e=>e.removeSection),l=a3(e=>e.divisionContentChange),u=a3(e=>e.insertAtCursor),d=a3(e=>e.startSectionEdit),f=a3(e=>e.setEditDraft),p=a3(e=>e.commitSectionEdit),m=a3(e=>e.cancelSectionEdit),h=a3(e=>e.editingId),g=a3(e=>e.editDraft),_=r?r.find(e=>e.xmlId===i)??r.find(e=>e.type===`book`||e.type===`article`||e.type===`slideshow`)??r[0]??null:null,v=_&&r?O6(r,_.xmlId):[],y=_&&r?k6(r,_.xmlId):[],b=(()=>{if(!r)return[];let e=new Set,t=[];for(let n of r)for(let r of _6(n.content)){let n=`${r.kind}:${r.ref}`;e.has(n)||(e.add(n),t.push(r))}return t})(),x=t8.map(e=>({kind:e,items:b.filter(t=>t.kind===e)})).filter(e=>e.items.length>0),[S,C]=(0,n.useState)(!1),[w,T]=(0,n.useState)(new Set),E=e=>!w.has(e),D=e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,n.useEffect)(()=>{if(!a||!_)return;let e=new Map(v.map(e=>[e.division.xmlId,e])),t=new Set;t.add(_.xmlId);let n=a;for(;n;){let r=e.get(n);if(!r?.parentXmlId)break;t.add(r.parentXmlId),n=r.parentXmlId}T(e=>{if([...t].every(t=>!e.has(t)))return e;let n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[a]);let O=new Set(v.map(e=>e.parentXmlId).filter(Boolean)),k=[];if(_){let e=new Set;E(_.xmlId)&&e.add(_.xmlId);for(let t of v)t.parentXmlId&&e.has(t.parentXmlId)&&(k.push(t),E(t.division.xmlId)&&e.add(t.division.xmlId))}let A=(e,t)=>{if(!r)return;let n=r.find(e=>e.xmlId===t);n&&l(n.xmlId,T6(b6(n.content,e)))},j=(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&&l(n.xmlId,T6(b6(n.content,e.xmlId)))}c(e.xmlId)}},ee=e=>{u(`<plus:${e.type} ref="${e.xmlId}"/>`)},te=e=>{_&&l(_.xmlId,T6(y6(_.content,e.xmlId,e.type,null)))},ne=(e,t)=>{u(`<plus:${e} ref="${t}"/>`)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(`ul`,{className:`pretext-plus-editor__toc-list`,role:`list`,children:[_&&(0,t.jsx)($6,{division:_,depth:0,isActive:a===_.xmlId,hasChildren:O.has(_.xmlId),isExpanded:E(_.xmlId),onToggleExpand:()=>D(_.xmlId),editDraft:h===_.xmlId?g:null,onSelect:()=>s(_.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(_)}],isLatex:_.sourceFormat===`latex`,isRoot:!0}),k.length===0&&_&&E(_.xmlId)&&(0,t.jsx)(`li`,{className:`pretext-plus-editor__toc-no-sections`,children:(0,t.jsx)(`span`,{children:`No placed divisions`})}),k.map(e=>(0,t.jsx)($6,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:O.has(e.division.xmlId),isExpanded:E(e.division.xmlId),onToggleExpand:()=>D(e.division.xmlId),editDraft:h===e.division.xmlId?g:null,onSelect:()=>s(e.division.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e.division)},{label:`Remove from document`,onClick:()=>A(e.division.xmlId,e.parentXmlId)},{label:`Delete from project`,onClick:()=>j(e.division,e.parentXmlId),danger:!0}],isLatex:e.division.sourceFormat===`latex`},e.division.xmlId))]}),y.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:y.map(e=>{let i=r?O6(r,e.xmlId):[],o=new Set(i.map(e=>e.parentXmlId).filter(Boolean));return(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)($6,{division:e,depth:0,isActive:a===e.xmlId,hasChildren:o.has(e.xmlId),isExpanded:E(e.xmlId),onToggleExpand:()=>D(e.xmlId),editDraft:h===e.xmlId?g:null,onSelect:()=>s(e.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e)},{label:`Place in document`,onClick:()=>te(e)},{label:`Insert at cursor`,onClick:()=>ee(e)},{label:`Delete from project`,onClick:()=>j(e,null),danger:!0}],isLatex:e.sourceFormat===`latex`}),E(e.xmlId)&&i.map(e=>(0,t.jsx)($6,{division:e.division,depth:e.depth+1,isActive:a===e.division.xmlId,hasChildren:o.has(e.division.xmlId),isExpanded:E(e.division.xmlId),onToggleExpand:()=>D(e.division.xmlId),editDraft:h===e.division.xmlId?g:null,onSelect:()=>s(e.division.xmlId),onDraftChange:f,onEditCommit:p,onEditCancel:m,menuItems:[{label:`Edit properties`,onClick:()=>d(e.division)},{label:`Insert at cursor`,onClick:()=>ee(e.division)},{label:`Delete from project`,onClick:()=>j(e.division,e.parentXmlId),danger:!0}],isLatex:e.division.sourceFormat===`latex`},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:()=>C(e=>!e),"aria-expanded":S,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-chevron`,children:S?`▾`:`▸`}),(0,t.jsx)(`span`,{children:`Assets`}),b.length>0&&(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-assets-count`,children:b.length})]})}),S&&(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-body`,children:b.length===0?(0,t.jsxs)(`p`,{className:`pretext-plus-editor__toc-assets-empty`,children:[`No assets referenced in this document.`,` `,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:x.map(({kind:e,items:n})=>(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`div`,{className:`pretext-plus-editor__toc-assets-group-header`,children:e8[e]}),(0,t.jsx)(`ul`,{className:`pretext-plus-editor__toc-assets-list`,children:n.map(({ref:n})=>(0,t.jsxs)(`li`,{className:`pretext-plus-editor__toc-asset-item`,children:[(0,t.jsxs)(`div`,{className:`pretext-plus-editor__toc-asset-name`,children:[(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-label`,children:o.find(t=>t.kind===e&&t.ref===n)?.name??n}),(0,t.jsx)(`span`,{className:`pretext-plus-editor__toc-asset-filename`,children:n})]}),(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-action-btn`,onClick:()=>ne(e,n),title:`Insert <plus:${e} ref="${n}"/> at cursor`,children:`Insert`})]},n))})]},e))})})]}),e&&(0,t.jsx)(`button`,{type:`button`,className:`pretext-plus-editor__toc-assets-btn`,onClick:e,children:`Manage Assets`})]})},r8=({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)(n8,{onOpenAssetPicker:r})]}),i8=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`})]})}};function a8(e){let t=()=>{},n={cbs:{selectDivision:t,addDivision:t,removeDivision:t,updateDivision:t,divisionContentChange:t,handleDivisionContentChange:t,assetInsert:t,updateTitle:t}};return{store:t3()((t,r)=>({source:e.source,sourceFormat:e.sourceFormat,projectAssets:void 0,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,isTocCollapsed:!1,showFullPreview:!0,isNarrowScreen:typeof window<`u`?window.innerWidth<800:!1,activeTab:`editor`,isLatexDialogOpen:!1,isConvertDialogOpen:!1,isDocinfoEditorOpen:!1,isAssetPickerOpen:!1,editingId:null,editDraft: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=>{let{xmlId:n,label:r}=c6(e.content);t({editingId:e.xmlId,editDraft:{title:e.title,type:e.type,xmlId:n,label:r}})},setEditDraft:e=>t({editDraft:e}),commitSectionEdit:()=>{let{editingId:e,editDraft:i}=r();e&&i&&n.cbs.updateDivision(e,{title:i.title.trim()||void 0,type:i.type,xmlId:i.xmlId.trim()||null,label:i.label.trim()||null}),t({editingId:null,editDraft:null})},cancelSectionEdit:()=>t({editingId:null,editDraft:null}),insertAsset:e=>n.cbs.assetInsert(e),insertAtCursor:e=>n.cbs.insertContentAtCursor?.(e),updateTitle:e=>n.cbs.updateTitle(e),feedbackSubmit:e=>n.cbs.feedbackSubmit?.(e)})),bindCallbacks:e=>{n.cbs=e}}}function o8({store:e,children:n}){return(0,t.jsx)(i3.Provider,{value:e,children:n})}var s8=(e,t)=>e.find(e=>t?e.xmlId===t:e.type===`book`||e.type===`article`||e.type===`slideshow`)??e[0]??null,c8=e=>{let[r]=(0,n.useState)(()=>{let t=s8(e.divisions,e.rootDivisionId),n=V6(e.divisions,t?.xmlId,e.projectType),r=n.find(e=>e.xmlId===t?.xmlId)??t,i=e.activeDivisionId??r?.xmlId??null,a=n.find(e=>e.xmlId===i)??r;return a8({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})});return(0,t.jsx)(o8,{store:r.store,children:(0,t.jsx)(l8,{...e,bindCallbacks:r.bindCallbacks})})},l8=e=>{let{bindCallbacks:r}=e,i=a3(e=>e.showFullPreview),a=a3(e=>e.isNarrowScreen),o=a3(e=>e.setIsNarrowScreen),s=a3(e=>e.activeTab),c=a3(e=>e.setActiveTab),l=a3(e=>e.isTocCollapsed),u=a3(e=>e.setIsTocCollapsed),d=a3(e=>e.isLatexDialogOpen),f=a3(e=>e.isConvertDialogOpen),p=a3(e=>e.isDocinfoEditorOpen),m=a3(e=>e.isAssetPickerOpen),h=a3(e=>e.openModal),g=a3(e=>e.closeModal),_=a3(e=>e.syncState),v=a3(e=>e.divisions)??[],y=a3(e=>e.activeDivisionId),b=a3(e=>e.title),x=a3(e=>e.docinfo),S=a3(e=>e.commonDocinfo),C=a3(e=>e.useCommonDocinfo),w=a3(e=>e.applyExternalUpdate),T=a3(e=>e.setDivisionContent),E=a3(e=>e.patchDivision),D=a3(e=>e.addDivisionToPool),O=a3(e=>e.removeDivisionFromPool),k=a3(e=>e.setActiveDivisionId),A=a3(e=>e.setTitle),j=a3(e=>e.setDocinfo),ee=(0,n.useRef)(null),te=(0,n.useRef)(null),ne=s8(v,e.rootDivisionId),re=v.find(e=>e.xmlId===y)??v[0]??null,M=re?.sourceFormat??`pretext`,ie=re?.content??``,ae=(t,n,r,i)=>{T(t,n),e.onContentChange({xmlId:t,sourceContent:n,sourceFormat:r,pretextSource:r===`pretext`?n:void 0,...i})},oe=(t,n)=>{E(t,n),e.onDivisionUpdate?.(t,n)},N=t=>{D(t),(e.onDivisionAdd?.(t))?.then(e=>E(t.xmlId,{id:e})).catch(()=>{})},se=t=>{O(t),e.onDivisionRemove?.(t)},P=t=>{k(t),e.onDivisionSelect?.(t)},ce=(0,n.useMemo)(()=>{if(!re||M===`pretext`)return;let e=Z4(ie,M);return e.pretextError?void 0:e.pretextSource},[re,M,ie]),le=e=>{if(!re)return;let t=M===`pretext`?T6(e||``):e||``;if(t===re.content)return;if(ae(re.xmlId,t,M),M===`pretext`){let e=l6(t);if(e){oe(re.xmlId,{title:e.title,type:e.type,xmlId:e.xmlId||null,label:e.label||null});let t=e.xmlId||re.xmlId;if(t!==re.xmlId||e.type!==re.type){let n=C6(v,re.xmlId);if(n){let r=S6(n.content,re.xmlId,t,e.type);r!==n.content&&ae(n.xmlId,r,n.sourceFormat)}}e.xmlId&&e.xmlId!==re.xmlId&&P(e.xmlId)}}else if(M===`latex`&&re.type===`section`){let e=r6(t);e!==null&&oe(re.xmlId,{title:e})}let n=new Set(v.map(e=>e.xmlId));for(let{xmlId:e,type:r}of g6(t))n.has(e)||(N(v6(e,r,M)),n.add(e))},ue=e=>{P(e)},de=()=>{let e=q3();N(e),k(e.xmlId)},F=e=>e.ref?`<plus:${e.kind} ref="${e.ref}"/>`:``,fe=t=>{let n=F(t);n&&te.current?.insertAtCursor(n),e.onAssetInsert?.(t)};(0,n.useEffect)(()=>{let e=()=>o(window.innerWidth<800);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]);let pe=M!==`pretext`;(0,n.useLayoutEffect)(()=>{r({selectDivision:ue,addDivision:()=>de(),removeDivision:e=>se(e),updateDivision:(e,t)=>oe(e,t),divisionContentChange:(e,t)=>{ae(e,t,v.find(t=>t.xmlId===e)?.sourceFormat??`pretext`)},handleDivisionContentChange:le,assetInsert:fe,insertContentAtCursor:e=>te.current?.insertAtCursor(e),updateTitle:t=>{A(t),e.onTitleChange?.(t)},feedbackSubmit:e.onFeedbackSubmit})}),(0,n.useEffect)(()=>{_({source:ie,sourceFormat:M,projectAssets:e.projectAssets,libraryAssets:e.libraryAssets,projectType:e.projectType,projectUrl:e.projectUrl,rootDivisionId:ne?.xmlId,canConvertToPretext:ce!==void 0,activeEditorSource:ie,hasFeedback:e.onFeedbackSubmit!==void 0})});let me=(0,n.useRef)({divisions:e.divisions,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId});(0,n.useEffect)(()=>{let t=me.current,n={},r=!1;if(e.divisions!==t.divisions){let t=s8(e.divisions,e.rootDivisionId),i=V6(e.divisions,t?.xmlId,e.projectType);n.divisions=i;let a=i.find(e=>e.xmlId===t?.xmlId)??t;(y==null||!e.divisions.some(e=>e.xmlId===y))&&(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&&w(n),me.current={divisions:e.divisions,title:e.title,docinfo:e.docinfo,commonDocinfo:e.commonDocinfo,useCommonDocinfo:e.useCommonDocinfo,activeDivisionId:e.activeDivisionId}});let he=C?S:x,ge=re?M===`pretext`?F6(v,re.xmlId):ce===void 0?void 0:`<${re.type} xml:id="${re.xmlId}">\n<title>${re.title}</title>\n\n${ce}\n</${re.type}>`:void 0,I=re&&ge!==void 0?z6(re.type,ge,he,re.title):void 0,_e=()=>ee.current?.rebuild(),ve=()=>{e.onSave?.(),ee.current?.rebuild()},ye=t=>{let n=t.ctrlKey||t.metaKey;n&&t.key===`Enter`&&e.onPreviewRebuild?(t.preventDefault(),_e()):n&&t.key===`s`&&(t.preventDefault(),ve())},be=()=>{if(!re||!ce)return;let e=q3(),t=T6(Z3(ce,re.type));N({id:e.xmlId,xmlId:e.xmlId,title:re.title,type:re.type,sourceFormat:`pretext`,content:t})},xe=(0,t.jsx)(Ps,{ref:te,content:ie,sourceFormat:M,onChange:le,onRebuild:e.onPreviewRebuild?_e:void 0,onSave:ve,onOpenLatexImport:()=>h(`isLatexDialogOpen`),onOpenDocinfoEditor:()=>h(`isDocinfoEditorOpen`),onOpenConvertToPretext:pe&&ce!==void 0?()=>h(`isConvertDialogOpen`):void 0,canConvertToPretext:ce!==void 0,onOpenAssets:e.projectAssets!==void 0&&M===`pretext`?()=>h(`isAssetPickerOpen`):void 0}),Se;Se=i&&e.onPreviewRebuild?(0,t.jsx)($L,{ref:ee,content:I||``,title:b,onRebuild:e.onPreviewRebuild}):(0,t.jsx)(XL,{content:ie,canEdit:M===`pretext`,editDisabledReason:M===`markdown`?`Visual editing is not available for Markdown documents.`:M===`latex`?`Visual editing is not available for LaTeX documents.`:``,onChange:e=>le(e)});let Ce=(0,t.jsx)(r8,{isCollapsed:l,onToggleCollapse:()=>u(e=>!e),onOpenAssetPicker:e.projectAssets===void 0?void 0:()=>h(`isAssetPickerOpen`)}),L=`pretext-plus-tab-editor`,we=`pretext-plus-tab-preview`,Te=`pretext-plus-tabpanel`,Ee;return Ee=a?(0,t.jsxs)(`div`,{className:`pretext-plus-editor__tabs`,children:[Ce,(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:L,role:`tab`,"aria-controls":Te,"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:we,role:`tab`,"aria-controls":Te,"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:Te,className:`pretext-plus-editor__tab-panel`,role:`tabpanel`,"aria-labelledby":s===`editor`?L:we,children:(0,t.jsx)(`div`,{style:{height:`100%`},children:s===`editor`?xe:Se})})]})]}):(0,t.jsxs)(`div`,{className:`pretext-plus-editor__sectioned-layout`,children:[Ce,(0,t.jsxs)(gt,{orientation:`horizontal`,className:`pretext-plus-editor__splitter`,children:[(0,t.jsx)(yt,{className:`pretext-plus-editor__editor-panel`,children:xe}),(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:Se})]})]}),(0,t.jsxs)(`div`,{className:`pretext-plus-editor`,onKeyDown:ye,children:[(0,t.jsx)(q6,{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)(i8,{resetKeys:[ie,y],children:Ee}),d?(0,t.jsx)(s3,{onClose:()=>g(`isLatexDialogOpen`)}):null,f&&re&&ce?(0,t.jsx)(d3,{sourceContent:ie,sourceFormat:M,pretextSource:ce,onConfirm:be,onClose:()=>g(`isConvertDialogOpen`)}):null,p?(0,t.jsx)(C3,{docinfo:x,showCommonDocinfoControls:!0,commonDocinfo:S,initialUseCommonDocinfo:C,onClose:t=>{if(g(`isDocinfoEditorOpen`),t!==void 0){j({docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo}),e.onCommonDocinfoChange?.(t.commonDocinfo),e.onUseCommonDocinfoChange?.(t.useCommonDocinfo);let n=ne??re;ae(n?.xmlId??``,n?.content??``,n?.sourceFormat??`pretext`,{docinfo:t.docinfo,commonDocinfo:t.commonDocinfo,useCommonDocinfo:t.useCommonDocinfo})}}}):null,m&&e.projectAssets!==void 0?(0,t.jsx)(K6,{open:m,onClose:()=>g(`isAssetPickerOpen`),onLoadAssets:e.onLoadAssets,onLoadLibraryAssets:e.onLoadLibraryAssets,onAddFromLibrary:e.onAssetAddFromLibrary,onUpload:e.onAssetUpload,onFetchUrl:e.onAssetFetchUrl,onCreateDoenet:e.onCreateDoenet,onRemoveAsset:e.onAssetRemove,onInsert:fe}):null]})]})};e.CodeEditor=Ps,e.DocinfoEditor=C3,e.Editors=c8,e.FeedbackLink=$4,e.FullPreview=$L,e.VisualEditor=XL,e.assembleFullProjectSource=L6,e.assembleProjectSource=F6,e.buildDivisionTree=O6,e.convertLatexToPretext=J4,e.createConclusion=Y3,e.createIntroduction=J3,e.createLatexConclusion=o6,e.createLatexIntroduction=a6,e.createNewLatexSection=i6,e.createNewSection=q3,e.derivePretextContent=Z4,e.detectSourceFormat=q4,e.ensureLatexSectionWrapper=t6,e.ensureSectionWrapper=Q3,e.extractDivisionMetadata=l6,e.extractLatexDivisionTitle=r6,e.findDivisionParent=C6,e.getOrphanRoots=k6,e.getOrphanedDivisions=D6,e.getSectionAttributes=c6,e.insertDivisionRef=y6,e.mergeTwoSections=s6,e.moveDivisionRef=x6,e.normalizeSelfClosingRefs=T6,e.parseDivisionRefs=h6,e.postToIframe=QL,e.removeDivisionRef=b6,e.renameDivisionRef=S6,e.reorderDivisionRefs=w6,e.rewrapLatexSection=e6,e.rewrapSection=Z3,e.stripLatexSectionWrapper=$3,e.stripSectionWrapper=X3,e.updateDivisionTitle=K3,e.updateLatexSectionTitle=n6,e.updateSectionMetadata=u6,e.wrapDivisionForPreview=z6});
|
|
1084
1084
|
//# sourceMappingURL=index.js.map
|